Commit graph

61 commits

Author SHA1 Message Date
Ahmed S. Darwish
f8714af56b 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>
2016-04-02 05:51:00 +02:00
Ahmed S. Darwish
b88acd0266 pulsecore: Transform pa_mempool_new() into a factory method
Soon we're going to have three types of memory pools: POSIX shm_open()
pools, memfd memfd_create() ones, and privately malloc()-ed pools.

Thus introduce annotations for the memory types supported and change
pa_mempool_new() into a factory method based on required memory.

Signed-off-by: Ahmed S. Darwish <darwish.07@gmail.com>
2016-04-02 05:44:34 +02:00
Ahmed S. Darwish
9bda6e344a pulsecore: Reference count mempools
In future commits, server-wide SHMs will be replaced with per-client
ones that will be dynamically created and freed according to clients
connections open and close.

Meanwhile, current PA design does not guarantee that the per-client
mempool blocks are referenced only by client-specific objects.

Thus reference count the pools and let each memblock inside the pool
itself, or just attached to it, increment the pool's refcount upon
allocation. This way, per-client mempools will only be freed when no
further component in the system holds any references to its blocks.

DiscussionLink: https://goo.gl/qesVMV
Suggested-by: Tanu Kaskinen <tanuk@iki.fi>
Suggested-by: David Henningsson <david.henningsson@canonical.com>
Signed-off-by: Ahmed S. Darwish <darwish.07@gmail.com>
2016-04-02 05:36:52 +02:00
Ondrej Holecek
5effc83479 update FSF addresses to FSF web page
FSF addresses used in PA sources are no longer valid and rpmlint
generates numerous warnings during packaging because of this.
This patch changes all FSF addresses to FSF web page according to
the GPL how-to: https://www.gnu.org/licenses/gpl-howto.en.html

Done automatically by sed-ing through sources.
2015-01-14 22:20:40 +02:00
David Henningsson
112a39fa43 memblock: Fix more block ID collisions
Since the srb memblock and the audio data were coming from separate
pools, and the base index was per pool, they could actually still
collide.

This patch changes the base index to be global and atomically
incremented.

Reported-by: Arun Raghavan <arun@accosted.net>
Signed-off-by: David Henningsson <david.henningsson@canonical.com>
2015-01-08 16:10:50 +01:00
David Henningsson
9e65fd1373 memblock: Initialize mempool object to zero
This fixes a "use of uninitialised value" error in previous memblock commit.

Reported-by: Alexander Patrakov <patrakov@gmail.com>
Signed-off-by: David Henningsson <david.henningsson@canonical.com>
2014-12-10 14:28:45 +01:00
David Henningsson
baf7b985fb memblock: Avoid block ID collisions when exporting memory blocks
Every new memexport object now gets an ever increasing base index,
that prevents block ID collisions between different memexport
objects on the same pstream.

In particular, this prevents block ID collision between the srb memblock
(which has its own memexport object) and audio data blocks.

Reported-by: Peter Meerwald <pmeerw@pmeerw.net>
Signed-off-by: David Henningsson <david.henningsson@canonical.com>
2014-12-08 09:09:38 +01:00
Peter Meerwald
f390e6e974 Cleanup !! for bool
!!x makes no sense if x is bool (this is a leftover from the
convertion pa_bool_t -> bool, d806b197)

Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
2014-10-28 17:36:22 +01:00
Lukasz Marek
78ca8cfc96 Client API: Add pa_stream_write_ext_free() function.
New function allows to pass data pointer that is a member
of the outer structure that need to be freed too when data
is not needed anymore.

Signed-off-by: Lukasz Marek <lukasz.m.luki2@gmail.com>
2014-09-10 10:12:08 +02:00
David Henningsson
710c4b39af memblock, pstream: Allow send/receive of remote writable memblocks
The shared ringbuffer memblock must be writable by both sides.
This makes it possible to send such a memblock over a pstream without
the "both sides writable" information getting lost.

Signed-off-by: David Henningsson <david.henningsson@canonical.com>
2014-06-27 14:16:32 +02:00
David Henningsson
613177919f shm: Allow to open shm in writable mode
This is a preparation for the shm ringbuffer, which needs to be able
to be writable by both sides, because there are atomic variables they
both need to modify.

