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