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/setregid.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/setregid.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/setregid.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/setregid.html on line 8

setregid()

Set real and effective group IDs

Synopsis:

#include <unistd.h>

int setregid( gid_t rgid, 
              gid_t egid );

Arguments:

rgid
The real group ID that you want to use for the process, or -1 if you don't want to change it.
egid
The effective group 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 setregid() function sets the real and effective group IDs of the calling process. If rgid or egid is -1, the corresponding real or effective group ID is left unchanged.

If the effective user ID of the calling process is the superuser, you can set the real group ID and the effective group ID to any legal value.

If the effective user ID of the calling process isn't the superuser, you can set either the real group ID to the saved set-group ID, or the effective group ID to either the saved set-group ID or the real group ID.


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

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

In either case, if you're changing the real group ID (i.e. rgid isn't -1), or you're changing the effective group ID to a value that isn't equal to the real group ID, the saved set-group ID is set to the new effective group ID.

Returns:

0
Success.
-1
An error occurred (errno is set).

Errors:

EINVAL
The rgid or egid is out of range.
EPERM
The calling process isn't the superuser, and you tried to change the effective group ID to a value other than the real or saved set-group ID.

Or:

The calling process isn't the superuser, and you tried to change the real group ID to a value other than the effective group ID.

Classification:

POSIX 1003.1 XSI

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

See also:

execve(), getgid(), setreuid(), 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/setregid.html on line 189

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/setregid.html on line 189