Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ setregid(3C) — Reliant UNIX 5.44c4

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

exec(2)

getgroups(2)

getuid(2)

setuid(2)

setreuid(3C)

unistd(4)

setregid(3C)                                                   setregid(3C)

NAME
     setregid - set real and effective group IDs

SYNOPSIS
     #include <unistd.h>

     int setregid(gidt rgid, gidt egid);

DESCRIPTION
     setregid is used to set the real and effective group IDs of the cal-
     ling process. If rgid is -1, the real GID is not changed; if egid is
     -1, the effective GID is not changed. The real and effective GIDs may
     be set to different values in the same call.

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

     If the effective user ID of the calling process is not super-user,
     either the real GID can be set to the saved set-GID from execv(), or the
     effective GID can either be set to the saved set-GID or the real GID.

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

     In either case, if the real GID is being changed (that is, if rgid is
     not -1), or the effective GID is being changed to a value not equal to
     the real GID, the saved set-GID is set equal to the new effective GID.

     If the real GID is changed from its current value, the old value is
     removed from the groups access list [see getgroups(2)] if it is
     present in that list, and the new value is added to the groups access
     list if it is not already present and if this would not cause the
     number of groups in that list to exceed NGROUPS, as defined in
     /usr/include/sys/param.h.

RETURN VALUE
     Upon successful completion, a value of 0 is returned. Otherwise, a
     value of -1 is returned and errno is set to indicate the error.

ERRORS
     The following error code descriptions are function-specific. You will
     find a general description in introprm2(2) or in errno(5).

     The setregid() function will fail if:

     EINVAL    The value of the rgid or egid argument is invalid or out-
               of-range.

     EPERM     The calling process' effective UID is not the super-user and
               a change other than changing the real GID to the saved set-
               GID, or changing the effective GID to the real GID or the
               saved GID, was specified.



Page 1                       Reliant UNIX 5.44                Printed 11/98

setregid(3C)                                                   setregid(3C)

SEE ALSO
     exec(2), getgroups(2), getuid(2), setuid(2), setreuid(3C), unistd(4).




















































Page 2                       Reliant UNIX 5.44                Printed 11/98

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026