Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ setregid(SSC) — OpenDesktop Software Development System 3.0.0

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

getgid(S)

execve(S)

setreuid(SSC)

setgid(S)

setegid(SLIB)


 setregid(SSC)                  6 January 1993                  setregid(SSC)


 Name

    setregid - set real and effective group IDs

 Syntax


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


 Description

    setregid is used to set the real and effective groupIDs 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 super-user, 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 super-user, either
    the real group ID can be set to the saved set-group ID from execve(SSC),
    or the effective group ID can either be set to the saved set-group ID or
    the real group ID.  Note that 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.

    In either case, if the real group ID is changed to a particular value
    (that is, if rgid is not -1), the saved set-group ID is set to that same
    value.

 Return value

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

 Errors

    setregid will fail and neither of the group IDs will be changed if:

    EPERM          The calling process' effective user ID is not the super-
                   user and a change other than changing the real group ID to
                   the saved set-group ID, or changing the effective group ID
                   to the real group-id or the saved set-group ID, was speci-
                   fied.

 See also

    getgid(S), execve(S), setreuid(SSC), setgid(S) and setegid(SLIB).


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