Upgrade less(1). 1/2
[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 .\"
22 .Dd August 3, 2007
23 .Dt SETRESUID 2
24 .Os
25 .Sh NAME
26 .Nm getresgid ,
27 .Nm getresuid ,
28 .Nm setresgid ,
29 .Nm setresuid
30 .Nd get or set real, effective and saved user or group ID
31 .Sh LIBRARY
32 .Lb libc
33 .Sh SYNOPSIS
34 .In sys/types.h
35 .In unistd.h
36 .Ft int
37 .Fn getresgid "gid_t *rgid" "gid_t *egid" "gid_t *sgid"
38 .Ft int
39 .Fn getresuid "uid_t *ruid" "uid_t *euid" "uid_t *suid"
40 .Ft int
41 .Fn setresgid "gid_t rgid" "gid_t egid" "gid_t sgid"
42 .Ft int
43 .Fn setresuid "uid_t ruid" "uid_t euid" "uid_t suid"
44 .Sh DESCRIPTION
45 The
46 .Fn setresuid
47 system call sets the real,
48 effective and saved user IDs of the current process.
49 The analogous
50 .Fn setresgid
51 sets the real, effective and saved group IDs.
52 .Pp
53 Privileged processes may set these IDs
54 to arbitrary values.
55 Unprivileged processes are restricted
56 in that each of the new IDs must match one of the current IDs.
57 .Pp
58 Passing -1 as an argument causes the corresponding value
59 to remain unchanged.
60 .Pp
61 The
62 .Fn getresgid
63 and
64 .Fn getresuid
65 calls retrieve the real, effective, and saved group and user IDs of
66 the current process, respectively.
67 .Sh RETURN VALUES
68 .Rv -std
69 .Sh ERRORS
70 .Bl -tag -width Er
71 .It Bq Er EFAULT
72 An address passed to
73 .Fn getresgid
74 or
75 .Fn getresuid
76 was invalid.
77 .It Bq Er EPERM
78 The calling process was not privileged
79 and tried to change one or more IDs to a value
80 which was not the current real ID, the current effective ID
81 nor the current saved ID.
82 .El
83 .Sh SEE ALSO
84 .Xr getegid 2 ,
85 .Xr geteuid 2 ,
86 .Xr getgid 2 ,
87 .Xr getuid 2 ,
88 .Xr issetugid 2 ,
89 .Xr setgid 2 ,
90 .Xr setregid 2 ,
91 .Xr setreuid 2 ,
92 .Xr setuid 2
93 .Sh HISTORY
94 These system calls first appeared in HP-UX.