Open System Services System Calls Reference Manual (G06.28+, H06.05+)

setreuid(2) OSS System Calls Reference Manual
NAME
setreuid - Sets the real and effective user IDs
LIBRARY
G-series native OSS processes: /G/system/sysnn/zsecsrl
H-series OSS processes: /G/system/zdllnnn/zsecdll
SYNOPSIS
#include <unistd.h>
int setreuid(
uid_t ruid,
uid_t euid );
PARAMETERS
ruid Species the new real user ID.
euid Species the new effective user ID.
DESCRIPTION
The setreuid() function sets the real user ID and effective user ID of the current process to the
values specied by the ruid and euid parameters, respectively. If ruid or euid has a value of -1,
the current user ID (UID) is used by the system.
A process with appropriate privileges can set either ID to any value.
A process without appropriate privileges:
Can set the effective user ID only if the euid parameter is equal to either the real,
effective, or saved user ID of the process.
Cannot set the real user ID.
Changing the effective user ID sets the process access ID (PAID) to the value of the effective
user ID.
NOTES
The setreuid() function can be called only by native processes.
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 the following conditions occur, the setreuid() function sets errno to the corresponding
value:
[EINVAL] The value of the ruid or euid parameter is invalid or out of range.
[EPERM] The current process does not have appropriate privileges and a change requiring
appropriate privileges was specied.
RELATED INFORMATION
Functions: getuid(2), setuid(2).
STANDARDS CONFORMANCE
The following are HP extensions to the XPG4 Version 2 specication:
If both the real and effective user IDs are changed so that they differ from each other and
from the saved-set user ID, then the saved-set user ID is set to the value of the effective
user ID.
740 Hewlett-Packard Company 527186-007