]> git.ipfire.org Git - thirdparty/systemd.git/commit - src/shared/varlink.h
varlink: add varlink_peek_dup_fd() helper
authorLennart Poettering <lennart@poettering.net>
Tue, 23 Jan 2024 09:22:27 +0000 (10:22 +0100)
committerLennart Poettering <lennart@poettering.net>
Sat, 6 Apr 2024 14:08:23 +0000 (16:08 +0200)
commitb219dcd45ac88ee18d2e3217f9f00631503bb77a
tree1a47211e9795b75c03c61672fdaa53aa6b75b48e
parent52bd61373b89bb6b458f5020b23a92253b12f235
varlink: add varlink_peek_dup_fd() helper

This new call is like varlink_peek_fd() (i.e. gets an fd out of the
connection but leaving it also in there), and combines ith with
F_DUPFD_CLOEXEC to make a copy of it.

We previously already had varlink_dup_fd() which was a duplicating
version for pushing an fd *into* the connection. To reduce confusion,
let's rename that one varlink_push_dup_fd() to make the symmetry to
valrink_push_fd() clear so that we have no:

varlink_peer_push_fd()        → put fd in without dup'ing
varlink_peer_push_dup_fd()    → same with F_DUPFD_CLOEXEC
varlink_peer_peek_fd()        → get fd out without dup'ing
varlink_peer_peek_dup_fd()    → same with F_DUPFD_CLOEXEC
src/shared/varlink.c
src/shared/varlink.h