Open System Services System Calls Reference Manual (G06.29+, H06.08+, J06.03+)

System Functions (s and S) setegid(2)
NAME
setegid - Sets the effective group ID of the calling process
LIBRARY
G-series native OSS processes: /G/system/sysnn/zsecsrl
32-bit H-series and J-series OSS processes: /G/system/zdllnnn/zsecdll
64-bit H-series and J-series OSS processes: /G/system/zdllnnn/ysecdll
SYNOPSIS
#include <sys/types.h> /* optional except for POSIX.1 */
#include <unistd.h>
int setegid( gid_t egid );
PARAMETERS
egid Specifies the new effective group ID.
DESCRIPTION
The setegid() function sets the effective group ID of the current process to the value specified by
egid parameter.
The process that calls this function must have appropriate privileges. A process without appropri-
ate privileges can set the effective group ID only if the egid parameter is equal to either the real
or saved-set-group-ID of the process.
The value of the egid parameter must be in the range 0 (zero) through 65535.
The real group ID, the saved-set-group-ID, and the group list of the calling process are not
changed.
NOTES
This function is supported on systems running J06.07 and later J-series RVUs, H06.18 and later
H-series RVUs, and G06.33 and later G-series RVUs.
This function does not set the default file security of a process. To set the default file security for
a process, use the PROCESS_SETINFO_ Guardian procedure call with item code 41.
RETURN VALUES
Upon successful completion, the value 0 (zero) is returned. Otherwise, the value -1 is returned
and errno is set to indicate the error.
ERRORS
If any of these conditions occur, the setegid() function sets errno to the corresponding value:
[EINVAL] The value of the egid parameter is invalid or out of range.
[EPERM] The current process does not have appropriate privileges and the egid parameter
does not match the real group ID or the saved-set-group-ID of the process.
RELATED INFORMATION
Functions: getegid(2), getgid(2).
STANDARDS CONFORMANCE
The following are HP extensions to the XPG4 Version 2 specification:
If both the real and effective group IDs are changed so that they differ from each other
and from the saved-set-group-ID, then the saved-set-group-ID is set to the value of the
effective group ID.
527186-023 Hewlett-Packard Company 753