change the real and effective user and group IDs of a process
#include <sys/types.h> #include <sys/proc_msg.h> #include <unistd.h> int qnx_setids( pid_t pid, int id, unsigned subtype );
The qnx_setids() function allows you to change the real and effective user or group ID of the process, identified by pid, to id. If pid is zero, the current process is used. The subtype parameter determines what's changed as follows:
The referenced POSIX functions call this function with pid set to zero.
/* * change my effective group id */ #include <stdio.h> #include <sys/types.h> #include <sys/proc_msg.h> #include <unistd.h> void main() { if( qnx_setids( 0, 4, _PROC_SUB_SETEUID ) != -1 ) fprintf( stderr, "Unable to change.\n" ); }
POSIX
Safety: | |
---|---|
Interrupt handler | No |
Signal handler | Yes, but modifies errno |
Thread | Yes |
errno, qnx_getids(), qnx_psinfo(), setuid(), setgid(), seteuid(), setegid()