]> git.ipfire.org Git - thirdparty/systemd.git/commit
pidref: add helpers for managing PidRef on the heap
authorLennart Poettering <lennart@poettering.net>
Tue, 19 Sep 2023 14:15:00 +0000 (16:15 +0200)
committerLennart Poettering <lennart@poettering.net>
Thu, 28 Sep 2023 21:22:58 +0000 (23:22 +0200)
commit837659825f5362949948826c0c8f6fc912cf4e3b
tree0811b405ebedad42a659eeb03bf324ea97c47663
parentdcfcea6d0248d91d1eb5fab4b6a5b53608cf810c
pidref: add helpers for managing PidRef on the heap

Usually we want to embed PidRef in other structures, but sometimes it
makes sense to allocate it on the heap in case it should be used
standalone. Add helpers for that.

Primary usecase: use as key in Hashmap objects, that for example map
process to unit objects in PID 1.

This adds pidref_free()/pidref_freep() for freeing such an allocated
struct, as well as pidref_dup() (for duplicating an existing PidRef
on the heap 1:1), and pidref_new_pid() (for allocating a new PidRef from a
PID).
src/basic/pidref.c
src/basic/pidref.h