HP-UX Reference (11i v1 00/12) - 2 System Calls (vol 5)

__________________________________________________________________________________________________________________________________________________________________________________________________
__________________________________________________________________________________________________________________________________________________________________________________________________
STANDARD Printed by: Nora Chuang [nchuang] STANDARD
/build/1111/BRICK/man2/!!!intro.2
________________________________________________________________
___ ___
s
setresuid(2) setresuid(2)
NAME
setresuid, setresgid - set real, effective, and saved user and group IDs
SYNOPSIS
#include <unistd.h>
int setresuid(uid_t ruid, uid_t euid, uid_t suid);
int setresgid(gid_t rgid, gid_t egid, gid_t sgid);
DESCRIPTION
setresuid() sets the real, effective and/or saved user ID of the calling process.
If the current real, effective or saved user ID is equal to that of a user having appropriate privileges,
setresuid() sets the real, effective and saved user IDs to ruid, euid, and suid, respectively. Other-
wise, setresuid() only sets the real, effective, and saved user IDs if ruid, euid, and suid each match at
least one of the current real, effective, or saved user IDs.
If ruid, euid,orsuid is -1, setresuid() leaves the current real, effective or saved user ID unchanged.
setresgid() sets the real, effective and/or saved group ID of the calling process.
If the current real, effective or saved user ID is equal to that of a user having appropriate privileges,
setresgid() sets the real, effective, and saved group ID to rgid, egid, and sgid, respectively. Other-
wise,
setresgid() only sets the real, effective and saved group ID if rgid, egid, and sgid each match at
least one of the current real, effective or saved group ID.
If rgid, egid,orsgid is
-1, setresgid() leaves the current real, effective or saved group ID
unchanged.
RETURN VALUE
Upon successful completion, setresuid() and setresgid() return 0; otherwise, they return 1 and
set errno to indicate the error.
ERRORS
setresuid() and setresgid() fail if any of the following conditions are encountered:
[EINVAL] ruid, euid,orsuid (rgid, egid,orsgid) is not a valid user (group) ID.
[EPERM] None of the conditions above are met.
AUTHOR
setresuid() and setresgid() were developed by HP.
SEE ALSO
exec(2), getuid(2), setuid(2).
Section 2316 1 HP-UX Release 11i: December 2000
___
___