Mike Yuan
a842c26be3
pidfd-util: extract pidfd_get_inode_id_impl() and make it thread safe
...
Preparation for later commits.
2025-06-05 00:28:01 +02:00
Mike Yuan
e09b7ced65
pidfd-util: open an internal pidfd if none is passed in pidfd_check_pidfs()
...
I'd like to introduce a libsystemd helper for acquiring pidfd
inode id, which however means the fd passed to pidfd_check_pidfs()
can no longer be trusted. Let's add back the logic of allocating
a genuine pidfd allocated internally, which was remove in
5dc9d5b4ea .
2025-06-05 00:28:01 +02:00
Daan De Meyer
0c15577abe
basic + fundamental: Clean up includes
...
Split out of #37344 .
2025-05-25 10:06:07 +02:00
Jan Vaclav
b900a8d827
pidfd-util: avoid alignment warning when accessing f_handle
2025-05-20 12:07:43 +02:00
Mike Yuan
d2c4df9e48
pidfd-util: use get_proc_field() for pidfd_get_pid_fdinfo()
2025-05-01 13:10:26 +09:00
Daan De Meyer
93a1f7921a
basic: Stop including log.h in macro.h
...
Now that the necessary functions from log.h have been moved to macro.h,
we can stop including log.h in macro.h. This requires modifying source
files all over the tree to include log.h instead.
2025-04-18 14:19:15 +02:00
Yu Watanabe
e75372958d
missing_threads.h: threads.h exists since glibc-2.28
2025-03-04 02:24:49 +09:00
Mike Yuan
9c039ef5ff
pidfd-util: preferably acquire pidfd inode id through name_to_handle_at()
...
See rationales described in kernel commit:
https://github.com/torvalds/linux/commit/b3caba8f7a34a2bbaf45ffc6ff3a49b70afeb192
2025-01-22 21:41:44 +01:00
Lennart Poettering
afede53ae9
pidfd-util: add helper for getting our own pidfdid
...
let's start caching our own pidfd id, since it's somewhat involved to
get but a much better identifier for things than the classic PID is.
2025-01-20 21:51:29 +01:00
Lennart Poettering
5dc9d5b4ea
pidfd-util: dont open a new pidfd unnecessarily in pidfd_check_pidfs()
2025-01-20 21:49:38 +01:00
Mike Yuan
6e14c46bac
tree-wide: drop support for kernels without pidfd_open() and pidfd_send_signal()
...
Our baseline is v5.4 now.
2025-01-12 00:01:07 +01:00
Mike Yuan
47f64104d1
process-util: port pidref_get_uid() and pidref_is_my_child() to pidfd helpers
2025-01-04 17:48:22 +01:00
Mike Yuan
85e7bbfaa4
pidfd-util: introduce pidfd_get_{ppid,uid,cgroupid} which goes via PIDFD_GET_INFO too
2025-01-04 17:08:01 +01:00
Mike Yuan
dcf0ef3f42
pidfd-util: try to translate pidfd -> pid through ioctl(PIDFD_GET_INFO)
2025-01-04 17:08:01 +01:00
Mike Yuan
72661e0091
pidfd-util: introduce helper for obtaining ns fd using PIDFD_GET_*_NAMESPACE directly
2025-01-04 17:07:59 +01:00
Mike Yuan
2fa42318c3
pidref: move generic pidfd_get_inode_id() to pidfd-util
...
Prompted by https://github.com/systemd/systemd/pull/35224/commits/221d6e54c60389f26c2c79dbfa4e83204d2775d7
Also generalize pidfd_check_pidfs() and expose have_pidfs for later use.
2025-01-04 17:07:58 +01:00
Mike Yuan
b234026d09
process-util: extract pidfd-related funcs into pidfd-util.[ch]
2025-01-04 16:58:13 +01:00