xref: /csrg-svn/lib/libc/compat-43/setreuid.2 (revision 47208)
1*47208Scael.\" Copyright (c) 1980, 1991 The Regents of the University of California.
238053Sbostic.\" All rights reserved.
320129Smckusick.\"
443568Strent.\" %sccs.include.redist.man%
520129Smckusick.\"
6*47208Scael.\"     @(#)setreuid.2	6.4 (Berkeley) 03/10/91
738053Sbostic.\"
8*47208Scael.Dd
9*47208Scael.Dt SETREUID 2
10*47208Scael.Os BSD 4
11*47208Scael.Sh NAME
12*47208Scael.Nm setreuid
13*47208Scael.Nd set real and effective user ID's
14*47208Scael.Sh SYNOPSIS
15*47208Scael.Fd #include <unistd.h>
16*47208Scael.Ft int
17*47208Scael.Fn setreuid "int ruid" "int euid"
18*47208Scael.Sh DESCRIPTION
1920130SmckusickThe real and effective user ID's of the
2020130Smckusickcurrent process are set according to the arguments.
2120130SmckusickIf
22*47208Scael.Fa ruid
2320130Smckusickor
24*47208Scael.Fa euid
25*47208Scaelis -1, the current uid is filled in by the system.
2620131SmckusickUnprivileged users may change the real user
2720131SmckusickID to the effective user ID and vice-versa; only the super-user may
2820131Smckusickmake other changes.
29*47208Scael.Sh RETURN VALUES
3020130SmckusickUpon successful completion, a value of 0 is returned.  Otherwise,
31*47208Scaela value of -1 is returned and
32*47208Scael.Va errno
33*47208Scaelis set to indicate the error.
34*47208Scael.Sh ERRORS
35*47208Scael.Bl -tag -width [EPERM]
36*47208Scael.It Bq Er EPERM
3720130SmckusickThe current process is not the super-user and a change
3820130Smckusickother than changing the effective user-id to the real user-id
3920130Smckusickwas specified.
40*47208Scael.El
41*47208Scael.Sh SEE ALSO
42*47208Scael.Xr getuid 2 ,
43*47208Scael.Xr setregid 2 ,
44*47208Scael.Xr setuid 3
45*47208Scael.Sh HISTORY
46*47208ScaelThe
47*47208Scael.Nm
48*47208Scaelfunction call appeared in
49*47208Scael.Bx 4.2 .
50