xref: /original-bsd/lib/libc/compat-43/setreuid.2 (revision 95a66346)
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.4 (Berkeley) 03/10/91
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
19The real and effective user ID's of the
20current process are set according to the arguments.
21If
22.Fa ruid
23or
24.Fa euid
25is -1, the current uid is filled in by the system.
26Unprivileged users may change the real user
27ID to the effective user ID and vice-versa; only the super-user may
28make other changes.
29.Sh RETURN VALUES
30Upon successful completion, a value of 0 is returned.  Otherwise,
31a value of -1 is returned and
32.Va errno
33is set to indicate the error.
34.Sh ERRORS
35.Bl -tag -width [EPERM]
36.It Bq Er EPERM
37The current process is not the super-user and a change
38other than changing the effective user-id to the real user-id
39was specified.
40.El
41.Sh SEE ALSO
42.Xr getuid 2 ,
43.Xr setregid 2 ,
44.Xr setuid 3
45.Sh HISTORY
46The
47.Nm
48function call appeared in
49.Bx 4.2 .
50