, __FILE__, PIDS_SELECT_PID, PROC_PID);
failed = 1;
}
+ if (PIDS_SELECT_PID_THREADS != PIDS_SELECT_PID + 1) {
+ fprintf(stderr, "%s: header error: PIDS_SELECT_PID_THREADS = 0x%04x, should be 0x%04x\n"
+ , __FILE__, PIDS_SELECT_PID_THREADS, PIDS_SELECT_PID + 1);
+ failed = 1;
+ }
if (PIDS_SELECT_UID != PROC_UID) {
fprintf(stderr, "%s: header error: PIDS_SELECT_UID = 0x%04x, PROC_UID = 0x%04x\n"
, __FILE__, PIDS_SELECT_UID, PROC_UID);
failed = 1;
}
+ if (PIDS_SELECT_UID_THREADS != PIDS_SELECT_UID + 1) {
+ fprintf(stderr, "%s: header error: PIDS_SELECT_UID_THREADS = 0x%04x, should be 0x%04x\n"
+ , __FILE__, PIDS_SELECT_UID_THREADS, PIDS_SELECT_UID + 1);
+ failed = 1;
+ }
+ // our select() function & select enumerators assume the following ...
+ if (PIDS_FETCH_THREADS_TOO != 1) {
+ fprintf(stderr, "%s: header error: PIDS_FETCH_THREADS_TOO = %d, should be 1\n"
+ , __FILE__, PIDS_FETCH_THREADS_TOO);
+ failed = 1;
+ }
if (failed) _Exit(EXIT_FAILURE);
#endif
return NULL;
if (numthese < 1 || numthese > FILL_ID_MAX)
return NULL;
- if (which != PIDS_SELECT_PID && which != PIDS_SELECT_UID)
+ if ((which != PIDS_SELECT_PID && which != PIDS_SELECT_UID)
+ && ((which != PIDS_SELECT_PID_THREADS && which != PIDS_SELECT_UID_THREADS)))
return NULL;
/* with items & numitems technically optional at 'new' time, it's
expected 'reset' will have been called -- but just in case ... */
if (!pids_oldproc_open(&info->fetch_PT, (info->oldflags | which), ids, numthese))
return NULL;
- info->read_something = readproc;
+ info->read_something = (which & PIDS_FETCH_THREADS_TOO) ? readeither : readproc;
rc = pids_stacks_fetch(info);
};
enum pids_select_type {
- PIDS_SELECT_PID = 0x10000,
- PIDS_SELECT_UID = 0x20000
+ PIDS_SELECT_PID = 0x10000,
+ PIDS_SELECT_PID_THREADS = 0x10001,
+ PIDS_SELECT_UID = 0x20000,
+ PIDS_SELECT_UID_THREADS = 0x20001
};
enum pids_sort_order {
goto next_proc;
if ((flags & PROC_UID) && !XinLN(uid_t, sb.st_uid, PT->uids, PT->nuid))
- goto next_proc; /* not one of the requested uids */
+ goto next_proc; /* not one of the requested uids */
p->euid = sb.st_uid; /* need a way to get real uid */
p->egid = sb.st_gid; /* need a way to get real gid */
if (stat(path, &sb) == -1) /* no such dirent (anymore) */
goto next_task;
-// if ((flags & PROC_UID) && !XinLN(uid_t, sb.st_uid, PT->uids, PT->nuid))
-// goto next_task; /* not one of the requested uids */
+ if ((flags & PROC_UID) && !XinLN(uid_t, sb.st_uid, PT->uids, PT->nuid))
+ goto next_task; /* not one of the requested uids */
t->euid = sb.st_uid; /* need a way to get real uid */
t->egid = sb.st_gid; /* need a way to get real gid */