[PATCH 0/3] Introduce shm pool helper functions

Andre Heider a.heider at gmail.com
Tue Aug 7 06:09:16 PDT 2012

On Tue, Aug 7, 2012 at 1:43 PM, Ander Conselvan de Oliveira
<conselvan2 at gmail.com> wrote:
> I think this could be called wl_shm_mapping and we get rid of the unmap
> parameter to wl_shm_pool_helper_destroy(). In terms of a public API I think
> it is bad idea to let the user leak the mapping. In simple-shm.c,
> simple-touch.c and screenshot.c, this would be just a matter of keeping a
> reference to the mapping until it is not needed anymore.

I like the name wl_shm_mapping.
wrt the unmap argument: My thoughts exactly ;) I only added it later
on as I noticed that a few clients leak.

I wasn't sure though if I should separate the munmap() from
_destroy(). If we're going with what you proposed, clients will behave
a little differently: The file descriptor would be kept open for the
lifetime of the client (and hence the anon. file will exist for that

> I think this is useful enough to have it in libwayland-client, and as it
> turns out, it ends up there anyway. So there's no value in creating
> libshared. We could just have the helper implementation in src/ and have
> cursor/os-compatibility.c merged with src/wayland-os.c.

I borrowed the libshared idea from weston with the assumptions that
wayland-cursor won't stay the only additional library. I don't mind
either solution.

> Cheers,
> Ander

Thanks for the review!

More information about the wayland-devel mailing list