oweals/dinit.git
5 years agocontrol: server side support for querying load paths.
Davin McCall [Tue, 18 Sep 2018 17:57:34 +0000 (18:57 +0100)]
control: server side support for querying load paths.

Support for querying the service loader mechanism (currently there is
only one) and its details (the paths from which it loads service
descriptions).

5 years agodirload_service_set; correctly record service dir allocation.
Davin McCall [Mon, 17 Sep 2018 17:32:12 +0000 (18:32 +0100)]
dirload_service_set; correctly record service dir allocation.

The service directory can be allocated statically or dynamically (in
which case it is "owned" by the service set). Correctly track it for the
single-directory constructor.

5 years agodinit: remove unused variable.
Davin McCall [Mon, 17 Sep 2018 09:43:54 +0000 (10:43 +0100)]
dinit: remove unused variable.

5 years agodinitctl: unload: issue a specialised message if service not loaded.
Davin McCall [Fri, 14 Sep 2018 20:21:47 +0000 (21:21 +0100)]
dinitctl: unload: issue a specialised message if service not loaded.

5 years agodinitctl: fix incorrect exit status if start/stop fails to load service.
Davin McCall [Fri, 14 Sep 2018 20:13:11 +0000 (21:13 +0100)]
dinitctl: fix incorrect exit status if start/stop fails to load service.

5 years agodinitctl: give an error message if unrecognized option/command given.
Davin McCall [Fri, 14 Sep 2018 20:12:02 +0000 (21:12 +0100)]
dinitctl: give an error message if unrecognized option/command given.

An unrecognized option was just exiting silently, and an unrecognized
command would print the help text. Now, print an appropriate error in
each case.

5 years agoAvoid multiple cout statements when printing help.
Davin McCall [Fri, 14 Sep 2018 19:11:21 +0000 (20:11 +0100)]
Avoid multiple cout statements when printing help.

Print help as one big string rather than by one-per-line cout with endl.

5 years agoUpdated bundled Dasynq to 1.1.5.
Davin McCall [Fri, 14 Sep 2018 15:54:01 +0000 (16:54 +0100)]
Updated bundled Dasynq to 1.1.5.

5 years agoRemove some default copy constructors and their unintended uses.
Davin McCall [Thu, 13 Sep 2018 18:56:27 +0000 (19:56 +0100)]
Remove some default copy constructors and their unintended uses.

5 years agoBuild docs: document fuzz testing for control protocol.
Davin McCall [Thu, 13 Sep 2018 18:20:53 +0000 (19:20 +0100)]
Build docs: document fuzz testing for control protocol.

5 years agoTests: use consistent output spacing and flush before running each test.
Davin McCall [Thu, 13 Sep 2018 18:13:56 +0000 (19:13 +0100)]
Tests: use consistent output spacing and flush before running each test.

5 years agoAvoid undefined char* arithmetic.
Davin McCall [Thu, 13 Sep 2018 18:04:47 +0000 (19:04 +0100)]
Avoid undefined char* arithmetic.

Use uintptr_t instead of char* for "unusual" pointer arithmetic.

5 years agoTests: add another test.
Davin McCall [Thu, 13 Sep 2018 15:55:51 +0000 (16:55 +0100)]
Tests: add another test.

Add a test that starting a service which has a waits-for dependency on
another service, currently stopping, causes that service to restart
after stopping.

5 years agoAdjust dependency auto-break logic.
Davin McCall [Thu, 13 Sep 2018 15:33:34 +0000 (16:33 +0100)]
Adjust dependency auto-break logic.

If a service stops, and has a soft dependency from another service,
don't break the dependency if the service is waiting_on this one - in
that case we want to restart.

5 years agoMinor header/signature adjustments.
Davin McCall [Thu, 13 Sep 2018 14:38:38 +0000 (15:38 +0100)]
Minor header/signature adjustments.

Add const to some method arguments.

5 years agoDocumentation: overcommit must be enabled for address sanitizer (Linux).
Davin McCall [Thu, 13 Sep 2018 14:36:35 +0000 (15:36 +0100)]
Documentation: overcommit must be enabled for address sanitizer (Linux).

Tests may run with address sanitizer enabled, so overcommit must be
enabled or address sanitizer disabled.

5 years agoMinor documentation updates.
Davin McCall [Thu, 13 Sep 2018 12:42:10 +0000 (13:42 +0100)]
Minor documentation updates.

5 years agobuild: add target to run cppcheck.
Davin McCall [Wed, 25 Jul 2018 13:48:00 +0000 (14:48 +0100)]
build: add target to run cppcheck.

5 years agoFix a number of minor issues found by static analysis.
Davin McCall [Wed, 25 Jul 2018 12:33:26 +0000 (13:33 +0100)]
Fix a number of minor issues found by static analysis.

5 years agoservice options: add waits-for.d to automatically add dependencies.
Davin McCall [Fri, 13 Jul 2018 17:44:43 +0000 (18:44 +0100)]
service options: add waits-for.d to automatically add dependencies.

The waits-for.d option allows specifying a directory, and the names of
files within are added as waits-for dependencies (excludes names with a
leading dot).

5 years agotests: add control test (add/rm dependency).
Davin McCall [Thu, 12 Jul 2018 19:03:06 +0000 (20:03 +0100)]
tests: add control test (add/rm dependency).

5 years agocontrol: ensure shutdown type is valid.
Davin McCall [Thu, 12 Jul 2018 17:47:39 +0000 (18:47 +0100)]
control: ensure shutdown type is valid.

