This is a v2 of: https://listman.redhat.com/archives/libvir-list/2023-June/240351.html Hopefully, I've implemented all Dan's suggestions. Michal Prívozník (5): virfile: Introduce virCloseRange() virfile: Introduce virCloseFrom() vircommand: Unify mass FD closing vircommand: Introduce virCommandMassCloseRange() src: Detect close_range syscall during virGlobalInit() src/libvirt.c | 4 + src/libvirt_private.syms | 4 + src/util/vircommand.c | 160 ++++++++++++++++++++++++--------------- src/util/virfile.c | 110 +++++++++++++++++++++++++++ src/util/virfile.h | 5 ++ tests/commandtest.c | 2 + 6 files changed, 222 insertions(+), 63 deletions(-) -- 2.41.0