The Single UNIX ® Specification, Version 2
Copyright © 1997 The Open Group

 NAME

setgid - set-group-ID

 SYNOPSIS



#include <sys/types.h>
#include <unistd.h>

int setgid(gid_t gid);

 DESCRIPTION

If the process has appropriate privileges, setgid() sets the real group ID, effective group ID  and the saved set-group-ID  to gid.

If the process does not have appropriate privileges, but gid is equal to the real group ID  or the saved set-group-ID,  setgid() function sets the effective group ID to gid; the real group ID  and saved set-group-ID  remain unchanged.

Any supplementary group IDs of the calling process remain unchanged.

 RETURN VALUE

Upon successful completion, 0 is returned. Otherwise, -1 is returned and errno is set to indicate the error.

 ERRORS

The setgid() function will fail if:
[EINVAL]
The value of the gid argument is invalid and is not supported by the implementation.
[EPERM]
The process does not have appropriate privileges and gid does not match the real group ID  or the saved set-group-ID.

 EXAMPLES

None.

 APPLICATION USAGE

None.

 FUTURE DIRECTIONS

None.

 SEE ALSO

exec, getgid(), setuid(), <sys/types.h>, <unistd.h>.

DERIVATION

Derived from Issue 1 of the SVID.

UNIX ® is a registered Trademark of The Open Group.
Copyright © 1997 The Open Group
[ Main Index | XSH | XCU | XBD | XCURSES | XNS ]