Signed-off-by: David Henningsson <david.henningsson@canonical.com>
2014-06-27 14:16:32 +02:00
Peter Meerwald
f4635818bd memblock: Fix typo in description of pa_memblock_unref_fixed(), cleanup
Signed-off-by: Peter Meerwald <p.meerwald@bct-electronic.com>
2013-10-29 18:26:57 +02:00
Arun Raghavan
6825df8cec hashmap: Add the ability to free keys
Since the hashmap stores a pointer to the key provided at pa_hashmap_put()
time, it make sense to allow the hashmap to be given ownership of the key and
have it free it at pa_hashmap_remove/free time.

To do this cleanly, we now provide the key and value free functions at hashmap
creation time with a pa_hashmap_new_full. With this, we do away with the free
function that was provided at remove/free time for freeing the value.
2013-09-17 18:01:22 +05:30
poljar (Damir Jelić)
d806b19714 Remove pa_bool_t and replace it with bool.
commands used for this (executed from the pulseaudio/src directory):
    find . -regex '\(.*\.[hc]\|.*\.cc\|.*\.m4\)' -not -name 'macro.h' \
        -a -not -name 'reserve.[ch]' -a -not -name 'reserve-monitor.[ch]' \
        -a -not -name 'glib-mainloop.c' -a -not -name 'gkt-test.c' \
        -a -not -name 'glib-mainloop.c' -a -not -name 'gkt-test.c' \
        -a -not -name 'poll-win32.c' -a -not -name 'thread-win32.c' \
        -a -not -name 'dllmain.c' -a -not -name 'gconf-helper.c' \
        -exec sed -i -e 's/\bpa_bool_t\b/bool/g' \
        -e 's/\bTRUE\b/true/g' -e 's/\bFALSE\b/false/g' {} \;

and:
    sed -i -e '181,194!s/\bpa_bool_t\b/bool/' \
        -e '181,194!s/\bTRUE\b/true/' -e \
        '181,194!s/\bFALSE\b/false/' pulsecore/macro.h
2013-07-04 12:25:30 +03:00
Tanu Kaskinen
8872c238ba hashmap: Use pa_free_cb_t instead of pa_free2_cb_t
The previous patch removed module-gconf's dependency on the userdata
pointer of the free callback, and that was the only place where the
userdata pointer of pa_free2_cb_t was used, so now there's no need for
pa_free2_cb_t in pa_hashmap_free(). Using pa_free_cb_t instead allows
removing a significant amount of repetitive code.
2013-02-16 01:12:21 +02:00
Tanu Kaskinen
3d6092bb0f memblock: Add pa_memblock_acquire_chunk().
Besides making the code a bit cleaner, this also gets rid of
a few "cast increases required alignment of target type"
warnings.
2012-08-22 09:47:03 +03:00
Peter Meerwald
92fbb294b7 core: Fix comments. 2012-04-17 18:15:21 +03:00
Maarten Bosmans
c5dca7cf2b More spelling fixes 2011-08-25 11:27:47 +01:00
Lu Guanqun
5fe545de23 memblock: use built-in function
Signed-off-by: Lu Guanqun <guanqun.lu@intel.com>
2011-08-15 09:41:56 +01:00
Lu Guanqun
ecbb4b4ef4 memblock: fix memory leak when pa_shm_create_rw fails
Signed-off-by: Lu Guanqun <guanqun.lu@intel.com>
2011-08-15 09:41:56 +01:00
Maarten Bosmans
dd9265ac78 Remove unnecessary #includes 2011-06-22 23:12:20 +01:00
Maarten Bosmans
684b89c639 Fix up some double spaces 2011-03-18 09:20:07 +00:00
Maarten Bosmans
ecf09f2cd6 Fix up according to Coding Style
Only whitespace changes in here
2011-03-11 11:49:35 +00:00
Lennart Poettering
1250b5d735 ratelimit: fix log levels of log suppression messages
When logging a suppression message do so on the same log level as the
suppressed messages.

