summaryrefslogtreecommitdiffstats
path: root/src/shared/fdset.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2023-10-11 11:11:12 +0200
committerLennart Poettering <lennart@poettering.net>2023-10-11 11:39:48 +0200
commit91a6447607635802ac2278b7997cde687e2549a4 (patch)
treeae6fa3cce1304dfb309eb9c2518f965dd70ed8ab /src/shared/fdset.c
parentlimits-util: suppress noisy debug message when reading tasks in top-level cgroup (diff)
downloadsystemd-91a6447607635802ac2278b7997cde687e2549a4.tar.xz
systemd-91a6447607635802ac2278b7997cde687e2549a4.zip
fdset: improve debug logging for left-over fds
Let's show which fds are closed as part of the left-over fd set logic on daemon reload/reexec cycles. This is useful to debug accidentally unclaimed fds.
Diffstat (limited to '')
-rw-r--r--src/shared/fdset.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/shared/fdset.c b/src/shared/fdset.c
index f5dcdce218..b62f15c649 100644
--- a/src/shared/fdset.c
+++ b/src/shared/fdset.c
@@ -54,6 +54,8 @@ void fdset_close(FDSet *s) {
void *p;
while ((p = set_steal_first(MAKE_SET(s)))) {
+ int fd = PTR_TO_FD(p);
+
/* Valgrind's fd might have ended up in this set here, due to fdset_new_fill(). We'll ignore
* all failures here, so that the EBADFD that valgrind will return us on close() doesn't
* influence us */
@@ -62,8 +64,14 @@ void fdset_close(FDSet *s) {
* which has no effect at all, since they are only duplicates. So don't be surprised about
* these log messages. */
- log_debug("Closing set fd %i", PTR_TO_FD(p));
- (void) close_nointr(PTR_TO_FD(p));
+ if (DEBUG_LOGGING) {
+ _cleanup_free_ char *path = NULL;
+
+ (void) fd_get_path(fd, &path);
+ log_debug("Closing set fd %i (%s)", fd, strna(path));
+ }
+
+ (void) close_nointr(fd);
}
}