setreuid()
Set the real and effective user IDs for the calling process
Synopsis:
#include <unistd.h>
int setreuid( uid_t ruid,
uid_t euid );
Arguments:
- ruid
- The real user ID that you want to use for the process, or -1 if you don't want to change it.
- euid
- The effective user ID that you want to use for the process, or -1 if you don't want to change it.
Library:
libc
Use the -l c option to qcc to link against this library. This library is usually included automatically.
Description:
The setreuid() function lets the calling process set its real and effective user IDs to its real or effective user ID, its saved set-user ID, or to any of the user IDs identified by the PROCMGR_AID_SETUID ability (see procmgr_ability()). If ruid or euid is -1, the corresponding real or effective user ID isn't changed.
In either case, if you're changing the real user ID (i.e., ruid isn't -1), or you're changing the effective user ID to a value that isn't equal to the real user ID, the saved set-user ID is set equal to the new effective user ID.
QNX recommends that you do not use a negative value for a user ID.Returns:
Zero on success, or -1 if an error occurs (errno is set).
Errors:
- EINVAL
- The ruid or euid is out of range.
- EPERM
- The calling process doesn't have the PROCMGR_AID_SETUID
ability enabled, and you tried to change the effective user ID to a value other than the
real or saved set-user ID.
Or:
The calling process doesn't have the PROCMGR_AID_SETUID ability enabled, and you tried to change the real user ID to a value other than the effective user ID.
Classification:
Safety: | |
---|---|
Cancellation point | No |
Signal handler | Yes |
Thread | Yes |