Davin McCall [Tue, 6 Nov 2018 12:36:29 +0000 (12:36 +0000)]
Makefile: fix parallel build (issue #9)
Davin McCall [Tue, 6 Nov 2018 11:34:15 +0000 (11:34 +0000)]
Update TODO (one task done).
Davin McCall [Tue, 6 Nov 2018 11:32:32 +0000 (11:32 +0000)]
Install halt and reboot as links to shutdown.
Until now, halt and reboot were shell scripts that called shutdown.
Davin McCall [Mon, 5 Nov 2018 22:01:26 +0000 (22:01 +0000)]
shutdown: clean up error handling.
Davin McCall [Mon, 5 Nov 2018 11:05:47 +0000 (11:05 +0000)]
shutdown: use argv 0 to determine default action.
If called as "reboot", default action is to reboot, otherwise to halt
and power down.
Davin McCall [Fri, 2 Nov 2018 10:39:48 +0000 (10:39 +0000)]
Add man page for shutdown et al.
Davin McCall [Tue, 30 Oct 2018 19:03:27 +0000 (19:03 +0000)]
Minor edits to dinit-service man page.
Davin McCall [Tue, 30 Oct 2018 19:01:02 +0000 (19:01 +0000)]
Implement a "shares-console" option for non-exclusive console access.
This could be useful for the "single" (single-user) service, so that
runs-on-console services can be started from it.
Davin McCall [Mon, 29 Oct 2018 19:02:59 +0000 (19:02 +0000)]
Implement a "chain-to" service property.
This specifies that if a service completes, another service should be
started (specified by name and resolved at the time it is needed, not
beforehand).
This has applications for recovery ("single-user mode") services, and
for multi-stage booting where service descriptions are on a separate
filesystem which is mounted by a service in an initial stage.
Davin McCall [Sat, 27 Oct 2018 15:24:45 +0000 (16:24 +0100)]
man page: minor additions/edits.
Davin McCall [Sat, 27 Oct 2018 15:09:50 +0000 (16:09 +0100)]
Linux: only filter "auto" from command line if running as pid 1.
Davin McCall [Mon, 29 Oct 2018 12:17:51 +0000 (12:17 +0000)]
Improve comments / fix excessively long lines.
Davin McCall [Sat, 27 Oct 2018 14:57:54 +0000 (15:57 +0100)]
dinit man page: describe general operation.
Davin McCall [Sat, 27 Oct 2018 13:33:31 +0000 (14:33 +0100)]
Add -u/--user to force running as a user service manager.
Since running as root now runs as a system service manager by default,
provide an option not to do so.
Davin McCall [Sat, 27 Oct 2018 13:09:33 +0000 (14:09 +0100)]
Fix indentation.
Davin McCall [Fri, 26 Oct 2018 09:25:07 +0000 (10:25 +0100)]
Set control_socket_open false when closing the socket.
If we booted to single-user mode, we close the socket once it exits, so
we need to open it again. Leaving control_socket_open true means that we
don't do that, so set it false.
Davin McCall [Fri, 26 Oct 2018 09:23:41 +0000 (10:23 +0100)]
Add a few comments.
Davin McCall [Fri, 26 Oct 2018 09:15:06 +0000 (10:15 +0100)]
Minor style fix.
Davin McCall [Sun, 21 Oct 2018 22:47:34 +0000 (23:47 +0100)]
Comparison: overhaul.
Davin McCall [Sun, 21 Oct 2018 20:58:10 +0000 (21:58 +0100)]
Do not try to manage system (shutdown, reboot) if not running as PID 1.
If not PID 1, assume system management is being taken care of by a
separate primary init.
Davin McCall [Sun, 21 Oct 2018 16:51:08 +0000 (17:51 +0100)]
BUILD: minor update and rename to BUILD.txt.
The rename is to prevent Github from rendering the file with syntax
highlighting, urgh.
Davin McCall [Sun, 21 Oct 2018 14:53:06 +0000 (15:53 +0100)]
man page: add notes on character set.
Davin McCall [Sun, 21 Oct 2018 14:35:43 +0000 (15:35 +0100)]
manpage: fix formatting glitch.
Davin McCall [Sun, 21 Oct 2018 13:37:45 +0000 (14:37 +0100)]
Add missing include (fixes build on musl systems)
Davin McCall [Sat, 20 Oct 2018 14:38:40 +0000 (15:38 +0100)]
docs: mention that dinitctl enable defaults to boot as dependent.
Davin McCall [Sat, 20 Oct 2018 14:26:18 +0000 (15:26 +0100)]
dinit-util: include string header (FreeBSD build fix)
Davin McCall [Sat, 20 Oct 2018 14:20:55 +0000 (15:20 +0100)]
docs: use boot.d directory with example boot service
Davin McCall [Sat, 20 Oct 2018 14:19:26 +0000 (15:19 +0100)]
Update .gitignore
Davin McCall [Sat, 20 Oct 2018 14:16:31 +0000 (15:16 +0100)]
docs: prefer elogind to ConsoleKit2
Davin McCall [Sat, 20 Oct 2018 13:27:25 +0000 (14:27 +0100)]
Update version number, TODO.
Davin McCall [Sat, 20 Oct 2018 13:17:19 +0000 (14:17 +0100)]
Add NEWS file.
Davin McCall [Sat, 20 Oct 2018 13:00:54 +0000 (14:00 +0100)]
Fix minor (non-bug) issues picked up by cppcheck.
Davin McCall [Sat, 20 Oct 2018 11:19:31 +0000 (12:19 +0100)]
Re-name and fix documentation for ss_read().
The function actually reads until the complete requested amount is read
(or it hits end-of-file or another error).
Davin McCall [Fri, 19 Oct 2018 22:00:41 +0000 (23:00 +0100)]
service description: make waits-for.d path relative to service file.
If the path specified by waits-for.d is not absolute, it will be
interpreted as relative to the directory containing the service
description file.
Davin McCall [Fri, 19 Oct 2018 08:48:54 +0000 (09:48 +0100)]
Add code style guide.
Davin McCall [Thu, 18 Oct 2018 21:24:39 +0000 (22:24 +0100)]
Minor TODO updates.
Davin McCall [Thu, 18 Oct 2018 20:33:22 +0000 (21:33 +0100)]
service start_dep(): only bump acquire count if not already holding.
Davin McCall [Thu, 18 Oct 2018 20:17:24 +0000 (21:17 +0100)]
dinitctl: enable: correct argument order for symlink
Target, then link name, apparently.
Davin McCall [Thu, 18 Oct 2018 19:56:15 +0000 (20:56 +0100)]
dinitctl: correct logic for checking missing arguments.
Enable/disable commands can set 'to_service' without setting 'service';
check for this.
Davin McCall [Thu, 18 Oct 2018 19:44:57 +0000 (20:44 +0100)]
Allow '.' in setting names (for "waits-for.d").
Davin McCall [Thu, 18 Oct 2018 19:30:34 +0000 (20:30 +0100)]
Minor build fixes for Linux/Glibc.
Davin McCall [Thu, 18 Oct 2018 17:59:33 +0000 (18:59 +0100)]
dinitctl man: add enable and disable command descriptions.
Davin McCall [Thu, 18 Oct 2018 17:41:42 +0000 (18:41 +0100)]
dinitctl: implement "disable" command.
Opposite of "enable"; removes a dependency and unlinks the entry in
waits-for.d of the target service.
Davin McCall [Thu, 18 Oct 2018 09:34:06 +0000 (10:34 +0100)]
dinitctl: refactoring.
Davin McCall [Thu, 18 Oct 2018 09:12:24 +0000 (10:12 +0100)]
dinitctl: implement "enable" command.
This is for persistently enabling a service. The enabled service is
added as a dependency of its target (default "boot") and an entry is
added to the target's waits-for.d directory (which must be specified
exactly once in its service description).
Davin McCall [Wed, 17 Oct 2018 16:33:46 +0000 (17:33 +0100)]
tests: add test for control protocol ENABLESERVICE command.
Davin McCall [Tue, 16 Oct 2018 21:45:05 +0000 (22:45 +0100)]
control: add function to enable service.
This adds a dependency, and starts the dependent service if not already
started (and if the dependent is started/starting).
Davin McCall [Mon, 15 Oct 2018 17:57:52 +0000 (18:57 +0100)]
Factor out service description loading to a separate header.
This allows for reading service descriptions directly from dinitctl,
which is useful for planned "enable/disable service" functionality.
Davin McCall [Mon, 24 Sep 2018 17:50:11 +0000 (18:50 +0100)]
Reduce some source line lengths.
Davin McCall [Mon, 24 Sep 2018 17:30:24 +0000 (18:30 +0100)]
Move service type id constants into service-constants.h
Davin McCall [Mon, 24 Sep 2018 12:30:34 +0000 (13:30 +0100)]
dinitctl: reduce verbosity of help text, trim some lines.
Davin McCall [Mon, 24 Sep 2018 12:23:49 +0000 (13:23 +0100)]
dinitctl: add utility method to extract string from cpbuffer.
Davin McCall [Fri, 21 Sep 2018 16:29:01 +0000 (17:29 +0100)]
control: send current working dir in load mechanism reply packet.
The load paths are relative to the current working directory, so the
client needs to know what it is to resolve the paths properly.
Davin McCall [Tue, 18 Sep 2018 22:31:37 +0000 (23:31 +0100)]
cpbuffer extract(): use integer arithmetic instead of char pointer.
The method is designed to extract data to an arbitrary type, and while
char * should probably be safe to do that with, conversion to char * is
not specified in C++ as it is in C, and compilers are becoming more
aggressive.
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).
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.
Davin McCall [Mon, 17 Sep 2018 09:43:54 +0000 (10:43 +0100)]
dinit: remove unused variable.
Davin McCall [Fri, 14 Sep 2018 20:21:47 +0000 (21:21 +0100)]
dinitctl: unload: issue a specialised message if service not loaded.
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.
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.
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.
Davin McCall [Fri, 14 Sep 2018 15:54:01 +0000 (16:54 +0100)]
Updated bundled Dasynq to 1.1.5.
Davin McCall [Thu, 13 Sep 2018 18:56:27 +0000 (19:56 +0100)]
Remove some default copy constructors and their unintended uses.
Davin McCall [Thu, 13 Sep 2018 18:20:53 +0000 (19:20 +0100)]
Build docs: document fuzz testing for control protocol.
Davin McCall [Thu, 13 Sep 2018 18:13:56 +0000 (19:13 +0100)]
Tests: use consistent output spacing and flush before running each test.
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.
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.
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.
Davin McCall [Thu, 13 Sep 2018 14:38:38 +0000 (15:38 +0100)]
Minor header/signature adjustments.
Add const to some method arguments.
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.
Davin McCall [Thu, 13 Sep 2018 12:42:10 +0000 (13:42 +0100)]
Minor documentation updates.
Davin McCall [Wed, 25 Jul 2018 13:48:00 +0000 (14:48 +0100)]
build: add target to run cppcheck.
Davin McCall [Wed, 25 Jul 2018 12:33:26 +0000 (13:33 +0100)]
Fix a number of minor issues found by static analysis.
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).
Davin McCall [Thu, 12 Jul 2018 19:03:06 +0000 (20:03 +0100)]
tests: add control test (add/rm dependency).
Davin McCall [Thu, 12 Jul 2018 17:47:39 +0000 (18:47 +0100)]
control: ensure shutdown type is valid.
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.
Davin McCall [Tue, 10 Jul 2018 18:54:59 +0000 (19:54 +0100)]
tests: add control protocol test (unload).
Davin McCall [Tue, 10 Jul 2018 16:37:13 +0000 (17:37 +0100)]
tests: add control protocol test (start/stop service).
Davin McCall [Tue, 10 Jul 2018 11:14:16 +0000 (12:14 +0100)]
tests: add another control protocol test (load service).
Davin McCall [Sun, 8 Jul 2018 21:12:15 +0000 (22:12 +0100)]
Add fuzz testing for control protocol based on LLVM libFuzzer.
Davin McCall [Mon, 9 Jul 2018 17:39:27 +0000 (18:39 +0100)]
tests: add some protocol tests.
Davin McCall [Mon, 9 Jul 2018 09:06:44 +0000 (10:06 +0100)]
tests: fix build deps for cptests.
Davin McCall [Mon, 9 Jul 2018 07:52:51 +0000 (08:52 +0100)]
testing: small fixes.
Davin McCall [Sun, 8 Jul 2018 21:21:50 +0000 (22:21 +0100)]
Add missing includes.
Compilation on Mac OS fails due to these.
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.
Davin McCall [Sun, 8 Jul 2018 19:02:51 +0000 (20:02 +0100)]
tests: add c.p. test for list services command.
Davin McCall [Sun, 8 Jul 2018 17:51:49 +0000 (18:51 +0100)]
Add contribution guide, including conduct statement.
Davin McCall [Sun, 8 Jul 2018 17:00:43 +0000 (18:00 +0100)]
Some updates to the design document.
Davin McCall [Sun, 8 Jul 2018 15:14:09 +0000 (16:14 +0100)]
Minor README fix.
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.
Davin McCall [Fri, 6 Jul 2018 20:32:51 +0000 (21:32 +0100)]
Minor cleanup of header.
Davin McCall [Tue, 3 Jul 2018 16:43:54 +0000 (17:43 +0100)]
dinitctl: add rm-dep subcommand to remove dependencies.
Davin McCall [Tue, 3 Jul 2018 09:08:28 +0000 (10:08 +0100)]
control: add command for removing dependencies.
Davin McCall [Mon, 2 Jul 2018 20:55:17 +0000 (21:55 +0100)]
build: remove test executables on clean.
Davin McCall [Mon, 2 Jul 2018 20:48:41 +0000 (21:48 +0100)]
build: generate mconfig.h in include directory.
Davin McCall [Mon, 2 Jul 2018 18:24:09 +0000 (19:24 +0100)]
dinitctl: add-dep subcommand, adds dependency between services.
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).
Davin McCall [Mon, 2 Jul 2018 09:43:58 +0000 (10:43 +0100)]
Implement adding dependencies via control protocol.
Davin McCall [Sat, 23 Jun 2018 14:43:00 +0000 (15:43 +0100)]
Correct a comment.