1SETGID(P) POSIX Programmer's Manual SETGID(P)
2
3
4
6 setgid - set-group-ID
7
9 #include <unistd.h>
10
11 int setgid(gid_t gid);
12
13
15 If the process has appropriate privileges, setgid() shall set the real
16 group ID, effective group ID, and the saved set-group-ID of the calling
17 process to gid.
18
19 If the process does not have appropriate privileges, but gid is equal
20 to the real group ID or the saved set-group-ID, setgid() shall set the
21 effective group ID to gid; the real group ID and saved set-group-ID
22 shall remain unchanged.
23
24 The setgid() function shall not affect the supplementary group list in
25 any way.
26
27 Any supplementary group IDs of the calling process shall remain
28 unchanged.
29
31 Upon successful completion, 0 is returned. Otherwise, -1 shall be
32 returned and errno set to indicate the error.
33
35 The setgid() function shall fail if:
36
37 EINVAL The value of the gid argument is invalid and is not supported by
38 the implementation.
39
40 EPERM The process does not have appropriate privileges and gid does
41 not match the real group ID or the saved set-group-ID.
42
43
44 The following sections are informative.
45
47 None.
48
50 None.
51
53 Refer to the RATIONALE section in setuid() .
54
56 None.
57
59 exec() , getegid() , geteuid() , getgid() , getuid() , setegid() ,
60 seteuid() , setregid() , setreuid() , setuid() , the Base Definitions
61 volume of IEEE Std 1003.1-2001, <sys/types.h>, <unistd.h>
62
64 Portions of this text are reprinted and reproduced in electronic form
65 from IEEE Std 1003.1, 2003 Edition, Standard for Information Technology
66 -- Portable Operating System Interface (POSIX), The Open Group Base
67 Specifications Issue 6, Copyright (C) 2001-2003 by the Institute of
68 Electrical and Electronics Engineers, Inc and The Open Group. In the
69 event of any discrepancy between this version and the original IEEE and
70 The Open Group Standard, the original IEEE and The Open Group Standard
71 is the referee document. The original Standard can be obtained online
72 at http://www.opengroup.org/unix/online.html .
73
74
75
76IEEE/The Open Group 2003 SETGID(P)