1SETGID(3P)                 POSIX Programmer's Manual                SETGID(3P)
2
3
4

PROLOG

6       This  manual  page is part of the POSIX Programmer's Manual.  The Linux
7       implementation of this interface may differ (consult the  corresponding
8       Linux  manual page for details of Linux behavior), or the interface may
9       not be implemented on Linux.
10

NAME

12       setgid - set-group-ID
13

SYNOPSIS

15       #include <unistd.h>
16
17       int setgid(gid_t gid);
18
19

DESCRIPTION

21       If the process has appropriate privileges, setgid() shall set the  real
22       group ID, effective group ID, and the saved set-group-ID of the calling
23       process to gid.
24
25       If the process does not have appropriate privileges, but gid  is  equal
26       to  the real group ID or the saved set-group-ID, setgid() shall set the
27       effective group ID to gid; the real group  ID  and  saved  set-group-ID
28       shall remain unchanged.
29
30       The  setgid() function shall not affect the supplementary group list in
31       any way.
32
33       Any supplementary  group  IDs  of  the  calling  process  shall  remain
34       unchanged.
35

RETURN VALUE

37       Upon  successful  completion,  0  is  returned.  Otherwise, -1 shall be
38       returned and errno set to indicate the error.
39

ERRORS

41       The setgid() function shall fail if:
42
43       EINVAL The value of the gid argument is invalid and is not supported by
44              the implementation.
45
46       EPERM  The  process  does  not have appropriate privileges and gid does
47              not match the real group ID or the saved set-group-ID.
48
49
50       The following sections are informative.
51

EXAMPLES

53       None.
54

APPLICATION USAGE

56       None.
57

RATIONALE

59       Refer to the RATIONALE section in setuid().
60

FUTURE DIRECTIONS

62       None.
63

SEE ALSO

65       exec(), getegid(), geteuid(), getgid(), getuid(), setegid(), seteuid(),
66       setregid(),  setreuid(),  setuid(),  the  Base  Definitions  volume  of
67       IEEE Std 1003.1-2001, <sys/types.h>, <unistd.h>
68
70       Portions of this text are reprinted and reproduced in  electronic  form
71       from IEEE Std 1003.1, 2003 Edition, Standard for Information Technology
72       -- Portable Operating System Interface (POSIX),  The  Open  Group  Base
73       Specifications  Issue  6,  Copyright  (C) 2001-2003 by the Institute of
74       Electrical and Electronics Engineers, Inc and The Open  Group.  In  the
75       event of any discrepancy between this version and the original IEEE and
76       The Open Group Standard, the original IEEE and The Open Group  Standard
77       is  the  referee document. The original Standard can be obtained online
78       at http://www.opengroup.org/unix/online.html .
79
80
81
82IEEE/The Open Group                  2003                           SETGID(3P)
Impressum