Davin McCall [Thu, 8 Aug 2019 12:18:26 +0000 (22:18 +1000)]
Add integration test for service "restart" function.
Davin McCall [Thu, 8 Aug 2019 11:53:32 +0000 (21:53 +1000)]
Update man page for revised restart/wake semantics.
Davin McCall [Thu, 8 Aug 2019 11:48:33 +0000 (21:48 +1000)]
Change semantics of "wake" command.
"Wake" now re-attaches dependencies (from the dependents of the named
service). You can no longer wake a service if it has no active
dependents.
Davin McCall [Wed, 7 Aug 2019 11:53:16 +0000 (21:53 +1000)]
Avoid signed-unsigned comparison warning.
Davin McCall [Wed, 7 Aug 2019 11:39:21 +0000 (21:39 +1000)]
dinitctl: update restart handling.
As per changes in dinit daemon/control protocol.
Davin McCall [Wed, 7 Aug 2019 11:04:56 +0000 (21:04 +1000)]
Re-work restart function.
Restart is now always "gentle", i.e. cannot be forced and isn't possible
when dependents (with hard dependency) exist.
Davin McCall [Wed, 7 Aug 2019 10:09:56 +0000 (20:09 +1000)]
Properly issue STARTCANCELLED message if restart is cancelled
Davin McCall [Sun, 4 Aug 2019 04:23:15 +0000 (14:23 +1000)]
Re-work state propogation/transition logic.
This mostly keeps existing behaviour, hopefully making it more
consistent and predictable in other cases, and simplifies the code.
Davin McCall [Wed, 31 Jul 2019 11:21:57 +0000 (21:21 +1000)]
Improve/refactor static_membuf.
Davin McCall [Mon, 29 Jul 2019 10:41:23 +0000 (20:41 +1000)]
Refactor some packet-building for readability and safety
Davin McCall [Sun, 28 Jul 2019 07:09:30 +0000 (17:09 +1000)]
Document dinitctl "restart" command.
Davin McCall [Sun, 28 Jul 2019 05:49:23 +0000 (15:49 +1000)]
Update TODO.
Davin McCall [Sun, 28 Jul 2019 01:50:48 +0000 (11:50 +1000)]
Up version, update NEWS.
Davin McCall [Sat, 27 Jul 2019 12:22:02 +0000 (22:22 +1000)]
stop: if not required, treat stop as full manual stop.
This is needed to properly handle shutdown when a service is alive but
not marked active.
Davin McCall [Sat, 27 Jul 2019 10:45:29 +0000 (20:45 +1000)]
Implement dinitctl restart, addresses #14
Davin McCall [Sat, 27 Jul 2019 07:03:41 +0000 (17:03 +1000)]
Don't add console watcher if not PID 1.
If not PID 1, we don't need to ask for console input. Adding a watcher
fails if we don't have a (suitable) stdin, eg FreeBSD shell if dinit is
run in background.
Davin McCall [Sat, 27 Jul 2019 06:15:09 +0000 (16:15 +1000)]
Update manpage/README for new "dinitctl stop" semantics.
"dinitctl stop" will now issue an error if dependent services would be
forced to stop. The new --force option can be used to force a service
and dependents to stop.
Davin McCall [Sat, 27 Jul 2019 06:03:21 +0000 (16:03 +1000)]
Add integration test for gentle stop/force stop.
Davin McCall [Sat, 27 Jul 2019 05:01:56 +0000 (15:01 +1000)]
Fix a bunch of issues identified by Coverity scan
Davin McCall [Sat, 27 Jul 2019 00:16:53 +0000 (10:16 +1000)]
dinitctl: print names of dependents which are inhibiting stop
Davin McCall [Tue, 23 Jul 2019 11:09:15 +0000 (21:09 +1000)]
dinitctl stop: gentle by default, implement --force.
A "gentle" stop won't stop if dependents will be affected, i.e. it warns
and aborts. The `--force' option (or `-f') can be used to force the
service to stop, which will also cause the dependents to stop.
Also sneak in a bug fix where certain options were not recognised.
Davin McCall [Mon, 22 Jul 2019 09:14:45 +0000 (19:14 +1000)]
Add control protocol query-name test
Davin McCall [Mon, 22 Jul 2019 09:02:27 +0000 (19:02 +1000)]
Update gitignore
Davin McCall [Sun, 21 Jul 2019 05:08:50 +0000 (15:08 +1000)]
Control protocol: implement QUERYSERVICENAME to get name from handle
Davin McCall [Sun, 21 Jul 2019 04:57:19 +0000 (14:57 +1000)]
Fix gentle service stop
Fix some problems with "gentle" service stop as found by test.
Davin McCall [Sun, 21 Jul 2019 05:01:37 +0000 (15:01 +1000)]
Add test for "gentle" stop.
Davin McCall [Sun, 21 Jul 2019 01:58:29 +0000 (11:58 +1000)]
Clean up fuzz test source
Davin McCall [Sat, 20 Jul 2019 08:50:41 +0000 (09:50 +0100)]
Implement careful/"gentle" service stop (abort if dependent would stop).
Davin McCall [Sun, 14 Jul 2019 04:48:32 +0000 (05:48 +0100)]
Update version, NEWS, TODO.
Davin McCall [Sun, 14 Jul 2019 01:53:39 +0000 (02:53 +0100)]
Generate man pages with m4.
Allows substituting current version and release date.
Davin McCall [Fri, 12 Jul 2019 13:28:23 +0000 (23:28 +1000)]
Log more information on exec failure.
Log failure stage as well as error-from-errno.
Davin McCall [Thu, 11 Jul 2019 12:38:19 +0000 (22:38 +1000)]
Add integration test for "chain-to" service parameter
Davin McCall [Thu, 11 Jul 2019 11:33:59 +0000 (21:33 +1000)]
Update TODO, CONTRIBUTING
Davin McCall [Thu, 11 Jul 2019 10:33:52 +0000 (20:33 +1000)]
Don't log to syslog if not running as system daemon
Davin McCall [Mon, 8 Jul 2019 10:25:27 +0000 (20:25 +1000)]
Don't put "shares console" processes in the foreground.
We don't want them to steal signals such as ^C from a real "runs on
console" process.
Davin McCall [Sat, 6 Jul 2019 02:53:45 +0000 (03:53 +0100)]
Add integration test for per-process environment.
Davin McCall [Sat, 6 Jul 2019 02:45:07 +0000 (03:45 +0100)]
Implement --socket-path option for dinitctl.
Davin McCall [Sat, 6 Jul 2019 00:05:09 +0000 (01:05 +0100)]
Implement "env-file" service setting for service-specific environment.
Davin McCall [Fri, 5 Jul 2019 11:43:17 +0000 (21:43 +1000)]
Update .gitignore.
Davin McCall [Fri, 5 Jul 2019 11:39:46 +0000 (21:39 +1000)]
Add extern definition for environ.
POSIX is somewhat ambiguous as to whether unistd.h should declare the
environ variable. It is not listed in the specific requirements for
unistd.h and OpenBSD does not declare it in that header.
Davin McCall [Fri, 5 Jul 2019 11:32:54 +0000 (21:32 +1000)]
Fix test stub for run_child_proc.
Davin McCall [Fri, 5 Jul 2019 11:17:09 +0000 (21:17 +1000)]
Make help output consistent.
Davin McCall [Fri, 5 Jul 2019 11:13:31 +0000 (21:13 +1000)]
Ignore addrspace resource limit if system has no RLIMIT_AS.
Davin McCall [Fri, 5 Jul 2019 11:03:11 +0000 (21:03 +1000)]
Add integration test framework (with 2 tests).
Run integration tests using "make check-igr". This complements the unit
tests ("make check").
Davin McCall [Wed, 3 Jul 2019 09:50:52 +0000 (19:50 +1000)]
Add -q/--quiet option for supressing console output.
Davin McCall [Wed, 3 Jul 2019 09:50:08 +0000 (19:50 +1000)]
Minor updates to Linux Dinit-as-init guidelines.
Davin McCall [Sun, 30 Jun 2019 11:49:52 +0000 (21:49 +1000)]
Fix non-POSIXisms in sample rcboot.sh
Davin McCall [Sat, 29 Jun 2019 10:20:55 +0000 (11:20 +0100)]
Fix notification environment variable setting.
Refactor start_ps_process to take a single struct argument, and fix a
bug in the process: the notification environment variable (where the
notification fd should be stored) was never passed through to the
service process.
Davin McCall [Thu, 4 Jul 2019 11:53:03 +0000 (21:53 +1000)]
Merge pull request #15 from fpoussin/crossbuild
Fixed strip on install for cross compilation
Fabien Poussin [Thu, 4 Jul 2019 11:39:27 +0000 (13:39 +0200)]
Added STRIPOPTS var for install
Davin McCall [Sat, 29 Jun 2019 05:46:28 +0000 (15:46 +1000)]
Update NEWS and version.
(Commit picked from r0.5.2 release branch).
Davin McCall [Sat, 29 Jun 2019 05:34:07 +0000 (15:34 +1000)]
Only move fds from force_notify_fd if it is set!
Davin McCall [Sat, 29 Jun 2019 05:04:21 +0000 (15:04 +1000)]
Shuffle file descriptors as necessary to avoid clash with notify fd.
Davin McCall [Sat, 29 Jun 2019 03:52:45 +0000 (13:52 +1000)]
Update TODO.
Davin McCall [Sat, 29 Jun 2019 03:41:38 +0000 (13:41 +1000)]
Re-create control socket file node if it disappears.
In case something is mounted over /dev (or wherever the control socket
lives) it will become inaccessible. When a starts-rwfs service starts,
check the socket node still exists and if not, close the socket and
re-open.
Davin McCall [Fri, 28 Jun 2019 11:16:17 +0000 (21:16 +1000)]
Build/logic fixes in parse_rlimit.
Davin McCall [Fri, 28 Jun 2019 10:28:05 +0000 (20:28 +1000)]
Additional check for bad setting values for rlimit settings.
Davin McCall [Fri, 28 Jun 2019 10:26:19 +0000 (20:26 +1000)]
Fix uninitialised variable.
Davin McCall [Fri, 28 Jun 2019 09:58:35 +0000 (19:58 +1000)]
Fix use of old settings in sample config, see #16.
Fabien Poussin [Thu, 27 Jun 2019 00:25:34 +0000 (02:25 +0200)]
Fixed strip on install for cross compilation
Davin McCall [Sat, 22 Jun 2019 08:26:11 +0000 (09:26 +0100)]
Add documentation for the resource limit settings.
Davin McCall [Sat, 22 Jun 2019 03:03:51 +0000 (04:03 +0100)]
Fix typo in function name (workding -> working)
Davin McCall [Sat, 22 Jun 2019 02:54:09 +0000 (03:54 +0100)]
Implement resource limit settings.
Davin McCall [Sun, 2 Jun 2019 10:09:46 +0000 (20:09 +1000)]
Process service state queues after readiness via fd.
Davin McCall [Sun, 2 Jun 2019 09:28:57 +0000 (19:28 +1000)]
Don't abuse std::find to find end of special message.
Edd Barrett [Thu, 30 May 2019 10:41:13 +0000 (11:41 +0100)]
Add CONTRIBUTORS.
Edd Barrett [Sat, 25 May 2019 13:26:50 +0000 (14:26 +0100)]
Add the getting started guide.
Davin McCall [Wed, 29 May 2019 10:16:18 +0000 (20:16 +1000)]
Improve "stop" documentation, bring in line with implementation.
Davin McCall [Wed, 29 May 2019 08:56:19 +0000 (18:56 +1000)]
Break holds from soft dependents if a service is manually stopped.
If all dependents are soft (waits-for or soft) then break their holds on
a service that is manually stopped. This prevents the service from
immediately re-starting, which would be unexpected behaviour.
Davin McCall [Tue, 28 May 2019 11:01:09 +0000 (21:01 +1000)]
Remove unused function.
Davin McCall [Tue, 28 May 2019 10:11:48 +0000 (20:11 +1000)]
Fix restart of dependency services not explicitly started.
Davin McCall [Tue, 28 May 2019 09:17:09 +0000 (19:17 +1000)]
Add test for restart of a waits-for dependency.
The dependent is not explicitly started, but should restart due to the
dependency (rather than breaking the dependency) because it has been set
to auto-restart.
Davin McCall [Sun, 26 May 2019 04:37:31 +0000 (14:37 +1000)]
Tests: don't call timer_expiry directly.
Advance the current simulated time and expire timers if they are active,
rather than calling the timer expiry directly (which makes the
assumption that the timer is active).
Davin McCall [Sun, 26 May 2019 04:09:43 +0000 (14:09 +1000)]
Fix time-out-during-start test.
Davin McCall [Sun, 26 May 2019 04:09:10 +0000 (14:09 +1000)]
Clear the stop timer if scripted start is interrupted.
Davin McCall [Sat, 25 May 2019 23:38:12 +0000 (09:38 +1000)]
dinitctl: fix display of termination signal
Davin McCall [Sat, 25 May 2019 14:56:12 +0000 (00:56 +1000)]
Fix restart after unexpected termination.
Davin McCall [Sat, 25 May 2019 14:55:51 +0000 (00:55 +1000)]
Add test for restart after unexpected termination.
Davin McCall [Sat, 25 May 2019 11:25:05 +0000 (21:25 +1000)]
Add cross-compilation support.
I.e. add HOSTCXX etc make variables, and use the host compiler when
compiling mconfig-gen.
Davin McCall [Sat, 25 May 2019 08:29:47 +0000 (18:29 +1000)]
make install: use force when creating links
Davin McCall [Sat, 25 May 2019 08:27:13 +0000 (18:27 +1000)]
Fix log flushing and clean up output in boot failure handling.
Davin McCall [Sat, 25 May 2019 07:53:03 +0000 (17:53 +1000)]
Add example recovery service.
Davin McCall [Sat, 25 May 2019 07:41:34 +0000 (17:41 +1000)]
man page: describe recovery service.
Davin McCall [Sat, 25 May 2019 07:10:34 +0000 (17:10 +1000)]
Fix waiting for console input.
Davin McCall [Sat, 25 May 2019 04:00:48 +0000 (05:00 +0100)]
Allow user to choose action when boot fails.
When all services stop with no shutdown issued, prompt user for several
possible actions.
Davin McCall [Fri, 24 May 2019 12:56:44 +0000 (22:56 +1000)]
Don't start any service during shutdown.
Davin McCall [Fri, 24 May 2019 11:49:41 +0000 (21:49 +1000)]
Rename/reverse set_auto_restart() to is_shutting_down().
Davin McCall [Fri, 24 May 2019 10:54:02 +0000 (20:54 +1000)]
Try to fix case where we can't getpgid() treating pid == pgid.
The logic behind this is: if we can't use getpgid(), it's because the
process is in a different session. If that's the case, it must be a
process group leader with pgid == pid.
Davin McCall [Fri, 24 May 2019 08:59:44 +0000 (18:59 +1000)]
log about not being able to get process group with INFO not WARN.
Davin McCall [Fri, 24 May 2019 08:58:50 +0000 (18:58 +1000)]
Fix log levels (swap console/main log).
The console should be WARN, main log should be INFO, not the other way
around. Don't want too much spurious stuff going out to the console.
Davin McCall [Thu, 23 May 2019 21:13:27 +0000 (07:13 +1000)]
Add KILL support to term-signal setting.
Also have renamed termsignal to term-signal for consistency, but the old
name remains supported.
Davin McCall [Thu, 23 May 2019 12:35:44 +0000 (22:35 +1000)]
Bump version to 0.5.1.
Davin McCall [Thu, 23 May 2019 11:20:39 +0000 (21:20 +1000)]
dinitctl: handle service dir with absolute path in enable/disable.
Davin McCall [Thu, 23 May 2019 10:39:28 +0000 (20:39 +1000)]
Update bundled Dasynq to latest (1.1.6).
Fixes critical issue on OpenBSD.
Davin McCall [Wed, 22 May 2019 10:33:15 +0000 (20:33 +1000)]
Just signal the process if we can't get the process group.
On OpenBSD (and possibly others) we can't get the process group of a
process that's in a different session, so fall back to signalling the
process.
Davin McCall [Wed, 22 May 2019 10:22:45 +0000 (20:22 +1000)]
Use SYSCONTROLSOCKET for socket path in dinitctl/shutdown.
Patches from vext01.
Davin McCall [Wed, 22 May 2019 10:13:31 +0000 (20:13 +1000)]
Another minor fix to man page.
Davin McCall [Tue, 21 May 2019 21:43:30 +0000 (07:43 +1000)]
Docs: mention "boot" service in Readme, etc.
Davin McCall [Fri, 10 May 2019 13:37:33 +0000 (23:37 +1000)]
Don't discard buffer unless >1 second has elapse since console release.
If the log subsystem releases the console, the log buffer is normally
discarded when it is re-acquired (so that stale messages are not then
displayed). This change allows for a 1 second window, so that
short-running foreground jobs don't prevent log messages being seen.
Davin McCall [Fri, 10 May 2019 10:53:27 +0000 (20:53 +1000)]
Don't fail service on failure to write utmp entry.
This can simply be the result of the utmp database not existing on the
system.