oweals/dinit.git
5 years agomconfig: improve consistency of comments. v0.3.0
Davin McCall [Fri, 22 Jun 2018 19:20:20 +0000 (20:20 +0100)]
mconfig: improve consistency of comments.

5 years agodinitctl: fix includes for FreeBSD.
Davin McCall [Fri, 22 Jun 2018 19:19:35 +0000 (20:19 +0100)]
dinitctl: fix includes for FreeBSD.

5 years agoUpdate TODO.
Davin McCall [Fri, 22 Jun 2018 18:06:17 +0000 (19:06 +0100)]
Update TODO.

5 years agoBump version to 0.3.0.
Davin McCall [Fri, 22 Jun 2018 17:56:47 +0000 (18:56 +0100)]
Bump version to 0.3.0.

5 years agoTests: add test for loading a non-existent service.
Davin McCall [Fri, 22 Jun 2018 17:51:49 +0000 (18:51 +0100)]
Tests: add test for loading a non-existent service.

5 years agoAdd "signal-process-only" option to avoid signalling process group.
Davin McCall [Fri, 22 Jun 2018 17:45:49 +0000 (18:45 +0100)]
Add "signal-process-only" option to avoid signalling process group.

5 years agodocs: minor update to build instructions.
Davin McCall [Fri, 22 Jun 2018 09:12:10 +0000 (10:12 +0100)]
docs: minor update to build instructions.

5 years agodinitctl: show if service was skipped or failed.
Davin McCall [Fri, 22 Jun 2018 08:57:21 +0000 (09:57 +0100)]
dinitctl: show if service was skipped or failed.

Also update documentation accordingly.

5 years agoCorrectly report failure to find a service description.
Davin McCall [Fri, 22 Jun 2018 08:39:18 +0000 (09:39 +0100)]
Correctly report failure to find a service description.

5 years agoRemove -fno-rtti from MacOS builds.
Davin McCall [Fri, 22 Jun 2018 08:29:15 +0000 (09:29 +0100)]
Remove -fno-rtti from MacOS builds.

