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>
This commit is contained in:
Ahmed S. Darwish 2016-04-15 23:07:36 +02:00 committed by Arun Raghavan
parent b1d47d60fc
commit d2a6afcab3
13 changed files with 122 additions and 24 deletions

View file

@ -61,16 +61,19 @@ static int core_process_msg(pa_msgobject *o, int code, void *userdata, int64_t o
static void core_free(pa_object *o);
pa_core* pa_core_new(pa_mainloop_api *m, bool shared, size_t shm_size) {
pa_core* pa_core_new(pa_mainloop_api *m, bool shared, bool enable_memfd, size_t shm_size) {
pa_core* c;
pa_mempool *pool;
pa_mem_type_t type;
int j;
pa_assert(m);
if (shared) {
if (!(pool = pa_mempool_new(PA_MEM_TYPE_SHARED_POSIX, shm_size, false))) {
pa_log_warn("Failed to allocate shared memory pool. Falling back to a normal memory pool.");
type = (enable_memfd) ? PA_MEM_TYPE_SHARED_MEMFD : PA_MEM_TYPE_SHARED_POSIX;
if (!(pool = pa_mempool_new(type, shm_size, false))) {
pa_log_warn("Failed to allocate %s memory pool. Falling back to a normal memory pool.",
pa_mem_type_to_string(type));
shared = false;
}
}