UXBoot
#import "UXBoot.xc" // tests only; not reachable through #use <UXKit>The problem it exists for
Section titled “The problem it exists for”On the board, init(1) runs the boot scripts off the SD card, and one of them
starts gemd with &.
Under qemu the SD card is not mounted. /bin/sh is missing, init runs no
scripts, and nothing starts the window server. libGEM then hard-exits with
“no window server”. That is correct: there is no single-process mode, and
pretending otherwise would be worse than the error.
A test running under qemu therefore has to start gemd itself. That is all this
class does.
Why an application must never do this
Section titled “Why an application must never do this”Starting the window server from a client is the “the desktop is not the server” mistake in miniature.
An application is a client. It connects to a service that something else is responsible for running. An application that starts its own server has taken the role of the system, and when two applications run, the second finds a server it did not start and does not own.
The file exists in one place, is imported by nothing that ships, and says so in its first line. The scaffolding is allowed to exist because this containment stops it from leaking.
What it does
Section titled “What it does”static bool ensureWindowServer(void)- Try to connect to the
gemservice. If it is already up (as on the board), return immediately. The common case costs one connect. - Otherwise
sys_spawn("/bin/gemd"). - Wait for it to register, retrying with a sleep, for up to 5 seconds.
Returns false if the spawn failed or the server never registered, so a test
can report “no window server” instead of proceeding into a crash.
See also
Section titled “See also”UXGemDriver: the backend that needs the server this startsUXApplication: what a real application starts instead