]> sourceware.org Git - lvm2.git/commit
libdaemon: implement daemon_close_stray_fds
authorZdenek Kabelac <zkabelac@redhat.com>
Fri, 12 Apr 2024 22:39:43 +0000 (00:39 +0200)
committerZdenek Kabelac <zkabelac@redhat.com>
Mon, 15 Apr 2024 11:38:44 +0000 (13:38 +0200)
commit79cdfc8ca650dec3ec6ea5e6eafbca2e3a2ebc9e
tree8ab31e8f3866e461feb6df3ef5215297c4da4636
parentecb83990050247782d2ebea4f7e588eac8e0a14f
libdaemon: implement daemon_close_stray_fds

Refactor existing code from tools/lvmcmdline.c to
libdaemon/server/daemon-stray.h daemon_close_stray_fds()
used to close stray descriptors above some specified Fd.

This is code parses content of /proc dir to minimize 'blind' closing
of all possible descriptors within rlimits range.

As we have the same code in few other places in it's more 'trivial'
version - these were actually sensitive to high amount of descriptors,
which might be configured on some system.

With this patch we effectively resolve this reported gitlab issue:
https://gitlab.com/lvmteam/lvm2/-/issues/5

TODO: Current placement might not be ideal - however considering
existing code base constrains it's not so simple.
ATM it uses lib/misc/lvm-file.h  for custom_fds declaration
and rest of functinality is included in daemon header file.
libdaemon/server/daemon-server.c
libdaemon/server/daemon-stray.h [new file with mode: 0644]
tools/lvmcmdline.c
This page took 0.043237 seconds and 5 git commands to generate.