5 years agotests: make unload test more comprehensive.
Davin McCall [Thu, 12 Jul 2018 17:27:48 +0000 (18:27 +0100)]
tests: make unload test more comprehensive.

Specifically, make sure that the service that we request to unload is
not loaded afterwards.

5 years agotests: add control protocol test (unload).
Davin McCall [Tue, 10 Jul 2018 18:54:59 +0000 (19:54 +0100)]
tests: add control protocol test (unload).

5 years agotests: add control protocol test (start/stop service).
Davin McCall [Tue, 10 Jul 2018 16:37:13 +0000 (17:37 +0100)]
tests: add control protocol test (start/stop service).

5 years agotests: add another control protocol test (load service).
Davin McCall [Tue, 10 Jul 2018 11:14:16 +0000 (12:14 +0100)]
tests: add another control protocol test (load service).

5 years agoAdd fuzz testing for control protocol based on LLVM libFuzzer.
Davin McCall [Sun, 8 Jul 2018 21:12:15 +0000 (22:12 +0100)]
Add fuzz testing for control protocol based on LLVM libFuzzer.

5 years agotests: add some protocol tests.
Davin McCall [Mon, 9 Jul 2018 17:39:27 +0000 (18:39 +0100)]
tests: add some protocol tests.

5 years agotests: fix build deps for cptests.
Davin McCall [Mon, 9 Jul 2018 09:06:44 +0000 (10:06 +0100)]
tests: fix build deps for cptests.

5 years agotesting: small fixes.
Davin McCall [Mon, 9 Jul 2018 07:52:51 +0000 (08:52 +0100)]
testing: small fixes.

5 years agoAdd missing includes.
Davin McCall [Sun, 8 Jul 2018 21:21:50 +0000 (22:21 +0100)]
Add missing includes.

Compilation on Mac OS fails due to these.

5 years agobuild: re-arrange to build all tests then run all.
Davin McCall [Sun, 8 Jul 2018 19:08:10 +0000 (20:08 +0100)]
build: re-arrange to build all tests then run all.

This is better than building the main tests and running them, and then
building the control protocol tests and running them, since you see all
test results together.

5 years agotests: add c.p. test for list services command.
Davin McCall [Sun, 8 Jul 2018 19:02:51 +0000 (20:02 +0100)]
tests: add c.p. test for list services command.

5 years agoAdd contribution guide, including conduct statement.
Davin McCall [Sun, 8 Jul 2018 17:51:49 +0000 (18:51 +0100)]
Add contribution guide, including conduct statement.

5 years agoSome updates to the design document.
Davin McCall [Sun, 8 Jul 2018 17:00:43 +0000 (18:00 +0100)]
Some updates to the design document.

5 years agoMinor README fix.
Davin McCall [Sun, 8 Jul 2018 15:14:09 +0000 (16:14 +0100)]
Minor README fix.

5 years agoAdd initial control protocol test.
Davin McCall [Fri, 6 Jul 2018 17:19:57 +0000 (18:19 +0100)]
Add initial control protocol test.

This includes a lot of framework necessary for writing additional tests.

5 years agoMinor cleanup of header.
Davin McCall [Fri, 6 Jul 2018 20:32:51 +0000 (21:32 +0100)]
Minor cleanup of header.

5 years agodinitctl: add rm-dep subcommand to remove dependencies.
Davin McCall [Tue, 3 Jul 2018 16:43:54 +0000 (17:43 +0100)]
dinitctl: add rm-dep subcommand to remove dependencies.

5 years agocontrol: add command for removing dependencies.
Davin McCall [Tue, 3 Jul 2018 09:08:28 +0000 (10:08 +0100)]
control: add command for removing dependencies.

5 years agobuild: remove test executables on clean.
Davin McCall [Mon, 2 Jul 2018 20:55:17 +0000 (21:55 +0100)]
build: remove test executables on clean.

5 years agobuild: generate mconfig.h in include directory.
Davin McCall [Mon, 2 Jul 2018 20:48:41 +0000 (21:48 +0100)]
build: generate mconfig.h in include directory.

5 years agodinitctl: add-dep subcommand, adds dependency between services.
Davin McCall [Mon, 2 Jul 2018 18:24:09 +0000 (19:24 +0100)]
dinitctl: add-dep subcommand, adds dependency between services.

5 years agoservice: correctly roll-back state on exception (bad_alloc).
Davin McCall [Mon, 2 Jul 2018 16:26:26 +0000 (17:26 +0100)]
service: correctly roll-back state on exception (bad_alloc).

Since a service adds its dependencies to other services' dependents
lists, it needs to roll back those changes if failing due to a bad_alloc
(or other exception).

5 years agoImplement adding dependencies via control protocol.
Davin McCall [Mon, 2 Jul 2018 09:43:58 +0000 (10:43 +0100)]
Implement adding dependencies via control protocol.

5 years agoCorrect a comment.
Davin McCall [Sat, 23 Jun 2018 14:43:00 +0000 (15:43 +0100)]
Correct a comment.

5 years agoAdd DESIGN overview.
Davin McCall [Sat, 23 Jun 2018 14:41:37 +0000 (15:41 +0100)]
Add DESIGN overview.

5 years agodinitctl: fix spacing in output.
Davin McCall [Fri, 22 Jun 2018 20:04:30 +0000 (21:04 +0100)]
dinitctl: fix spacing in output.

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.

6 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.

6 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.

6 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.

6 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.

6 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.

6 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.

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

6 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.

6 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.

6 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.

6 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.

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

6 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.

6 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.

6 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).

6 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.

6 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.

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

6 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.

6 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).

6 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.

6 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.

6 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.

6 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.

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