It seems to break exception handling. (Didn't I remove this earlier?...)

5 years agoReplace README with markdown version.
Davin McCall [Thu, 21 Jun 2018 08:07:53 +0000 (09:07 +0100)]
Replace README with markdown version.

5 years agoAdd more detail to sample "dinitctl list" output.
Davin McCall [Tue, 19 Jun 2018 21:54:27 +0000 (22:54 +0100)]
Add more detail to sample "dinitctl list" output.

Since pid and console state are now displayed, add them to the sample
output.

5 years agoDefine constants for supported control protocol versions.
Davin McCall [Tue, 19 Jun 2018 21:50:44 +0000 (22:50 +0100)]
Define constants for supported control protocol versions.

(Rather than hard-coding the values at point-of-use.)

5 years agodinitctl: show process id and console state in service list.
Davin McCall [Tue, 19 Jun 2018 21:40:40 +0000 (22:40 +0100)]
dinitctl: show process id and console state in service list.

5 years agoMove stopped_reason_t to service_constants.h header.
Davin McCall [Tue, 19 Jun 2018 20:39:02 +0000 (21:39 +0100)]
Move stopped_reason_t to service_constants.h header.

5 years agoservice: add various accessors.
Davin McCall [Tue, 19 Jun 2018 18:40:47 +0000 (19:40 +0100)]
service: add various accessors.

5 years agoAvoid rebuilding tests each time they're run.
Davin McCall [Mon, 18 Jun 2018 19:59:44 +0000 (20:59 +0100)]
Avoid rebuilding tests each time they're run.

5 years agoTests: add a new test.
Davin McCall [Mon, 18 Jun 2018 20:28:54 +0000 (21:28 +0100)]
Tests: add a new test.

5 years agoRemember the reason why a service stopped.
Davin McCall [Fri, 15 Jun 2018 18:47:13 +0000 (19:47 +0100)]
Remember the reason why a service stopped.

This will later allow for reporting the reason to dinitctl etc.

5 years agoAvoid another unnecessary issue-stop-on-release.
Davin McCall [Fri, 15 Jun 2018 16:31:35 +0000 (17:31 +0100)]
Avoid another unnecessary issue-stop-on-release.

5 years agoAvoid issuing do_stop twice when a process service process exits.
Davin McCall [Fri, 15 Jun 2018 16:20:26 +0000 (17:20 +0100)]
Avoid issuing do_stop twice when a process service process exits.

Probably it's harmless, but we may as well avoid it.

5 years agoDon't try to stop an already stopped service.
Davin McCall [Fri, 15 Jun 2018 16:08:54 +0000 (17:08 +0100)]
Don't try to stop an already stopped service.

It might or might not actually cause a problem, but it will at least
perform some unnecessary work, so don't do it.

5 years agoRefactor: rename onstart_flags_t to service_flags_t.
Davin McCall [Fri, 15 Jun 2018 09:16:08 +0000 (10:16 +0100)]
Refactor: rename onstart_flags_t to service_flags_t.

5 years agoRefactor: move "start-interruptible" flag into onstart_flags
Davin McCall [Fri, 15 Jun 2018 09:11:15 +0000 (10:11 +0100)]
Refactor: move "start-interruptible" flag into onstart_flags

5 years agoTests: add a test for interrupted start of skippable scripted service.
Davin McCall [Fri, 15 Jun 2018 08:47:51 +0000 (09:47 +0100)]
Tests: add a test for interrupted start of skippable scripted service.

5 years agoAdd test for scripted service start skip.
Davin McCall [Thu, 14 Jun 2018 17:06:05 +0000 (18:06 +0100)]
Add test for scripted service start skip.

5 years agoImplement "skippable" option for scripted services.
Davin McCall [Thu, 14 Jun 2018 09:37:39 +0000 (10:37 +0100)]
Implement "skippable" option for scripted services.

This causes a service start that is skipped via interruption (eg ^C) to
be considered as started for dependency purposes.

5 years agoTODO: add planned features for next release.
Davin McCall [Tue, 12 Jun 2018 17:20:25 +0000 (18:20 +0100)]
TODO: add planned features for next release.

5 years agoUp version to 0.2.0. v0.2.0
Davin McCall [Fri, 8 Jun 2018 20:55:38 +0000 (21:55 +0100)]
Up version to 0.2.0.

5 years agoFix bug causing scripted service shutdown scripts to be run twice.
Davin McCall [Fri, 8 Jun 2018 20:04:58 +0000 (21:04 +0100)]
Fix bug causing scripted service shutdown scripts to be run twice.

All tests now passing.

5 years agoAdd another process service test, currently failing.
Davin McCall [Fri, 8 Jun 2018 19:06:58 +0000 (20:06 +0100)]
Add another process service test, currently failing.

5 years agoDon't keep char * from array_string temporary.
Davin McCall [Thu, 7 Jun 2018 23:13:13 +0000 (00:13 +0100)]
Don't keep char * from array_string temporary.

The string might not be resolved as a compile-time constant, and the
temporary object may be destroyed before the string within it is used.

5 years agoarray_string: declare 'arr' member as const.
Davin McCall [Thu, 7 Jun 2018 22:17:11 +0000 (23:17 +0100)]
array_string: declare 'arr' member as const.

5 years agomconfig-gen: generate constexpr declarations.
Davin McCall [Thu, 7 Jun 2018 22:13:59 +0000 (23:13 +0100)]
mconfig-gen: generate constexpr declarations.

5 years agoFix mconfig.h generation.
Davin McCall [Thu, 7 Jun 2018 20:21:47 +0000 (21:21 +0100)]
Fix mconfig.h generation.

Re-work mconfig-gen so that it takes the variables at run-time on the
command line, rather than receiving them as macros at compile time. The
latter makes it impossible to use some values.

5 years agoAdd loading test for environment variable substitution.
Davin McCall [Thu, 7 Jun 2018 18:05:48 +0000 (19:05 +0100)]
Add loading test for environment variable substitution.

5 years agoAvoid logging service stop after failure to start.
Davin McCall [Thu, 7 Jun 2018 17:38:10 +0000 (18:38 +0100)]
Avoid logging service stop after failure to start.

The "FAILED" followed by "STOPPED" is somewhat redundant and arguably
incorrect.

5 years agoFix acquire/release counting in some sitations.
Davin McCall [Tue, 5 Jun 2018 17:37:05 +0000 (18:37 +0100)]
Fix acquire/release counting in some sitations.

In particular, failure to start did not always cause a release as it
should have.

5 years agoAdd service load test.
Davin McCall [Tue, 5 Jun 2018 09:12:43 +0000 (10:12 +0100)]
Add service load test.

5 years agoproctests: add a new test, currently failing.
Davin McCall [Mon, 4 Jun 2018 21:09:02 +0000 (22:09 +0100)]
proctests: add a new test, currently failing.

This also includes more OS abstraction in bp_sys so that we can test
different exit statuses.

5 years agoIntroduce "load-options" setting and "sub-vars" option.
Davin McCall [Mon, 4 Jun 2018 09:43:09 +0000 (10:43 +0100)]
Introduce "load-options" setting and "sub-vars" option.

This allows for specifying a service command line with parameters in the
form of $NAME, where NAME is an environment variable. The parameter is
replaced with the contents of the environment variable as a single
value.

5 years agoUse control socket path and sbin directory from config.
Davin McCall [Mon, 21 May 2018 17:28:27 +0000 (18:28 +0100)]
Use control socket path and sbin directory from config.

Use configured paths rather than hardcoded paths for the control socket
(normally /dev/dinitctl) and the sbin directory (/sbin).

5 years agoGenerate mconfig.h file with selected variables from mconfig.
Davin McCall [Tue, 15 May 2018 20:36:03 +0000 (21:36 +0100)]
Generate mconfig.h file with selected variables from mconfig.

5 years agoImplement a compile-time string manipulation class.
Davin McCall [Fri, 18 May 2018 18:19:13 +0000 (19:19 +0100)]
Implement a compile-time string manipulation class.

Currently very simple, allows for concatenation only.

5 years agoMinor fixes to rootfscheck script.
Davin McCall [Wed, 16 May 2018 12:31:51 +0000 (13:31 +0100)]
Minor fixes to rootfscheck script.

5 years agoshutdown: set passed-via-environment control socket to blocking.
Davin McCall [Wed, 16 May 2018 12:24:07 +0000 (13:24 +0100)]
shutdown: set passed-via-environment control socket to blocking.

We don't expect non-blocking errors like EAGAIN so we need it in
blocking mode.

5 years agoSet main log format earlier.
Davin McCall [Tue, 15 May 2018 22:43:23 +0000 (23:43 +0100)]
Set main log format earlier.

This is necessary to avoid buffering messages in incorrect format
(without the priority indicator).

5 years agoCorrect some logic for handling overflow messages in log.
Davin McCall [Tue, 15 May 2018 21:23:36 +0000 (22:23 +0100)]
Correct some logic for handling overflow messages in log.

5 years agoInstall man pages with correct permissions mask.
Davin McCall [Tue, 15 May 2018 20:57:58 +0000 (21:57 +0100)]
Install man pages with correct permissions mask.

5 years agoLook in multiple directories for service descriptions.
Davin McCall [Mon, 14 May 2018 20:22:43 +0000 (21:22 +0100)]
Look in multiple directories for service descriptions.

Previously we checked only /etc/dinit.d; now, check /etc/dinit.d,
/usr/local/lib/dinit.d, and /lib/dinit.d, in that order.

5 years agodirload_service_set: add support for multiple service directories.
Davin McCall [Mon, 14 May 2018 09:24:01 +0000 (10:24 +0100)]
dirload_service_set: add support for multiple service directories.

5 years agoUpdate MacOS build defaults.
Davin McCall [Mon, 14 May 2018 09:06:50 +0000 (10:06 +0100)]
Update MacOS build defaults.

6 years agoSet example filesystem services to have no start timeout.
Davin McCall [Wed, 25 Apr 2018 08:36:48 +0000 (09:36 +0100)]
Set example filesystem services to have no start timeout.

File system checks take as long as they take; let them run.

6 years agoUpdate bundled Dasynq to 1.1.4.
Davin McCall [Fri, 6 Apr 2018 21:00:18 +0000 (22:00 +0100)]
Update bundled Dasynq to 1.1.4.

6 years agoshutdown: push all output through a cyclic buffer.
Davin McCall [Fri, 6 Apr 2018 18:25:04 +0000 (19:25 +0100)]
shutdown: push all output through a cyclic buffer.

Push all output, including from subprocesses, through a cyclic
buffer, and discard buffer contents if it cannot be output fast
enough. I.e. shutdown should not hang if the console is blocked
(such as due to a hardware issue with serial console, or user
having pressed ctrl+S to stop console output on a VT).

6 years agoUpdate COMPARISON, TODO.
Davin McCall [Thu, 22 Mar 2018 18:26:49 +0000 (18:26 +0000)]
Update COMPARISON, TODO.

Shuffle around a few TODO items.

6 years agoUpdate version number to 0.1.1. v0.1.1
Davin McCall [Tue, 20 Mar 2018 20:40:25 +0000 (20:40 +0000)]
Update version number to 0.1.1.

6 years agoUpdate man page with --log-file documentation.
Davin McCall [Tue, 20 Mar 2018 20:39:04 +0000 (20:39 +0000)]
Update man page with --log-file documentation.

6 years agoAdd --log-file (-l) option to specify logging to file.
Davin McCall [Tue, 20 Mar 2018 19:01:02 +0000 (19:01 +0000)]
Add --log-file (-l) option to specify logging to file.

The default is to log to the syslog facility. Also in this commit: start
logging from the beginning if not system init, rather than waiting for
logging service.

6 years agoMake "syslog" formatting of main log entries optional.
Davin McCall [Tue, 20 Mar 2018 18:28:40 +0000 (18:28 +0000)]
Make "syslog" formatting of main log entries optional.

6 years agoload service: simplify conditional in while loop.
Davin McCall [Tue, 20 Mar 2018 09:58:32 +0000 (09:58 +0000)]
load service: simplify conditional in while loop.

6 years agotests: add a new test.
Davin McCall [Tue, 20 Mar 2018 09:54:23 +0000 (09:54 +0000)]
tests: add a new test.

6 years agoFix issue with incorrect acquisition counts with waits_for dependencies.
Davin McCall [Tue, 20 Mar 2018 00:11:17 +0000 (00:11 +0000)]
Fix issue with incorrect acquisition counts with waits_for dependencies.

6 years agoservice stopped(): release console if have_console is set.
Davin McCall [Mon, 19 Mar 2018 22:59:32 +0000 (22:59 +0000)]
service stopped(): release console if have_console is set.

Previously relied on onstart_flags.runs_on_console, which should also be
accurate, but seeing as we have a flag available with the exact
semantics guaranteed then we should use that.

6 years agoHandle startup timer expiry using failed_to_start.
Davin McCall [Mon, 19 Mar 2018 22:57:00 +0000 (22:57 +0000)]
Handle startup timer expiry using failed_to_start.

Reduces code duplication, and probably handles some things that were not
being handled correctly.

6 years agoMake sure listeners are notified of start cancellation.
Davin McCall [Mon, 19 Mar 2018 22:45:17 +0000 (22:45 +0000)]
Make sure listeners are notified of start cancellation.

Start cancellation was only working for process-based services.

6 years agoLog service start timeout.
Davin McCall [Mon, 19 Mar 2018 19:08:49 +0000 (19:08 +0000)]
Log service start timeout.

6 years agoAdd a test, adjustments to other tests.
Davin McCall [Mon, 19 Mar 2018 19:08:12 +0000 (19:08 +0000)]
Add a test, adjustments to other tests.

6 years agoWhen stopping dependents, also release waits_for/soft dependencies.
Davin McCall [Mon, 19 Mar 2018 19:01:56 +0000 (19:01 +0000)]
When stopping dependents, also release waits_for/soft dependencies.

waits for / soft dependencies should treat a start failure or other
dependency stop as a prompt to check for start conditions having been
met, after the dependency link is unchained.

6 years agoMinor fixes to README.
Davin McCall [Sun, 4 Mar 2018 02:28:54 +0000 (02:28 +0000)]
Minor fixes to README.

6 years agoBump version to 0.1.0. v0.1.0
Davin McCall [Thu, 1 Mar 2018 19:59:20 +0000 (19:59 +0000)]
Bump version to 0.1.0.

6 years agoUpdate COMPARISON with other systems.
Davin McCall [Wed, 28 Feb 2018 16:04:43 +0000 (16:04 +0000)]
Update COMPARISON with other systems.

6 years agotests: build fix for OpenBSD.
Davin McCall [Wed, 28 Feb 2018 15:29:40 +0000 (15:29 +0000)]
tests: build fix for OpenBSD.

6 years agoman page: rework slightly.
Davin McCall [Wed, 28 Feb 2018 15:29:29 +0000 (15:29 +0000)]
man page: rework slightly.

6 years agoman pages: reword description of depends-ms dependency.
Davin McCall [Wed, 28 Feb 2018 12:32:11 +0000 (12:32 +0000)]
man pages: reword description of depends-ms dependency.

6 years agoFix: stop milestone dependency before started.
Davin McCall [Wed, 28 Feb 2018 12:08:37 +0000 (12:08 +0000)]
Fix: stop milestone dependency before started.

Stopping a milestone dependency before its dependent has started must
also stop the dependent (the "milestone" hasn't been reached).

Add a test.

6 years agoSet default log level for main log (not console) to INFO.
Davin McCall [Tue, 27 Feb 2018 17:55:58 +0000 (17:55 +0000)]
Set default log level for main log (not console) to INFO.

6 years agoLog system startup.
Davin McCall [Tue, 27 Feb 2018 17:47:42 +0000 (17:47 +0000)]
Log system startup.

6 years agoLogging: support for supressing output to console per message.
Davin McCall [Tue, 27 Feb 2018 17:27:39 +0000 (17:27 +0000)]
Logging: support for supressing output to console per message.

6 years agoMinor man-page fixes.
Davin McCall [Tue, 27 Feb 2018 14:10:40 +0000 (14:10 +0000)]
Minor man-page fixes.

6 years agologging: refactoring, add comment.
Davin McCall [Tue, 27 Feb 2018 13:16:33 +0000 (13:16 +0000)]
logging: refactoring, add comment.

6 years agoRead environment from file at startup.
Davin McCall [Mon, 26 Feb 2018 22:53:40 +0000 (22:53 +0000)]
Read environment from file at startup.

6 years agoAllow setting working directory for services.
Davin McCall [Fri, 23 Feb 2018 18:40:45 +0000 (18:40 +0000)]
Allow setting working directory for services.

6 years agoClean up a comparison warning.
Davin McCall [Tue, 20 Feb 2018 20:09:44 +0000 (20:09 +0000)]
Clean up a comparison warning.

6 years agoAdd another (passing) test.
Davin McCall [Tue, 20 Feb 2018 19:07:04 +0000 (19:07 +0000)]
Add another (passing) test.

6 years agoAdd another test and a fix to make it pass.
Davin McCall [Tue, 20 Feb 2018 18:59:41 +0000 (18:59 +0000)]
Add another test and a fix to make it pass.

6 years agoMove processing of start pin in do_stop.
Davin McCall [Tue, 20 Feb 2018 11:43:51 +0000 (11:43 +0000)]
Move processing of start pin in do_stop.

The pin should prevent the process from stopping, but not from any other
effects on dependencies. This change makes dependencies of a
start-pinned service potentially go into STOPPING state, if the pinned
service is issued a stop.

6 years agoAdditional comment to better explain two-phase service transition.
Davin McCall [Tue, 20 Feb 2018 10:19:06 +0000 (10:19 +0000)]
Additional comment to better explain two-phase service transition.

6 years agoAdd comment.
Davin McCall [Mon, 19 Feb 2018 10:57:40 +0000 (10:57 +0000)]
Add comment.

6 years agoAdd a new test.
Davin McCall [Mon, 19 Feb 2018 10:39:24 +0000 (10:39 +0000)]
Add a new test.

6 years agoDon't bypass queue cycle in emergency_stop.
Davin McCall [Fri, 16 Feb 2018 10:09:54 +0000 (10:09 +0000)]
Don't bypass queue cycle in emergency_stop.

Rather than calling stopped() directly from emergency_stop(), wait for
the transition cycle.

6 years agoUpdate TODO.
Davin McCall [Thu, 15 Feb 2018 19:04:25 +0000 (19:04 +0000)]
Update TODO.

6 years agoOn interrupting start of scripted service, run stop script.
Davin McCall [Thu, 15 Feb 2018 18:32:19 +0000 (18:32 +0000)]
On interrupting start of scripted service, run stop script.

If a scripted service startup is interrupted via signal, run the stop
script in case cleanup is required.

6 years agoMock tcsetpgrp() and getpgrp() for tests.
Davin McCall [Tue, 13 Feb 2018 18:32:01 +0000 (18:32 +0000)]
Mock tcsetpgrp() and getpgrp() for tests.

6 years agoRefactoring in utilities.
Davin McCall [Tue, 13 Feb 2018 18:14:29 +0000 (18:14 +0000)]
Refactoring in utilities.

6 years agoFix test build failures.
Davin McCall [Mon, 12 Feb 2018 20:46:05 +0000 (20:46 +0000)]
Fix test build failures.

6 years agodinitctl: query protocol version at beginning + refactoring.
Davin McCall [Mon, 12 Feb 2018 20:34:56 +0000 (20:34 +0000)]
dinitctl: query protocol version at beginning + refactoring.

6 years agoFactor out some Dinit client functions tp a new header (dinit-client.h).
Davin McCall [Mon, 5 Feb 2018 10:58:44 +0000 (10:58 +0000)]
Factor out some Dinit client functions tp a new header (dinit-client.h).

6 years agoOn FreeBSD, build without -fno-rtti.
Davin McCall [Sun, 11 Feb 2018 15:02:25 +0000 (15:02 +0000)]
On FreeBSD, build without -fno-rtti.

It seems to stop exception handling from being able to recognise which
exception was thrown.

6 years agoAllow initial services to be specified on command-line on non-Linux OS.
Davin McCall [Sun, 11 Feb 2018 13:05:44 +0000 (13:05 +0000)]
Allow initial services to be specified on command-line on non-Linux OS.