Pidfd: Difference between revisions
| (One intermediate revision by the same user not shown) | |||
| Line 16: | Line 16: | ||
As of 6.5, credentials can be sent using pidfds rather than <tt>SCM_CREDENTIALS</tt>-style PIDs using the <tt>SCM_PIDFD</tt> type. <tt>getsockopt(2)</tt> can use <tt>SO_PEERPIDFD</tt> to get a pidfd for the peer process on a <tt>unix(7)</tt> socket. | As of 6.5, credentials can be sent using pidfds rather than <tt>SCM_CREDENTIALS</tt>-style PIDs using the <tt>SCM_PIDFD</tt> type. <tt>getsockopt(2)</tt> can use <tt>SO_PEERPIDFD</tt> to get a pidfd for the peer process on a <tt>unix(7)</tt> socket. | ||
6.9 introduces pidfdfs, a pseudo filesystem similar to nsfs | 6.9 introduces pidfdfs, a pseudo filesystem similar to nsfs. This is not visible from userspace, and is not mounted. It facilitates system calls which demand a filesystem backing: <tt>statx()</tt> now works, as do LSMs (Linux Security Modules). | ||
==[[Glibc]]== | ==[[Glibc]]== | ||
GNU libc added pidfd system call support in 2.36. Glibc 2.39 added two functions for pidfds, complementing <tt>posix_spawn(3)</tt>. They return pidfds rather than PIDs: | GNU libc added pidfd system call support in 2.36. Glibc 2.39 added two functions for pidfds, complementing <tt>posix_spawn(3)</tt>. They return pidfds rather than PIDs: | ||
* <tt>pidfd_spawn(3)</tt>:analogous to <tt>posix_spawn(3)</tt> | * <tt>pidfd_spawn(3)</tt>: analogous to <tt>posix_spawn(3)</tt> | ||
* <tt>pidfd_spawnp(3)</tt>: analogous to <tt>posix_spawnp(3)</tt> | * <tt>pidfd_spawnp(3)</tt>: analogous to <tt>posix_spawnp(3)</tt> | ||