SETUID(2) SysV SETUID(2)
NAME
setuid, setgid - set user and group IDs
SYNOPSIS
int setuid (uid)
int uid;
int setgid (gid)
int gid;
DESCRIPTION
setuid (setgid) is used to set the real user (group) ID and effective
user (group) ID of the calling process.
If the effective user ID of the calling process is super-user, the real
user (group) ID and effective user (group) ID are set to uid (gid).
If the effective user ID of the calling process is not super-user, but
its real user (group) ID is equal to uid (gid), the effective user
(group) ID is set to uid (gid).
If the effective user ID of the calling process is not super-user, but
the saved set-user (group) ID from exec(2) is equal to uid (gid), the
effective user (group) ID is set to uid (gid).
NOTES
Under some implementations of the UNIX operating system, the setgid call
will modify the supplementary group list. This is not the case under
Domain/OS.
At login time, the user's native group is automatically added to the
supplementary group list. Therefore, a setgid call will leave the user
in that original group (since the supplementary list is not changed).
ERRORS
setuid (setgid) will fail if either of the following is true:
[EPERM] The real user (group) ID of the calling process is not equal
to uid (gid) and its effective user ID is not super-user.
[EINVAL] The uid is out of range.
SEE ALSO
intro(2), getoid(2), getuid(2), setoid(2).
DIAGNOSTICS
Upon successful completion, a value of 0 is returned. Otherwise, a value
of -1 is returned and errno is set as indicated under "Errors."