]> git.ipfire.org Git - thirdparty/systemd.git/commit
fd-util: use F_DUPFD_QUERY for same_fd() 34675/head
authorLennart Poettering <lennart@poettering.net>
Tue, 8 Oct 2024 08:01:22 +0000 (10:01 +0200)
committerLennart Poettering <lennart@poettering.net>
Tue, 8 Oct 2024 11:13:49 +0000 (13:13 +0200)
commite7f905347526dd17543dd54561f56a047e6ff9f4
tree61f574ac97abcbd16d2b0ebe1ac0968ba4531dd4
parent6056663a14863da81ef6dad3258e514382c31adc
fd-util: use F_DUPFD_QUERY for same_fd()

Catch up with the nice little toys the kernel fs developers have added
for us. Preferably, let's make use of the new F_DUPFD_QUERY fcntl() call
that checks whether two fds are just duplicates of each other
(duplicates as in dup(), not as in open() of the same inode, i.e.
whether they share a single file offset and so on).

This API is much nicer, since it is a core kernel feature, unlike the
kcmp() call we so far used, which is part of the (optional)
checkpoint/restore stuff.

F_DUPFD_QUERY is available since kernel 6.10.
src/basic/fd-util.c
src/basic/missing_fcntl.h
src/test/test-fd-util.c