1SETREGID(2)                   System Calls Manual                  SETREGID(2)
2
3
4

NAME

6       setregid - set real and effective group ID
7

SYNOPSIS

9       #include <unistd.h>
10
11       int
12       setregid(rgid, egid)
13            gid_t rgid, egid
14

DESCRIPTION

16       The real and effective group ID's of the current process are set to the
17       arguments.  Unprivileged users may change the  real  group  ID  to  the
18       effective  group  ID and vice-versa; only the super-user may make other
19       changes.
20
21       Supplying a value of -1 for either  the  real  or  effective  group  ID
22       forces  the  system  to  substitute  the  current ID in place of the -1
23       parameter.
24
25       The setregid function was intended  to  allow  swapping  the  real  and
26       effective  group IDs in set-group-ID programs to temporarily relinquish
27       the set-group-ID value.  This function did not work correctly, and  its
28       purpose  is  now  better served by the use of the setegid function (see
29       setuid(2)).
30
31       When setting the real and effective group IDs to the  same  value,  the
32       standard setgid function is preferred.
33

RETURN VALUES

35       Upon  successful  completion,  a  value of 0 is returned.  Otherwise, a
36       value of -1 is returned and errno is set to indicate the error.
37

ERRORS

39       EPERM     The current process is not the super-user and a change  other
40                 than changing the effective group-id to the real group-id was
41                 specified.
42

SEE ALSO

44       getgid(2), setegid(2), setgid(2), setuid(2)
45

HISTORY

47       The setregid function call  appeared  in  4.2BSD  and  was  dropped  in
48       4.4BSD.
49
50
51
524.2 Berkeley Distribution      December 2, 1997                    SETREGID(2)
Impressum