setregid(3) (BSD Compatibility Package) setregid(3)
NAME
setregid - set real and effective group IDs
SYNOPSIS
cc [ flag... ] file ... -lucb
int setregid(rgid, egid)
int rgid, egid;
DESCRIPTION
setregid is used to set the real and effective user IDs of the
calling process. setregid is implemented via the system calls setgid
and setegid. If rgid is not -1, then rgid is passed to setgid; if
egid is not -1, then egid is passed to setegid.
The call to setegid is attempted first.
See the setgid manual page for the description of the setgid and
setegid system calls.
NOTE
This library call is slightly different from the original Berkeley
system call. You cannot set the real gid ID without resetting the
effective and saved gid IDs.
RETURN VALUE
Upon successful completion, a value of 0 is returned. Otherwise, a
value of -1 is returned and errno is set to indicate the error.
ERRORS
setregid will fail and neither of the group IDs will be changed if:
EPERM The calling process's effective UID is not the super-
user and a change other than changing the real GID to
the saved setGID, or changing the effective GID to the
real GID or the saved GID, was specified.
SEE ALSO
setreuid(3)
exec(2), getgid(2), setgid(2) in the Programmer's Reference Manual.
10/91 Page 1