Age | Commit message (Collapse) | Author |
|
use the realpath of the target to locate which sysconf dir it's in,
using it as a base to load the config file. the service path is then
normalized from the symlink without dereferencing it.
Signed-off-by: Anna (navi) Figueiredo Gomes <navi@vlhl.dev>
|
|
add two api functions, `rc_service_dir` and `rc_sysconf_dir`, both are
generate paths (and sub-paths) for resources, and meant to replace the
hardcoded variables like `RC_SVCDIR`.
those functions differ by dynamically switching between the system path,
or the user path, set in their home folder or runtime directory.
this lays out the intial support for user services.
Signed-off-by: Anna (navi) Figueiredo Gomes <navi@vlhl.dev>
|
|
|
|
|
|
svc_exec waits until SIGCHLD comes in to close its input, but in
rc_parallel case the SIGCHLD might be unrelated.
Checking the proper pid is found in signal handler and only signaling
signal_pipe the status code directly avoids this problem.
|
|
work around scary warnings described in previous commit
|
|
restarting a service with --no-deps ran into a "hairy workaround", which
had a few problems discussed in [1]:
- it ignores --dry-run, really restarting the requested service
- if the service was stopped, the program is started but the service
status stays stopped. This makes long-lived services impossible to
(re)start again (pid already exists and running), and the service also
won't stop on shutdown.
The kludge had a long comment describing the following situation:
- openvpn needs net and dns
- net restarts dns
- dns needs net
If the restart in net handled deps, openrc would deadlock waiting for
net in dns' restart, as net won't be started until that is done.
Restarting with --nodeps works around the deadlock, but can display
errors without the kludge (note that the services did start properly
anyway, the problem is that the default service path tries to lock dns
twice from openvn's dep's start and net's start's restart):
---
alpine:~# rc-service openvn start
openvn | * Caching service dependencies ... [ ok ]
net |net starting
net |dns | * Call to flock failed: Resource temporarily unavailable
net |dns | * ERROR: dns stopped by something else
net |net started
dns |dns started
openvn |openvn started
alpine:~# rc-status | grep s[1-3]
net [ started ]
dns [ started ]
openvn [ started ]
---
Locking again in restart --nodep can fail in two patterns:
- openvpn's need dependency start was first, and the restart in net
failed (case above): we can just silence locking failures and exit quietly
with restart --no-deps, which is not worse than trying to restart while
another process hold the lock.
- the restart in net's start was first, and openvpn's need dependency
start failed: not much can be done here short of adding a new status
that a no-deps restart is in progress as in the comment, but this case
can actually just be solved by adjusting dependencies -- and it actually
has already been fixed: the current openvpn init script in alpine only
'use dns', so it will not try to start it, and that will start just
fine with openvpn -> net -> dns only each starting each other once
sequentially.
Another failure pattern is just starting dns directly: that will start
net, which will try to restart dns while we are starting it.
Silencing messages on restart also solves this.
Link: https://github.com/OpenRC/openrc/issues/224 [1]
|
|
same rational as 459783bb
Bug: https://github.com/OpenRC/openrc/issues/589
|
|
|
|
|
|
|
|
These become fine with C23 because () starts to mean (void) then, but for
previous language versions, it's deprecated, and it causes an annoying
warning when building with Clang by default.
Plus, GCC lacks specific flags to trigger what C23 *does* ban, so a lot
of people are going around building with -Wstrict-prototypes, so let's
just fix this to be consistent with the rest of the codebase anyway
to fend off false positive reports.
|
|
Fixes #491.
|
|
This fixes #516.
|
|
- drop old build system
- move shared include and source files to common directory
- drop "rc-" prefix from shared include and source files
- move executable-specific code to individual directories under src
- adjust top-level .gitignore file for new build system
This closes #489.
|