sys_pidfd_open(9)
π sys_pidfd_open(9) β the Kernel API Manual, bestie edition π
okay so this is <pink>sys_pidfd_open</pink> from the Kernel API Manual, and honestly? it's giving "tiny function, huge main character energy" β¨ let's get into it.
β¨ NAME β¨
sys_pidfd_open β open a new pid file descriptor, periodt π
πΈ SYNOPSIS πΈ
long sys_pidfd_open (pid_t pid , unsigned int flags );
that's it. that's the whole vibe. two little args, one long coming back at you π«Ά
π¦ ARGUMENTS π¦
pidβ the pid you wanna get a pidfd for π like, which task are we locking eyes withflagsβ the flags you're passing in π just hand them over
π DESCRIPTION π
so what this does is create a brand-new pid file descriptor for the task identified by pid, and no cap β it's created with the O_CLOEXEC flag already set π₯
β οΈ important lil caveat bestie: without the PIDFD_THREAD flag, the target task must be a thread-group leader. like, that's not optional. thread-group leader only. iykyk π
β RETURN β
- on success β you get a cloexec pidfd back, slay π
- on error β a negative errno number comes back π (not me getting a negative number instead of a fd, fr fr)
π§ SEE ALSO π§
- Kernel file
./kernel/pid.c pidfd_get_task(9)pidfd_create(9)sys_pidfd_getfd(9)
go read those too, they're all connected, it's a whole ecosystem bestie π¦β¨
and that's the page!! sourced from ./kernel, dated October 2026 β mwah, bye, go open some pidfds responsibly πππ
π¦ where this page comes from
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms