Set supplementary group IDs for a child process
Synopsis:
#include <unistd.h>
int setgroupspid( int gidsetsize,
const gid_t *grouplist,
pid_t pid );
Arguments:
- gidsetsize
- The number of entries in the grouplist array.
This number can't exceed sysconf(_SC_NGROUPS_MAX).
- grouplist
- An array of the supplementary group IDs that you want to assign to
the calling process.
- pid
- The process ID of a child of the calling process, or 0 to set the groups for the calling process.
Library:
libc
Use the -l c option to
qcc
to link against this library.
This library is usually included automatically.
Description:
The setgroupspid() function sets the group access list of the
process identified by pid to the array of group IDs in grouplist.
This function lets you modify a child process's supplementary group set without having to set the parent's groups
before spawning.
Note:
- The process identified by pid must be a child of the calling process,
must have been created by
posix_spawn() or posix_spawnp()
with the POSIX_SPAWN_HOLD flag set, and must not have yet received a SIGCONT.
-
In order to set new groups or delete existing groups, your process must have the
PROCMGR_AID_SETGID ability enabled.
For more information, see
procmgr_ability().
Returns:
0, or -1 if an error occurred
(errno is set).
Errors:
- EFAULT
- The grouplist argument isn't a valid pointer.
- EINVAL
- The value of gidsetsize is larger than sysconf(_SC_NGROUPS_MAX).
- EPERM
- One of the following occurred:
- The calling process doesn't have the required permission; see
procmgr_ability().
- The process identified by pid isn't a child of the calling process.
- The child process isn't held.
Classification:
QNX Neutrino
Safety: |
|
Cancellation point |
No |
Interrupt handler |
No |
Signal handler |
No |
Thread |
Yes |