Fortifying demo apps against running out of disk space
ppaalanen at gmail.com
Fri Nov 29 07:45:22 PST 2013
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
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.
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
No more randomly disappearing demo apps on the RPi. ;-)
(At least for this reason.)
I will reply to this email with a couple of patches to wayland and
More information about the wayland-devel