| 1 |
.\" Copyright (C) 1997 Andries Brouwer ([email protected]) |
| 2 |
.\" and Copyright (c) 2007, Michael Kerrisk <[email protected]> |
| 3 |
.\" |
| 4 |
.\" SPDX-License-Identifier: Linux-man-pages-copyleft |
| 5 |
.\" |
| 6 |
.\" Modified, 2003-05-26, Michael Kerrisk, <[email protected]> |
| 7 |
.\" |
| 8 |
.TH getresuid 2 2024-05-02 "Linux man-pages 6.9.1" |
| 9 |
.SH NAME |
| 10 |
getresuid, getresgid \- get real, effective, and saved user/group IDs |
| 11 |
.SH LIBRARY |
| 12 |
Standard C library |
| 13 |
.RI ( libc ", " \-lc ) |
| 14 |
.SH SYNOPSIS |
| 15 |
.nf |
| 16 |
.BR "#define _GNU_SOURCE" " /* See feature_test_macros(7) */" |
| 17 |
.B #include <unistd.h> |
| 18 |
.P |
| 19 |
.BI "int getresuid(uid_t *" ruid ", uid_t *" euid ", uid_t *" suid ); |
| 20 |
.BI "int getresgid(gid_t *" rgid ", gid_t *" egid ", gid_t *" sgid ); |
| 21 |
.fi |
| 22 |
.SH DESCRIPTION |
| 23 |
.BR getresuid () |
| 24 |
returns the real UID, the effective UID, and the saved set-user-ID |
| 25 |
of the calling process, in the arguments |
| 26 |
.IR ruid , |
| 27 |
.IR euid , |
| 28 |
and |
| 29 |
.IR suid , |
| 30 |
respectively. |
| 31 |
.BR getresgid () |
| 32 |
performs the analogous task for the process's group IDs. |
| 33 |
.SH RETURN VALUE |
| 34 |
On success, zero is returned. |
| 35 |
On error, \-1 is returned, and |
| 36 |
.I errno |
| 37 |
is set to indicate the error. |
| 38 |
.SH ERRORS |
| 39 |
.TP |
| 40 |
.B EFAULT |
| 41 |
One of the arguments specified an address outside the calling program's |
| 42 |
address space. |
| 43 |
.SH STANDARDS |
| 44 |
None. |
| 45 |
These calls also appear on HP-UX and some of the BSDs. |
| 46 |
.SH HISTORY |
| 47 |
Linux 2.1.44, |
| 48 |
glibc 2.3.2. |
| 49 |
.P |
| 50 |
The original Linux |
| 51 |
.BR getresuid () |
| 52 |
and |
| 53 |
.BR getresgid () |
| 54 |
system calls supported only 16-bit user and group IDs. |
| 55 |
Subsequently, Linux 2.4 added |
| 56 |
.BR getresuid32 () |
| 57 |
and |
| 58 |
.BR getresgid32 (), |
| 59 |
supporting 32-bit IDs. |
| 60 |
The glibc |
| 61 |
.BR getresuid () |
| 62 |
and |
| 63 |
.BR getresgid () |
| 64 |
wrapper functions transparently deal with the variations across kernel versions. |
| 65 |
.SH SEE ALSO |
| 66 |
.BR getuid (2), |
| 67 |
.BR setresuid (2), |
| 68 |
.BR setreuid (2), |
| 69 |
.BR setuid (2), |
| 70 |
.BR credentials (7) |