X-Git-Url: https://git.saurik.com/apple/xnu.git/blobdiff_plain/9bccf70c0258c7cac2dcb80011b2a964d884c552..0a7de7458d150b5d4dffc935ba399be265ef0a1a:/bsd/man/man2/setuid.2?ds=sidebyside diff --git a/bsd/man/man2/setuid.2 b/bsd/man/man2/setuid.2 index b271097c8..205e8cfdc 100644 --- a/bsd/man/man2/setuid.2 +++ b/bsd/man/man2/setuid.2 @@ -37,22 +37,29 @@ .Dt SETUID 2 .Os BSD 4.2 .Sh NAME -.Nm setuid , +.Nm setegid , .Nm seteuid , .Nm setgid , -.Nm setegid +.Nm setuid .Nd set user and group ID .Sh SYNOPSIS -.Fd #include .Fd #include .Ft int -.Fn setuid "uid_t uid" +.Fo setegid +.Fa "gid_t egid" +.Fc .Ft int -.Fn seteuid "uid_t euid" +.Fo seteuid +.Fa "uid_t euid" +.Fc .Ft int -.Fn setgid "gid_t gid" +.Fo setgid +.Fa "gid_t gid" +.Fc .Ft int -.Fn setegid "gid_t egid" +.Fo setuid +.Fa "uid_t uid" +.Fc .Sh DESCRIPTION The .Fn setuid @@ -97,7 +104,7 @@ in this way, the effective user ID of a set-user-ID executable may be toggled by switching to the real user ID, then re-enabled by reverting to the set-user-ID value. Similarly, the effective group ID may be set to the value -of the real group ID or the saved set-user-ID. +of the real group ID or the saved set-group-ID. .Pp .Sh RETURN VALUES Upon success, these functions return 0; @@ -106,9 +113,38 @@ otherwise \-1 is returned. If the user is not the super user, or the uid specified is not the real, effective ID, or saved ID, these functions return \-1. +.Pp +.Sh ERRORS +The +.Fn setegid , +.Fn seteuid , +.Fn setgid , +and +.Fn setuid +system calls will fail if: +.Bl -tag -width Er +.\" =========== +.It Bq Er EINVAL +The value of the {group,user} ID argument is invalid +and is not supported by the implementation. +.\" =========== +.It Bq Er EPERM +The process does not have appropriate privileges and +the ID argument +does not match the real ID +or the saved set-{group,user}-ID. +.El +.Sh LEGACY SYNOPSIS +.Fd #include +.Fd #include +.Pp +The include file +.In sys/types.h +is necessary for all functions. .Sh SEE ALSO +.Xr getgid 2 , .Xr getuid 2 , -.Xr getgid 2 +.Xr compat 5 .Sh STANDARDS The .Fn setuid