Cherry picked by Colin Guthrie from ec5a785712
with a couple of additional changes due to extra limiting in master
that was not present in stable-queue.
2011-01-31 11:36:24 +00:00
Lennart Poettering
744490a681 memblock: decrease tile size to 64k again 2009-10-28 21:29:01 +01:00
Jason Newton
cf8331a0da module-equalizer-sink: trying new buffering strategies 2009-09-29 23:50:52 -07:00
Lennart Poettering
9697c5dc18 memblock: don't try to reuse PA_MEMBLOCK_APPENDED memblocks since they usually are much bigger than we want them 2009-09-18 22:16:26 +02:00
Lennart Poettering
c010172c66 memblock: modernizations 2009-09-18 22:16:25 +02:00
Lennart Poettering
e2899f8bf3 memblock: make it easy to disable mempool usage with $PULSE_MEMPOOL_DISABLE 2009-09-17 01:21:56 +02:00
Lennart Poettering
e6a666d8d5 libpulse: introduce PA_BYTES_SNPRINT_MAX and make use of it wherever applicable 2009-09-06 22:33:04 +02:00
Lennart Poettering
286ab2f193 memblock: rate limit 'Pool full' message 2009-08-12 21:40:38 +02:00
Lennart Poettering
5e24b6dff5 memblock: try to hit an assert earlier when ref counting doesn't work 2009-07-24 15:49:22 +02:00
Lennart Poettering
28e4625a52 memblock: rearrange locking order 2009-07-01 20:20:55 +02:00
Lennart Poettering
684b4c116c memtrap: hook up core to memtrap system 2009-04-21 22:56:08 +02:00
Lennart Poettering
e41ec51f1b add simple ref counting debugging framework 2009-03-25 02:42:18 +01:00
Lennart Poettering
1737a19c86 allow importing of more memory blocks than exporting 2009-02-18 21:52:21 +01:00
Lennart Poettering
4e8ada521a show maximum usable slot size 2009-01-10 02:55:57 +01:00
Lennart Poettering
f728e9cce0 disable valgrind macro usage for now since valgrind generates a lot of spurious warnings as it seems 2008-10-05 22:51:25 +02:00
Lennart Poettering
79ad4e63f6 Make the shared memory segment size configurable
This is useful only on systems where memory overcommit is not available
or disabled.
2008-10-01 01:14:36 +02:00
Lennart Poettering
b7026bf248 add a few more gcc warning flags and fix quite a few problems found by doing so 2008-08-19 22:39:54 +02:00
Lennart Poettering
5cc2187bec add some code to make invalid valgrind warnings go away 2008-08-18 19:55:55 +02:00
Lennart Poettering
113c62bf5d halve memory consumption of mempool flist, since we know we cannot have more than n_blocks entries in it 2008-06-27 20:13:26 +02:00
Lennart Poettering
c26be0d762 modernize hashmap implementation a bit, reduce memory consumption a bit 2008-06-27 20:12:24 +02:00
Lennart Poettering
8ae83d618e get rid of svn $ keywords 2008-06-18 23:23:21 +03:00
Lennart Poettering
045c1d602d merge glitch-free branch back into trunk
git-svn-id: file:///home/lennart/svn/public/pulseaudio/trunk@2445 fefdeb5f-60dc-0310-8127-8f9354f1896f
2008-05-15 23:34:41 +00:00
Lennart Poettering
a67c21f093 merge 'lennart' branch back into trunk.
git-svn-id: file:///home/lennart/svn/public/pulseaudio/trunk@1971 fefdeb5f-60dc-0310-8127-8f9354f1896f
2007-10-28 19:13:50 +00:00
Lennart Poettering
918cacb4f4 Replace AO_xxx usage with pa_atomic_xxx and friends wherever it makes sense
git-svn-id: file:///home/lennart/svn/public/pulseaudio/trunk@1459 fefdeb5f-60dc-0310-8127-8f9354f1896f
2007-05-27 20:38:14 +00:00
Pierre Ossman
06211b7c8f Add copyright notices to all relevant files. (based on svn log)
git-svn-id: file:///home/lennart/svn/public/pulseaudio/trunk@1426 fefdeb5f-60dc-0310-8127-8f9354f1896f
2007-02-13 15:35:19 +00:00
Pierre Ossman
521daf6f0a Huge trailing whitespace cleanup. Let's keep the tree pure from here on,
mmmkay?


git-svn-id: file:///home/lennart/svn/public/pulseaudio/trunk@1418 fefdeb5f-60dc-0310-8127-8f9354f1896f
2007-01-04 13:43:45 +00:00
Pierre Ossman
8dc6214276 Revert r1404 and keep it on a development branch until it is fully tested.
git-svn-id: file:///home/lennart/svn/public/pulseaudio/trunk@1409 fefdeb5f-60dc-0310-8127-8f9354f1896f
2006-11-06 13:06:01 +00:00