[pulseaudio-discuss] [PATCH 01/11] pulsecore: Cache daemon shm size inside pa_core

Tanu Kaskinen tanuk at iki.fi
Tue Sep 22 01:28:54 PDT 2015


On Sun, 2015-09-20 at 23:25 +0200, Ahmed S. Darwish wrote:
> The daemon `shm-size-bytes' configuration value was read, and then
> directly used, for creating the initial server-wide SHM files.
> 
> This is fine for now, but soon, such server-wide SHMs will be replaced
> with per-client SHM files that will be dynamically created and deleted
> according to clients connections open and close. Thus, appropriately
> cache the configuration value.
> 
> Signed-off-by: Ahmed S. Darwish <darwish.07 at gmail.com>
> ---
>  src/pulsecore/core.c | 1 +
>  src/pulsecore/core.h | 5 +++++
>  2 files changed, 6 insertions(+)
> 
> diff --git a/src/pulsecore/core.c b/src/pulsecore/core.c
> index 0e63bac..d198e48 100644
> --- a/src/pulsecore/core.c
> +++ b/src/pulsecore/core.c
> @@ -123,6 +123,7 @@ pa_core* pa_core_new(pa_mainloop_api *m, bool shared, size_t shm_size) {

Note that shm_size type is size_t here...

>      c->subscription_event_last = NULL;
>  
>      c->mempool = pool;
> +    c->shm_size = shm_size;
>      pa_silence_cache_init(&c->silence_cache);
>  
>      if (shared && !(c->rw_mempool = pa_mempool_new(shared, shm_size)))
> diff --git a/src/pulsecore/core.h b/src/pulsecore/core.h
> index 6a8affc..29680cb 100644
> --- a/src/pulsecore/core.h
> +++ b/src/pulsecore/core.h
> @@ -182,6 +182,11 @@ struct pa_core {
>         The rw_mempool is used for data writable by both server and client (and
>         can be NULL in some cases). */
>      pa_mempool *mempool, *rw_mempool;
> +
> +    /* Shared memory size, as specified either by daemon configuration
> +     * or PA daemon defaults (~ 64 MiB). */
> +    int shm_size;

...but here it's int. For consistency, both places should use size_t.

-- 
Tanu


More information about the pulseaudio-discuss mailing list