mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-11-14 06:59:53 -05:00
pulsecore: Introduce memfd support
Memfd is a simple memory sharing mechanism, added by the systemd/kdbus developers, to share pages between processes in an anonymous, no global registry needed, no mount-point required, relatively secure, manner. This patch introduces the necessary building blocks for using memfd shared memory transfers in PulseAudio. Memfd support shall also help us in laying out the necessary (but not yet sufficient) groundwork for application sandboxing, protecting PA from its clients, and protecting clients data from each other. We plan to exclusively use memfds, instead of POSIX SHM, on the way forward. Signed-off-by: Ahmed S. Darwish <darwish.07@gmail.com>
This commit is contained in:
parent
1c3a2bcaf1
commit
73e86b1cb1
5 changed files with 231 additions and 66 deletions
|
|
@ -30,7 +30,19 @@ typedef struct pa_shm {
|
|||
unsigned id;
|
||||
void *ptr;
|
||||
size_t size;
|
||||
|
||||
/* Only for type = PA_MEM_TYPE_SHARED_POSIX */
|
||||
bool do_unlink:1;
|
||||
|
||||
/* Only for type = PA_MEM_TYPE_SHARED_MEMFD
|
||||
*
|
||||
* To avoid fd leaks, we keep this fd open only until we pass it
|
||||
* to the other PA endpoint over unix domain socket.
|
||||
*
|
||||
* When we don't have ownership for the memfd fd in question (e.g.
|
||||
* pa_shm_attach()), or the file descriptor has now been closed,
|
||||
* this is set to -1. */
|
||||
int fd;
|
||||
} pa_shm;
|
||||
|
||||
int pa_shm_create_rw(pa_shm *m, pa_mem_type_t type, size_t size, mode_t mode);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue