From bb1cb530fc844a784457c79da32823086f02c837 Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Tue, 2 Jun 2020 14:06:51 +0200 Subject: [PATCH] add more debug of fd create and close --- spa/plugins/support/system.c | 10 ++++++++++ src/modules/module-client-node/client-node.c | 2 +- src/pipewire/impl-node.c | 4 ++-- 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/spa/plugins/support/system.c b/spa/plugins/support/system.c index b1349f3e1..758ff1a82 100644 --- a/spa/plugins/support/system.c +++ b/spa/plugins/support/system.c @@ -80,7 +80,9 @@ static int impl_ioctl(void *object, int fd, unsigned long request, ...) static int impl_close(void *object, int fd) { + struct impl *impl = object; int res = close(fd); + spa_log_debug(impl->log, NAME " %p: close fd:%d", impl, fd); return res < 0 ? -errno : res; } @@ -102,10 +104,12 @@ static int impl_clock_getres(void *object, /* poll */ static int impl_pollfd_create(void *object, int flags) { + struct impl *impl = object; int fl = 0, res; if (flags & SPA_FD_CLOEXEC) fl |= EPOLL_CLOEXEC; res = epoll_create1(fl); + spa_log_debug(impl->log, NAME " %p: new fd:%d", impl, res); return res < 0 ? -errno : res; } @@ -160,12 +164,14 @@ static int impl_pollfd_wait(void *object, int pfd, /* timers */ static int impl_timerfd_create(void *object, int clockid, int flags) { + struct impl *impl = object; int fl = 0, res; if (flags & SPA_FD_CLOEXEC) fl |= TFD_CLOEXEC; if (flags & SPA_FD_NONBLOCK) fl |= TFD_NONBLOCK; res = timerfd_create(clockid, fl); + spa_log_debug(impl->log, NAME " %p: new fd:%d", impl, res); return res < 0 ? -errno : res; } @@ -200,6 +206,7 @@ static int impl_timerfd_read(void *object, int fd, uint64_t *expirations) /* events */ static int impl_eventfd_create(void *object, int flags) { + struct impl *impl = object; int fl = 0, res; if (flags & SPA_FD_CLOEXEC) fl |= EFD_CLOEXEC; @@ -208,6 +215,7 @@ static int impl_eventfd_create(void *object, int flags) if (flags & SPA_FD_EVENT_SEMAPHORE) fl |= EFD_SEMAPHORE; res = eventfd(0, fl); + spa_log_debug(impl->log, NAME " %p: new fd:%d", impl, res); return res < 0 ? -errno : res; } @@ -228,6 +236,7 @@ static int impl_eventfd_read(void *object, int fd, uint64_t *count) /* signals */ static int impl_signalfd_create(void *object, int signal, int flags) { + struct impl *impl = object; sigset_t mask; int res, fl = 0; @@ -240,6 +249,7 @@ static int impl_signalfd_create(void *object, int signal, int flags) sigaddset(&mask, signal); res = signalfd(-1, &mask, fl); sigprocmask(SIG_BLOCK, &mask, NULL); + spa_log_debug(impl->log, NAME " %p: new fd:%d", impl, res); return res < 0 ? -errno : res; } diff --git a/src/modules/module-client-node/client-node.c b/src/modules/module-client-node/client-node.c index a315c592e..41fee37a2 100644 --- a/src/modules/module-client-node/client-node.c +++ b/src/modules/module-client-node/client-node.c @@ -1266,7 +1266,7 @@ static void node_initialized(void *data) node->writefd = impl->fds[1]; spa_loop_add_source(node->data_loop, &node->data_source); - pw_log_debug(NAME " %p: transport fd %d %d", node, impl->fds[0], impl->fds[1]); + pw_log_debug(NAME " %p: transport read-fd:%d write-fd:%d", node, impl->fds[0], impl->fds[1]); size = sizeof(struct spa_io_buffers) * MAX_AREAS; diff --git a/src/pipewire/impl-node.c b/src/pipewire/impl-node.c index 6c1c8bd73..232ef2d24 100644 --- a/src/pipewire/impl-node.c +++ b/src/pipewire/impl-node.c @@ -996,13 +996,13 @@ struct pw_impl_node *pw_context_create_node(struct pw_context *context, goto error_clean; } - pw_log_debug(NAME" %p: new", this); - this->properties = properties; if ((res = spa_system_eventfd_create(data_system, SPA_FD_CLOEXEC | SPA_FD_NONBLOCK)) < 0) goto error_clean; + pw_log_debug(NAME" %p: new fd:%d", this, res); + this->source.fd = res; this->source.func = node_on_fd_events; this->source.data = this;