It can talk to kanshi via the varlink interface. The only command
currently supported is to reload the config.
Co-authored-by: Érico Nogueira <erico.erc@gmail.com>
We don't want to fallback to libwayland's defaults, so WAYLAND_DISPLAY
needs to be set in env. Since IPC in the future is going to use
XDG_RUNTIME_DIR, we also require it.
Because these functions will be used in other parts of the code as well,
we rework the build system slightly to accommodate it.
Co-authored-by: Érico Nogueira <erico.erc@gmail.com>
This rework is necessary because it will allow us to add signal handlers
via signalfd and a varlink interface for IPC.
Co-authored-by: Érico Nogueira <erico.erc@gmail.com>
Rename pid_t variables "pid", "child" to "child" and "grandchild", since
we were using "child" in comments to refer to the PID stored in "pid".
Use _exit(2) whenever exiting from a forked child; calling exit(3)
should't be done in such a context.
Add missing new lines to error messages. Arguably using stdio in this
context isn't safe either, but we aren't a threaded program and stderr
is always flushed when this function is called, so it won't ouput
previous buffer contents or deadlock.
Fix one _exit(2) call to return 1 as status code, since it should be
indicating a failure.
Add error message in case waitpid(2) fails.
../main.c:82:3: error: use of undeclared identifier 'sigset_t'
sigset_t set;
^
../main.c:83:3: error: implicit declaration of function 'sigemptyset' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
sigemptyset(&set);
^
../main.c:83:16: error: use of undeclared identifier 'set'
sigemptyset(&set);
^
../main.c:84:3: error: implicit declaration of function 'sigprocmask' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
sigprocmask(SIG_SETMASK, &set, NULL);
^
../main.c:84:15: error: use of undeclared identifier 'SIG_SETMASK'
sigprocmask(SIG_SETMASK, &set, NULL);
^
../main.c:84:29: error: use of undeclared identifier 'set'
sigprocmask(SIG_SETMASK, &set, NULL);
^
The `matches` array contained heads *and* was indexed by head. This didn't
make a lot of sense.
Instead, make it contain profile outputs and indexed by head.