The Open Group Base Specifications Issue 8
IEEE Std 1003.1-2024
Copyright © 2001-2024 The IEEE and The Open Group

NAME

setresgid — set real group ID, effective group ID, and saved set-group-ID

SYNOPSIS

[XSI] [Option Start] #include <unistd.h>

int setresgid(gid_t
rgid, gid_t egid, gid_t sgid); [Option End]

DESCRIPTION

The setresgid() function shall set the real group ID, effective group ID, and saved set-group-ID of the calling process to the values specified by rgid, egid, and sgid, respectively.

If an argument is -1, the corresponding ID shall not be changed.

Only a process with appropriate privileges can set the real group ID, effective group ID, and saved set-group-ID to any valid value.

A non-privileged process can set its real group ID, effective group ID, and saved set-group-ID, each to one of the values that it currently holds in its real group ID, effective group ID, or saved set-group-ID.

The real group ID, effective group ID, and saved set-group-ID can be set to different values in the same call.

Any supplementary group IDs of the calling process shall remain unchanged.

RETURN VALUE

Upon successful completion, 0 shall be returned. Otherwise, -1 shall be returned and errno set to indicate the error, and none of the IDs shall be changed.

ERRORS

The setresgid() function shall fail if:

[EINVAL]
The value of the rgid, egid, or sgid argument is invalid or out-of-range.
[EPERM]
The calling process does not have appropriate privileges and an attempt was made to change the real group ID, effective group ID, or saved set-group-ID to a value that is not currently present in one of those IDs.

The following sections are informative.

EXAMPLES

None.

APPLICATION USAGE

None.

RATIONALE

None.

FUTURE DIRECTIONS

None.

SEE ALSO

exec , getegid , geteuid , getgid , getresgid , getresuid , getuid , setegid , seteuid , setgid , setregid , setresuid , setreuid , setuid

XBD <unistd.h>

CHANGE HISTORY

First released in Issue 8.

End of informative text.

 

return to top of page

UNIX® is a registered Trademark of The Open Group.
POSIX™ is a Trademark of The IEEE.
Copyright © 2001-2024 The IEEE and The Open Group, All Rights Reserved
[ Main Index | XBD | XSH | XCU | XRAT ]