mirror of
				https://gitlab.freedesktop.org/pipewire/pipewire.git
				synced 2025-11-03 09:01:54 -05:00 
			
		
		
		
	add more debug of fd create and close
This commit is contained in:
		
							parent
							
								
									803c2860ed
								
							
						
					
					
						commit
						bb1cb530fc
					
				
					 3 changed files with 13 additions and 3 deletions
				
			
		| 
						 | 
					@ -80,7 +80,9 @@ static int impl_ioctl(void *object, int fd, unsigned long request, ...)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static int impl_close(void *object, int fd)
 | 
					static int impl_close(void *object, int fd)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
 | 
						struct impl *impl = object;
 | 
				
			||||||
	int res = close(fd);
 | 
						int res = close(fd);
 | 
				
			||||||
 | 
						spa_log_debug(impl->log, NAME " %p: close fd:%d", impl, fd);
 | 
				
			||||||
	return res < 0 ? -errno : res;
 | 
						return res < 0 ? -errno : res;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -102,10 +104,12 @@ static int impl_clock_getres(void *object,
 | 
				
			||||||
/* poll */
 | 
					/* poll */
 | 
				
			||||||
static int impl_pollfd_create(void *object, int flags)
 | 
					static int impl_pollfd_create(void *object, int flags)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
 | 
						struct impl *impl = object;
 | 
				
			||||||
	int fl = 0, res;
 | 
						int fl = 0, res;
 | 
				
			||||||
	if (flags & SPA_FD_CLOEXEC)
 | 
						if (flags & SPA_FD_CLOEXEC)
 | 
				
			||||||
		fl |= EPOLL_CLOEXEC;
 | 
							fl |= EPOLL_CLOEXEC;
 | 
				
			||||||
	res = epoll_create1(fl);
 | 
						res = epoll_create1(fl);
 | 
				
			||||||
 | 
						spa_log_debug(impl->log, NAME " %p: new fd:%d", impl, res);
 | 
				
			||||||
	return res < 0 ? -errno : res;
 | 
						return res < 0 ? -errno : res;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -160,12 +164,14 @@ static int impl_pollfd_wait(void *object, int pfd,
 | 
				
			||||||
/* timers */
 | 
					/* timers */
 | 
				
			||||||
static int impl_timerfd_create(void *object, int clockid, int flags)
 | 
					static int impl_timerfd_create(void *object, int clockid, int flags)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
 | 
						struct impl *impl = object;
 | 
				
			||||||
	int fl = 0, res;
 | 
						int fl = 0, res;
 | 
				
			||||||
	if (flags & SPA_FD_CLOEXEC)
 | 
						if (flags & SPA_FD_CLOEXEC)
 | 
				
			||||||
		fl |= TFD_CLOEXEC;
 | 
							fl |= TFD_CLOEXEC;
 | 
				
			||||||
	if (flags & SPA_FD_NONBLOCK)
 | 
						if (flags & SPA_FD_NONBLOCK)
 | 
				
			||||||
		fl |= TFD_NONBLOCK;
 | 
							fl |= TFD_NONBLOCK;
 | 
				
			||||||
	res = timerfd_create(clockid, fl);
 | 
						res = timerfd_create(clockid, fl);
 | 
				
			||||||
 | 
						spa_log_debug(impl->log, NAME " %p: new fd:%d", impl, res);
 | 
				
			||||||
	return res < 0 ? -errno : res;
 | 
						return res < 0 ? -errno : res;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -200,6 +206,7 @@ static int impl_timerfd_read(void *object, int fd, uint64_t *expirations)
 | 
				
			||||||
/* events */
 | 
					/* events */
 | 
				
			||||||
static int impl_eventfd_create(void *object, int flags)
 | 
					static int impl_eventfd_create(void *object, int flags)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
 | 
						struct impl *impl = object;
 | 
				
			||||||
	int fl = 0, res;
 | 
						int fl = 0, res;
 | 
				
			||||||
	if (flags & SPA_FD_CLOEXEC)
 | 
						if (flags & SPA_FD_CLOEXEC)
 | 
				
			||||||
		fl |= EFD_CLOEXEC;
 | 
							fl |= EFD_CLOEXEC;
 | 
				
			||||||
| 
						 | 
					@ -208,6 +215,7 @@ static int impl_eventfd_create(void *object, int flags)
 | 
				
			||||||
	if (flags & SPA_FD_EVENT_SEMAPHORE)
 | 
						if (flags & SPA_FD_EVENT_SEMAPHORE)
 | 
				
			||||||
		fl |= EFD_SEMAPHORE;
 | 
							fl |= EFD_SEMAPHORE;
 | 
				
			||||||
	res = eventfd(0, fl);
 | 
						res = eventfd(0, fl);
 | 
				
			||||||
 | 
						spa_log_debug(impl->log, NAME " %p: new fd:%d", impl, res);
 | 
				
			||||||
	return res < 0 ? -errno : res;
 | 
						return res < 0 ? -errno : res;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -228,6 +236,7 @@ static int impl_eventfd_read(void *object, int fd, uint64_t *count)
 | 
				
			||||||
/* signals */
 | 
					/* signals */
 | 
				
			||||||
static int impl_signalfd_create(void *object, int signal, int flags)
 | 
					static int impl_signalfd_create(void *object, int signal, int flags)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
 | 
						struct impl *impl = object;
 | 
				
			||||||
	sigset_t mask;
 | 
						sigset_t mask;
 | 
				
			||||||
	int res, fl = 0;
 | 
						int res, fl = 0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -240,6 +249,7 @@ static int impl_signalfd_create(void *object, int signal, int flags)
 | 
				
			||||||
	sigaddset(&mask, signal);
 | 
						sigaddset(&mask, signal);
 | 
				
			||||||
	res = signalfd(-1, &mask, fl);
 | 
						res = signalfd(-1, &mask, fl);
 | 
				
			||||||
	sigprocmask(SIG_BLOCK, &mask, NULL);
 | 
						sigprocmask(SIG_BLOCK, &mask, NULL);
 | 
				
			||||||
 | 
						spa_log_debug(impl->log, NAME " %p: new fd:%d", impl, res);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	return res < 0 ? -errno : res;
 | 
						return res < 0 ? -errno : res;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1266,7 +1266,7 @@ static void node_initialized(void *data)
 | 
				
			||||||
	node->writefd = impl->fds[1];
 | 
						node->writefd = impl->fds[1];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	spa_loop_add_source(node->data_loop, &node->data_source);
 | 
						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;
 | 
						size = sizeof(struct spa_io_buffers) * MAX_AREAS;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -996,13 +996,13 @@ struct pw_impl_node *pw_context_create_node(struct pw_context *context,
 | 
				
			||||||
		goto error_clean;
 | 
							goto error_clean;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	pw_log_debug(NAME" %p: new", this);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	this->properties = properties;
 | 
						this->properties = properties;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if ((res = spa_system_eventfd_create(data_system, SPA_FD_CLOEXEC | SPA_FD_NONBLOCK)) < 0)
 | 
						if ((res = spa_system_eventfd_create(data_system, SPA_FD_CLOEXEC | SPA_FD_NONBLOCK)) < 0)
 | 
				
			||||||
		goto error_clean;
 | 
							goto error_clean;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						pw_log_debug(NAME" %p: new fd:%d", this, res);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	this->source.fd = res;
 | 
						this->source.fd = res;
 | 
				
			||||||
	this->source.func = node_on_fd_events;
 | 
						this->source.func = node_on_fd_events;
 | 
				
			||||||
	this->source.data = this;
 | 
						this->source.data = this;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue