Fortifying demo apps against running out of disk space

Kristian Høgsberg krh at
Mon Dec 2 16:25:04 PST 2013

On Fri, Nov 29, 2013 at 7:45 AM, Pekka Paalanen <ppaalanen at> wrote:
> Hi,
> I have been looking at RaspberryPi and especially how small the
> filesystem for XDG_RUNTIME_DIR is. Well, Raspbian does not provide
> XDG_RUNTIME_DIR, so you define that yourself. In any case, it is very
> small, I am using /run/shm which is somewhere around 25 MB.
> Weston demos and also libwayland-cursor allocate all wl_shm buffers
> from XDG_RUNTIME_DIR, therefore the free space on that file system is
> important.
> If space on that file system runs out, ftruncate will not catch it.
> Instead, apps will get a SIGBUS while trying to draw into the buffer.
> I am proposing to use posix_fallocate() to ensure at wl_shm_pool
> allocation time that the space is actually reserved for the pool, and
> SIGBUS cannot happen.

I think that sounds good and it's what we agreed on when we last
discussed this on list.  Thanks for putting the patches together.

> Furthermore, I have fortified toytoolkit to deal gracefully with wl_shm
> buffer allocation failures. Now you can e.g. resize weston-terminal
> bigger and bigger until you run out of space. When you run out of
> space, resizing stops, but the app stays usable. More details are in
> the patch.
> No more randomly disappearing demo apps on the RPi. ;-)
> (At least for this reason.)

Very nice.  All patches applied.


> I will reply to this email with a couple of patches to wayland and
> weston each.
> Thanks,
> pq
> _______________________________________________
> wayland-devel mailing list
> wayland-devel at

More information about the wayland-devel mailing list