DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 

setregid(SSC-osr5)


setregid -- set real and effective group IDs

Syntax

cc ... -lsocket

int setregid(rgid, egid)
int rgid, egid;

Description

setregid( ) is used to set the real and effective group IDs of the calling process. If rgid is -1, the real group ID is not changed; if egid is -1, the effective group ID is not changed. The real and effective group IDs may be set to different values in the same call.

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

If the effective user ID of the calling process is not root, the real group ID can be set to the saved set-group ID from execve(S-osr5), or the effective group ID can be set to either the saved set-group ID or the real group ID. If a set-GID 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.

If the real group ID is changed (rgid is not -1), the saved set-group ID is set to that same value.


NOTE: This same library routine is also included in the current release of libc. However, an application that links with the version of setregid( ) in libsocket.a (the library archive) can run on both SCO OpenServer and Open Desktop. provided the application does nothing else to prevent itself from running on Open Desktop.

Return values

A return value of zero indicates that the call succeeded. A return value of -1 indicates that an error occurred, and an error code is stored in the global variable errno.

Diagnostics

setregid( ) fails and neither of the group IDs are changed if:

EPERM
The effective user ID of the calling process is not root, and the specified change is other than:

See also

setreuid(SSC-osr5), setgid(S-osr5), getgid(S-osr5), setegid(SLIB), execve(S-osr5)
© 2005 The SCO Group, Inc. All rights reserved.
SCO OpenServer Release 6.0.0 -- 02 June 2005