Museum

Home

Lab Overview

Retrotechnology Articles

⇒ Online Manual

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

setuid(2)

getuid(2)



  setgid(2)                           CLIX                           setgid(2)



  NAME

    setgid - Sets the process group IDs

  LIBRARY

    Standard C Library (libc.a)

  SYNOPSIS

    #include <sys/types.h>

    int setgid(
      gid_t gid );

  PARAMETERS

    gid   Specifies the value of the group ID to be set.

  DESCRIPTION

    The setgid() function sets the real and effective group IDs of the calling
    process.

    If the effective user ID of the calling process is superuser, the real
    group ID and effective group ID are set to gid.

    If the effective user ID of the calling process is not superuser, but its
    real group ID is equal to gid, the effective group ID is set to gid.

    If the effective user ID of the calling process is not superuser, but the
    saved set-group ID from the exec() function is equal to gid, the effective
    group ID is set to gid.

    Supplementary group IDs of the calling process remain unchanged.

  EXAMPLES

    if (setgid(new_gid) == -1)
            perror("Setgid failed");


  RETURN VALUES

    Upon successful completion, the setgid() function returns a value of 0.
    If setgid() fails, a value of -1 is returned and errno is set to indicate
    the error.

  ERRORS

    The setgid() function fails if any of the following are true:



  2/94 - Intergraph Corporation                                              1






  setgid(2)                           CLIX                           setgid(2)



    [EPERM]    The gid parameter is not equal to either the real or saved
               group IDs of the process and the calling process does not have
               superuser privilege.

    [EINVAL]   The value of gid is invalid.

  RELATED INFORMATION

    Functions:  setuid(2), getuid(2)













































  2                                              Intergraph Corporation - 2/94




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