diff options
author | Ahmed S. Darwish <darwish.07@gmail.com> | 2016-04-15 23:07:36 +0200 |
---|---|---|
committer | Arun Raghavan <git@arunraghavan.net> | 2016-04-27 18:37:08 +0530 |
commit | d2a6afcab31f9f8122200ce383fdd5479ca0ebd1 (patch) | |
tree | 0d99cc24fe698380b388204e5bd740e7ef2662da /PROTOCOL | |
parent | b1d47d60fc3f5dcc098f0ccc52a0f29dca8ce29e (diff) |
core: Support memfd transport; bump protocol version
Now that all layers in the stack support memfd blocks, add memfd
support for the daemon's global core mempool. Also introduce
"enable-memfd=" daemon argument and configuration option.
For now, memfd support is an opt-in feature to be activated only
when daemon's enable-memfd= is set to yes.
Signed-off-by: Ahmed S. Darwish <darwish.07@gmail.com>
Diffstat (limited to 'PROTOCOL')
-rw-r--r-- | PROTOCOL | 37 |
1 files changed, 37 insertions, 0 deletions
@@ -371,6 +371,43 @@ PA_COMMAND_DISABLE_SRBCHANNEL Tells the client to stop listening on the additional SHM ringbuffer channel. Acked by client by sending PA_COMMAND_DISABLE_SRBCHANNEL back. +## v31, implemented by >= 9.0 + +Memfd shared-memory support is now added to PulseAudio as an opt-in feature. +Add 'enable-memfd=yes' to daemon's configuration to use memfds, instead of +POSIX shm, by default. + +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. + +PulseAudio memfd support builds the necessary (but not yet sufficient) +groundwork for a better integration with per-app containers (e.g. xdg-app) + +For further details on memfds in general, please check: + + https://dvdhrm.wordpress.com/2014/06/10/memfd_create2/ + Archived at: http://www.webcitation.org/6gnHTy9Kr + +Moreover, for both client and server, the second most-significant bit of +the version tag is now used to flag memfd SHM support. On the way forward, +the two most-significant _bytes_ of the version tag are now also reserved +for flags. + +PA_COMMAND_REGISTER_MEMFD_SHMID +New command that can be sent both ways, from client to server and vice versa. +This is needed to transfer a memfd pool's blocks without passing its fd every +time, thus minimizing overhead and avoiding fd leaks. + +The registration command above sends a packet with the pool's memfd fd as +ancillary data. Such packet has an ID that uniquely identifies the pool's +memfd memory area. Upon arrival, the other end (client or server) creates a +permanent ID<->memfd mapping. + +By doing so, there's need to reference the pool's memfd file descriptor any +further -- just its ID. Thus both endpoints can then quickly and safely +close their memfd file descriptors. + #### If you just changed the protocol, read this ## module-tunnel depends on the sink/source/sink-input/source-input protocol ## internals, so if you changed these, you might have broken module-tunnel. |