DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH
 

setregid(SSC)


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), 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), setgid(S), getgid(S), setegid(SLIB), execve(S)
© 2003 Caldera International, Inc. All rights reserved.
SCO OpenServer Release 5.0.7 -- 11 February 2003