socket/socketpair: Add SOCK_{NONBLOCK,CLOEXEC} support.
[dragonfly.git] / lib / libc / sys / setresuid.2
1 .\" Copyright (c) 2000
2 .\"      Sheldon Hearn.  All rights reserved.
3 .\"
4 .\" Redistribution and use in source and binary forms, with or without
5 .\" modification, are permitted provided that the following conditions
6 .\" are met:
7 .\" 1. Redistributions of source code must retain the above copyright
8 .\"    notice, this list of conditions and the following disclaimer.
9 .\" 2. Redistributions in binary form must reproduce the above copyright
10 .\"    notice, this list of conditions and the following disclaimer in the
11 .\"    documentation and/or other materials provided with the distribution.
12 .\"
13 .\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
14 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
16 .\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
17 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
18 .\" DAMAGES
19 .\"
20 .\" $FreeBSD: src/lib/libc/sys/setresuid.2,v 1.2.2.8 2001/12/14 18:34:01 ru Exp $
21 .\" $DragonFly: src/lib/libc/sys/setresuid.2,v 1.4 2007/08/03 08:40:14 swildner Exp $
22 .\"
23 .Dd August 3, 2007
24 .Dt SETRESUID 2
25 .Os
26 .Sh NAME
27 .Nm getresgid ,
28 .Nm getresuid ,
29 .Nm setresgid ,
30 .Nm setresuid
31 .Nd get or set real, effective and saved user or group ID
32 .Sh LIBRARY
33 .Lb libc
34 .Sh SYNOPSIS
35 .In sys/types.h
36 .In unistd.h
37 .Ft int
38 .Fn getresgid "gid_t *rgid" "gid_t *egid" "gid_t *sgid"
39 .Ft int
40 .Fn getresuid "uid_t *ruid" "uid_t *euid" "uid_t *suid"
41 .Ft int
42 .Fn setresgid "gid_t rgid" "gid_t egid" "gid_t sgid"
43 .Ft int
44 .Fn setresuid "uid_t ruid" "uid_t euid" "uid_t suid"
45 .Sh DESCRIPTION
46 The
47 .Fn setresuid
48 system call sets the real,
49 effective and saved user IDs of the current process.
50 The analogous
51 .Fn setresgid
52 sets the real, effective and saved group IDs.
53 .Pp
54 Privileged processes may set these IDs
55 to arbitrary values.
56 Unprivileged processes are restricted
57 in that each of the new IDs must match one of the current IDs.
58 .Pp
59 Passing -1 as an argument causes the corresponding value
60 to remain unchanged.
61 .Pp
62 The
63 .Fn getresgid
64 and
65 .Fn getresuid
66 calls retrieve the real, effective, and saved group and user IDs of
67 the current process, respectively.
68 .Sh RETURN VALUES
69 .Rv -std
70 .Sh ERRORS
71 .Bl -tag -width Er
72 .It Bq Er EFAULT
73 An address passed to
74 .Fn getresgid
75 or
76 .Fn getresuid
77 was invalid.
78 .It Bq Er EPERM
79 The calling process was not privileged
80 and tried to change one or more IDs to a value
81 which was not the current real ID, the current effective ID
82 nor the current saved ID.
83 .El
84 .Sh SEE ALSO
85 .Xr getegid 2 ,
86 .Xr geteuid 2 ,
87 .Xr getgid 2 ,
88 .Xr getuid 2 ,
89 .Xr issetugid 2 ,
90 .Xr setgid 2 ,
91 .Xr setregid 2 ,
92 .Xr setreuid 2 ,
93 .Xr setuid 2
94 .Sh STANDARDS
95 These system calls are not available on many platforms.
96 They exist in
97 .Dx
98 to support Linux binaries linked against GNU libc2.
99 .Sh HISTORY
100 These system calls first appeared in HP-UX.