Set the real and effective user IDs for the calling process
#include <unistd.h> int setreuid( uit_t ruid, uid_t euid );
- The real user ID that you want to use for the process, or -1 if you don't want to change it.
- The effective user ID that you want to use for the process, or -1 if you don't want to change it.
Use the -l c option to qcc to link against this library. This library is usually included automatically.
The setreuid() function sets the real and effective user IDs of the calling process. If ruid or euid is -1, the corresponding real or effective user ID isn't changed.
If the process has the PROCMGR_AID_SETUID ability enabled (see procmgr_ability()), you can set the real user ID and the effective user ID to any legal value.
If the process doesn't have the PROCMGR_AID_SETUID ability enabled, you can set either the real user ID to the effective user ID, or the effective user ID to the saved set-user ID or the real user ID.
In either case, if you're changing the real user ID (i.e. ruid is not -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.
Zero on success, or -1 if an error occurs (errno is set).
- The ruid or euid is out of range.
- 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.
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.
Last modified: 2013-09-30