From 2c42d4c1cf1add4772c09a56e65fa5f593861c21 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Barnab=C3=A1s=20P=C5=91cze?= Date: Thu, 15 Aug 2024 22:17:44 +0200 Subject: [PATCH] pulse-server: add more logging related to systemd socket activation See #4117 --- src/modules/module-protocol-pulse/server.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/modules/module-protocol-pulse/server.c b/src/modules/module-protocol-pulse/server.c index e35f25c32..3576a8ca7 100644 --- a/src/modules/module-protocol-pulse/server.c +++ b/src/modules/module-protocol-pulse/server.c @@ -546,21 +546,26 @@ static bool is_stale_socket(int fd, const struct sockaddr_un *addr_un) #ifdef HAVE_SYSTEMD static int check_systemd_activation(const char *path) { - const int n = sd_listen_fds(0); + const int n = sd_listen_fds(false); + if (n < 0) + return n; for (int i = 0; i < n; i++) { const int fd = SD_LISTEN_FDS_START + i; - if (sd_is_socket_unix(fd, SOCK_STREAM, 1, path, 0) > 0) + int res = sd_is_socket_unix(fd, SOCK_STREAM, true, path, 0); + pw_log_debug("sd_is_socket_unix(%d, \"%s\"): %d", fd, path, res); + + if (res > 0) return fd; } - return -1; + return -ENOENT; } #else static inline int check_systemd_activation(SPA_UNUSED const char *path) { - return -1; + return -EOPNOTSUPP; } #endif @@ -580,6 +585,8 @@ static int start_unix_server(struct server *server, const struct sockaddr_storag goto done; } else { + pw_log_debug("server %p: no systemd socket activation socket found for '%s': %s", + server, addr_un->sun_path, spa_strerror(fd)); server->activated = false; }