This refactor should have been done years ago when we first introduced
the big state machine. The old functions service_runvel() and the oddly
named service_reload_dynamic() are actually state machine control fns,
so let relocate them.
Also in this commit, remove the global variable 'sm' and rename a few of
the critical functions to better names.
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
Historically we've kept these two apart, but their commonalities are far
more than what separates them.
This fixes a bug where ready:scripts were not called for sysv daemons,
and also opens up for adding support for a reload:script for both types.
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit also switches the stdout/stderr log capture backend for all
notify:systemd services from the sysklogd project's logger tool to the
bundled logit tool.
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
clang-tidy complained that parse_prio() always returned OK(0), turns out
it was right. This patch adds validation of the parsing.
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit introduces a bare-bones replacement for libsystemd:
- Build .so file and add --with-libsystemd to configure
- Add capabilities support to test/src/serv.c
- Update tests to account for a Finit built w/o libsystemd support
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
A systemd service should only use NOTIFY_SOCKET and an s6 style
service reads its notify descript from the command line. For
details, see notify.sh
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit introduces a stripped down sd_notify(), taken from the
systemd man page example, which is used by the serv daemon in lieu
of the previous broken implementation.
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This patch fixes issue #440 which details how systemd readiness
notification has been broken since its inception in Finit.
In addition to now providing a proper abstract socket, the refactor
also drops the reliance on the Finit client API to fetch a socket.
Now an s6 descriptor is the write end of a pipe() and the systemd
socket is instead created before forking off the service.
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
When building with global CFLAGS=-Wunused-parameter the output from the
build looks terrible. This commit explicitly declares unused variables
to prevent triggering -Wunused-parameter
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
Fix the following warnings:
| cgroup.c:296:13: warning: implicit declaration of function 'conf_any_change' [-Wimplicit-function-declaration]
| cgroup.c:297:17: warning: implicit declaration of function 'service_reload_dynamic' [-Wimplicit-function-declaration]
Signed-off-by: Ming Liu <liu.ming50@gmail.com>
Fix the following linking issues of tmpfiles:
| exec.c:308: warning: stty is not implemented and will always fail
| plugin.c:237: undefined reference to `run_parts'
Signed-off-by: Ming Liu <liu.ming50@gmail.com>
The existing implementation seemed useful enough to warrant a new
helper function. Care was taken to ensure the revised code no longer
suffers any memory leaks.
The tmpfiles.d spec contains entry types that should be acted upon in different modes
of operation: create, clean, remove, and purge - split up create & remove logic to
clarify the modes of operation finit supports.
The tmpfiles.d spec has proven useful in systemd, enough so that some developers
are starting to ship tmpfiles.d configuration files with their software.
By splitting the tmpfiles functionality in finit out into a separate executable
we are providing a useful piece of software that package managers can hook into.