Sets the user IDs. This function is supported on OpenVMS Integrity servers and Alpha only. Format #include <unistd.h> int setreuid (uid_t ruid, uid_t euid);
1 – Arguments
ruid The value to which you want the real user ID set. euid The value to which you want the effective user ID set.
2 – Description
The setreuid function sets the real and effective user IDs of the current process to the values specified by the ruid and euid arguments. If ruid or euid is -1, the corresponding effective or real user ID of the current process is left unchanged. A process with the IMPERSONATE privilege can set either ID to any value. An unprivileged process can set the effective user ID only if the euid argument is equal to either the real, effective, or saved user ID of the process. It is unspecified whether a process without the IMPERSONATE privilege is permitted to change the real user ID to match the current real, effective, or saved user ID of the process. This function requires that long (32-bit) UID/GID support be enabled. See 32-Bit UID and GID Macro (Integrity servers, Alpha) for more information. See also getuid to know how UIC is represented.
3 – Return Values
0 Successful completion. -1 Indicates an error. The function sets errno to one of the following values: o EINVAL - The value of the ruid or euid argument is invalid or out of range. o EPERM - The current process does not have the IMPERSONATE privilege, and either an attempt was made to change the effective user ID to a value other than the real user ID or the saved set-user-ID, or an attempt was made to change the real user ID to a value not permitted by the implementation.