sys_pidfd_getfd(9)
π sys_pidfd_getfd β a Kernel API Manual moment π
okay bestie, welcome to the <pink>Kernel API Manual</pink> entry for sys_pidfd_getfd, and trust me, this one is lowkey iconic π¦
β¨ NAME β¨
sys_pidfd_getfd β literally just Get a file descriptor from another process π
πΈ SYNOPSIS πΈ
long sys_pidfd_getfd (int pidfd , int fd , unsigned int flags );
π ARGUMENTS π
pidfdβ the pidfd file descriptor of the process π«Άfdβ the file descriptor number to get (yes, the actual number, no cap) π’flagsβ flags on how to get the fd, and bestieβ¦ they're reserved π
π DESCRIPTION π
so the way this works is: this syscall gets a copy of a file descriptor from another process, based on the pidfd and the file descriptor number. the range! β¨
but here's the vibe check π
β it requires that the calling process has the ability to ptrace the process represented by the pidfd. so no sneaky business, you gotta have the clearance, iykyk.
and the process which is having its file descriptor copied? otherwise unaffected. she doesn't even notice, main character behavior fr fr π
π₯ RETURN π₯
On success, a cloexec file descriptor is returned. slay. π
On error, a negative errno number will be returned π (yes negative, like, emotionally).
π SEE ALSO π
Kernel file ./kernel/pid.c pidfd_get_task(9), pidfd_create(9), sys_pidfd_open(9) β go read those next, they're giving lore π§π
and that's the whole page, bestie! π
this cutie came from ./kernel, dated October 2026, and she's filed under sys_pidfd_getfd(9) β periodt. πππ¦
π¦ 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