getresuid(2)
π getresuid(2) β the system calls manual page, bestie edition π
okay so this is the getresuid(2) page from the System Calls Manual, and we're about to make UID/GID lore actually make sense. stay with me π«Ά
β¨ NAME β¨
getresuid, getresgid β get real, effective, and saved user/group IDs
like... it literally just gets them. no cap.
π LIBRARY π
Standard C library (libc, -lc)
the og. the moment. link against her and you're set π
π SYNOPSIS π
#define _GNU_SOURCE /* See feature_test_macros(7) */
#include <unistd.h>
int getresuid(uid_t *ruid, uid_t *euid, uid_t *suid);
int getresgid(gid_t *rgid, gid_t *egid, gid_t *sgid);
okay so bestie, notice how you gotta define _GNU_SOURCE before you pull in <unistd.h> β and yes there's a whole other page about that, it's feature_test_macros(7), go read it i'm literally begging π
πΈ DESCRIPTION πΈ
so getresuid() hands you back three things about the calling process, and it drops them into the args you passed in:
ruidβ the real UIDeuidβ the effective UIDsuidβ the saved set-user-ID
and getresgid() is literally the same serve but for the process's group IDs. analogous task, different IDs, same energy. periodt β¨
π RETURN VALUE π
- on success β
0is returned. slay. - on error β
-1is returned, anderrnogets set to tell you what went wrong.
π ERRORS π
EFAULTβ one of the arguments pointed at an address outside the calling program's address space. so like... you handed it a pointer into the void. it's giving wanderlust, but for memory. not the vibe. π
β STANDARDS β
POSIX.1-2024 XSI π certified iconic, we love a standardized baddie
π HISTORY π
Linux 2.1.44, glibc 2.3.2, POSIX.1-2024 XSI. a whole glow-up timeline fr fr.
and okay, storytime π β the original Linux getresuid() and getresgid() system calls only ever supported 16-bit user and group IDs. sixteen. bits. tiny. baby.
then Linux 2.4 showed up and added getresuid32() and getresgid32(), which support 32-bit IDs β the main character era.
and the way the glibc getresuid() and getresgid() wrapper functions handle all of this?? they transparently deal with the variations across kernel versions. you don't have to think about it. you just call the function. she handles the drama behind the scenes. we're obsessed π§
π¦ SEE ALSO π¦
go read them, i'm not asking π
and that's the whole page bestie!! this was Linux man-pages 6.20, dated 2026-02-08, and honestly?? iconic of her. now go write some C and hydrate πβ¨ππ«Ά
π¦ where this page comes from
- arch rolling: man-pages 6.20-1 Β· BSD-2-Clause AND BSD-3-Clause AND BSD-4.3TAHOE AND BSD-4-Clause-UC AND GPL-1.0-or-later AND GPL-2.0-only AND GPL-2.0-or-later AND GPL-3.0-or-later AND LGPL-3.0-linking-exception AND LGPL-3.0-or-later AND LicenseRef-Public-Domain AND LicenseRef-UltraPermissive AND Linux-man-pages-1-para AND Linux-man-pages-copyleft AND Linux-man-pages-copyleft-2-para AND Linux-man-pages-copyleft-var AND MIT AND Spencer-94
- nixpkgs unstable: man-pages 6.20
- π the page's license: Linux-man-pages-copyleft
- Copyright 1997, Andries E. Brouwer <aeb@cwi.nl>
- Copyright 2007, Michael Kerrisk <mtk.manpages@gmail.com>
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms