mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-03 09:01:54 -05:00
pipewire: extend memfd name with additional information
Knowing the flags, type, and size that were used in the `pw_mempool_alloc()` call can be useful for debugging purposes.
This commit is contained in:
parent
f971362f76
commit
9d5f565682
1 changed files with 11 additions and 2 deletions
|
|
@ -485,7 +485,12 @@ struct pw_memblock * pw_mempool_alloc(struct pw_mempool *pool, enum pw_memblock_
|
|||
spa_list_init(&b->memmaps);
|
||||
|
||||
#ifdef HAVE_MEMFD_CREATE
|
||||
b->this.fd = memfd_create("pipewire-memfd", MFD_CLOEXEC | MFD_ALLOW_SEALING);
|
||||
char name[128];
|
||||
snprintf(name, sizeof(name),
|
||||
"pipewire-memfd:flags=0x%08x,type=%" PRIu32 ",size=%zu",
|
||||
(unsigned int) flags, type, size);
|
||||
|
||||
b->this.fd = memfd_create(name, MFD_CLOEXEC | MFD_ALLOW_SEALING);
|
||||
if (b->this.fd == -1) {
|
||||
res = -errno;
|
||||
pw_log_error("%p: Failed to create memfd: %m", pool);
|
||||
|
|
@ -499,7 +504,11 @@ struct pw_memblock * pw_mempool_alloc(struct pw_mempool *pool, enum pw_memblock_
|
|||
goto error_free;
|
||||
}
|
||||
#else
|
||||
char filename[] = "/dev/shm/pipewire-tmpfile.XXXXXX";
|
||||
char filename[128];
|
||||
snprintf(filename, sizeof(filename),
|
||||
"/dev/shm/pipewire-tmpfile:flags=0x%08x,type=%" PRIu32 ",size=%zu:XXXXXX",
|
||||
(unsigned int) flags, type, size);
|
||||
|
||||
b->this.fd = mkostemp(filename, O_CLOEXEC);
|
||||
if (b->this.fd == -1) {
|
||||
res = -errno;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue