xref: /original-bsd/lib/libc/compat-43/setreuid.2 (revision df23cbe6)
1.\" Copyright (c) 1980, 1991 The Regents of the University of California.
2.\" All rights reserved.
3.\"
4.\" %sccs.include.redist.man%
5.\"
6.\"     @(#)setreuid.2	6.5 (Berkeley) 07/09/92
7.\"
8.Dd
9.Dt SETREUID 2
10.Os BSD 4
11.Sh NAME
12.Nm setreuid
13.Nd set real and effective user ID's
14.Sh SYNOPSIS
15.Fd #include <unistd.h>
16.Ft int
17.Fn setreuid "int ruid" "int euid"
18.Sh DESCRIPTION
19.Bf -symbolic
20This interface is made obsolete by:
21.Ef
22.Xr seteuid 2 .
23.Pp
24The effective user ID's of the
25current process is set according to the
26.Fa euid
27argument.
28The real user ID's of the
29current process is checked to ensure that it matches
30either the real or saved ID of the process
31(thus ensuring that it can later be restored to the effective ID).
32If
33.Fa euid
34is -1, the current uid is filled in by the system.
35If
36.Fa ruid
37is -1, the check on real ID above is skipped.
38Unprivileged users may change the effective user
39ID to the real user ID or the saved user ID;
40only the super-user may make other changes.
41.Sh RETURN VALUES
42Upon successful completion, a value of 0 is returned.  Otherwise,
43a value of -1 is returned and
44.Va errno
45is set to indicate the error.
46.Sh ERRORS
47.Bl -tag -width [EPERM]
48.It Bq Er EPERM
49The current process is not the super-user and a change
50other than changing the effective user-id to the real user-id
51or saved user-id was specified.
52.El
53.Sh SEE ALSO
54.Xr getuid 2 ,
55.Xr seteuid 2 ,
56.Xr setuid 2
57.Sh HISTORY
58The
59.Nm
60function call appeared in
61.Bx 4.2
62and was dropped in
63.Bx 4.4 .
64