nptl(7)
โจ nptl โ Native POSIX Threads Library โจ
okay bestie, welcome to the nptl(7) page ๐ this is from the Miscellaneous Information Manual and it's all about the threading situation on your Linux box. it's giving "backbone of everything you've ever run" energy, fr fr.
๐ธ NAME ๐ธ
nptl โ Native POSIX Threads Library
๐ DESCRIPTION ๐
NPTL (Native POSIX Threads Library) is the GNU C library POSIX threads implementation that is used on modern Linux systems. that's it, that's the whole vibe โ she's the threading queen and she runs your entire system, no cap. ๐
๐ NPTL and signals ๐
so here's the tea, bestie: NPTL makes internal use of the first two real-time signals โ that's signal numbers 32 and 33. one of these signals is used to support thread cancelation and POSIX timers (peep timer_create(2) for that one); the other is used as part of a mechanism that ensures all threads in a process always have the same UIDs and GIDs, as required by POSIX. that's a whole lot of responsibility for two little signals tbh.
โ ๏ธ warning bestie: these signals cannot be used in applications. periodt. not yours to touch.
to prevent accidental use of these signals in applications โ which might interfere with the operation of the NPTL implementation โ various glibc library functions and system call wrapper functions attempt to hide these signals from applications, as follows:
SIGRTMINis defined with the value34(rather than32). sneaky!! ๐- the
sigwaitinfo(2),sigtimedwait(2), andsigwait(3)interfaces silently ignore requests to wait for these two signals if they are specified in the signal set argument of these calls. - the
sigprocmask(2)andpthread_sigmask(3)interfaces silently ignore attempts to block these two signals. - the
sigaction(2),pthread_kill(3), andpthread_sigqueue(3)interfaces fail with the errorEINVAL(indicating an invalid signal number) if these signals are specified. sigfillset(3)does not include these two signals when it creates a full signal set.
likeโฆ it's a whole protective-big-sister situation and honestly? iconic. ๐ซถ
๐ฆ NPTL and process credential changes ๐ฆ
ngl this part is lowkey fascinating. at the Linux kernel level, credentials (user and group IDs) are a per-thread attribute. but POSIX said "absolutely not, bestie" and requires that all of the POSIX threads in a process have the same credentials. slay, standards.
to accommodate this requirement, the NPTL implementation wraps all of the system calls that change process credentials with functions that, in addition to invoking the underlying system call, arrange for all other threads in the process to also change their credentials. so like, no thread gets left behind. ๐
here's how it goes down, mechanically speaking:
the implementation of each of these system calls involves the use of a real-time signal that is sent (using tgkill(2)) to each of the other threads that must change its credentials. before sending these signals, the thread that is changing credentials saves the new credential(s) and records the system call being employed in a global buffer. then a signal handler in the receiving thread(s) fetches this information and then uses the same system call to change its credentials. chef's kiss coordination honestly ๐
wrapper functions employing this technique are provided for:
setgid(2)setuid(2)setegid(2)seteuid(2)setregid(2)setreuid(2)setresgid(2)setresuid(2)setgroups(2)
โญ STANDARDS โญ
for details of the conformance of NPTL to the POSIX standard, see pthreads(7). (yes bestie, we're citing sources, we're being academic about it ๐)
๐ NOTES ๐
POSIX says that any thread in any process with access to the memory containing a process-shared (PTHREAD_PROCESS_SHARED) mutex can operate on that mutex. sounds great, right?
BUT โ and this is the plot twist โ on 64-bit x86 systems, the mutex definition for x86-64 is incompatible with the mutex definition for i386, meaning that 32-bit and 64-bit binaries can't share mutexes on x86-64 systems. ๐ so keep that in mind, fr fr.
๐ฅ SEE ALSO ๐ฅ
and that's the whole page, bestie!! ๐ this was nptl(7) from Linux man-pages 6.20, dated 2026-02-08. go forth and thread responsibly, you absolute main character ๐ธ๐ฆโจ
๐ฆ 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 2015, 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