Warning: main(/www/www/htdocs/style/globals.php) [function.main]: failed to open stream: No such file or directory in /www/www/docs/6.4.1/neutrino/lib_ref/s/setreuid.html on line 1

Warning: main() [function.include]: Failed opening '/www/www/htdocs/style/globals.php' for inclusion (include_path='.:/www/www/common:/www/www/php/lib/php') in /www/www/docs/6.4.1/neutrino/lib_ref/s/setreuid.html on line 1

Warning: main(/www/www/htdocs/style/header.php) [function.main]: failed to open stream: No such file or directory in /www/www/docs/6.4.1/neutrino/lib_ref/s/setreuid.html on line 8

Warning: main() [function.include]: Failed opening '/www/www/htdocs/style/header.php' for inclusion (include_path='.:/www/www/common:/www/www/php/lib/php') in /www/www/docs/6.4.1/neutrino/lib_ref/s/setreuid.html on line 8

setreuid()

Set real and effect user IDs

Synopsis:

#include <unistd.h>

int setreuid( uit_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 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 effective user ID of the calling process is the superuser, you can set the real user ID and the effective user ID to any legal value.

If the effective user ID of the calling process isn't the superuser, 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.


Note: If a set-UID process sets its effective user ID to its real user ID, it can still set its effective user ID back to the saved set-UID.

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.

The “superuser” is defined as any process with an effective user ID of 0, or an effective user ID of root.

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 isn't the superuser, 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 isn't the superuser, and you tried to change the real user ID to a value other than the effective user ID.

Classification:

POSIX 1003.1 XSI

Safety:
Cancellation point No
Interrupt handler No
Signal handler Yes
Thread Yes

See also:

execve(), getuid(), setregid(), setuid()


Warning: main(/www/www/htdocs/style/footer.php) [function.main]: failed to open stream: No such file or directory in /www/www/docs/6.4.1/neutrino/lib_ref/s/setreuid.html on line 175

Warning: main() [function.include]: Failed opening '/www/www/htdocs/style/footer.php' for inclusion (include_path='.:/www/www/common:/www/www/php/lib/php') in /www/www/docs/6.4.1/neutrino/lib_ref/s/setreuid.html on line 175