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 UID
  • euid β†’ the effective UID
  • suid β†’ 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 β†’ 0 is returned. slay.
  • on error β†’ -1 is returned, and errno gets 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
  • πŸ’– girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms