29 #include <sys/types.h> 51 char key[16] = { 0 }, procpath[128] = { 0 };
58 local_pid = atoi(entry->d_name);
59 if ((local_pid <= 0) || (strlen(entry->d_name) > 114)) {
67 strcpy(procpath,
"/proc/");
68 strcat(procpath, entry->d_name);
69 fd = open(procpath, O_RDONLY);
73 if (fstat(fd, &statbuf) < 0) {
80 if (!S_ISDIR(statbuf.st_mode)) {
89 strcat(procpath,
"/status");
90 file = fopen(procpath,
"r");
94 if ((fscanf(file,
"%15s%63s", key, name) != 2)
120 struct dirent *entry;
122 char entry_name[64] = { 0 };
124 dp = opendir(
"/proc");
126 crm_notice(
"Can not read /proc directory to track existing components");
130 while ((entry = readdir(dp)) != NULL) {
135 crm_info(
"Found %s active as process %d", name, pid);
#define crm_notice(fmt, args...)
int crm_pid_active(long pid, const char *daemon)
gboolean safe_str_neq(const char *a, const char *b)
int crm_procfs_process_info(struct dirent *entry, char *name, int *pid)
#define safe_str_eq(a, b)
#define crm_info(fmt, args...)
int crm_procfs_pid_of(const char *name)