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>
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.
The service_fork() function blocks all signals for the new process, it
is up to the callee to call sig_unblock() before calling exec().
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
Add explicit argument separator before username to ensure correct
parsing of the login command regardless of username format. This
follows best practices for command execution and prevents unexpected
behavior when processing special characters in usernames.
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
When a service is stopped, but does not respond to the default SIGTERM,
a fallback kicks in after 3 seconds (default) to send SIGKILL. Since
91a9c83 (v3.2-rc2) this has however not worked since the signal was
only sent to the process group.
It is the job of service_monitor(), when it reaps the process leader,
to forward the signal to the process group.
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
Don't try to source an optional env:file if it is missing. Otherwise
execution of pre/post/ready/cleanup script will fail.
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
Initiating a shutdown/reboot from `initctl` should not cause `initctl`
to be killed in do_shutdown().
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
When a user sets up a TTY without a device, triggering the tty->notty
code path, the tty->dev will be NULL and tty_parse_args() still return
OK result.
Found by Coverity Scan
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>