PR_GET_TID_ADDRESS(2const)

πŸ’– PR_GET_TID_ADDRESS πŸ’–

okay bestie, welcome to PR_GET_TID_ADDRESS(2const) β€” yes that's the manual name, it's giving "const page" energy, and we're about to get into the clear_child_tid address situation. buckle up πŸŽ€


✨ NAME ✨

PR_GET_TID_ADDRESS β€” get the clear_child_tid address 🧚

πŸ“š LIBRARY πŸ“š

Standard C library (libc, -lc)

🌸 SYNOPSIS 🌸

#include <linux/prctl.h>  /* Definition of PR_* constants */
#include <sys/prctl.h>

int prctl(PR_GET_TID_ADDRESS, int **addrp);

πŸ‘‘ DESCRIPTION πŸ‘‘

so like. this returns the clear_child_tid address β€” the one that got set by set_tid_address(2) and the clone(2) CLONE_CHILD_CLEARTID flag β€” and it drops it right into the location that addrp points to. πŸ’…

heads up bestie: this feature is ONLY available if the kernel was built with the CONFIG_CHECKPOINT_RESTORE option enabled. no config, no vibes. 😭

πŸ”₯ RETURN VALUE πŸ”₯

  • On success, 0 is returned. slay ✨
  • On error, -1 is returned, and errno is set to indicate the error. tragic πŸ’€

πŸ’€ ERRORS πŸ’€

  • EFAULT β€” addrp is an invalid address. not her finest moment πŸ™ˆ

🌈 STANDARDS 🌈

Linux.

πŸ¦‹ HISTORY πŸ¦‹

Linux 3.5. old money, lowkey iconic ⭐

⚠️ CAVEATS ⚠️

okay so pay attention here because this one is a whole thing. since the prctl() system call does not have a compat implementation for the AMD64 x32 and MIPS n32 ABIs, and the kernel writes out a pointer using the kernel's pointer size, this operation expects a user-space buffer of 8 (not 4) bytes on these ABIs. yes. eight. not four. do not come to me with four bytes on those ABIs, I will know. πŸ’…

πŸ”— SEE ALSO πŸ”—


and that's the whole page bestie, no cap, every flag and caveat accounted for 🫢

this little adventure was brought to you by Linux man-pages 6.20, dated 2026-02-08, and the letters PR_GET_TID_ADDRESS(2const). mwah πŸ’–βœ¨

πŸ“¦ 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