mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2026-03-12 05:34:05 -04:00
pipewire: mem: log if close() fails
If a file descriptor is expected to be closed by the associated `pw_memblock`, and closing fails, then that usually signals a more serious issue in the memory accounting. So add a log message when that happens.
This commit is contained in:
parent
d33066cdd7
commit
5c67ab2a7a
1 changed files with 5 additions and 2 deletions
|
|
@ -15,6 +15,7 @@
|
|||
#include <sys/syscall.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
#include <spa/utils/cleanup.h>
|
||||
#include <spa/utils/list.h>
|
||||
#include <spa/buffer/buffer.h>
|
||||
|
||||
|
|
@ -856,8 +857,10 @@ void pw_memblock_free(struct pw_memblock *block)
|
|||
}
|
||||
|
||||
if (block->fd != -1 && !(block->flags & PW_MEMBLOCK_FLAG_DONT_CLOSE)) {
|
||||
pw_log_debug("%p: close fd:%d", pool, block->fd);
|
||||
close(block->fd);
|
||||
int fd = spa_steal_fd(block->fd);
|
||||
pw_log_debug("%p: block:%p close fd:%d", pool, block, fd);
|
||||
if (close(fd) < 0)
|
||||
pw_log_error("%p: block:%p close fd:%d failed: %m", pool, block, fd);
|
||||
}
|
||||
|
||||
spa_hook_list_clean(&b->listener_list);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue