1SETREGID(3P)               POSIX Programmer's Manual              SETREGID(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       setregid - set real and effective group IDs
13

SYNOPSIS

15       #include <unistd.h>
16
17       int setregid(gid_t rgid, gid_t egid);
18
19

DESCRIPTION

21       The setregid() function shall set the real and effective group  IDs  of
22       the calling process.
23
24       If  rgid  is -1, the real group ID shall not be changed; if egid is -1,
25       the effective group ID shall not be changed.
26
27       The real and effective group IDs may be set to different values in  the
28       same call.
29
30       Only  a  process  with appropriate privileges can set the real group ID
31       and the effective group ID to any valid value.
32
33       A non-privileged process can set either the real group ID to the  saved
34       set-group-ID from one of the exec family of functions, or the effective
35       group ID to the saved set-group-ID or the real group ID.
36
37       Any supplementary group IDs of the calling process remain unchanged.
38

RETURN VALUE

40       Upon successful completion, 0 shall be returned. Otherwise, -1 shall be
41       returned  and errno set to indicate the error, and neither of the group
42       IDs are changed.
43

ERRORS

45       The setregid() function shall fail if:
46
47       EINVAL The value of the rgid or egid argument  is  invalid  or  out-of-
48              range.
49
50       EPERM  The  process  does  not have appropriate privileges and a change
51              other than changing the real group ID to the saved set-group-ID,
52              or  changing  the effective group ID to the real group ID or the
53              saved set-group-ID, was requested.
54
55
56       The following sections are informative.
57

EXAMPLES

59       None.
60

APPLICATION USAGE

62       If a set-group-ID process sets its effective group ID to its real group
63       ID,  it  can  still  set  its effective group ID back to the saved set-
64       group-ID.
65

RATIONALE

67       None.
68

FUTURE DIRECTIONS

70       None.
71

SEE ALSO

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