diff options
author | Ahmed S. Darwish <darwish.07@gmail.com> | 2016-03-13 01:07:27 +0200 |
---|---|---|
committer | David Henningsson <david.henningsson@canonical.com> | 2016-04-02 05:51:00 +0200 |
commit | f8714af56bfcfeccd15a091c47492d3dc3008f61 (patch) | |
tree | feebbb0ae47e2570c14d4996a0beb45c4922e117 /src/tests | |
parent | 73e86b1cb164b1c37b27238b529879a4a2d9f24c (diff) | |
download | pulseaudio-f8714af56bfcfeccd15a091c47492d3dc3008f61.tar.gz |
memimport: Support memfd blocks
To transfer memfd-backed blocks without passing their fd every time,
thus minimizing overhead and avoiding fd leaks, a command is sent
with the memfd fd as ancil data very early on.
This command has an ID that uniquely identifies the memfd region.
Further memfd block references are then exclusively done using this
ID.
This commit implements the details of such 'permanent' mappings on
the receiving end, using memimport segments.
Suggested-by: David Henningsson <david.henningsson@canonical.com>
Signed-off-by: Ahmed S. Darwish <darwish.07@gmail.com>
Diffstat (limited to 'src/tests')
-rw-r--r-- | src/tests/memblock-test.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/tests/memblock-test.c b/src/tests/memblock-test.c index 089648f49..04eb37729 100644 --- a/src/tests/memblock-test.c +++ b/src/tests/memblock-test.c @@ -74,6 +74,7 @@ START_TEST (memblock_test) { pa_memblock *mb_a, *mb_b, *mb_c; int r, i; pa_memblock* blocks[5]; + pa_mem_type_t mem_type; uint32_t id, shm_id; size_t offset, size; char *x; @@ -122,22 +123,22 @@ START_TEST (memblock_test) { import_c = pa_memimport_new(pool_c, release_cb, (void*) "C"); fail_unless(import_b != NULL); - r = pa_memexport_put(export_a, mb_a, &id, &shm_id, &offset, &size); + r = pa_memexport_put(export_a, mb_a, &mem_type, &id, &shm_id, &offset, &size); fail_unless(r >= 0); fail_unless(shm_id == id_a); pa_log("A: Memory block exported as %u", id); - mb_b = pa_memimport_get(import_b, id, shm_id, offset, size, false); + mb_b = pa_memimport_get(import_b, PA_MEM_TYPE_SHARED_POSIX, id, shm_id, offset, size, false); fail_unless(mb_b != NULL); - r = pa_memexport_put(export_b, mb_b, &id, &shm_id, &offset, &size); + r = pa_memexport_put(export_b, mb_b, &mem_type, &id, &shm_id, &offset, &size); fail_unless(r >= 0); fail_unless(shm_id == id_a || shm_id == id_b); pa_memblock_unref(mb_b); pa_log("B: Memory block exported as %u", id); - mb_c = pa_memimport_get(import_c, id, shm_id, offset, size, false); + mb_c = pa_memimport_get(import_c, PA_MEM_TYPE_SHARED_POSIX, id, shm_id, offset, size, false); fail_unless(mb_c != NULL); x = pa_memblock_acquire(mb_c); pa_log_debug("1 data=%s", x); |