new postponed stop handling tried to reload already stopped and removed
services. We should of course skip already stopped services and halt
those that have been removed.
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This patch reverts the change in behavior introduced in Finit v2.2,
commit 924bf041, where `initctl restart JOB` changed from 'stop + start'
to `SIGHUP` for services that support `SIGHUP`.
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
When `service_stop_done()` is called with a `NULL` argument and no
dynamic services have been stopped, this regression is triggered.
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This patch makes it possible to see debug traces when running the client
program initctl, using `--debug`. Please note, this does not affect the
debug command to the daemon.
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This patch adds support for declaring *why* a service is being stopped
or reloaded. This is later used when all stopped services have been
collected by the `service_monitor()` to issue start or postponed SIGHUP.
As an added benefit we can now also see why a service is not running.
If it has been paused by a user, halted when moving to another runlevel,
waiting for a condition (event), or similar.
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
The `initctl reload <JOB>` command did not work properly. This
was due to the service not being properly initialized to default
settings when reading the Finit configuration file.
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This patch fixes a race condition when doing an ordered RELOAD and STOP
event sequence. For services that shall be stopped it is imperative
that we wait for them to be colleced by the `service_monitor()`, so that
we know they have really been stopped, before calling HOOK_SVC_RECONF.
The latter is a promise to external services that all services have been
indeed stopped.
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
The TTY plugin might fail in read() with EINVAL if the inotify event
buffer is too small. Fix: set the receive event buffer to the size
recommended in inotify(7). Also add a handler for EINVAL to close and
reinitialize the inotify descriptor so we do not accidentally overrun
the CPU with any unhandled errors.
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
When building a static Finit the plugins do not get a unique name
automatically from the file. This led to only the first plugin being
loaded, since its name was 'unknown' it was registered as such and all
other plugins conflicted, since 'unknown' was already ... known and
loaded.
This patch gives all plugins a default name, __FILE__, making it
possible to use all of them when building a static Finit.
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
For embedded systems with no initial random seed, usually stored in
/var/lib/urandom/urandom-seed on desktops, servers and laptops, we now
provide an initial seed file using a built-in PRNG.
Also, let the configure script default to *enable* the random seeding
at boot, granted the urandom plugin is enabled. We should encourage
users to properly seed their random, for security reasons.
Moreover, the plugin did not properly regenerate the random seed on
reboot, or shutdown, this patch also rectifies that problem.
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
- Upgrade libite (LITE) for new UNIX file parser API to improve static
builds of Finit.
- Re-enable bootmisc plugin for static builds by adding built-in support
for reading GID from /etc/group.
- Allow inetd support for static builds by adding built-in support for
reading service and protocol from /etc/services and /etc/protocols.
- Do not try to install/uninstall any plugins for static builds.
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
service.c:
Don't declare find_inetd_svc() if inetd is disabled.
api.c:
Disable inetd API
initctl.c:
Disable presentation of inetd services
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
After forking off a new child, all signals that are blocked by finit
should be unblocked before exec-ing the final binary. Also, finit now
blocks SIGHUP, so add it to the set of signals that should be
unblocked.
We should not use -Os as default optimization, it is sometimes unstable
in cross compilers. Instead, default to -O2, which is the more tried
and tested path.
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
When integrating finit as a component in another system, that build
system may set VERSION as an environment variable for that OS -- we do
not want that version to be set as the version of finit.
Also, bump version to 2.0.1-dev for upcoming patch release cycle.
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
Check return code from `mount -na`, if there where any errors give
plugins a chance to do something about it.
Signed-off-by: Tobias Waldekranz <tobias@waldekranz.com>
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This patch adds a simple `service <script> <stop|start|reload|restart>`
script for for SysV init compatibility. Very common with users of the
Ubuntu upstart init as well.
Also, fixed `make uninstall` for plugins.
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
Even though libite and libuEv can be disabled, using the --with-libnnn
option to configure, we let make descend into those submodules for the
clean and distclean targets. This way we can rely on make dev to work.
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This commit makes it possible to build Finit with an external libuEv.
Without this configure script option the libuev submodule is used.
With an external libuEv we make sure to set the SONAME to libuev.so.1
to prevent any future runtime ABI issues.
Fixes issue #4.
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This commit makes it possible to build Finit with an external libite.
Without this configure script option the libite submodule is used.
With an external libite we make sure to set the SONAME to libite.so.2
to prevent runtime ABI issues with older libite versions.
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>