get the user, group and parent process IDs for a process
#include <sys/psinfo.h> #include <unistd.h> int qnx_getids( pid_t pid, struct _psinfo2 *info );
The qnx_getids() function returns information on the process identified by pid, in the structure pointed to by info. If pid is zero, the current process is used. The information returned includes the user and group IDs, process group number and the parent process ID; it's a subset of the information returned by qnx_psinfo().
/* * print the parent ID of the process */ #include <stdio.h> #include <sys/types.h> #include <sys/psinfo.h> #include <unistd.h> void main() { struct _psinfo2 info; qnx_getids( 0, &info ); printf( "My parent is %ld\n", info.ppid ); }
QNX
Safety: | |
---|---|
Interrupt handler | No |
Signal handler | Yes, but modifies errno |
Thread | Yes |
errno, qnx_psinfo(), qnx_setids()