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