2023-05-29  Ludovic Courtès  <ludo@gnu.org>

	build: Bump to version 0.10.1.
	* configure.ac: Bump to version 0.10.1.

	guix: Bump pseudo version number.
	* build-aux/guix/shepherd-package.scm (%shepherd-version): Bump.

2023-05-27  Ludovic Courtès  <ludo@gnu.org>

	tests: Test more service respawns.
	* tests/respawn.sh: Add call to 'default-respawn-limit' in $conf.
	Call 'assert_killed_service_is_respawned' in a loop.

	service: Add 'default-respawn-limit'.
	* modules/shepherd/service.scm (respawn-limit): Remove.
	(default-respawn-limit): New variable.
	(respawn-service): Honor it.
	* doc/shepherd.texi (Defining Services): Mention it.
	(Service De- and Constructors): Document it.
	* NEWS: Update.

2023-05-26  Ludovic Courtès  <ludo@gnu.org>

	service: Fix singular translatable string.
	Reported by Sebastian Rasmussen <sebras@gmail.com>.

	* modules/shepherd/service.scm (service-registry): Fix singular string.

2023-05-26  Ludovic Courtès  <ludo@gnu.org>

	shepherd: Make signal handling fiber an essential task.
	This ensures the signal handling loop can never exit.  Previously, this
	could in theory happen if, say, 'handle-SIGCHLD' would throw, though
	there is no clear scenario how this can happen.

	* modules/shepherd/service.scm (essential-task-thunk): New procedure.
	(essential-task-launcher): Use it.
	* modules/shepherd.scm (run-daemon): Define 'signal-handler'.
	Wrap it with 'essential-task-thunk' when launching it.

2023-05-26  Ludovic Courtès  <ludo@gnu.org>

	service: Do not attempt to restart transient services.
	* modules/shepherd/service.scm (perform-service-action): In 'restart',
	do not restart transient services.
	* tests/transient.sh: Test it.
	* NEWS: Update.

2023-05-26  Ludovic Courtès  <ludo@gnu.org>

	service: 'terminate-process' ignores 'kill' exceptions.
	This avoids a potential race condition whereby 'kill' would
	throw (because the process terminated in the meantime), and thus nobody
	would read from REPLY, leaving the monitor blocked in a 'put-message'
	call.

	* modules/shepherd/service.scm (terminate-process): Catch 'system-error'
	around 'kill'.

2023-05-26  Ludovic Courtès  <ludo@gnu.org>

	system: Add comment regarding 'pipe2'.
	* modules/shepherd/system.scm.in (pipe2): Use 'define'.  Update comment.

2023-05-25  Ludovic Courtès  <ludo@gnu.org>

	service: Restart replacements rather than original services upon "restart".
	Fixes <https://issues.guix.gnu.org/63717>.

	* modules/shepherd/service.scm (stop-service): When REPLACEMENT is true,
	add REPLACEMENT rather than SERVICE to the returned list.
	* tests/replacement.sh: Raise an error if the initial 'start' method is
	called more than once.  Use 'herd restart' rather than 'start' followed
	by 'stop'.  Ensure the replacement's 'start' method is called.
	* NEWS: Update.

2023-05-18  Ludovic Courtès  <ludo@gnu.org>

	doc: Clarify and illustrate 'herd eval root' & co.
	* doc/shepherd.texi (The root Service): Clarify that code is evaluated
	in the shepherd process.  Add 'herd eval root' examples.

	doc: Clarify when the service interface may be used.
	* doc/shepherd.texi (Services): Add note about valid usage contexts.

	service: Add #:bind-attempts to 'endpoint'.
	* modules/shepherd/service.scm (<endpoint>)[bind-attempts]: New field.
	* modules/shepherd/service.scm (default-bind-attempts): New variable.
	(endpoint): Add #:bind-attempts.
	(bind/retry-if-in-use): Change default value.
	(endpoint->listening-socket): Honor 'bind-attempts'.
	* doc/shepherd.texi (Service De- and Constructors): Document it.
	* NEWS: Update.

2023-05-14  Ludovic Courtès  <ludo@gnu.org>

	doc: Add missing newline in copyright section.
	* doc/shepherd.texi: Add missing newline.

2023-05-13  Ludovic Courtès  <ludo@gnu.org>

	doc: Homogenize variable definitions.
	* doc/shepherd.texi: Use @defvar throughout for variable definitions.

	build: Bump to version 0.10.0.
	* configure.ac: Bump to version 0.10.0.

	doc: Use title case for section titles.
	* doc/shepherd.texi (Coding Standards, Design Decisions): Capitalize.

	doc: Write "Service Internals".
	* doc/shepherd.texi (Interacting with Services): Link to "Service
	Internals".
	(Service Internals): Write it.

2023-05-13  Ludovic Courtès  <ludo@gnu.org>

	doc: Remove outdated section.
	The 'copy-hashq-table' procedure had been removed in
	4fb3a18499a325d194d99ab14feb557c9b9f90fd (2016).

	* doc/shepherd.texi (Others): Remove.

2023-05-13  Ludovic Courtès  <ludo@gnu.org>

	doc: Consistently use the term "procedure".
	* doc/shepherd.texi (Defining Services): Replace "@defun" with
	"@deffn {Procedure}"; always capitalize "Procedure".

	Update 'NEWS'.

2023-05-12  Ludovic Courtès  <ludo@gnu.org>

	Disable JIT on AArch64.
	This works around <https://github.com/wingo/fibers/issues/83>, which
	causes unexplained behavior such as messages sent twice.

	* shepherd.in: Set 'GUILE_JIT_THRESHOLD' to -1 and re-exec self when
	running on AArch64.

2023-05-09  Ludovic Courtès  <ludo@gnu.org>

	herd: Report the right time.
	* modules/shepherd/scripts/herd.scm (time->string): Report (localtime
	time), not (localtime now).

2023-05-07  Ludovic Courtès  <ludo@gnu.org>

	build: Bump to version 0.10.0rc2.
	* configure.ac: Bump to version 0.10.0rc2.

	nls: Update de, ro, and uk translations.

	tests: Remove tabs from 'status-sexp.sh'.
	* tests/status-sexp.sh: Remove tabs.

2023-05-07  Ludovic Courtès  <ludo@gnu.org>

	shepherd: 'start' action returns service sexp on success.
	This behavior was inadvertently changed in
	0fc51b65862f1386877340550c5c0309f9af13d9.

	* modules/shepherd.scm (process-command): For 'start', return SERVICE
	when 'start-service' succeeds.
	* tests/status-sexp.sh: Add test.

2023-05-06  Ludovic Courtès  <ludo@gnu.org>

	service: 'service->sexp' always emits 'one-shot?' and 'transient?'.
	In Guix, the (gnu services herd) client would check whether 'transient?
	is present to distinguish between shepherd >= 0.9.1 and earlier
	versions.  This lifts the ambiguity.

	* modules/shepherd/service.scm (service->sexp): Emit the 'one-shot?' and
	'transient?' properties unconditionally.
	* tests/status-sexp.sh: Adjust accordingly.

2023-05-06  Ludovic Courtès  <ludo@gnu.org>

	tests: Remove racy check after "herd stop root".
	Reported by Efraim Flashner <efraim@flashner.co.il>
	in <https://issues.guix.gnu.org/63178>.

	* tests/basic.sh: After "herd stop root", wait for a few more seconds if
	"kill -0 $shepherd_pid" succeeds.
	* tests/starting-status.sh: Remove racy "kill -0 $shepherd_pid" after
	"herd stop root".
	* tests/status-sexp.sh: Likewise.
	* tests/stopping-status.sh: Likewise.

2023-05-03  Ludovic Courtès  <ludo@gnu.org>

	tests: Individual tests time out after 3 minutes.
	This provides better diagnostics, and more quickly, when a test gets
	stuck.

	* configure.ac: Check for 'timeout'. Substitute 'TIMEOUT' and define
	'HAVE_TIMEOUT' conditional.
	* Makefile.am (SH_LOG_COMPILER) [HAVE_TIMEOUT]: New value.

2023-05-03  Ludovic Courtès  <ludo@gnu.org>

	tests: Initialize argument to 'accept' call.
	* tests/close-on-exec.sh: In C program, initialize 'len'.

2023-04-29  Ludovic Courtès  <ludo@gnu.org>

	tests: Correctly check for expected failures.
	The '! cmd' pattern was use to check for expected failures.  However,
	with 'set -e', a return status inverted with '!' does not cause the
	shell to exit immediately.

	See <https://issues.guix.gnu.org/62406>.

	* tests/basic.sh, tests/forking-service.sh, tests/inetd.sh,
	tests/respawn.sh, tests/services/monitoring.sh,
	tests/services/repl.sh, tests/starting-status.sh,
	tests/status-sexp.sh, tests/stopping-status.sh,
	tests/system-star.sh, tests/transient.sh: Replace ineffective "! cmd"
	pattern with "cmd && false" or "if cmd; then false; else true; fi" when
	in tail position.

2023-04-29  Ludovic Courtès  <ludo@gnu.org>

	monitoring: 'period' action returns #f on failure.
	* modules/shepherd/service/monitoring.scm (monitoring-service): In
	'period', return #f on failure.

2023-04-29  Ludovic Courtès  <ludo@gnu.org>

	tests: Improve synchronization in starting/stopping tests.
	This is a followup to 347d274e945334cbc0247512da84ccb9efcad0ff and
	f418f74a8e5848f5af0f94821c997410755f8579.

	* tests/starting-status.sh: Loop until 'herd status test' shows
	"starting".
	* tests/stopping-status.sh: Loop until 'herd status test' show "being
	stopped".

2023-04-29  Ludovic Courtès  <ludo@gnu.org>

	service: Use 'match' in 'start' and 'stop' implementations.
	* modules/shepherd/service.scm (service-controller): In 'start and
	'stop clauses, use 'match' instead of 'cond'.

2023-04-29  Ludovic Courtès  <ludo@gnu.org>

	service: Wait when attempting to stop a service in "starting" state.
	Previously, stopping a service would fail with "Service ~a might have
	failed to stop." if it was in 'starting' state.  Now it will wait until
	the service is running before attempting to stop it.

	* modules/shepherd/service.scm (service-controller): In 'stop' clause,
	when STATUS is 'starting, wait CONDITION then resend message to
	CHANNEL.  Send #f on REPLY only if STATUS is 'stopped.
	* tests/stopping-status.sh: Test it.

2023-04-29  Ludovic Courtès  <ludo@gnu.org>

	service: Wait when attempting to start a service in "stopping" state.
	Previously, a service could be started if it was in either 'stopped' or
	'stopping' state, which could lead to race conditions.

	* modules/shepherd/service.scm (service-controller): In 'start' clause,
	when STATUS is 'stopping, wait CONDITION then resend message to CHANNEL.
	* tests/stopping-status.sh: Test it.

2023-04-29  Ludovic Courtès  <ludo@gnu.org>

	doc: Add missing menu entry.
	This is a followup to 69f93a6d3eac94629ca90412ff8c942f47412e54.
	Texinfo 6.7 reports the missing menu entry, but Texinfo 7.0.3 does not.

	* doc/shepherd.texi (Services): Add missing entry.

2023-04-28  Ludovic Courtès  <ludo@gnu.org>

	tests: Skip 'close-on-exec.sh' when /proc/self/fd is missing.
	* tests/close-on-exec.sh: Skip when /proc/self/fd is missing.

2023-04-28  Ludovic Courtès  <ludo@gnu.org>

	tests: Make 'close-on-exec.sh' systemd test more robust.
	On some machines like relatively slow aarch64-linux boxes, the Guile
	program spawned by 'connect_to_server 5556' would crash with ECONNRESET,
	thus causing the test to fail.  The fix here is to systematically accept
	incoming connections for 'systemd-ctor', which should be deterministic.

	* tests/close-on-exec.sh: Change C program to accept the client
	connection when LISTEN_FDS is defined.  Increase the expected FD count
	for 'systemd-ctor'.

2023-04-28  Ludovic Courtès  <ludo@gnu.org>

	build: Bump to version 0.10.0rc1.
	* configure.ac: Bump to version 0.10.0rc1.

	Update 'NEWS'.

2023-04-28  Ludovic Courtès  <ludo@gnu.org>

	build: Remove shepherd/service/*.go on 'make clean'.
	This is a followup to c64804f3a95f0fc74bcf75cd76975f67817f797d.

	* Makefile.am (CLEANFILES): Add $(nodist_servicegosub_DATA):.

2023-04-28  Ludovic Courtès  <ludo@gnu.org>

	service: For inetd and systemd, retry 'bind' upon EADDRINUSE.
	Reported by Lars-Dominik Braun <ldb@leibniz-psychology.org>
	at <https://issues.guix.gnu.org/58485#13>.

	* modules/shepherd/service.scm (bind/retry-if-in-use): New procedure.
	(endpoint->listening-socket): Use it instead of 'bind'.
	* tests/inetd.sh: Test it.

2023-04-27  Ludovic Courtès  <ludo@gnu.org>

	repl: Update calls to deprecated 'start'.
	This is a followup to 0fc51b65862f1386877340550c5c0309f9af13d9.

	* modules/shepherd/service/repl.scm (spawn-child-service): Call
	'start-service' instead of 'start'.
	* tests/services/repl.sh: Likewise.

2023-04-27  Ludovic Courtès  <ludo@gnu.org>

	herd: Use 'strftime' rather than 'date->string' for 'status' output.
	* modules/shepherd/scripts/herd.scm (time->string)[absolute]: Use
	'strftime' instead of 'date->string'.

	service: Localize help message of the 'root' service.
	* modules/shepherd/service.scm (root-service): Wrap help message in
	'l10n'.

	service: 'shutdown-services' does not stop 'root'.
	* modules/shepherd/service.scm (service-controller): Remove
	'notify-termination' handler.
	(shutdown-services): Do not call 'stop-service' on ROOT-SERVICE.
	(root-service): Remove 'notify-termination' message.

	herd: Add 'graph' action.
	* modules/shepherd/scripts/herd.scm (display-service-graph): New
	procedure.
	(run-command, main): Handle 'graph' action.
	* tests/basic.sh: Add test.
	* doc/shepherd.texi (Jump Start, Defining Services): Mention 'herd
	graph'.

	doc: Update user services example.
	* doc/shepherd.texi (Managing User Services): Strip comment.
	Pass #:documentation, not #:docstring.

	doc: Clarify upfront what the config file does.
	* doc/shepherd.texi (Invoking shepherd): For '--config', enumerate what
	the file does, with cross-references.  Add index entry.
	(The root Service): Remove mention of (oop goops).
	(Service Examples): Add index entry.

	tests: Update for new 'register-services' interface.
	* tests/basic.sh, tests/close-on-exec.sh,
	tests/eval-load.sh, tests/file-creation-mask.sh,
	tests/forking-service.sh, tests/inetd.sh,
	tests/logging.sh, tests/one-shot.sh,
	tests/pid-file.sh, tests/replacement.sh,
	tests/respawn-throttling.sh, tests/respawn.sh,
	tests/restart.sh, tests/services/monitoring.sh,
	tests/services/repl.sh, tests/signals.sh,
	tests/starting-status.sh, tests/startup-failure.sh,
	tests/status-sexp.sh, tests/stopping-status.sh,
	tests/system-star.sh, tests/systemd.sh,
	tests/transient.sh: Pass 'register-services' a list.

	service: 'register-services' now takes a list of services.
	* modules/shepherd/service.scm (register-services): Deprecate the rest
	list form.  Improve docstring.
	(replace-service, make-inetd-constructor): Adjust accordingly.
	* modules/shepherd/service/repl.scm (spawn-child-service): Likewise.
	* modules/shepherd.scm (main): Likewise.
	* doc/shepherd.texi (Service Registry): Adjust accordingly.
	(Service Examples, Managing User Services)
	(Monitoring Service, REPL Service): Update examples.

	service: Rename 'make-actions' to 'actions'.
	* modules/shepherd/service.scm (make-actions): Rename to...
	(actions): ... this.
	(make-actions): Define as a deprecated alias for 'make-actions'.
	(<service>, service, root-service): Use 'actions'.
	* modules/shepherd/service/monitoring.scm (monitoring-service):
	Likewise.
	* tests/basic.sh, tests/replacement.sh: Adjust accordingly.
	* doc/shepherd.texi (Defining Services): Update accordingly.

	doc: Rewrite "Services" chapter to match GOOPS-less interface.
	* doc/shepherd.texi (Slots of service): Rename to...
	(Defining Services): ... this, and rewrite.
	(Methods of services): Rename to...
	(Interacting with Services): ... this, and rewrite.
	(Service Convenience): Remove.
	(Service Registry, Legacy GOOPS Interface): New sections.
	(Introduction): Remove reference to GOOPS.
	(NEW-YEARS): Add 2023.

	service: Record more service status changes.
	* modules/shepherd/service.scm (%max-recorded-status-changes): Bump.

2023-04-26  Ludovic Courtès  <ludo@gnu.org>

	herd: Report startup failures in event log.
	* modules/shepherd/scripts/herd.scm (display-event-log)[events]: Use
	'fold-right' instead of 'map'.  Detect and flag startup failures.
	Display 'startup-failure' events appropriately.
	* tests/startup-failure.sh: Test it.

	herd: Distinguish one-shot and transient services in event log.
	* modules/shepherd/scripts/herd.scm (display-event-log): Distinguish
	transient and one-shot services when rendering 'stopped' service.

	herd: Factorize 'live-service-failing?'.
	* modules/shepherd/scripts/herd.scm (live-service-failing?): New
	procedure.
	(display-status-summary): Use it.

2023-04-24  Ludovic Courtès  <ludo@gnu.org>

	herd: 'log' command errors out when there are no events.
	* modules/shepherd/scripts/herd.scm (display-event-log): Error out when
	SORTED is empty.

2023-04-23  Ludovic Courtès  <ludo@gnu.org>

	herd: Properly interpret value of 'transient?' property.
	Since 253ccf82de21b2a94e7609a01a853073df6157f5 the 'transient?' field
	would always have truth value.

	* modules/shepherd/scripts/herd.scm (sexp->live-service): Use TRANSIENT?
	as-is.

2023-04-23  Ludovic Courtès  <ludo@gnu.org>

	service: Use a ring buffer for event logs.
	This is marginally better than using the O(N) 'at-most' at every event.

	* modules/shepherd/support.scm (<ring-buffer>): New record type.
	(ring-buffer, ring-buffer-insert): New procedures.
	(ring-buffer->list): New procedure.
	* modules/shepherd/service.scm (service-controller): Turn 'changes' and
	'failures' into ring buffers.  Adjust uses accordingly.
	(service-startup-failures, service-status-changes): Compose with
	'ring-buffer->list'.

2023-04-23  Ludovic Courtès  <ludo@gnu.org>

	doc: Remove references to service conflicts.
	* doc/shepherd.texi (Introduction, Jump Start)
	(Slots of services): Remove references to conflicts.

	herd: Add 'log' command.
	* modules/shepherd/scripts/herd.scm (display-event-log): New procedure.
	(run-command): Implement it.
	(main): Recognize "log" as a one-argument command.
	* tests/basic.sh: Test 'herd log'.
	* doc/shepherd.texi (Jump Start): Mention 'herd log'.

2023-04-22  Ludovic Courtès  <ludo@gnu.org>

	herd: Show dates in a friendlier way.
	* modules/shepherd/scripts/herd.scm (time->string): New procedure.
	(display-service-status)[timestamp->string]: Remove.
	Use 'time->string' instead of 'timestamp->string'.

	herd: Display service start and stop date.
	* modules/shepherd/service.scm (service->sexp): Add 'status-changes'
	property.
	* modules/shepherd/scripts/herd.scm (<live-service>)[status-changes]:
	New field.
	(sexp->live-service): Fill it in.
	(display-service-status)[timestamp->string]: New procedure.
	Use it.  Display start and stop time.
	* tests/basic.sh, tests/forking-service.sh,
	tests/inetd.sh, tests/logging.sh, tests/one-shot.sh,
	tests/pid-file.sh, tests/respawn.sh, tests/restart.sh,
	tests/services/monitoring.sh, tests/services/repl.sh,
	tests/starting-status.sh, tests/startup-failure.sh,
	tests/stopping-status.sh, tests/system-star.sh,
	tests/systemd.sh, tests/transient.sh: Grep for "running" instead of
	"started".
	* tests/status-sexp.sh: Adjust to new sexp.

	service: Keep track of status change times.
	* modules/shepherd/service.scm (%max-recorded-status-changes): New
	variable.
	(service-controller): Add 'changes' variable.  Add 'status-changes'
	pattern.  Define 'update-status-changes'; in each status change, pass
	'changes'.
	(service-status-changes): New procedure.

2023-04-21  Ludovic Courtès  <ludo@gnu.org>

	maint: Add Guix System test to the manifest.
	* build-aux/manifest.scm (operating-system-with-latest-shepherd): New
	procedure.
	(system-test/base): New variable.
	(system-test->manifest-entry): New procedure.
	(system-tests): New variable.
	<top level>: Concatenate SYSTEM-TESTS to the other manifests.

2023-04-20  Ludovic Courtès  <ludo@gnu.org>

	herd: 'status' shows starting and stopping services separately.
	* modules/shepherd/scripts/herd.scm (live-service-status-predicate): New
	procedure.
	(display-status-summary): Use it to filter based on the status.  Display
	'starting' and 'stopping' services separately.
	* tests/starting-status.sh: Test it.

2023-04-20  Ludovic Courtès  <ludo@gnu.org>

	herd: Parse service sexps into records.
	This makes it easier to fiddle with service info.

	* modules/shepherd/scripts/herd.scm (<live-service>): New record type.
	(live-service-canonical-name): New procedure.
	(service-canonical-name): Remove.
	(sexp->live-service): New procedure.
	(display-status-summary): Expect a list of <live-service>; adjust
	accordingly.
	(display-service-status): Likewise.
	(run-command): Adjust callers accordingly.

2023-04-20  Ludovic Courtès  <ludo@gnu.org>

	service: Export more state accessors.
	* modules/shepherd/service.scm: Export more state accessors.

	guix: Set localstatedir.
	* build-aux/guix/shepherd-package.scm (shepherd)[arguments]:
	Add #:configure-flags.

2023-04-19  Ludovic Courtès  <ludo@gnu.org>

	herd: Make 'status' output more colorful.
	* modules/shepherd/colors.scm (highlight/error): New variable.
	* modules/shepherd/scripts/herd.scm (display-status-summary)
	(display-service-status): Use the highlight procedures.

	support: Add colors to 'report-error'.
	* modules/shepherd/support.scm (print-error-message): New procedure.
	(report-error): Make 'l10n' a literal.  Use 'print-error-message'.

	support: 'verify-dir' reports errors with 'report-error'.
	* modules/shepherd/support.scm (verify-dir): Use 'report-error' rather
	than 'local-output'.

2023-04-19  Ludovic Courtès  <ludo@gnu.org>

	Add (shepherd colors).
	Imported from Guix commit 84bd7cf9189574d9a966c4583f95bfe843e4b56a.

	* modules/shepherd/colors.scm: New file.
	* Makefile.am (dist_shepherdsub_DATA): Add it.

2023-04-19  Ludovic Courtès  <ludo@gnu.org>

	herd: 'herd status' distinguishes services that failed to start.
	* modules/shepherd/scripts/herd.scm (display-status-summary): Define
	'failing' and display them separately from stopped services.
	* tests/startup-failure.sh: Test it.

	Switch from SRFI-11 to SRFI-71.
	* modules/shepherd/scripts/herd.scm (display-status-summary): Switch to
	SRFI-71 'let*' instead of SRFI-11.
	* modules/shepherd/system.scm.in (%libc-reboot, sysconf, prctl)
	(getpgid, pipe2, sigprocmask): Likewise.

2023-04-18  Ludovic Courtès  <ludo@gnu.org>

	.guix-channel: Add primary URL.
	* .guix-channel: Add 'url'.

2023-04-16  Ludovic Courtès  <ludo@gnu.org>

	herd: Report startup failure.
	* modules/shepherd/scripts/herd.scm (display-service-status): Check
	'startup-failures'.  When the service is stopped and STARTUP-FAILURES is
	a pair, mark it as failing and report the startup failure time.
	* tests/startup-failure.sh: New file.
	* Makefile.am (TESTS): Add it.

	tests: Remove reference to non-existent file.
	* tests/eval-load.sh: Remove reference to "$stamp".

	service: Record time of last startup failures.
	* modules/shepherd/service.scm (%max-recorded-startup-failures): New
	variable.
	(service-controller): Add 'failures' variable.  Handle
	'startup-failures' messages.  In 'started-message?' and in
	'stopped-message?' clauses, updates FAILURES.
	(service-startup-failures): New procedure.
	(service->sexp): Add 'startup-failures' field.
	* modules/shepherd/support.scm (at-most): New procedure.
	* tests/status-sexp.sh: Adjust accordingly.

	Add missing 'l10n' calls.
	* modules/shepherd.scm (main): Add missing 'l10n' to 'process-args'
	argument.
	* modules/shepherd/scripts/halt.scm (main): Likewise.
	* modules/shepherd/scripts/reboot.scm (main): Likewise.

	comm: Capture the client command protocol version.
	* modules/shepherd/comm.scm (<shepherd-command>)[version]: New field.
	(%protocol-version): New variable.
	(shepherd-command): Add #:version.
	(read-command): Pass #:version.
	(write-command): Honor 'version' field.
	* modules/shepherd.scm (process-command): Update <shepherd-command>
	match pattern.

	shepherd: Factorize command message gathering.
	* modules/shepherd.scm (call-with-command-message-port): New procedure.
	(with-command-message-port): New macro.
	(process-command): Use it.

	service: 'stop-service' returns the list of stopped services, not names.
	* modules/shepherd/service.scm (stop-service): Return the list of
	stopped services rather than the list of canonical names.
	(perform-service-action): Adjust accordingly in 'restart' case.
	(stop): Call 'service-canonical-name' on the result.
	* modules/shepherd.scm (process-command): Likewise.
	* doc/shepherd.texi (Methods of services): Update accordingly.

	service: Turn 'stop' method into a procedure.
	* modules/shepherd/service.scm (stop): Rename to...
	(stop-service): ... this.  Turn into a procedure.
	(stop): Define as a deprecated method.
	(perform-service-action, deregister-service)
	(shutdown-services): Use 'stop-service' instead of 'stop'.
	* modules/shepherd/service/repl.scm (run-client-repl): Likewise.
	* modules/shepherd.scm (call-with-server-socket)
	(handle-SIGINT, process-command, process-textual-commands): Likewise.
	* doc/shepherd.texi (Methods of services): Update accordingly.
	(Service Convenience): Remove 'stop'.

	service: Turn 'start' method into a procedure.
	* modules/shepherd/service.scm (start): Rename to...
	(start-service): ... this.  Turn into a procedure.
	(start): Define as a deprecated method.
	(launch-service): Remove.
	(start-in-parallel, perform-service-action, make-inetd-constructor)
	(respawn-service): Adjust to use 'start-service' instead of 'start'.
	* modules/shepherd.scm (process-command): Likewise.
	* tests/inetd.sh, tests/logging.sh, tests/pid-file.sh,
	tests/respawn.sh, tests/signals.sh, tests/status-sexp.sh: Likewise.
	* doc/shepherd.texi (Methods of services): Document 'start-service'.
	(Service Convenience): Remove 'start'.
	(Managing User Services, Monitoring Service): Update examples.

	service: Turn 'action' method into a procedure.
	* modules/shepherd/service.scm (lookup-service): Make public.
	(action): Rename to...
	(perform-service-action): ... this.  Turn into a procedure.
	(issue-deprecation-warning): New procedure.
	(define-deprecated-method): Use it.
	(define-deprecated-method/rest): New macro.
	(action): Define as a deprecated method.
	* modules/shepherd/support.scm (make-bare-init-file): Suggest
	'perform-service-action', not 'action'.
	(Managing User Services): Likewise.
	* modules/shepherd.scm (process-command): Define 'service'.  Call
	'perform-service-action' instead of 'action'.
	* tests/basic.sh: Likewise.
	* doc/shepherd.texi (Methods of services): Adjust accordingly.
	(Service Convenience): Remove 'action'.

	service: Turn 'doc' method into a procedure.
	* modules/shepherd/service.scm (doc): Rename to...
	(display-service-documentation): ... this.  Turn into a regular
	procedure.  Keep private.
	(action): Adjust accordingly.

	monitoring: Log registered service names.
	* modules/shepherd/service.scm (service-registry): Handle
	'service-name-count' messages.
	(service-name-count): New procedure.
	* modules/shepherd/service/monitoring.scm (log-monitoring-stats): Use
	it.
	* tests/services/monitoring.sh: Add test.
	* doc/shepherd.texi (Monitoring Service): Adjust example.

	service: Use 'lookup-service' instead of 'lookup-services'.
	* modules/shepherd/service.scm (launch-service): Change to use
	'lookup-service' (singular).
	(start-in-parallel): Likewise.
	(deregister-service): Likewise.
	(stop <symbol>): Likewise.
	(action <symbol>): Likewise.
	(first-running, lookup-running-or-providing): Remove.
	(lookup-running): Rewrite.

2023-04-08  Ludovic Courtès  <ludo@gnu.org>

	service: Replace 'lookup-services' with 'lookup-service' (singular).
	This is a followup to 7e206fbad57578f67d34ff1804880ae099f10b01.

	* modules/shepherd/service.scm (lookup-service): New procedure.
	(lookup-services): Rewrite and deprecate.
	(service-registry): Change 'lookup' reply to use 'vhash-assq' instead of
	'vhash-foldq*'.
	* doc/shepherd.texi (Service Convenience): Update accordingly.

2023-04-08  Ludovic Courtès  <ludo@gnu.org>

	service: Deprecate the 'enable' and 'disable' methods.
	* modules/shepherd/service.scm (action): Use 'enable-service' and
	'disable-service' and print a message.
	(enable, disable): Deprecate.

2023-04-06  Ludovic Courtès  <ludo@gnu.org>

	service: Use 'service' procedure to replace (make <service> ...).
	* doc/shepherd.texi, modules/shepherd/service/monitoring.scm,
	modules/shepherd/service/repl.scm,
	modules/shepherd/support.scm: Replace (make <service> ...) with the
	new (service ...) form.
	* tests/basic.sh, tests/close-on-exec.sh,
	tests/eval-load.sh, tests/file-creation-mask.sh,
	tests/forking-service.sh, tests/inetd.sh, tests/logging.sh,
	tests/one-shot.sh, tests/pid-file.sh, tests/replacement.sh,
	tests/respawn-throttling.sh, tests/respawn.sh, tests/restart.sh,
	tests/signals.sh, tests/starting-status.sh,
	tests/status-sexp.sh, tests/stopping-status.sh,
	tests/system-star.sh, tests/systemd.sh, tests/transient.sh: Likewise.

2023-04-06  Ludovic Courtès  <ludo@gnu.org>

	service: Provide 'service' constructor.
	This is meant to supersede (make <service> ...).

	* modules/shepherd/service.scm (service): New procedure.
	(make-inetd-constructor, root-service): Use it instead of 'make'.

2023-04-06  Ludovic Courtès  <ludo@gnu.org>

	service: Mark action and state methods as deprecated.
	* modules/shepherd/service.scm (service-running?, service-stopped?)
	(service-action-list, lookup-service-action, service-defines-action?):
	New procedures.
	(define-deprecated-method): New macro.
	(define-deprecated-service-getter): Redefine in terms of
	'define-deprecated-method'.
	(action-list, running?, stopped?, enabled?, lookup-action)
	(defines-action): Define as deprecated methods.  Adjust users
	accordingly.
	* doc/shepherd.texi (Methods of services): Adjust accordingly.

	service: Replace 'canonical-name' method with 'service-canonical-name'.
	* modules/shepherd/service.scm (canonical-name): Redefine in using
	'define-deprecated-service-getter'.
	(service-canonical-name): New procedure.
	Update users of 'canonical-name' to 'service-canonical-name'.
	* doc/shepherd.texi (Methods of services): Adjust accordingly.

2023-04-06  Ludovic Courtès  <ludo@gnu.org>

	Remove example of the 'unknown' service.
	This is a followup to 2afe1feeee4f2b23e9fa70bb8462b59d37f34f72.

	* doc/examples/_unknown.scm: Remove.
	* Makefile.am (EXTRA_DIST): Remove it.

2023-04-06  Ludovic Courtès  <ludo@gnu.org>

	service: Add getters for <service> and remove uses of 'slot-ref'.
	* modules/shepherd/service.scm (<service>)[start, stop, actions]
	[handle-termination, docstring]: Add #:getter.
	* modules/shepherd/service.scm (service-controller):
	(action-list, lookup-action, start, stop, doc)
	(service->sexp): Use getters instead of 'slot-ref'.

	service: Rename <service> getters following Scheme conventions.
	* modules/shepherd/service.scm (<service>): Rename getters following
	Scheme conventions.  Update users.
	(define-deprecated-service-getter): New macro.
	(provided-by, required-by, one-shot?, transient?, respawn?): Define
	using 'define-deprecated-service-getter'.
	* doc/shepherd.texi (Methods of services): Adjust accordingly.

2023-04-05  Ludovic Courtès  <ludo@gnu.org>

	comm: Remove use of (oop goops).
	* modules/shepherd/comm.scm (%record-serializers): New variable.
	(define-record-type-serializer): New macro.
	(result->sexp): Turn into a regular procedure.
	* modules/shepherd/service.scm (service->sexp): Define with
	'define-record-type-serializer'.
	(result->sexp): Remove method.

	args: Remove use of (oop goops).
	* modules/shepherd/args.scm (<option>): Turn into a SRFI-9 record type.
	(option): New procedure.
	(optional-arg?, long-option-string, display-doc): Turn into regular
	procedures and adjust to accessor name changes.
	(process-args): Adjust to accessor name changes.
	* modules/shepherd.scm (main): Adjust to new option interface.
	* modules/shepherd/scripts/herd.scm, modules/shepherd/scripts/halt.scm,
	modules/shepherd/scripts/reboot.scm: Likewise.

2023-03-25  Ludovic Courtès  <ludo@gnu.org>

	service: Print "already running" message in 'launch-service', not 'start'.
	That way, the message gets printed when running, say, "herd start
	root" (until now that command wouldn't print anything), but it's not
	printed when starting services in parallel and possibly calling 'start'
	several times on the same service.

	* modules/shepherd/service.scm (start): Move "already running" message
	to...
	(launch-service): ... here.
	* tests/basic.sh: Test it.

2023-03-25  Ludovic Courtès  <ludo@gnu.org>

	service: Make 'launch-service' private.
	* modules/shepherd/service.scm (launch-service): Remove 'proc'
	parameter and adjust caller.  Make it private.

	service: Remove redundant condition in 'start'.
	* modules/shepherd/service.scm (start): Remove redundant and racy
	'service-status' check.  Move "already running" message to after
	'start' message reply.

2023-03-25  Ludovic Courtès  <ludo@gnu.org>

	service: 'make-systemd-constructor' supports starting processes eagerly.
	This is useful when the synchronization afforded by socket activation is
	welcome, yet we need the process to start right away; an example that
	falls into this category is "guix publish --advertise", which should
	start right away so it can start advertising itself.

	* modules/shepherd/service.scm (make-systemd-constructor): Add #:lazy-start?
	parameter and honor it.
	* modules/shepherd/support.scm (blocking-port): New procedure.
	* tests/systemd.sh: Add 'test-systemd-unix-eager' service and test it.
	* doc/shepherd.texi (Service De- and Constructors): Update documentation.

2023-03-25  Ludovic Courtès  <ludo@gnu.org>

	service: Catch exceptions of essential tasks.
	* modules/shepherd/service.scm (essential-task-launcher): New procedure.
	(spawn-process-monitor, spawn-service-registry): Define in terms of
	'essential-task-launcher'.

	repl: Delete socket before starting.
	* modules/shepherd/service/repl.scm (repl-service): In 'start' method,
	start by deleting SOCKET-FILE.

	shepherd: Define and use 'replace-core-bindings!'.
	* modules/shepherd.scm (replace-core-bindings!): New macro.
	(main): Use it instead of hand-crafted 'set!' sequences.

2023-03-25  Ludovic Courtès  <ludo@gnu.org>

	shepherd: Replace 'primitive-load' with a Scheme implementation.
	As of Guile 3.0.9, 'primitive-load' is implemented in C, which makes it
	a continuation barrier.  This patch addresses that.

	This is necessary because 'guix system reconfigure' does something like
	"herd eval root '(map primitive-load files)'" where each file might
	evaluate code that needs to suspend the current fiber.

	* modules/shepherd.scm (main): Replace 'primitive-load' with
	'primitive-load*'.
	* modules/shepherd/support.scm (primitive-load*): Export.
	* tests/eval-load.sh: New file.
	* Makefile.am (TESTS): Add it.

2023-03-24  Ludovic Courtès  <ludo@gnu.org>

	service: 'stop' no longer prints an extra "has been stopped" message.
	This message was redundant with those printed by 'service-controller'.
	More importantly, it could be misleading: SERVICE might be in the
	'stopping' state at this point, in which case (running? service) returns #f
	and the "could not be stopped" message would wrongfully be printed.

	* modules/shepherd/service.scm (stop): Remove redundant and possibly
	misleading message.

2023-03-24  Ludovic Courtès  <ludo@gnu.org>

	service: 'make-systemd-destructor' returns #f once it has closed ports.
	Previously it would return a truth value, leading to misleading
	"Service ~a might have failed to stop." messages.

	* modules/shepherd/service.scm (make-systemd-destructor): Return #f
	after calling 'close-port'.

2023-03-24  Ludovic Courtès  <ludo@gnu.org>

	service: Remove now irrelevant 'conflicts-with' methods.
	This is a followup to fc6e37c5ec46ea68437a2baf42d427a4125058c1: since
	there cannot be different services with the same name, there cannot be
	conflicts and these two methods are irrelevant.  This has been the case
	since the introduction of replacements in
	9ec5c0000e9a45441417a6ee4138cdcbf1b1f2b2.

	* modules/shepherd/service.scm (conflicts-with, conflicts-with-running):
	Remove.
	(service->sexp): Always return the empty list for 'conflicts'.
	(start): Remove conflicts case.
	* modules/shepherd/scripts/herd.scm (display-service-status): Remove
	conflicts.
	* doc/shepherd.texi (Methods of services): Adjust accordingly.

2023-03-24  Ludovic Courtès  <ludo@gnu.org>

	service: Removed unnecessary and racy 'handle-termination' messages.
	* modules/shepherd/service.scm (service-controller): Do not send
	'notify-termination' message after calling the 'handle-termination'
	slot: the 'notify-termination' message could be received *before*
	'handle-termination' has run and sent a 'handle-termination' message,
	in which case we'd fail to respawn the service.
	(stop): Do not send 'notify-termination' message: it is redundant with
	the 'stopped-message?' sent once the 'stop' procedure has completed.

2023-03-24  Ludovic Courtès  <ludo@gnu.org>

	service: Move service process monitoring to service controller.
	This fixes a possible race condition whereby the 'find-service' call in
	'process-monitor' could see the wrong running value, for instance
	because the service is being started and hasn't yet recorded the PID as
	its running value.

	* modules/shepherd/service.scm (process-monitor): Remove call to
	'find-service' and subsequent 'handle-service-termination' call.
	(monitor-service-process): New procedure.
	(handle-service-termination): Add PID parameter and pass it to the
	controller.
	(service-controller)[pid?]: New procedure.
	In 'started-message?' and 'change-value-message?' clauses, add call to
	'monitor-service-process' when NEW-VALUE looks like a PID.
	Add 'pid' argument to 'handle-termination' message; leave value
	unchanged when STATUS is 'stopped' or VALUE is not PID.

2023-03-24  Ludovic Courtès  <ludo@gnu.org>

	service: Change protocol for systemd services whose value changes.
	The value change is now explicit instead of being the mutation of a
	closed-over variable.

	* modules/shepherd/service.scm (service-controller)
	[*change-value*, change-value-message?]: New variables.
	On 'started-message?', special-case values that are procedures.
	Handle 'change-value-message?'.
	(service-running-value): Rewrite in terms of 'service-control-message'.
	(make-systemd-constructor): Return a one-argument procedure instead of
	mutating the 'running' variable.

2023-03-23  Ludovic Courtès  <ludo@gnu.org>

	service: Remove unused 'make-service-group' macro.
	* modules/shepherd/service.scm (make-service-group): Remove.

2023-03-22  Ludovic Courtès  <ludo@gnu.org>

	monitoring: Log one last time before stopping.
	* modules/shepherd/service/monitoring.scm (run-monitoring-service): Add
	call to 'log-monitoring-stats' in 'stop' message handler.

2023-03-22  Ludovic Courtès  <ludo@gnu.org>

	service: Registry explicitly has only one service with a given name.
	This was already the case before but parts of the code, such as the
	'service-list' message handler in 'service-registry', maintained the
	illusion that there could be several same-named services.

	* modules/shepherd/service.scm (service-registry): Simplify
	'service-list' based on the assumption that there can only be one
	service for each name: registering a service with the same name as an
	existing one turns it into a "replacement" for that service.
	(lookup-canonical-service): Remove.
	(fold-services): Expect a single service in the alist returned by
	'service-list'.

2023-03-22  Ludovic Courtès  <ludo@gnu.org>

	service: Registry replaces service anytime a same-named service is found.
	* modules/shepherd/service.scm (service-registry): In 'register' clause,
	look for a service with any name provided by SERVICE, as opposed to just
	its canonical name.

2023-03-22  Ludovic Courtès  <ludo@gnu.org>

	service: One-short services really started once by 'start-in-parallel'.
	This is a followup to f4c48666d41040fef8c1e9ee6c474f45139017a2, which
	was ineffective in some cases, such as with 'start-in-the-background' as
	shown in the test.

	* modules/shepherd/service.scm (start-in-parallel): Move 'hashq-set!'
	call before 'start'.
	* tests/one-shot.sh: Test it.

2023-03-20  Ludovic Courtès  <ludo@gnu.org>

	service: 'start-in-the-background' prints failed service names.
	So far it would print the service objects themselves.

	* modules/shepherd/service.scm (start-in-the-background): Map
	'canonical-name' over FAILURES.

2023-03-19  Ludovic Courtès  <ludo@gnu.org>

	service: Remove 'enforce' methods.
	* modules/shepherd/service.scm (enforce): Remove.
	* modules/shepherd.scm (process-command): Remove special treatment of
	'enforce' action.

2023-03-19  Ludovic Courtès  <ludo@gnu.org>

	service: One-shot services are started only once by 'start-in-parallel'.
	Previously, since commit c195b87c275f39391c90a75a8843d4f6aedeb9c2, the
	same one-shot service could be started several times if several services
	depend on it.  This change ensures each one-shot service is started only
	once.

	* modules/shepherd/service.scm (%one-shot-services-started): New variable.
	(start-in-parallel): Parameterize it.  Call 'lookup-services' on
	elements of SERVICES that are symbols.  When starting a one-shot
	service, call 'start' if and only if it's not already in
	%ONE-SHOT-SERVICES-STARTED.
	* tests/one-shot.sh: Add test.

2023-03-18  Ludovic Courtès  <ludo@gnu.org>

	support: Add 'let-loop' and use it in 'service-controller'.
	* modules/shepherd/support.scm (let-loop): New macro.
	* modules/shepherd/service.scm (service-controller): Use it.
	* .dir-locals.el (scheme-mode): Add 'let-loop'.

	service: Remove 'replacement' slot, thread it in the controller.
	* modules/shepherd/service.scm (<service>)[replacement]: Remove.
	(service-controller): Add 'replacement' variable and thread it.  Adjust
	'replace-if-running' handling accordingly.  Add clause for 'replacement'
	messages.
	(service-replacement): New procedure.
	(stop): Use it instead of accessing the 'replacement' slot.

2023-03-18  Ludovic Courtès  <ludo@gnu.org>

	service: Terminate controlling fiber of unregistered services.
	Previously, when replacing or unloading a service, its service fiber
	would be kept and left running (idle, though).

	* modules/shepherd/service.scm (service-controller): Handle 'terminate
	message.
	(stop): Move replacement handling at the very end.
	(service-registry)[unregister]: Send 'terminate message to each one of
	SERVICES.

2023-03-18  Ludovic Courtès  <ludo@gnu.org>

	service: Unregistering no longer leads to service duplicates.
	Previously, the 'unregister' procedure would register the same service
	multiple times.  For instance, ROOT-SERVICE provides 'root' and
	'shepherd', so it would appear four times in the REGISGTERED vhash
	instead of two.

	* modules/shepherd/service.scm (service-registry)[unregister]: Install
	just the one pair at hand instead of folding over (provided-by service).

2023-03-17  Ludovic Courtès  <ludo@gnu.org>

	service: Remove unused variable in 'shutdown-services'.
	* modules/shepherd/service.scm (shutdown-services): Remove
	'running-services'.

	service: Soften message when 'stop' returns a truth value.
	* modules/shepherd/service.scm (service-controller): Soften message when
	STOPPED? is false.

2023-03-16  Ludovic Courtès  <ludo@gnu.org>

	service: Remove undocumented 'depends-resolved?' method.
	* modules/shepherd/service.scm (depends-resolved?): Remove.

	Remove unused private procedure.
	* modules/shepherd.scm (start-in-order): Remove.

2023-03-15  Ludovic Courtès  <ludo@gnu.org>

	service: 'start-in-parallel' catches 'start' failures.
	Previously we'd leave a 'start-in-parallel' fiber behind in the event a
	service would fail to start.

	* modules/shepherd/service.scm (start-in-parallel): Catch
	'action-runtime-error?' when calling 'start' and report it.

2023-03-15  Ludovic Courtès  <ludo@gnu.org>

	service: Correctly log failure to start a service.
	* modules/shepherd/service.scm (service-controller): In 'start' handler,
	report "failed to start" when RUNNING is false.

2023-03-13  Ludovic Courtès  <ludo@gnu.org>

	comm: Remove 'start-logging' and 'stop-logging'.
	These were deprecated in
	f7925b2227debde91ece17cc91981e4491936b72 (March 2018).

	* modules/shepherd/comm.scm (start-logging, stop-logging): Remove.

2023-03-13  Ludovic Courtès  <ludo@gnu.org>

	service: Controller and 'start' method inherit the right output port.
	Previously, when creating and starting a service from the REPL (as shown
	in the test), the controller and 'start' method would inherit
	'current-output-port' from the REPL; that is, they would talk directly
	over the REPL socket.  Once the REPL has terminated, the controller
	would find itself attempting to write messages to a closed file port.
	Likewise for the service's body if it inherited current-output-port from
	its 'start' method.  This commit fixes that.

	* modules/shepherd/comm.scm (%current-service-output-port): New
	variable.
	* modules/shepherd.scm (main): Parameterize it and parameterize
	'current-output-port' accordingly.
	* modules/shepherd/service.scm (spawn-service-controller): Parameterize
	'current-output-port' and 'current-error-port'.
	(start): Likewise around call to 'start'.
	* tests/services/repl.sh: Add test.

2023-03-13  Ludovic Courtès  <ludo@gnu.org>

	service: Don't say "running with value" when service failed to start.
	* modules/shepherd/service.scm (service-controller): Do not emit
	"running with value" message when VALUE is false.

2023-03-12  Ludovic Courtès  <ludo@gnu.org>

	Add REPL service.
	* modules/shepherd/service/repl.scm, tests/services/repl.sh: New files.
	* Makefile.am (dist_servicesub_DATA, TESTS): Add them.
	* doc/shepherd.texi (REPL Service): New section.
	* po/POTFILES.in: Add 'repl.scm'.

	comm: Add 'open-server-socket'.
	* modules/shepherd.scm (open-server-socket): Move to...
	* modules/shepherd/comm.scm (open-server-socket): ... here.

	Add resource monitoring service.
	* modules/shepherd/service/monitoring.scm: New file.
	* modules/shepherd/service.scm (get-message*): Export.
	* tests/services/monitoring.sh: New file.
	* doc/shepherd.texi (Service Collection): New chapter.
	* po/POTFILES.in: Add 'monitoring.scm'.
	* Makefile.am (servicesubdir, servicegosubdir)
	(dist_servicesub_DATA, nodist_servicegosub_DATA): New variables.
	(TESTS): Add 'tests/services/monitoring.sh'.

2023-03-11  Ludovic Courtès  <ludo@gnu.org>

	doc: Recommend against 'make-system-constructor'.
	* doc/shepherd.texi (Service De- and Constructors): Move
	'make-system-constructor' and 'make-system-destructor' to the bottom and
	recommend against them.

2023-03-11  Ludovic Courtès  <ludo@gnu.org>
	    Ulf Herrman  <striness@tilde.club>.

	service: Define 'spawn-shell-command' and use it to replace 'system'.
	* modules/shepherd/service.scm (spawn-shell-command): New procedure.
	(make-system-constructor, make-system-destructor): Use it.
	* modules/shepherd.scm (main): Install 'spawn-shell-command' as a
	replacement for 'system'.

2023-03-11  Ludovic Courtès  <ludo@gnu.org>

	tests: Add 'make-system-constructor' test.
	* tests/basic.sh: Define 'spawn-with-system' test and use it.

2023-03-10  Ludovic Courtès  <ludo@gnu.org>

	maint: Add Guix manifest for continuous integration.
	This commit turns the repository into a Guix channel, which in turn lets
	tools such as Cuirass treat it as such and build what 'manifest.scm'
	specifies.

	* build-aux/manifest.scm, .guix-channel: New files.
	* Makefile.am (EXTRA_DIST): Add 'build-aux/manifest.scm'.

2023-03-10  Ludovic Courtès  <ludo@gnu.org>

	maint: Add 'guix.scm' file.
	* build-aux/guix/shepherd-package.scm, guix.scm: New files.
	* Makefile.am (EXTRA_DIST): Add them.
	* README (Hacking): Update.

2023-03-06  Ludovic Courtès  <ludo@gnu.org>

	service: Print "has been started" message only once.
	* modules/shepherd/service.scm (start): Print "has been started" message
	only when we won the race.

2023-03-06  Ludovic Courtès  <ludo@gnu.org>

	service: Remove unnecessary termination message for one-shot services.
	Suggested by bjc on #guix.

	* modules/shepherd/service.scm (start): Remove unnecessary
	'notify-termination' message for one-shot services.

2023-03-05  Ludovic Courtès  <ludo@gnu.org>

	support: Update copyright year in '--version' output.
	* modules/shepherd/support.scm (display-version): Update to 2023.

	service: Thread 'enabled?' boolean in service controller fiber.
	* modules/shepherd/service.scm (<service>)[enabled?]: Remove.
	(service-controller): Thread 'enabled?' through the loop.  Add clauses
	for 'enabled?', 'enable', and 'disable'.
	(service-enabled?, enable-service, disable-service): New procedures.
	(enabled?): New method.
	(enable): Call 'enable-service' instead of changing the 'enabled?' slot.
	(disable): Likewise.
	(start, service->sexp, process-monitor): Use 'service-enabled?' instead
	of 'enabled?'.
	(respawn-service): Call 'disable-service' instead of changing the
	'enabled?' slot.

	service: Thread respawn times in the service controller fiber.
	* modules/shepherd/service.scm (<service>)[last-respawns]: Remove.
	(service-controller): Add 'respawns' argument.  Add clauses for
	'respawn-times' and 'record-respawn-time' messages.
	(service-control-message): New procedure.
	(service-status): Redefine in terms of 'service-control-message'.
	(service-status, record-service-respawn-time): New procedures.
	(stop): Remove modification of the 'last-respawns' slot.
	(service->sexp): Replace reference to the 'last-respawns' slot with a
	'service-respawn-times' call.
	(respawn-service): Likewise, and replace 'last-respawns' modification
	with a call to 'record-service-respawn-time'.
	* doc/shepherd.texi (Slots of services): Remove references to
	'last-respawns' slot.

	service: Move termination handling to the service controller.
	* modules/shepherd/service.scm (service-controller): Add clause for
	'handle-termination' messages.
	(stop): Remove temporary modification of the 'handle-termination' slot
	of SERVICE since it's no longer needed.
	(handle-service-termination): Change to send a 'handle-termination'
	message to SERVICE's control channel.

2023-03-04  Ludovic Courtès  <ludo@gnu.org>

	service: 'spawn-command' takes keyword parameters.
	Fixes <https://issues.guix.gnu.org/60106>.

	* modules/shepherd/service.scm (process-monitor): 'spawn' message now
	expects an argument list, passes it to 'fork+exec-command'.
	(spawn-via-monitor): Rename 'command' to 'arguments'.
	(spawn-command): Change to accept #:user, #:group,
	 #:environment-variables, #:directory, and #:resource-limits.
	* modules/shepherd.scm (main): Adjust 'system*' replacement
	accordingly.

2023-03-04  Jan (janneke) Nieuwenhuizen  <janneke@gnu.org>

	doc: Update user services example for `services already running'.
	The previously suggested example now gives

	    Services already running, so not daemonizing.

	which is fixed by daemonizing right away.

	This is a follow-up to commit
	    3197c1c161d10b7f76771a2943f20fdafc5cc14a
	    service: 'daemonize' action does nothing when services are already running.

	* doc/shepherd.texi (Managing User Services): Daemonize before starting
	services.

2023-03-02  ulfvonbelow  <striness@tilde.club>
	    Ludovic Courtès  <ludo@gnu.org>

	service: Propagate exceptions while spawning in process monitor.
	* modules/shepherd/service.scm (unboxed-errors): new procedure.
	  (boxed-errors): new syntax.
	  (process-monitor): use it to propagate exceptions from fork+exec-command via
	  reply channel.
	  (spawn-via-monitor): new procedure.
	  (spawn-command): use it.
	* tests/system-star.sh: Add test.

2023-03-02  Ludovic Courtès  <ludo@gnu.org>

	service: When 'start' throws, mark the service as "stopped".
	Previously the service would be left indefinitely in 'starting' status
	because there would never be a message on NOTIFICATION.

	* modules/shepherd/service.scm (start): In 'catch' handler around
	'start' call, add 'put-message' call before 'report-exception'.
	* tests/basic.sh: Check that the status of 'broken' is stopped after
	attempting to start it.

2023-03-02  Ludovic Courtès  <ludo@gnu.org>

	tests: Check 'system*' behavior for commands that are not found.
	* tests/system-star.sh: Add test with 'test-command-not-found'.

2023-02-26  Ludovic Courtès  <ludo@gnu.org>

	service: Remove 'cd' action of 'root'.
	Changing the working directory of shepherd is not recommended; if one
	really wants to do that, there's still the 'eval' action.

	* modules/shepherd/service.scm (root-service): Remove 'cd' action.

2023-02-26  Ludovic Courtès  <ludo@gnu.org>

	service: Remove support for the 'unknown' service.
	This feature was untested and there were no clear use cases.

	* modules/shepherd/service.scm (launch-service, stop, action): Remove
	lookup of the 'unknown' service.
	(handle-unknown): Remove.
	* doc/shepherd.texi (The root and unknown services): Rename to...
	(The root Service): ... this.  Remove paragraph about the 'unknown'
	service.

2023-02-26  Ludovic Courtès  <ludo@gnu.org>

	Remove traces of "persistency" (sic) support.
	This functionality was untested and would have been hard to use.

	* modules/shepherd.scm (run-daemon): Remove #:persistency and related
	code.  Adjust caller.
	(main): Remove '--persistency' option.
	* modules/shepherd/service.scm (shutdown-services): Remove traces of
	persistency.
	(root-service): Remove the 'persistency' and 'no-persistency' actions.
	* modules/shepherd/support.scm (default-persistency-state-file)
	(persistency, persistency-state-file): Remove.

2023-02-19  Ludovic Courtès  <ludo@gnu.org>

	herd: Report 'starting' and 'stopping' service statuses.
	Previously "herd status SERVICE" would report either "started" or
	"stopped".

	* modules/shepherd/scripts/herd.scm (display-service-status): Check
	'status' field.  Report 'starting' and 'stopping' statuses.
	* tests/starting-status.sh, tests/stopping-status.sh,
	tests/system-star.sh: Adjust accordingly.

2023-02-19  Ludovic Courtès  <ludo@gnu.org>

	service: Communicate the service status symbol to clients.
	* modules/shepherd/service.scm (service->sexp): Add 'status' field.
	* tests/status-sexp.sh: Adjust accordingly.

2023-02-19  Ludovic Courtès  <ludo@gnu.org>

	service: Clarify expected statuses.
	Previously service status was derived from the 'running' value: it was
	either true (running) or false (stopped).  Now that there are officially
	several statuses, take them into account.

	* modules/shepherd/service.scm (service-status, stopped?): New
	procedures.
	(running?): Define as the opposite of 'stopped?'.
	(start): Explicitly check for the 'running' status.
	(stop): Explicitly check for the 'stopped' status.
	(service-registry)[stopped?]: Remove.
	(stop <symbol>): Use 'find' instead of 'lookup-running'.
	(first-running): Explicitly check for the 'running' status.

2023-02-19  Ludovic Courtès  <ludo@gnu.org>

	service: Rename "service monitor" to "service registry".
	* modules/shepherd/service.scm (current-monitor-channel): Rename to...
	(current-registry-channel): ... this.  Update users.
	(service-monitor): Rename to...
	(service-registry): ... this.  Update users.
	(spawn-service-monitor): Rename to...
	(spawn-service-registry): ... this.  Update user.
	(call-with-service-monitor): Rename to...
	(call-with-service-registry): ... this.  Update user.
	(with-service-monitor): Rename to...
	(with-service-registry): ... this.  Update users.

2023-02-19  Ludovic Courtès  <ludo@gnu.org>

	service: Associate a control fiber with each service.
	This moves service state handling from the service monitor to each
	"service controller".

	* modules/shepherd/service.scm (<service>)[control]: New slot.
	(service-control, spawn-service-controller, service-controller): New
	procedures.
	(start, stop, handle-service-termination, root-service): Send 'start',
	'stop', and 'notify-termination' messages to the control channel of the
	service rather than to the service monitor.
	(service-monitor)[*service-started*, started-message?]
	[*service-stopped*, stopped-message?]: Remove.
	[stopped?]: New procedure.
	Remove 'running', 'starting', and 'stopping' from the 'loop' variables.
	Use 'replace-if-running' message when registering a service.  Use
	'stopped?' when unregistering services.  Remove handlers for 'running',
	'start', 'stop', 'notify-termination', 'stopped-message?', and
	'started-message?', now moved to 'service-controller'.
	(remove): New procedure.

2023-02-19  Ludovic Courtès  <ludo@gnu.org>

	service: 'service-running-value' uses a fresh channel for each reply.
	This avoids confusion if 'service-running-value' might be called from
	different fibers concurrently.

	* modules/shepherd/service.scm (service-running-value): Use a fresh
	channel for each reply.

2023-02-18  Ludovic Courtès  <ludo@gnu.org>

	service: 'stop' blocks when a service is already being stopped.
	This change allows the monitor to keep track of services that are being
	stopped.  The 'stop' method now blocks when called on a service already
	being stopped, until the service has actually been stopped.  This was
	the case before 0.9.0; since 0.9.0 though, invoking 'stop' on a service
	already being stopped would lead to a second invocation of its 'stop'
	method.

	* modules/shepherd/service.scm (stop): Send a 'stop' message
	to (current-monitor-channel).  Call the 'stop' slot if and only if the
	monitor returns a channel.
	(service-monitor)[*service-stopped*, stopped-message?]: New variables.
	Add 'stopping' loop variable and thread it in recursive calls.  Handle
	'stop' and 'stopped-message?' messages.
	* tests/stopping-status.sh: New file.
	* Makefile.am (TESTS): Add it.

2023-02-18  Ludovic Courtès  <ludo@gnu.org>

	service: 'start-in-the-background' starts services in parallel.
	* modules/shepherd/service.scm (start-in-the-background): Use
	'start-in-parallel' instead of 'for-each'.

	service: Start dependent services in parallel.
	* modules/shepherd/service.scm (start-in-parallel): New procedure.
	(start): Use it instead of 'find'.  Print all the dependent services
	that could not be started.

2023-02-18  Ludovic Courtès  <ludo@gnu.org>

	service: 'start' blocks when a service is already being started.
	This change allows the monitor to keep track of services that are being
	started, in addition to running/stopped.  The 'start' method now blocks
	when called on a service already being started, until the service has
	actually been started.  This was the case before 0.9.0; since 0.9.0
	though, invoking 'start' on a service already being started would
	lead to a second invocation of its 'start' method.

	* modules/shepherd/service.scm (start): Use the new 'start' protocol
	with the monitor and adjust accordingly.
	(service-monitor)[*service-started*, started-message?]: New variables.
	Add 'starting' variable to 'loop'.  Remove ('set-running ...) clause;
	add ('start ...) clause.
	* tests/starting-status.sh: New file.
	* Makefile.am (TESTS): Add it.

2023-02-17  Ludovic Courtès  <ludo@gnu.org>

	service: Handle service state in a monitoring agent.
	* modules/shepherd/service.scm (default-service-termination-handler):
	Add 'pid' parameter.  Remove uses of 'service-running-value'.
	(<service>)[running]: Remove slot.
	(service-running-value): Rewrite as an RPC to (current-monitor-channel).
	(start): Replace accesses to the 'running' slot with messages
	to (current-monitor-channel).
	(replace-service): Replace references to the '%services' hash table with
	messages to (current-monitor-channel).
	(stop): Likewise.  Temporarily change 'handle-termination' slot of
	SERVICE while stopping it.
	(service-monitor, spawn-service-monitor): New procedures.
	(current-monitor-channel): New variable.
	(with-service-monitor): New macro.
	(make-inetd-constructor)[handle-child-termination]: Add 'pid'  parameter
	to 'handle-child-termination'.
	(%services): Remove.
	(fold-services, find-service, lookup-services): Rewrite as an RPC
	to (current-monitor-channel).
	(for-each-service, service-list): Rewrite in terms of 'fold-services'.
	(handle-service-termination): Send message to (current-monitor-channel).
	(respawn-service): Remove references to the 'running' slot and to
	'%services' by messages to (current-monitor-channel).
	(deregister-service): Likewise.
	<top level>: Remove (register-services root-service) call.
	* modules/shepherd/support.scm (primitive-load*): New procedure.
	(load-in-user-module): Use it instead of 'load-in-user-module'.
	(eval-in-user-module): Use 'primitive-eval' instead of 'eval'.
	* tests/inetd.sh: Add "herd eval root '(gc)'" before assignment of
	'initial_fd_count'.
	* modules/shepherd.scm (main): Remove (start root-service) call.
	Wrap body in 'with-service-monitor'.
	* doc/shepherd.texi (Slots of services): Remove 'running' slot.  Adjust
	wording for 'handle-termination'.
	(Methods of services): Adjust wording that referred to the 'running' slot.
	(Service Convenience, Service De- and Constructors): Likewise.

2023-02-17  Ludovic Courtès  <ludo@gnu.org>

	service: Remove 'stop-delay?' and 'waiting-for-termination?'.
	The 'stop-delay?' feature had weird semantics, was untested, and most
	likely unused.

	* modules/shepherd/service.scm (<service>)[stop-delay?]
	[waiting-for-termination?]: Remove.
	(stop): Remove code to handle 'stop-delay?'.
	(respawn-service): Remove code to handle 'waiting-for-termination?'.
	* doc/shepherd.texi (Slots of services): Adjust accordingly.
	* doc/examples/wolfgangj.scm: Likewise.

2022-11-17  Ludovic Courtès  <ludo@gnu.org>

	build: Bump to version 0.9.3.
	* configure.ac: Bump to version 0.9.3.

	service: Avoid continuation barrier on 'find' in Guile 2.2.
	* modules/shepherd/service.scm (find) <not guile-3.0>: New procedure.

2022-11-16  Ludovic Courtès  <ludo@gnu.org>

	Update 'NEWS'.

2022-11-16  Ludovic Courtès  <ludo@gnu.org>

	shepherd: Restore 'system*' in the child process after fork.
	This is a followup to 975b0aa0d6f0a184f712c935cd1ad284cd39deaf.

	Users such as the marionette service in Guix expect to be able to call
	'primitive-fork' from shepherd and be able to run Guile code right from
	there, without exec'ing.  This change makes sure they get a usable
	'system*'.

	* modules/shepherd.scm (main): Replace 'primitive-fork' with a procedure
	that restores 'system*' in the child.

2022-11-16  Ludovic Courtès  <ludo@gnu.org>

	support: Make the 'load' and 'eval' actions suspendable.
	* modules/shepherd/support.scm (primitive-load*): New procedure.
	(load-in-user-module): Use it instead of 'load-in-user-module'.
	(eval-in-user-module): Use 'primitive-eval' instead of 'eval'.
	* tests/basic.sh: Test (@ (fibers) sleep) within 'herd eval root'.

2022-11-16  Ludovic Courtès  <ludo@gnu.org>

	service: 'eval' action gracefully handles user code returning zero values.
	Previously, "herd eval root '(values)'" would cause shepherd to crash.

	* modules/shepherd/service.scm (action): Adjust the result of PROC to be
	exactly one value.
	* tests/basic.sh: Test zero-value returns with "herd eval root '(values)'".

2022-11-16  Ludovic Courtès  <ludo@gnu.org>

	service: 'make-kill-destructor' waits for termination, eventually SIGKILLs.
	Fixes <https://issues.guix.gnu.org/58485>.
	Reported by Lars-Dominik Braun <lars@6xq.net>.

	Previously, the procedure returned by 'make-forkexec-constructor' was
	asynchronous: it did not wait for the process to actually terminate.
	This could lead to issues typically when running 'herd restart SVC',
	because the initial process might still be around by the time we start a
	new one.

	* modules/shepherd/service.scm (make-kill-destructor): Add #:grace-period.
	Use 'terminate-process' instead of 'kill'.
	(process-monitor): Add clause for 'await' request.  Adjust now that
	WAITERS can contain several waiters for a given PID.
	(default-process-termination-grace-period): New parameter.
	(get-message*, terminate-process): New procedures.
	(stop): When computing STOPPED-DEPENDENTS, arrange to call 'stop'
	outside of 'fold-services'.
	* tests/forking-service.sh: Add 'test4' service and exercise the grace
	period mechanism.
	* modules/shepherd.scm (handle-SIGINT): Wrap 'catch' expression in
	'spawn-fiber'.
	(signal-handler): Use 'handle-SIGINT' for SIGTERM and SIGHUP as well.
	* doc/shepherd.texi (Service De- and Constructors): Update
	'make-kill-destructor' documentation.  Document
	'default-process-termination-grace-period'.

2022-11-14  Ludovic Courtès  <ludo@gnu.org>

	service: 'shutdown-services' no longer introduces a continuation barrier.
	* modules/shepherd/service.scm (shutdown-services): Use 'for-each' and
	'service-list' instead of 'for-each-service'.
	* tests/system-star.sh: Test it.

2022-11-14  Ludovic Courtès  <ludo@gnu.org>

	service: Prevent respawn while stopping a service.
	This is a followup to 5b08dcab1275e4b88fa0fba00aafb980c6ab4af7.

	Contrary what to the comment says in that commit, it is possible for
	SIGCHLD to be received and processed while the 'stop' method is running,
	causing the service being stopped to be respawned.  To prevent this,
	clear the 'running' slot before calling the service's 'stop' method so
	that the process monitor doesn't end up respawning the thing.

	* modules/shepherd/service.scm (stop): Set the 'running' slot to #f
	before calling SERVICE's 'stop' method.  Remove inaccurate comment.
	* tests/system-star.sh: Test that.

2022-11-13  Ludovic Courtès  <ludo@gnu.org>

	service: Remove 'call-with-blocked-asyncs' from 'stop' method.
	* modules/shepherd/service.scm (stop): Remove
	'call-with-blocked-asyncs'.  This would introduce a continuation
	barrier, making it impossible to use 'system*' (for example) from
	'stop'; it had also become unnecessary.
	* tests/system-star.sh: Use 'system*' in 'stop' and make sure it
	actually works.

2022-11-13  Ludovic Courtès  <ludo@gnu.org>

	service: Provide a non-blocking replacement of 'system*'.
	Fixes <https://issues.guix.gnu.org/56674>.

	* modules/shepherd/service.scm (process-monitor): Thread 'waiters'
	through 'loop'.  In 'handle-process-termination', notify the relevant
	subset of WAITERS.  Add 'spawn' operation.
	(spawn-command): New procedure.
	* modules/shepherd.scm (main): Set 'system*' to 'spawn-command'.
	* tests/system-star.sh: New file.
	* Makefile.am (TESTS): Add it.

2022-11-13  Ludovic Courtès  <ludo@gnu.org>

	service: Spawn a fiber responsible for process monitoring.
	* modules/shepherd/service.scm (process-monitor)
	(spawn-process-monitor, call-with-process-monitor): New procedures.
	(current-process-monitor): New variable.
	(with-process-monitor): New macro.
	(handle-SIGCHLD): Change to delegate process termination handling
	to (current-process-monitor) by sending it a message.
	* modules/shepherd.scm (main): Wrap 'run-daemon' call in
	'with-process-monitor'.

2022-10-22  Ludovic Courtès  <ludo@gnu.org>

	service: Logging fibers read lines into a pre-allocated buffer.
	This reduces heap allocation on each line that is logged.

	* modules/shepherd/service.scm (%logging-buffer-size): New variable.
	(read-line!): New procedure.
	(%service-file-logger): Use it instead of 'read-line'.  Use 'put-string'
	instead of 'display'.
	(service-builtin-logger): Likewise.

2022-10-22  Ludovic Courtès  <ludo@gnu.org>

	service: Reduce heap allocations while logging.
	* modules/shepherd/service.scm (%service-file-logger): Use 'display'
	and 'newline' instead of 'format' ('format' allocates a string port, etc.).
	(service-builtin-logger): Use 'simple-format'.

2022-10-10  Ludovic Courtès  <ludo@gnu.org>

	nls: Add ro translation.

2022-10-01  Ludovic Courtès  <ludo@gnu.org>

	nls: Add sr translation.

2022-09-10  Ludovic Courtès  <ludo@gnu.org>

	build: Bump to version 0.9.2.
	* configure.ac: Bump to version 0.9.2.

	Update 'NEWS'.

	doc: Format 'make-inetd-constructor' documentation correctly.
	* doc/shepherd.texi (Service De- and Constructors): Add missing @ sign
	before newline.

	tests: Make file descriptor count deterministic.
	* tests/inetd.sh: Run "herd eval root (gc)" before setting
	'initial_fd_count'.

2022-09-09  Ludovic Courtès  <ludo@gnu.org>

	service: Remove file descriptor closing loop from 'exec-command'.
	It is no longer necessary now that file descriptors are marked as
	close-on-exec.

	* modules/shepherd/service.scm (exec-command): Remove
	'without-automatic-finalization' and 'close-fdes' loop.

2022-09-09  Ludovic Courtès  <ludo@gnu.org>

	tests: Skip test requiring suspendable 'read' on Guile 2.2.
	This is a followup to eb275516157f7a664844b3b657d18761932803b5.

	* tests/misbehaved-client.sh: Skip last 'read' test on Guile 2.x.

2022-09-09  Ludovic Courtès  <ludo@gnu.org>

	system: Define 'O_CLOEXEC' on Guile 2.2.
	* configure.ac: Check the value of O_CLOEXEC and substitute it.
	* modules/shepherd/system.scm.in (O_CLOEXEC): New variable.

2022-09-07  Ludovic Courtès  <ludo@gnu.org>

	shepherd: Add test ensuring proper use of close-on-exec.
	* tests/close-on-exec.sh: New file.
	* Makefile.am (TESTS): Add it.
	(SHELL): Add CC.
	* modules/shepherd/service.scm (exec-command): Add comment.

	shepherd: Upon startup, mark preexisting file descriptors as FD_CLOEXEC.
	* modules/shepherd.scm (mark-as-close-on-exec): New procedure.
	(run-daemon): Call it.

	service: Mark inetd connection sockets as SOCK_CLOEXEC.
	* modules/shepherd/service.scm (make-inetd-constructor): Pass
	SOCK_CLOEXEC to 'accept'.

	service: Mark systemd listening sockets as SOCK_CLOEXEC.
	* modules/shepherd/service.scm (close-on-exec-endpoint): Remove.
	(endpoint->listening-socket): Use SOCK_CLOEXEC unconditionally.
	(make-inetd-constructor): Remove use of 'close-on-exec-endpoint'.

	service: Mark service logging pipe as O_CLOEXEC.
	* modules/shepherd/service.scm (fork+exec-command): Use 'pipe2'.

	system: Add 'pipe2' bindings.
	* modules/shepherd/system.scm.in (define-as-needed): New macro.
	(pipe2): New procedure.

	shepherd: Mark client connection sockets as SOCK_NONBLOCK.
	* modules/shepherd.scm (run-daemon): Pass SOCK_NONBLOCK to 'accept'.
	* tests/misbehaved-client.sh: Add test.

	shepherd: Mark client connection sockets as SOCK_CLOEXEC.
	* modules/shepherd.scm (run-daemon): Pass SOCK_CLOEXEC to 'accept'.

	shepherd: Open listening socket as SOCK_NONBLOCK.
	* modules/shepherd.scm (open-server-socket): Pass SOCK_NONBLOCK to
	'socket'.  Remove 'fcntl' call.

2022-09-07  Ludovic Courtès  <ludo@gnu.org>

	doc: Update inetd service example.
	This is a followup to 390319028d979318334aa8dfd59b3b30238b65f9.

	* doc/shepherd.texi (Service Examples): Change inetd example to use
	endpoints and 'make-inetd-destructor'.
	(Service De- and Constructors): Add anchor for endpoints.

2022-08-31  Ludovic Courtès  <ludo@gnu.org>

	service: Create listening sockets with SOCK_NONBLOCK.
	* modules/shepherd/service.scm (endpoint->listening-socket): Add
	SOCK_NONBLOCK to the second argument of 'socket' instead of calling
	'non-blocking-port'.

	service: Mark inetd listening sockets as SOCK_CLOEXEC.
	* modules/shepherd/service.scm (close-on-exec-endpoint): New procedure.
	(make-inetd-constructor): Use it.

2022-08-29  Ludovic Courtès  <ludo@gnu.org>

	service: Open log files as O_CLOEXEC.
	* modules/shepherd/service.scm (%service-file-logger): Pass O_CLOEXEC to
	'open-fdes'.

2022-08-29  Liliana Marie Prikler  <liliana.prikler@gmail.com>

	service: Gracefully handle non-existing log directories.
	* gnu/packages/services.scm (%service-file-logger): New variable,
	implementing...
	(service-file-logger): ... the old behaviour of this variable.  Catch system
	errors from %service-file-logger and handle them.

2022-08-29  Ludovic Courtès  <ludo@gnu.org>

	support: Remove unused 'label' macro.
	* modules/shepherd/support.scm (label): Remove.

	shepherd: Open log file as O_CLOEXEC.
	* modules/shepherd/support.scm (buffering): New procedure.
	* modules/shepherd.scm (main): Define 'log-flags'.  Open log file with
	'open' and LOG-FLAGS.

2022-08-29  Ludovic Courtès  <ludo@gnu.org>

	support: Remove 'buffering-mode' compatibility macro.
	This macro is no longer needed because Guile >= 2.2 is required since
	commit 3edbcaedbe4c456097a46a6214ddd249b014b0cf.

	* modules/shepherd/support.scm (buffering-mode): Remove.
	(initialize-cli): Adjust accordingly.
	* modules/shepherd/comm.scm (open-connection)
	(call-with-syslog-port): Likewise.
	* tests/misbehaved-client.sh: Likewise.

2022-08-28  Ludovic Courtès  <ludo@gnu.org>

	comm: Mark the syslog socket as SOCK_CLOEXEC.
	* modules/shepherd/comm.scm (call-with-syslog-port):  Add 'SOCK_CLOEXEC'
	to the second argument to 'socket'.

	shepherd: Mark server socket as SOCK_CLOEXEC.
	* modules/shepherd.scm (open-server-socket): Add SOCK_CLOEXEC to the
	second argument to 'socket'.

2022-06-29  Ludovic Courtès  <ludo@gnu.org>

	tests: Ensure log file is closed when service is stopped.
	* tests/logging.sh (find_file_descriptor): New function.
	Use it to check whether "$service_log" is closed after "herd stop
	test-file-logging".

2022-05-22  Ludovic Courtès  <ludo@gnu.org>

	build: Bump to version 0.9.1.
	* configure.ac: Bump to version 0.9.1.

	README: Clarify GNU/Linux support.
	* README: Clarify.

	tests: Add comment linking to Fibers 1.1.0 bug.
	* tests/inetd.sh: Add comment and link to Fibers 1.1.0 bug.

2022-05-21  Ludovic Courtès  <ludo@gnu.org>

	README: Add "Hacking" section.
	* README: Add "Hacking" section.

	Interpret AF_INET6 endpoints as IPv6-only.
	* configure.ac: Check the values of IPPROTO_IPV6 and IPV6_V6ONLY.
	* modules/shepherd/system.scm.in (ipv6-only): New procedure.
	* modules/shepherd/service.scm (endpoint->listening-socket): Call it if
	ADDRESS is AF_INET6.
	(define-as-needed): New macro.
	(IN6ADDR_LOOPBACK, IN6ADDR_ANY): New variables.
	* tests/inetd.sh: Add 'test-inetd6' and 'test-inetd-v6-only' services.
	Test them.

	tests: Update inetd tests to pass a list of endpoints.
	* tests/inetd.sh: Pass 'make-inetd-constructor' a list of endpoints.

	service: 'make-inetd-constructor' accepts a list of endpoints.
	* modules/shepherd/service.scm (endpoint->listening-socket)
	(open-sockets): New procedures.
	(make-inetd-constructor): Change 'address' parameter to 'endpoints'.
	Mark #:socket-style, #:socket-owner, #:socket-group, #:socket-directory-permissions,
	and #:listen-backlog as deprecated.
	[spawn-child-service, accept-clients]: Take 'server-address' parameter
	and use it.  Update callers.
	Add compatibility later for when ENDPOINTS is an address.
	(make-inetd-destructor): Adjust.
	(make-systemd-destructor)[endpoint->listening-socket, open-sockets]:
	Remove.
	Adjust to new return value of 'open-sockets'.
	* NEWS: Mention it.

	Add '.guix-authorizations'.
	* .guix-authorizations: New file.

2022-05-18  Ludovic Courtès  <ludo@gnu.org>

	Update 'NEWS'.

2022-05-14  Ludovic Courtès  <ludo@gnu.org>

	service: 'socket-address->string' correctly handles AF_INET6 addresses.
	Reported by Jack Hill <jackhill@jackhill.us>
	at <https://issues.guix.gnu.org/55335#4>.

	* modules/shepherd/service.scm (socket-address->string): Pass AF_INET6
	as the first argument to 'inet-ntop' in the AF_INET6 case.

2022-05-08  Bastien Riviere  <me@babariviere.com>

	service: systemd: Use correct format for LISTEN_FDNAMES.
	As in the documentation, LISTEN_FDNAMES is expected to be a
	"colon-separated list of names".  This patch adds the missing delimiter
	when joining to LISTEN_FDNAMES.

	This fixes issues with services, like gpg-agent, which produces this
	kind of error:

	> [gpg-agent] Fatal: number of items in LISTEN_FDNAMES (1) does not match LISTEN_FDS (4) in --supervised mode

	* modules/shepherd/service.scm (make-systemd-constructor): Pass second
	argument to 'string-join' when constructing LISTEN_FDNAMES value.

2022-05-02  Ludovic Courtès  <ludo@gnu.org>

	service: inetd: Close socket when an exception is caught.
	This avoids a file descriptor leak when, for example, 'bind' throws an
	EADDRINUSE 'system-error' exception.

	Fixes <https://issues.guix.gnu.org/55223>.

	* modules/shepherd/service.scm (make-inetd-constructor): Catch
	exceptions after 'socket' call and close SOCK upon exception.

2022-05-02  Ludovic Courtès  <ludo@gnu.org>

	service: inetd: Extract 'accept-clients' loop.
	* modules/shepherd/service.scm (make-inetd-constructor)[accept-clients]:
	New procedure.
	Use it in 'spawn-fiber' call.

2022-04-29  Ludovic Courtès  <ludo@gnu.org>

	service: 'start-in-the-background' returns a value.
	* modules/shepherd/service.scm (start-in-the-background): Return a
	value.

	doc: Fix typo.
	* doc/shepherd.texi (Service De- and Constructors): Fix typo in
	'endpoint' doc.

2022-04-09  Ludovic Courtès  <ludo@gnu.org>

	herd: "herd status SERVICE" reports whether the service is transient.
	* modules/shepherd/scripts/herd.scm (display-service-status): Report
	it if SERVICE is transient.
	* tests/transient.sh: Test it.

	service: 'service->sexp' reports value of 'transient?' field.
	* modules/shepherd/service.scm (service->sexp): Report value of
	'transient?' field when true.

2022-04-08  Ludovic Courtès  <ludo@gnu.org>

	doc: Fix typo.
	Fixes <https://issues.guix.gnu.org/54749>.
	Reported by Aleksandr Vityazev <avityazev@posteo.org>.

	* doc/shepherd.texi (Service De- and Constructors): Fix typo for
	'make-systemd-destructor'.

2022-04-06  Ludovic Courtès  <ludo@gnu.org>

	build: Bump to version 0.9.0.
	* configure.ac: Bump to version 0.9.0.

	Update NEWS.

	nls: Update da, de, sv, and uk translations.

	maint: Add 'download-po-files' target.
	* Makefile.am (download-po-files): New target.

	service: Default termination handler avoids raw 'running' slot access.
	* modules/shepherd/service.scm (default-service-termination-handler):
	Use 'service-running-value' instead of 'slot-ref'.

2022-04-05  Ludovic Courtès  <ludo@gnu.org>

	po: Tell xgettext to handle 'l10n' plural calls.
	This is a followup to 3dabd8ad2dfa3b2122e1aa812fdea763c22b1cb4.

	Reported by Anders Jonsson <anders.jonsson@norsjovallen.se>.

	* po/Makevars (XGETTEXT_OPTIONS): Add second '--keyword' option.

2022-04-02  Ludovic Courtès  <ludo@gnu.org>

	Update 'NEWS'.

	doc: Rewrite "Service Examples".
	* doc/shepherd.texi (Service Examples): Rewrite.

2022-03-31  Ludovic Courtès  <ludo@gnu.org>

	service: 'daemonize' action does nothing when services are already running.
	* modules/shepherd/service.scm (root-service): In 'daemonize' action, do
	nothing if services other than ROOT-SERVICE are already running.

	doc: Remove nonexistent persitency-related actions.
	* doc/shepherd.texi (The root and unknown services): Remove
	nonexistent 'enable-persistency' and 'disable-persistency' actions.

2022-03-30  Ludovic Courtès  <ludo@gnu.org>

	build: Bump to version 0.9.0rc1.
	* configure.ac: Bump to version 0.9.0rc1.

	doc: Clarify which instance 'herd' talks to.
	* doc/shepherd.texi (Invoking herd): Clarify which instance 'herd' talks to.

	Avoid Guile run-time warning about overridden 'sleep' binding.
	* modules/shepherd.scm: Hide 'sleep' from (fibers) and define it
	locally.
	* modules/shepherd/service.scm: Likewise.

2022-03-30  Ludovic Courtès  <ludo@gnu.org>

	shepherd: Gracefully handle failure to open the socket.
	Previously 'shepherd' would just show a backtrace and hang because other
	fibers would still be running.

	* modules/shepherd.scm (call-with-server-socket): Catch 'system-error'
	around 'open-server-socket' call.

2022-03-30  Ludovic Courtès  <ludo@gnu.org>

	shepherd: Do not change to the client directory when executing a command.
	This mechanism was mostly useless and potentially unsafe.

	* modules/shepherd.scm (process-command): Remove
	'with-directory-excursion' use.
	* tests/basic.sh: Adjust test to pass an absolute file name to 'herd
	load root'.

2022-03-30  Ludovic Courtès  <ludo@gnu.org>

	service: 'make-inetd-constructor' lets the caller specify socket ownership.
	* modules/shepherd/service.scm (make-inetd-constructor): Add
	 #:socket-owner, #:socket-group, and #:socket-directory-permissions
	 parameters.  Honor them.
	* doc/shepherd.texi (Service De- and Constructors): Document it.

	service: Add #:max-connections to 'make-inetd-constructor'.
	* modules/shepherd/service.scm (default-inetd-max-connections): New variable.
	(make-inetd-constructor): Add #:max-connections.
	[connection-count]: New variables.
	[handle-child-termination, spawn-child-service]: New procedures.
	Close CONNECTION when CONNECTION-COUNT is greater than MAX-CONNECTIONS.
	* tests/inetd.sh: Test it.
	* doc/shepherd.texi (Service De- and Constructors): Document it.

	service: Add #:handle-termination slot.
	* modules/shepherd/service.scm (<service>)[handle-termination]: New slot.
	(handle-service-termination): New procedure.
	(handle-SIGCHLD): Call it instead of 'respawn-service'.
	(default-service-termination-handler): New procedure.
	* doc/shepherd.texi (Slots of services): Document the new slot.

	shepherd: "shepherd -s -" replies to the current output port.
	* modules/shepherd.scm (process-textual-commands):
	Pass (current-output-port) as the second argument to 'process-command'.

	shepherd: Remove half-baked readline support.
	* modules/shepherd.scm (main): Remove call to 'activate-readline'.
	(run-daemon): Remove initial 'handle-SIGCHLD' call.

	service: Add 'start-in-the-background'.
	* modules/shepherd/service.scm (start-in-the-background): New procedure.
	* doc/shepherd.texi (Service Convenience): Document it.

	service: Add systemd constructor and destructor.
	* modules/shepherd/service.scm (exec-command): Add #:extra-ports and
	honor it.
	(fork+exec-command): Add #:extra-ports and #:listen-pid-variable and
	honor them.
	(<endpoint>): New record type.
	(endpoint, wait-for-readable, make-systemd-constructor)
	(make-systemd-destructor): New procedures.
	* tests/systemd.sh: New file.
	* Makefile.am (TESTS): Add it.
	* doc/shepherd.texi (Service De- and Constructors): Document it.

2022-03-30  Ludovic Courtès  <ludo@gnu.org>

	service: Allow 'running' value to be a thunk.
	Constructors may now return a thunk whose return value changes over
	time.

	* modules/shepherd/service.scm (service-running-value): New procedure.
	(running?, start, action, stop, service->sexp, handle-SIGCHLD)
	(check-for-dead-services): Call it instead of accessing the 'running'
	slot directly.

2022-03-30  Ludovic Courtès  <ludo@gnu.org>

	service: Add inetd constructor and destructor.
	* modules/shepherd/service.scm (exec-command): Add #:input-port and
	honor it.
	(make-inetd-forkexec-constructor, socket-address->string)
	(inetd-variables, make-inetd-constructor): New procedures.
	* modules/shepherd/support.scm: Use (ice-9 format).
	* tests/inetd.sh: New file.
	* Makefile.am (TESTS): Add it.
	* doc/shepherd.texi (Service De- and Constructors): Update
	'exec-command' documentation and add 'make-inetd-constructor' and
	'make-inetd-destructor'.

	service: Add the #:transient? slot.
	* modules/shepherd/service.scm (<service>)[transient?]: New slot.
	(stop, respawn-service): Unregister transient services.
	* tests/transient.sh: New file.
	* Makefile.am (TESTS): Add it.
	* doc/shepherd.texi (Slots of services): Document it.

	service: Remove unused 'make-init.d-service'.
	* modules/shepherd/service.scm (make-init.d-service): Remove.

	support: 'l10n' accepts plural forms.
	* modules/shepherd/support.scm (l10n): Turn into a macro.

	doc: Fix inetutils cross-reference.
	* doc/shepherd.texi (Invoking shepherd): Fix inetutils cross-reference.

	service: 'make-forkexec-constructor' spawns a logging fiber.
	* modules/shepherd/service.scm (service-file-logger)
	(service-builtin-logger): New procedures.
	(exec-command): Add #:log-port and honor it.
	(fork+exec-command): Add #:log-encoding.  Call 'pipe' before
	'primitive-fork' and pass #:log-port to 'exec-command'.  Call
	'spawn-fiber' for logging.
	* tests/logging.sh: New file.
	* doc/shepherd.texi (Service De- and Constructors): Adjust accordingly.
	(NEW-YEARS): Add 2022.
	* Makefile.am (TESTS): Add it.

	shepherd: Encode log as UTF-8 unconditionally.
	* modules/shepherd.scm (main): Add 'set-port-encoding!' call.

	service: 'read-pid-file' uses (@ (guile) sleep) when it's not suspendable.
	* modules/shepherd/service.scm (read-pid-file)[sleep*]: New procedure.
	[try-again]: Use it instead of 'sleep'.
	* tests/pid-file.sh: Call 'start' from the config file top-level.  Check
	that 'test-works' is running right at the beginning.
	* configure.ac: Check for (fibers scheduler).

	service: 'read-pid-file' no longer blocks.
	* modules/shepherd/service.scm: Use (fibers).
	(read-pid-file): Remove XXX comment.
	(start): Remove 'call-with-blocked-asyncs', which is a continuation barrier.

	shepherd: Use one fiber for signal handling, and one for clients.
	* modules/shepherd.scm (unwind-protect): New macro.
	(call-with-server-socket): Use it instead of 'dynamic-wind'.
	(maybe-signal-port): Use it.
	(run-daemon): Spawn a fiber for signal handling.  Write connection
	processing loop in direct style, without 'select'.
	* modules/shepherd/support.scm (non-blocking-port): New procedure.

2022-03-30  Ludovic Courtès  <ludo@gnu.org>

	build: Capture the source and object directories of Fibers.
	This ensures Fibers modules are found when running 'herd' and
	'shepherd'.

	* configure.ac: Substitute 'FIBERS_SOURCE_DIRECTORY' and
	'FIBERS_OBJECT_DIRECTORY'.
	* Makefile.am (instantiate): Likewise.
	* herd.in: Add FIBERS_SOURCE_DIRECTORY to %LOAD-PATH and add
	FIBERS_OBJECT_DIRECTORY to %LOAD-COMPILED-PATH.
	* shepherd.in: Likewise.

2022-03-30  Ludovic Courtès  <ludo@gnu.org>

	README: Update requirements.
	* README: Update.

	Use Fibers.
	* configure.ac: Add 'GUILE_MODULE_AVAILABLE' use for Fibers.
	Add 'AC_CACHE_CHECK' use for 'ac_cv_fibers_creates_pthreads'.
	* modules/shepherd.scm: Use (fibers).
	(signal-handler): In the SIGTERM/SIGHUP case, catch 'quit.
	(main): Wrap call to 'run-daemon' in 'run-fibers'.
	(quit-exception-handler): Call 'primitive-exit' in the default case.

	build: Drop support for Guile 2.0.
	* configure.ac: Drop Guile 2.0 support.
	* modules/shepherd/support.scm (if-2.0): Remove.
	(buffering-mode): Remove 'if-2.0' uses.
	(initialize-cli): Likewise.
	* modules/shepherd/system.scm.in (%set-automatic-finalization-enabled?!):
	(without-automatic-finalization): Define unconditionally; remove
	2.0-specific 'cond-expand' branch.

	shepherd: Factorize out the main loop.
	* modules/shepherd.scm (run-daemon): New procedure, with code moved
	from...
	(main): ... here.

	README: Update bug-report section.
	* README: Update.

	Remove 'QUESTIONS' file.
	* QUESTIONS: Remove.
	* Makefile.am (EXTRA_DIST): Remove it.
	* README: Adjust accordingly, and mention Git repository.

	README: Mention copyright year ranges.
	* README: Add sentence.

2022-03-30  Ludovic Courtès  <ludo@gnu.org>

	tests: Remove 'nofiles' test file when cleaning up.
	This a followup to 3ee9a7193d73821d6f1dd76a745ed5e4bb1a78c8.

	* tests/forking-service.sh (cleanup): Remove "$service_nofiles".

2022-03-24  Ludovic Courtès  <ludo@gnu.org>

	support: Internationalize initial configuration file
	* modules/shepherd/support.scm (make-bare-init-file): Add 'l10n' calls.

	config: Remove unused 'copyright' variable.
	* modules/shepherd/config.scm.in (copyright): Remove.

2022-03-24  Liliana Marie Prikler  <liliana.prikler@gmail.com>

	support: Use XDG_STATE_HOME for log files.
	As per XDG Base Directory Specification 0.8, "action history" (such as logs)
	ought to be stored in $XDG_STATE_HOME, defaulting to $HOME/.local/state.
	Respect this specification.

	* modules/shepherd/support.scm (%user-log-dir): Define in terms of
	XDG_STATE_HOME.
	* doc/shepherd.texi: Adjust accordingly.
	* tests/basic.sh: Adjust accordingly.

2022-03-21  Attila Lendvai  <attila@lendvai.name>
	    Ludovic Courtès  <ludo@gnu.org>

	service: Add #:resource-limits parameter to 'exec-command' & co.
	* modules/shepherd/service.scm (exec-command, fork+exec-command,
	make-forkexec-constructor): Add #:resource-limits and honor it.  Reorder
	keyword args where needed to be uniform.
	* tests/forking-service.sh: Test 'nofile' rlimit.
	* doc/shepherd.texi (Service De- and Constructors): Document #:resource-limits.

2022-03-21  Ludovic Courtès  <ludo@gnu.org>

	support: Show 2022 in '--version' output.
	* modules/shepherd/support.scm (display-version): Change year to 2022.

2022-02-05  Ludovic Courtès  <ludo@gnu.org>

	shepherd: Upon 'quit', reboot only if we're running as PID 1.
	Reported by Arun Isaac <arunisaac@systemreboot.net>.

	* modules/shepherd.scm (quit-exception-handler): Reboot if and only
	if (getpid) returns 1.

2022-01-17  Ludovic Courtès  <ludo@gnu.org>

	tests: Avoid possible race condition in 'tests/no-home.sh'.
	Fixes <https://issues.guix.gnu.org/52779>.
	Reported by Maxim Cournoyer <maxim.cournoyer@gmail.com>.

	It would seem there's a race condition, whereby the shell running
	'no-home.sh' may or may not have called waitpid(2) for the child
	'shepherd' process by the time 'kill' was invoked.

	* tests/no-home.sh: Terminate with 'wait' rather than 'kill'.

2021-08-10  Ludovic Courtès  <ludo@gnu.org>

	service: Add #:create-session? parameter to 'exec-command' & co.
	Suggested by muradm <mail@muradm.net>.

	* modules/shepherd/service.scm (exec-command, fork+exec-command)
	(make-forkexec-constructor): Add #:create-session? and honor it.
	* doc/shepherd.texi (Service De- and Constructors): Update accordingly.

2021-08-10  Ludovic Courtès  <ludo@gnu.org>

	herd: Work around Guile 3.0.[5-7] compiler bug.
	* modules/shepherd/scripts/herd.scm (root-service?): New procedure.
	(run-command): Use it.

2020-11-18  Jan (janneke) Nieuwenhuizen  <janneke@gnu.org>
	    Efraim Flashner  <efraim@flashner.co.il>
	    Ludovic Courtès  <ludo@gnu.org>

	doc: Add "Managing User Services".
	* modules/shepherd/support.scm: Export %user-log-dir, %user-config-dir,
	%user-runtime-dir.
	* doc/shepherd.texi (Managing User Services): Use them in new section with
	example.

2020-11-18  Ludovic Courtès  <ludo@gnu.org>
	    Efraim Flashner  <efraim@flashner.co.il>

	support: Move unprivileged shepherd log file to XDG_DATA_DIR.
	* modules/shepherd/support.scm (%user-log-dir): New variable.
	(user-default-log-file): Use it.
	* tests/basic.sh: Adjust accordingly.
	* doc/shepherd.texi (Invoking shepherd): Likewise.

2020-06-19  Oleg Pykhalov  <go.wigust@gmail.com>

	service: Add #:supplementary-groups.
	* modules/shepherd/service.scm (format-supplementary-groups): New procedure.
	(exec-command, fork+exec-command, make-forkexec-constructor): Add
	'#:supplementary-groups'.
	* doc/shepherd.texi (Service De- and Constructors): Document this.

2020-06-03  Ludovic Courtès  <ludo@gnu.org>

	build: Bump to version 0.8.1.
	* configure.ac: Bump to version 0.8.1.

	Update 'NEWS'.

2020-06-02  Ludovic Courtès  <ludo@gnu.org>

	shepherd: Factorize list of handled signals.
	Suggested by Mathieu Othacehe <othacehe@gnu.org>.

	* modules/shepherd/service.scm (%precious-signals): Export.
	* modules/shepherd.scm (handle-SIGINT): Turn into a thunk.
	(signal-handler): New procedure.
	(handle-signal-port): Replace 'cond' by a call to 'signal-handler'.
	(main): Pass %PRECIOUS-SIGNALS to 'maybe-signal-port'.
	Replace three explicit calls to 'sigaction' by 'for-each' +
	'signal-handler' calls.

2020-05-30  Ludovic Courtès  <ludo@gnu.org>

	service: 'fork+exec-command' blocks handled signals before forking.
	This is a followup to d190773751ddeddbe0daa8e4a43f76b73c4fd7ac, which
	addressed only SIGTERM instead of all of %PRECIOUS-SIGNALS.
	Furthermore, setting the SIGTERM handler introduced a window in the
	shepherd process during which SIGTERM instances would be lost.

	* modules/shepherd/service.scm (%precious-signals): New variable.
	(fork+exec-command): Remove calls to 'sigaction' for SIGTERM.  Wrap
	'let' in 'with-blocked-signals'.  Restore default signal handlers in the
	child before unblocking signals.

2020-05-30  Ludovic Courtès  <ludo@gnu.org>

	system: Add 'with-blocked-signals'.
	* configure.ac: Compute and substitute 'SIG_SETMASK'.
	* modules/shepherd/system.scm.in (SIG_SETMASK): New variable.
	(set-blocked-signals, call-with-blocked-signals): New procedures.
	(with-blocked-signals): New macro.

	system: 'sigprocmask' returns the previous set of blocked signals.
	* modules/shepherd/system.scm.in (sigismember, sigset->list): New
	procedures.
	(sigprocmask): Return the old set of signals.

	system: Throw an exception when 'sigprocmask' fails.
	* modules/shepherd/system.scm.in (sigprocmask): Check the result and
	call 'throw' upon error.

2020-05-30  Ludovic Courtès  <ludo@gnu.org>

	doc: Remove "Runlevel evolution".
	What's discussed in there is less and less relevant to the actual code.

	* doc/shepherd.texi (Runlevel evolution): Remove.

2020-05-27  Ludovic Courtès  <ludo@gnu.org>

	nls: Update sv translation.

2020-05-26  Ludovic Courtès  <ludo@gnu.org>

	shepherd: Use 'signalfd' when possible.
	This eliminates possible race conditions related to signal delivery and
	'select', which in turn means we can pass 'select' an infinite timeout
	without any risk of missing a signal.  It also allows us to structure
	the code around a single event loop.

	* modules/shepherd.scm (maybe-signal-port, handle-SIGINT): New procedures.
	(main): Use it and define 'signal-port'.  Add 'ports' argument to
	'next-command'.  Pass it to 'select'.  Change the timeout argument of
	'select' to #f when SIGNAL-PORT is true.
	* modules/shepherd/service.scm (fork+exec-command): Call
	'unblock-signals' in the child process, right before 'exec-command'.

2020-05-24  Ludovic Courtès  <ludo@gnu.org>

	system: Add support for 'signalfd'.
	* configure.ac: Add 'AC_CHECK_SIZEOF' calls for 'struct
	signalfd_siginfo' and 'sigset_t'.  Add 'AC_COMPUTE_INT' for
	'SFD_CLOEXEC', 'SIG_BLOCK', and 'SIG_UNBLOCK'.  Substitute the results.
	* modules/shepherd/system.scm.in (allocate-sigset, sigemptyset)
	(sigaddset, sigset): New procedures.
	(%sizeof-struct-signalfd-siginfo, SFD_CLOEXEC): New variables.
	(signalfd, consume-signalfd-siginfo): New procedures.
	(SIG_BLOCK, SIG_UNBLOCK): New variables.
	(sigprocmask, block-signals, unblock-signals): New procedures.

2020-05-23  Ludovic Courtès  <ludo@gnu.org>

	system: 'syscall->procedure' throws ENOSYS for functions not found.
	* modules/shepherd/system.scm.in (syscall->procedure): Throw to
	'system-error instead of calling 'error'.
	(prctl): Remove now unneeded 'if'.

2020-05-23  Ludovic Courtès  <ludo@gnu.org>

	system: Remove errno handling code for Guile < 2.0.12.
	This is a followup to 766c4dccfa6e956a41d6e4d42d08d9b13a880d21.

	* modules/shepherd/system.scm.in (syscall->procedure): Remove
	'wrong-number-of-args' catch.
	(%libc-errno-pointer, errno): Remove.

2020-05-11  Mathieu Othacehe  <m.othacehe@gmail.com>

	service: Fix 'make-kill-destructor' when PGID is zero.
	Fixes <https://bugs.gnu.org/40981>.

	When a process is forked, and before its GID is changed in "exec-command",
	it will share the parent GID, which is 0 for Shepherd. In that case, use
	the PID instead of the PGID.

	Also make sure to reset the SIGTERM handler before forking a process. Failing
	to do so, will result in stopping Shepherd if a SIGTERM is received between
	fork and execv calls. Restore the SIGTERM handler once the process has been
	forked.

	* modules/shepherd/service.scm (fork+exec-command): Save the current SIGTERM
	handler and reset it before forking. Then, restore it on the parent after
	forking.
	(make-kill-destructor): Handle the case when PGID is zero, between the process
	fork and exec.

2020-04-28  Diego Nicola Barbato  <dnbarbato@posteo.de>

	tests: Test #:file-creation-mask option of 'make-forkexec-constructor'.
	This is a followup to 4b5f958035426e1a4fce1ada19be68b62d7b75df.

	* tests/file-creation-mask.sh: New file.
	* Makefile.am (TESTS): Add it.

2020-04-22  guy fleury iteriteka  <gfleury@disroot.org>

	doc: Remove 'call/cc' and 'call/ec'.
	This is a followup to commit 6b0e1e1923107bdf5073f87649a724b7375808b0.

	* doc/shepherd.texi (call/cc, call/ec): Remove documentation.

2020-04-21  Ludovic Courtès  <ludo@gnu.org>

	build: Bump to version 0.8.0.
	* configure.ac: Bump to version 0.8.0.

	Update 'NEWS'.

2020-04-20  Ludovic Courtès  <ludo@gnu.org>

	tests: Increase PID file timeout in 'forking-service.sh'.
	* tests/forking-service.sh: Call 'default-pid-file-timeout'.

	shepherd: Resolve 'handle-SIGCHLD' upfront.
	* modules/shepherd.scm (main): Call 'handle-SIGCHLD' before entering
	the 'next-command' loop.

2020-04-20  Ludovic Courtès  <ludo@gnu.org>

	shepherd: No longer send SIGALRM every second.
	This kludge was mostly unnecessary since commit
	0ce1076eab9659c29c74bb6aeafb2fec6ef1efd8 on Guile 2.2+.

	* modules/shepherd.scm (main): Remove calls to 'sigaction' and 'alarm'.
	Call 'handle-SIGCHLD' each time 'select' returns.
	* modules/shepherd/service.scm (waitpid*): Remove warning in exception
	handler.
	(handle-SIGCHLD): Make 'signum' optional.
	* modules/shepherd/system.scm.in <top level> [guile-2.0]: Replace
	'select'.

	fixlet

2020-04-20  Ludovic Courtès  <ludo@gnu.org>

	system: 'without-automatic-finalization' accepts several expressions on 2.0.
	* modules/shepherd/system.scm.in (without-automatic-finalization)
	[!guile-2.2]: Add ellipsis.

	Augment '.gitignore'.

2020-04-19  Ludovic Courtès  <ludo@gnu.org>

	service: Shut down finalization thread before closing file descriptors.
	This addresses the infamous:

	  error in the finalization thread: Bad file descriptor

	messages that we've been seeing since Guile 2.2.

	* modules/shepherd/service.scm (exec-command): Wrap 'loop' in
	'without-automatic-finalization'.  Remove inner loop over (fdes->ports i).

2020-04-19  Ludovic Courtès  <ludo@gnu.org>

	system: Add 'without-automatic-finalization'.
	* modules/shepherd/system.scm.in (%set-automatic-finalization-enabled?!):
	New procedure.
	(without-automatic-finalization): New macro.

2020-04-19  Matthew Kraai  <kraai@ftbfs.org>

	Fix typo.
	* doc/shepherd.texi (Jump Start): Fix typo.

2020-04-19  Diego Nicola Barbato  <dnbarbato@posteo.de>

	service: Add #:file-creation-mask to 'make-forkexec-constructor'.
	* modules/shepherd/service.scm (exec-command): Add #:file-creation-mask
	  parameter and honor it.
	  (fork+exec-command): Add #:file-creation-mask parameter and pass it to
	  exec-command.
	  (make-forkexec-constructor): Add #:file-creation-mask parameter and pass it
	  to fork+exec-command.
	* doc/shepherd.texi (Service De- and Constructors): Adjust accordingly.

	service: Create log files as non-world-readable.
	* modules/shepherd/service.scm (exec-command): Create log-file with file
	  permissions #o640.

2020-04-18  Ludovic Courtès  <ludo@gnu.org>

	system: Fix typo in 'getpgid'.
	* modules/shepherd/system.scm.in (getpgid): Check whether RESULT is -1,
	not 1.

2020-04-18  Ludovic Courtès  <ludo@gnu.org>

	service: 'make-forkexec-constructor' no longer supports the 0.1 form.
	This is a followup to 53435801fa7a4d1c5ce65d328bc29c2c044388d4.

	* modules/shepherd/service.scm (make-forkexec-constructor): Remove
	support for the calling convention that was deprecated in version 0.1.

2020-04-18  Ludovic Courtès  <ludo@gnu.org>

	service: Introduce 'default-pid-file-timeout'.
	* modules/shepherd/service.scm (default-pid-file-timeout): New variable.
	(%pid-file-timeout): Remove.
	(read-pid-file, make-forkexec-constructor): Use it as the default
	 #:pid-file-timeout.
	* doc/shepherd.texi (Service De- and Constructors): Document it.

	service: 'make-kill-destructor' kills the process group.
	* modules/shepherd/service.scm (make-kill-destructor): Change the
	argument of 'kill' to (getpgid (- pid)).  Use 'define*' instead of
	'lambda*' and add a docstring.
	* doc/shepherd.texi (Service De- and Constructors): Adjust accordingly.
	* tests/pid-file.sh: Change '%command' to a shell script.
	Define '%daemon-command-successful' and use it for 'test-works'.

	system: Add 'getpgid'.
	* modules/shepherd/system.scm.in (getpgid): New procedure.

2020-04-18  Ludovic Courtès  <ludo@gnu.org>

	service: Terminate the progress group when the PID file doesn't show up.
	Fixes <https://bugs.gnu.org/40672>.

	Previously, we'd just terminate the initial process, which was typically
	already dead (because it had deamonized), thus potentially leaving the
	actual daemon running in the background.

	* modules/shepherd/service.scm (make-forkexec-constructor): When
	PID-FILE is true and 'read-pid-file' returns #f, pass (- PID) as the
	argument to 'kill'.
	* tests/pid-file.sh: Add test with 'test-daemonizes' service.

2020-04-18  Ludovic Courtès  <ludo@gnu.org>

	service: 'check-for-dead-services' uses 'catch-system-error'.
	* modules/shepherd/service.scm (check-for-dead-services)[process-exists?]:
	Use 'catch-system-error' instead of 'catch #t'.

2020-04-16  guy fleury iteriteka  <gfleury@disroot.org>

	support: Remove local 'call/ec' definition.
	* modules/shepherd/args.scm: Import (ice-9 control).
	* modules/shepherd/service.scm: Likewise.
	* modules/shepherd/support.scm (call/ec): Remove.

2020-04-01  Leo Famulari  <leo@famulari.name>

	doc: Replace "GuixSD" with "Guix System".
	* doc/shepherd.texi (Internals): Replace "GuixSD" with "Guix System".

	doc: Fix typo in Jump start.
	* doc/shepherd.texi (Jump start): Fix typo in documentation of special action
	'doc'.

2020-03-08  Ludovic Courtès  <ludo@gnu.org>

	doc: Mention "daemonizing" processes for 'make-forkexec-constructor'.
	Suggested by Maxim Cournoyer <maxim.cournoyer@gmail.com>.
	It was found confusing as noted in <https://bugs.gnu.org/39708>.

	* doc/shepherd.texi (Service De- and Constructors): Add note about
	processes that daemonize.

2020-03-07  Ludovic Courtès  <ludo@gnu.org>

	doc: Fix typos in @copying block.
	This is a followup to d5da712a5605a0cdaa4cf3bd64621a95a54520c0.

	* doc/shepherd.texi: Fix typos in @copying block.

2020-03-07  Jan Nieuwenhuizen  <janneke@gnu.org>
	    Ludovic Courtès  <ludo@gnu.org>

	system: Support compilation on the Hurd.
	* modules/shepherd/system.scm.in (prctl): Wrap 'dynamic-func' call in
	'false-if-exception'.

2020-03-06  Brice Waegeneire  <brice@waegenei.re>

	.dir-locals.el: End sentence with a double space.
	* .dir-locals.el (nil): Add variable 'sentence-end-double-space'.

	doc: Fix wolfgangj example.
	* doc/examples/wolfgangj.scm: Use module SRFI-1. Replace "dmd" by "shepherd".

	doc: Expand the part on special action 'doc'.
	* doc/shepherd.texi (Jump start): Rewrite paragraph about special action
	'doc'.

	service: Fix typos.
	* modules/shepherd/service.scm (root-service): Replace "safe" by "save".

	doc: Fix typos.
	* doc/shepherd.texi (Jump start): Lower case after a colon. Remove
	"the".

2020-03-06  Ludovic Courtès  <ludo@gnu.org>

	build: Rebuild man pages when 'configure.ac' changes.
	Fixes <https://bugs.gnu.org/39694>.
	Reported by Efraim Flashner <efraim@flashner.co.il>.

	This ensures that man pages are rebuilt when the version number is
	changed in 'configure.ac'.

	* Makefile.am (doc/shepherd.1, doc/%.1, doc/%.8): Add dependency on
	'configure.ac'.

2020-02-16  Ludovic Courtès  <ludo@gnu.org>

	build: Bump to version 0.7.0.
	* configure.ac: Bump to version 0.7.0.

	Update 'NEWS'.
	* NEWS: Change "0.6.2" to "0.7.0".

2020-02-03  Ludovic Courtès  <ludo@gnu.org>

	Update 'NEWS'.

	service: Export 'default-environment-variables'.
	* modules/shepherd/service.scm (default-environment-variables): Turn
	into a parameter and export.
	* doc/shepherd.texi (Service De- and Constructors): Document it.

2020-01-20  Ludovic Courtès  <ludo@gnu.org>

	nls: Update uk translation.

2020-01-02  Ludovic Courtès  <ludo@gnu.org>

	support: Update copyright year in '--version' output.
	* modules/shepherd/support.scm (display-version): Update to 2020.

	service: Adjust 'action' exception handler to Guile 3.0.
	* modules/shepherd/service.scm (action): Adjust 'catch' handler
	wrt. SRFI-34 exceptions to Guile 2.9.7/2.9.8 by checking whether KEY is
	'%exception and using 'raise-exception' instead of 'throw' to re-throw
	the exception.

2019-12-30  Ludovic Courtès  <ludo@gnu.org>

	nls: Update sv translation.

2019-12-09  Ludovic Courtès  <ludo@gnu.org>

	Update 'NEWS'.

2019-12-09  Ludovic Courtès  <ludo@gnu.org>

	Add SIGSEGV/SIGABRT "crash" handler.
	This allows shepherd to dump core when it's running as PID 1 on
	GNU/Linux.

	* etc/crash-handler.c: New file.
	* configure.ac: Define 'BUILD_CRASH_HANDLER' Automake conditional.
	* Makefile.am (EXTRA_DIST): Add 'etc/crash-handler.c'.
	(all-local, install-crash-handler, etc/crash-handler.so) [BUILD_CRASH_HANDLER]:
	New targets.
	(CLEANFILES) [BUILD_CRASH_HANDLER]: Add 'etc/crash-handler.so'.
	(install-exec-hook): Depend on 'install-crash-handler'.
	(uninstall-hook): Delete $(pkglibdir)/crash-handler.so.
	(instantiate): Substitute "%pkglibdir%".
	* modules/shepherd/config.scm.in (%pkglibdir): New variable.
	* modules/shepherd.scm (main): Attempt to load "crash-handler.so".

2019-06-21  Ludovic Courtès  <ludo@gnu.org>

	service: 'make-forkexec-constructor' no longer deletes the log file.
	* modules/shepherd/service.scm (make-forkexec-constructor): Remove call
	to 'clean-up' for LOG-FILE.

2019-06-06  Ludovic Courtès  <ludo@gnu.org>

	shepherd: Disable reboot on ctrl-alt-del before loading the config file.
	Reported by Florian Pelz <pelzflorian@pelzflorian.de>
	in <https://bugs.gnu.org/35996>.

	* modules/shepherd.scm (main): Move 'sigaction' and
	'disable-reboot-on-ctrl-alt-del' calls before 'load-in-user-module'.
	This ensures a clean reboot if the user presses ctrl-alt-del before the
	config file has been fully loaded (on Guix System, the config file is
	fully loaded once all the services have been started).

2019-05-11  Ludovic Courtès  <ludo@gnu.org>

	build: Bump to version 0.6.1.
	* configure.ac: Bump to version 0.6.1.

	Update 'NEWS'.

	nls: Update es, fr, and pt_BR translations.

	nls: Add de translation.

	nls: Add sk translation.

2019-05-08  Ludovic Courtès  <ludo@gnu.org>

	herd: Distinguish between stopped and one-shot services.
	* modules/shepherd/scripts/herd.scm (display-status-summary): Partition
	STOPPED into STOPPED and ONE-SHOT.  Add an extra call to
	'display-services' for one-shot services.
	(display-service-status): Distinguish between "stopped" and
	"stopped (one-shot)".
	* tests/one-shot.sh: Test it all.

	comm: Send clients the 'one-shot?' property when it is true.
	* modules/shepherd/service.scm (service->sexp): Send the 'one-shot?'
	property when SERVICE is one-shot.

	comm: Add 'herd load' test for exceptions containing records.
	* tests/basic.sh: Add 'herd load' test with throw to 'what?!.

2019-05-08  Ludovic Courtès  <ludo@gnu.org>

	comm: Serialize pairs.
	Fixes <https://bugs.gnu.org/35631>.
	Reported by Gábor Boskovits <boskovits@gmail.com>.

	Previously shepherd would die on 'syntax-error exceptions: its arguments
	include an alist for the source location, and there was no
	'result->sexp' method for pairs.

	* modules/shepherd/comm.scm (result->sexp <pair>): New method.
	* tests/basic.sh: Add test.

2019-05-08  Ludovic Courtès  <ludo@gnu.org>

	services: 'read-pid-file' optionally ensures it read a valid PID.
	* modules/shepherd/service.scm (read-pid-file): Add #:validate-pid?
	parameter and honor it.
	(make-forkexec-constructor): Pass #:validate-pid? #t.

2019-05-06  Ludovic Courtès  <ludo@gnu.org>

	services: 'read-pid-file' always exits its busy loop.
	* modules/shepherd/service.scm (read-pid-file): Factorize retrial in
	'try-again'.  This avoids the direct and unconditional call to 'loop'
	introduced in 72631752149d000c8c98ae0cc66e0b0c2eda94ef.

2019-05-04  Ludovic Courtès  <ludo@gnu.org>

	services: Gracefully handle PID files not created atomically.
	Prompted by <https://bugs.gnu.org/35550>.

	* modules/shepherd/service.scm (read-pid-file): Loop when
	'string->number' returns #f.
	* tests/pid-file.sh: Define 'test-works' service that checks for PID
	files not created atomically.

2019-05-03  Ludovic Courtès  <ludo@gnu.org>

	nls: Update da translation.

2019-04-23  Ludovic Courtès  <ludo@gnu.org>

	build: Bump to version 0.6.0.
	* configure.ac: Bump to version 0.6.0.

	Update 'NEWS'.

	nls: Update da, es, fr, pt_BR, sv, ta, uk, zh_CN.

2019-04-18  Ludovic Courtès  <ludo@gnu.org>

	Ignore tests/*.log and tests/*.trs.

	support: Improve i18n for the '--version' output.
	* modules/shepherd/support.scm (display-version): Split output in two
	strings, and make the year an parameter.

	support: Update copyright year in '--version' output.
	* modules/shepherd/support.scm (display-version): Update to 2019.

	service: Add one-shot services.
	* modules/shepherd/service.scm (<service>)[one-shot?]: New field.
	(start): Always set the 'running slot of a one-shot service to #f, but
	always return the value returned by the service's 'start' method.
	* tests/one-shot.sh: New file.
	* Makefile.am (TESTS): Add it.
	* doc/shepherd.texi (Slots of services): Document it.
	(Methods of services): Add 'one-shot?'.

2019-04-18  Ludovic Courtès  <ludo@gnu.org>

	shepherd: Don't fail if the socket file has already been removed.
	This is a followup to f260b2f90ed9ea9a1529e5a58db8df3a886d9c10.

	In the test suite, for example, we'd usually explicitly remove the
	socket file, possibly before 'shepherd' has exited.  This would cause a
	'system-error' exception when 'shepherd' tries to delete it.

	* modules/shepherd.scm (call-with-server-socket): Wrap 'delete-file'
	call in 'catch-system-error'.

2019-04-18  Ludovic Courtès  <ludo@gnu.org>

	'report-error' now translates messages.
	Until now, messages passed to 'report-error' would never be passed to
	gettext.

	* modules/shepherd/support.scm (report-error): Guard now checks that P
	is actually L10N.  Add call to 'l10n' on MESSAGE and remove
	expansion-time format string modification.

2019-04-18  Ludovic Courtès  <ludo@gnu.org>

	herd: Add comment about confusing message.
	Suggested by pelzflorian (Florian Pelz) <pelzflorian@pelzflorian.de>.

	* modules/shepherd/scripts/herd.scm (display-service-status): Add
	"TRANSLATORS" comment.

2019-04-08  宋文武  <iyzsong@member.fsf.org>

	shepherd: Delete the socket file upon exit.
	Fixes <https://bugs.gnu.org/34407>.

	* modules/shepherd.scm (call-with-server-socket): New procedure.
	(main): Use it instead of 'open-server-socket'.

2019-03-31  Ludovic Courtès  <ludo@gnu.org>

	nls: Add ta translation.

2019-03-16  Ludovic Courtès  <ludo@gnu.org>

	tests: Adjust "herd stop" test.
	This is a followup to 5368ee4a9f0e71a091883c0b6bddbcf33ab1ecf8.

	* tests/basic.sh: Avoid $(...) form, quote the output of "$herd stop
	test", and redirect stderr or "herd stop" to stdout so we actually
	capture it.

2019-03-16  Ludovic Courtès  <ludo@gnu.org>

	shepherd: Correctly handle 'quit' exception with an associated value.
	* modules/shepherd.scm (quit-exception-handler): Add optional 'value'
	parameter.

2019-02-05  Ricardo Wurmus  <rekado@elephly.net>

	service: Don't raise error when stopping an already stopped service.
	* modules/shepherd/service.scm (stop): If a service by the given name exists
	and is already stopped, then don't raise an error.
	* tests/basic.sh: Add test.

2019-01-31  Ludovic Courtès  <ludo@gnu.org>

	tests: Mitigate timing issue.
	Partly fixes <https://bugs.gnu.org/30299>.
	Reported by Mark H Weaver <mhw@netris.org>
	and Andreas Enge <andreas@enge.fr>.

	* tests/pid-file.sh: Set #:pid-file-timeout to 6 seconds.

2018-11-26  Florian Dold  <flo@dold.me>

	build: set gettext version to make bootstrap work
	* configure.ac: add AM_GNU_GETTEXT_VERSION

2018-11-16  Ludovic Courtès  <ludo@gnu.org>

	doc: Provide complete socket file name under /run/user.
	Reported by Danny Milosavljevic <dannym@scratchpost.org>.

	* doc/shepherd.texi (Invoking shepherd): Add "/socket" to "/run/user/…".

2018-11-14  Ludovic Courtès  <ludo@gnu.org>

	doc: Explain where /run/user comes from.
	Suggested by Marius Bakke <mbakke@fastmail.com>
	in <https://bugs.gnu.org/33260>.

	* doc/shepherd.texi (Invoking shepherd): Explain where /run/user comes
	from.

2018-11-13  Ludovic Courtès  <ludo@gnu.org>

	herd: Exit with non-zero when a custom action returns false.
	* modules/shepherd/scripts/herd.scm (run-command): Call (exit 1) unless
	all the values of RESULT are true.
	* tests/basic.sh: Test it.

2018-11-07  Ludovic Courtès  <ludo@gnu.org>

	nls: Update uk translation.

2018-10-08  Ludovic Courtès  <ludo@gnu.org>

	doc: Fix typos.
	Fixes <https://bugs.gnu.org/32985>.
	Reported by Meiyo Peng <meiyo.peng@gmail.com>.

	* doc/shepherd.texi (The root and unknown services): Replace "safe" by
	"save".

2018-09-28  Ludovic Courtès  <ludo@gnu.org>

	service: Simplify 'register-services'.
	* modules/shepherd/service.scm (register-services)[register-single-service]:
	Simplify by using 'assert'.

	doc: Add missing @command markup.
	* doc/shepherd.texi (Invoking herd, Invoking reboot)
	(Invoking halt): Use @command in the section title.

	service: Use 'else' in 'cond'.
	* modules/shepherd/service.scm (register-services)[register-single-service]:
	Use 'else', not '#:else' (in practice it makes no difference other than
	aesthetically.)

2018-09-26  Ludovic Courtès  <ludo@gnu.org>

	shepherd: Ignore reboot(2) errors in containers.
	* modules/shepherd.scm (main): Ignore EINVAL and EPERM raised by
	'disable-reboot-on-ctrl-alt-del'.

	build: Bump to version 0.5.0.
	* configure.ac: Bump to version 0.5.0.

	Update 'NEWS'.

	build: Accept Guile 3.0.
	* configure.ac: Add 3.0 to 'GUILE_PKG'.

	Fix bogus 'cond-expand'.
	* modules/shepherd/support.scm (initialize-cli): Use 'if-2.0' instead of
	a bogus 'cond-expand'.

	Avoid uses of the _IO* constants on Guile >= 2.2.
	* modules/shepherd/support.scm (if-2.0, buffering-mode): New macros.
	(initialize-cli): Use 'buffering-mode' instead of _IO*.
	* modules/shepherd/comm.scm (open-connection): Likewise.
	* modules/shepherd.scm (main): Likewise.
	* tests/misbehaved-client.sh: Likewise.

	nls: Update fr translation.

	nls: Update sv translation.

	nls: Update pt_BR translation.

2018-09-21  Rafael Fontenelle  <rafaelff@gnome.org>

	Fix typographical errors.
	* configure.ac: procude -> produce.
	* doc/shepherd.texi: Fix several typos.
	* modules/shepherd/args.scm: ambigous -> ambiguous.
	* modules/shepherd/service.scm: childs -> children.

2018-09-19  Ludovic Courtès  <ludo@gnu.org>

	nls: Add sv translation.

	service: Update use of long gone 'apply-to-args'.
	* modules/shepherd/service.scm (handle-unknown): Use 'apply', not
	'apply-to-args'.

2018-09-19  Ludovic Courtès  <ludo@gnu.org>

	Remove runlevels.
	This feature was never fully implemented and there's little interest in
	having it nowadays.

	* modules/shepherd/runlevel.scm: Remove.
	* Makefile.am (dist_shepherdsub_DATA): Remove it.
	* doc/shepherd.texi (Runlevels): Remove node.
	* modules/shepherd.scm: Remove use of (shepherd runlevel).
	* modules/shepherd.scm (start-in-order): New procedure, salvaged from
	runlevel.scm.

2018-09-19  Ludovic Courtès  <ludo@gnu.org>

	comm: Do not introduce empty lines in the log.
	Fixes a regression introduced in
	329cec8b6fcc57f945e748793470f573b2b449a3 whereby regular "has been
	started" etc. lines in the log would be followed by an empty line.

	* modules/shepherd/comm.scm (make-shepherd-output-port): Use
	'string-index' in a loop instead of 'string-split' to detect newlines in
	STR.
	* tests/basic.sh: Check for zero empty lines in $log.

2018-09-19  Ludovic Courtès  <ludo@gnu.org>

	i18n: Add missing calls to 'l10n'.
	* modules/shepherd/support.scm (local-output): Remove useless 'gettext'
	call.
	Add missing 'l10n' call around strings passed to 'local-output'.
	* modules/shepherd/service.scm, modules/shepherd.scm: Likewise.

	Make sure ctrl-alt-del is handled by PID 1.
	* configure.ac: Set RB_DISABLE_CAD to "#f" on GNU/Hurd and other OSes.
	Substitute it.
	* modules/shepherd.scm (main): Call 'disable-reboot-on-ctrl-alt-del'
	when running as PID 1.  In SIGINT handler, catch 'quit to make sure we
	reboot.
	(quit-exception-handler): New procedure.
	(process-command): Use it.
	* modules/shepherd/system.scm.in (RB_DISABLE_CAD): New variable.
	(disable-reboot-on-ctrl-alt-del): New procedure.

2018-09-19  Carlo Zancanaro  <carlo@zancanaro.id.au>
	    Ludovic Courtès  <ludo@gnu.org>

	Remove EINTR-safe, and all references to it.
	This fixes commit 2756a929d96725d837738e396619072d50b366cc by removing
	leftover #:replace in (shepherd service), which had the effect of
	leaving 'system' and 'system*' unbound.

	* modules/shepherd/support.scm (EINTR-safe): Remove procedure and its export.
	* modules/shepherd/service.scm (system*, system*): Remove now-unnecessary
	procedures, and remove corresponding #:replace.
	(waitpid*): Remove references to EINTR-safe.
	* modules/shepherd.scm (main): Remove references to EINTR-safe.

2018-08-26  Carlo Zancanaro  <carlo@zancanaro.id.au>

	service: Restart dependent services on service restart
	* modules/shepherd/service.scm (required-by?): New procedure.
	(stop): Return a list of canonical-names for stopped dependent services,
	including transitive dependencies.
	(action)[restart]: Start services based on the return value of stop.
	(fold-services): New procedure.
	* doc/shepherd.texi (Jump Start): Clarify details about new behaviour of
	restart.
	* tests/restart.sh: New file.
	* Makefile.am (TESTS): Add tests/restart.sh.

	Revert "Remove EINTR-safe, and all references to it."
	This reverts commit 2756a929d96725d837738e396619072d50b366cc.

2018-08-23  Carlo Zancanaro  <carlo@zancanaro.id.au>

	service: Add a replacement slot for delayed service replacement.
	* modules/shepherd/service.scm (<service>): Add replacement slot
	(replace-service): New procedure.
	(stop): Call replace-service after stopping a service.
	(register-services): Replace existing services where possible, setting the new
	replacement slot if they are currently running.
	* tests/replacement.sh: Add a test for it.
	* Makefile.am (TESTS): Add the new test.
	* doc/shepherd.texi (Slots of services): Document it.

2018-07-13  Ludovic Courtès  <ludo@gnu.org>

	service: Let users invoke actions even on services that don't run.
	Suggested by Clément Lassieur <clement@lassieur.org>
	in <https://bugs.gnu.org/32128>.

	* modules/shepherd/service.scm (action): Call PROC unconditionally.

2018-07-11  Ludovic Courtès  <ludo@gnu.org>

	shepherd: Preserve empty lines in action messages.
	Previously, "herd hi test-2" in the example added by this commit would
	lack the empty line between "start" and "end".

	* modules/shepherd.scm (%not-newline): Remove.
	(process-command)[get-messages]: Use 'string-split' plus some
	post-processing instead of 'string-tokenize'.
	* modules/shepherd/comm.scm (%not-newline): Remove.
	(make-shepherd-output-port): Use 'string-split' instead of
	'string-tokenize'.
	* tests/basic.sh: Add #:actions in 'test-2' and test the new action.

2018-07-11  Ludovic Courtès  <ludo@gnu.org>

	build: Make forbidden pattern stricter.
	Somehow, with Guile 2.2.4, we were now getting:

	  configure:6899: error: possibly undefined macro: GUILE_PKG_ERRORS

	* configure.ac: Make forbidden pattern stricter.

2018-05-10  Ludovic Courtès  <ludo@gnu.org>

	nls: Add es translation.

2018-04-23  Ludovic Courtès  <ludo@gnu.org>

	nls: Update pt_BR translation.

2018-04-10  Carlo Zancanaro  <carlo@zancanaro.id.au>

	Remove EINTR-safe, and all references to it.
	* modules/shepherd/support.scm (EINTR-safe): Remove procedure and its export.
	* modules/shepherd/service.scm (system*, system*): Remove now-unnecessary
	  procedures.
	  (waitpid*): Remove references to EINTR-safe.
	* modules/shepherd.scm (main): Remove references to EINTR-safe.

	Update Guile dependency to 2.0.13 or later
	* README (Requirements): Change 2.x to 2.0.13 or later.
	* configure.ac: Check for 2.0.13 or later if Guile 2.0 is detected.

2018-03-22  Ludovic Courtès  <ludo@gnu.org>

	Update 'NEWS'.

	build: Bump to version 0.4.0.
	* configure.ac: Bump to version 0.4.0.

	service: 'exec-command' closes file descriptors as its last action.
	* modules/shepherd/service.scm (exec-command): Move
	file-descriptor-closing loop as the last action before 'execl'.

	nls: Add missing translatable files.
	* po/POTFILES.in: Add modules/scripts/*.scm.

2018-03-15  Ludovic Courtès  <ludo@gnu.org>

	Use syslog for logging when running as root.
	* modules/shepherd/comm.scm (call-with-syslog-port, syslog-output-port):
	New procedures.
	* modules/shepherd.scm (main): Set 'log-output-port'
	to (syslog-output-port) when running as root.
	* doc/shepherd.texi (Invoking shepherd): Adjust accordingly.

	Simplify 'make-shepherd-output-port'.
	* modules/shepherd/comm.scm (%not-newline): New variable.
	(make-shepherd-output-port): Rewrite second method to simplify and make
	a single 'display' call per line.

	Turn 'log-output-port' into a parameter.
	* modules/shepherd/comm.scm (log-output-port): Turn into a parameter and
	publish it.
	(start-logging, stop-logging): Adjust accordingly and mark as deprecated.
	(make-shepherd-output-port): Adjust accordingly.
	* modules/shepherd/support.scm (default-logfile): Remove.
	(user-default-log-file): New procedure.
	(default-logfile-date-format): Remove 'if'.
	* modules/shepherd.scm (main): Have LOGFILE default to #f.  Parameterize
	'log-output-port' and 'current-output-port'.

2018-03-12  Ludovic Courtès  <ludo@gnu.org>

	nls: Update fr translation.

2018-03-05  Danny Milosavljevic  <dannym@scratchpost.org>
	    Ludovic Courtès  <ludo@gnu.org>

	Log to /dev/kmsg when running as root on GNU/Linux.
	* modules/shepherd/support.scm (default-logfile): Set /dev/kmsg when it
	exists and we're root.
	(default-logfile-date-format): Adjust format when using /dev/kmsg.
	* modules/shepherd.scm (main): Redirect 'current-output-port' to the
	bitbucket when LOGFILE is /dev/kmsg.
	* doc/shepherd.texi (Invoking shepherd): Document the new behavior when
	'--log-file' is omitted.

	comm: Expose 'make-shepherd-output-port' in lieu of 'shepherd-output-port'.
	* modules/shepherd/comm.scm (make-shepherd-output-port): Make
	'original-output-port' optional, and make public.
	(shepherd-output-port): Remove.
	* modules/shepherd.scm (main): Adjust accordingly.

	Make date format in the log file configurable.
	* modules/shepherd/support.scm (default-logfile-date-format): New
	variable.
	* modules/shepherd/comm.scm (%current-logfile-date-format): New
	variable.
	(make-shepherd-output-port): Use it.

2018-03-05  Ludovic Courtès  <ludo@gnu.org>

	system: Adjust error case of 'prctl'.
	* modules/shepherd/system.scm.in (prctl): Remove reference to 'name' in
	call to 'throw'.

2018-03-05  Carlo Zancanaro  <carlo@zancanaro.id.au>

	Poll every 0.5s to find dead forked services if prctl fails.
	* modules/shepherd.scm (open-server-socket): Set socket to be
	  non-blocking.
	  (main): If we are unable to use prctl/PR_SET_CHILD_SUBREAPER, then poll for
	  service processes between client connections, or every 0.5 seconds.
	* modules/shepherd/service.scm (fork+exec-command): Install handle-SIGCHLD as
	  signal handler.
	  (respawn-service): Separate logic for respawning services from handling
	  SIGCHLD.
	  (handle-SIGCHLD, check-for-dead-services): New exported procedures.
	* tests/basic.sh, tests/status-sexp.sh: Replace constant integers with
	  symbols.
	* doc/shepherd.texi (Slots of services): Add note about service running slot
	  being a process id.

2018-03-05  Ludovic Courtès  <ludo@gnu.org>

	nls: Update fr translation.

	nls: Add da translation.

	nls: Add zh_CN translation.

2018-03-04  Carlo Zancanaro  <carlo@zancanaro.id.au>

	Handle forked process SIGCHLD signals.
	* tests/forking-service.sh: New file.
	* Makefile.am (TESTS): Add tests/forking-service.sh.
	* modules/shepherd.scm: Set the child subreaper attribute of main shepherd
	  process (as long as we're not pid 1).
	* modules/shepherd/service.scm (root-service)[daemonize]: Set the child
	  subreaper attribute of newly forked shepherd process.

	Add prctl syscall wrapper along with with PR_SET_CHILD_SUBREAPER.
	* configure.ac: Detect and substitute PR_SET_CHILD_SUBREAPER.
	* modules/shepherd/system.scm.in (PR_SET_CHILD_SUBREAPER): Add new variable
	  and export it.
	  (prctl): Add new procedure and export it.

2018-03-02  Ludovic Courtès  <ludo@gnu.org>

	nls: Add pt_BR translation.

	nls: Add fr translation.

2018-03-02  Ludovic Courtès  <ludo@gnu.org>

	build: Fix typo.
	Fixes a regression introduced in
	6dd27d2925fc4fe589e5b2632df5307c41fba1bf.

	* Makefile.am (AM_TESTS_ENVIRONMENT): Fix typo.

2018-03-02  Ludovic Courtès  <ludo@gnu.org>

	args: Invite translators to add a bug report address.
	* modules/shepherd/args.scm (process-args): Add TRANSLATORS comment.

	Augment '.gitignore'.

	nls: Add uk translation.
	* po/LINGUAS, po/uk.po: New files.

	args: Add missing 'l10n' annotations.
	* modules/shepherd/args.scm (process-args): Add missing 'l10n' calls.

	Complete i18n support.
	* Makefile.am (instantiate): Substitute '%localedir%'.
	(AM_TESTS_ENVIRONMENT): Clear l10n-related variables.
	* modules/shepherd/config.scm.in (%localedir): New variable.
	* modules/shepherd/support.scm (%gettext-domain): New variable.
	(initialize-cli): New procedure.
	* modules/shepherd.scm (main): Use 'initialize-cli' instead of
	'setlocale'.
	* modules/shepherd/scripts/halt.scm (main): Likewise.
	* modules/shepherd/scripts/herd.scm (main): Likewise.
	* modules/shepherd/scripts/reboot.scm (main): Likewise.

2018-03-02  Ludovic Courtès  <ludo@gnu.org>

	service: 'exec-command' opens #:log-file in append mode.
	Fixes <https://bugs.gnu.org/30649>.
	Reported by Andreas Enge <andreas@enge.fr>.

	* modules/shepherd/service.scm (exec-command): Open LOG-FILE with
	O_APPEND.  Avoid second 'open-fdes' call for stderr.
	* doc/shepherd.texi (Service De- and Constructors): Adjust accordingly.

2018-03-01  Ludovic Courtès  <ludo@gnu.org>

	Adjust strings for Translation Project submission.
	Suggested by Benno Schulenberg <coordinator@translationproject.org>.

	* modules/shepherd.scm (main): Add missing comma.
	* modules/shepherd/comm.scm (report-command-error): Add "TRANSLATORS"
	comment.

2018-03-01  Carlo Zancanaro  <carlo@zancanaro.id.au>

	Terminate all services upon SIGTERM or SIGHUP
	* modules/shepherd.scm (main): Add SIGTERM and SIGHUP handlers which stop
	  root-service.
	* tests/sigint.sh: Rename to...
	* tests/signals.sh: ... this, and add tests for SIGTERM and SIGUP.

2018-02-04  Ludovic Courtès  <ludo@gnu.org>

	build: Add i18n infrastructure.
	* Makefile.am (EXTRA_DIST): Add build-aux/config.rpath.
	(SUBDIRS, ACLOCAL_AMFLAGS): New variables.
	* configure.ac: Use 'AM_GNU_GETTEXT'.  Instantiate po/Makefile.in.
	* po/Makevars, po/POTFILES.in: New files.

	Use 'l10n' where it's missing.
	* modules/shepherd.scm (main): Use 'l10n' for option arguments and all.
	* modules/shepherd/scripts/herd.scm (main): Likewise.
	* modules/shepherd/args.scm (process-args): Use 'l10n' for the last few
	lines of '--help'.

	support: Update copyright year in '--version' output.
	* modules/shepherd/support.scm (display-version): Update to 2018.

2018-02-04  Ludovic Courtès  <ludo@gnu.org>

	herd: 'herd status' now sorts the result.
	Partly fixes <https://bugs.gnu.org/30299>.
	Reported by Mark H Weaver <mhw@netris.org>.

	Previously 'tests/basic.sh' could occasionally fail on:

	  test "`$herd status`" == "$pristine_status"

	because the order of stopped services were not always the same.  Indeed,
	those services come from 'service-list' on the shepherd side, which uses
	'hash-fold' to traverse the service hash table, and the traversal order
	of 'hash-fold' is undefined.

	* modules/shepherd/scripts/herd.scm (display-status-summary)[service<?]:
	New procedure.
	[display-services]: Call 'sort' and use the above.

2017-12-03  Ludovic Courtès  <ludo@gnu.org>

	service: In 'exec-command', close open ports before 'execl'.
	This gets rid of annoying "Bad file descriptor" warnings from shepherd.

	* modules/shepherd/service.scm (exec-command): In 'loop', invoke
	'close-port' and the ports returned by (fdes->ports i).

2017-09-07  Jelle Licht  <jlicht@fsfe.org>

	Lazily register SIGCHLD hander on first call to 'fork+exec-command'.
	* modules/shepherd.scm (main): Move unconditional top-level call to 'sigaction' to...
	* modules/shepherd/service.scm (fork+exec-command): here. Use new variable.
	(%sigchld-handler-installed?): New variable.

2017-07-10  宋文武  <iyzsong@member.fsf.org>

	service: Fix arguments passing in the 'restart' action.
	* modules/shepherd/service.scm (action): Use 'apply' to invoke the 'start'
	procedure in the 'restart' action.

2017-06-16  Danny Milosavljevic  <dannym@scratchpost.org>
	    Ludovic Courtès  <ludo@gnu.org>

	Use XDG_RUNTIME_DIR for the shepherd socket.
	* modules/shepherd/support.scm (%user-runtime-dir): New variable.
	(default-socket-dir): Use it.
	* doc/shepherd.texi (Invoking shepherd): Document it.

	Make sure that shepherd does not serve already-served sockets.
	* modules/shepherd.scm (open-server-socket): Remove call to
	'delete-file'.
	* tests/basic.sh: Remove "$socket" before spawning a new 'shepherd'.

2017-01-14  Benz Schenk  <benz.schenk@uzh.ch>

	doc: Fix typo "Jump Start".
	* doc/shepherd.texi (Jump Start): Fix typo.

2016-12-04  Ludovic Courtès  <ludo@gnu.org>

	Update 'NEWS'.

	build: Bump to 0.3.2.
	* configure.ac: Bump to version 0.3.2.

	build: 'make clean' removes 'modules/shepherd.go'.
	* Makefile.am (CLEANFILES): Add $(nodist_guileobject_DATA).

2016-12-04  Ludovic Courtès  <ludo@gnu.org>

	build: Make sure installed .scm files are older than installed .go files.
	This is a followup to 657387546ecf20b28632394be58a4ec43eb08d19.

	* Makefile.am (shepherd_install_go_files): Set to
	'install-nodist_guileobjectDATA'.
	(shepherdsub_install_go_files): Set to
	'install-nodist_shepherdgosubDATA'.  Add dependency on
	'install-nodist_shepherdsubDATA' to account for shepherd/config.scm.
	(scripts_install_go_files): Set to 'install-nodist_scriptsgoDATA'.

2016-11-26  Ludovic Courtès  <ludo@gnu.org>

	services: Kill the process that did not create its PID file.
	Reported by iyzsong@member.fsf.org (宋文武)
	at <https://lists.gnu.org/archive/html/guix-devel/2016-11/msg00947.html>.

	* modules/shepherd/service.scm (read-pid-file): Return #f upon ENOENT
	after MAX-DELAY has expired.
	(make-forkexec-constructor): When 'read-pid-file' returns #f,
	do (kill pid SIGTERM).
	* tests/pid-file.sh: New file.
	* Makefile.am (TESTS): Add it.

2016-11-26  Ludovic Courtès  <ludo@gnu.org>

	service: Add #:pid-file-timeout parameter to 'make-forkexec-constructor'.
	* modules/shepherd/service.scm (%pid-file-timeout): New variable.
	(make-forkexec-constructor): Add #:pid-file-timeout parameter and pass
	it to 'read-pid-file'.

2016-11-26  Christopher Allan Webber  <cwebber@dustycloud.org>
	    Ludovic Courtès  <ludo@gnu.org>

	herd: Have status display services as a bulleted list.
	* modules/shepherd/scripts/herd.scm (display-status-summary)
	[display-services]: New procedure.
	Display services as an ASCII bulleted list.
	* tests/basic.sh: Adjust accordingly.

2016-11-21  Ludovic Courtès  <ludo@gnu.org>

	Register SIGCHLD handler in (sherpherd) rather than at the top level.
	* modules/shepherd/service.scm: Move top-level call to 'sigaction' to...
	* modules/shepherd.scm (main): ... here.

2016-10-21  Ludovic Courtès  <ludo@gnu.org>

	build: Refer to $(guileobjectdir) in installed scripts.
	This is a followup to 657387546ecf20b28632394be58a4ec43eb08d19.

	* Makefile.am (install-exec-hook): Adjust to new 'guileobjectdir'.

2016-10-20  Ludovic Courtès  <ludo@gnu.org>

	system: Use #:return-errno? when it's available.
	* modules/shepherd/system.scm.in (syscall->procedure): New procedure.
	(%libc-reboot): Use it.  Adjust call to PROC accordingly.
	(sysconf): Likewise.

	build: Install '.go' files under LIBDIR.
	* configure.ac: Define and substitute 'guileobjectdir'.
	* Makefile.am (nodist_guileobject_DATA): New variable.
	(nodist_guilemodule_DATA): Remove.
	(nodist_shepherdsub_DATA): Remove 'modules/shepherd/system.scm'.
	(nodist_shepherdgosub_DATA, shepherdgosubdir)
	(scriptsgodir, nodist_scriptsgo_DATA): New variables.
	(nodist_scripts_DATA): Remove.
	(CLEANFILES): Add $(nodist_shepherdgosub_DATA) and
	$(nodist_scriptsgo_DATA).  Remove $(nodist_scripts_DATA).

	build: Support Guile 2.2.
	* configure.ac: Use 'GUILE_PKG'.  Remove explicit Guile version check
	and check for 'guild'.  Honor $GUILE_EFFECTIVE_VERSION in
	'guilemoduledir'.

2016-10-16  Ludovic Courtès  <ludo@gnu.org>

	service: 'enable' and other actions now have a fixed arity.
	* modules/shepherd/service.scm (action)[default-action]: Return
	fixed-arity procedures for 'status', 'enable', and 'disable'.
	* tests/basic.sh: Add test.

2016-10-16  Ludovic Courtès  <ludo@gnu.org>

	service: Protect against wrong number of arguments to 'enable' etc.
	Fixes <http://bugs.gnu.org/24684>.
	Reported by Caleb Ristvedt <caleb.ristvedt@cune.org>.

	* modules/shepherd/service.scm (action)[default-action]: Add 'enable',
	'disable', and 'doc'.
	Move 'catch' form around the 'cond' expression.
	(action) <symbol>: Invoke the other 'action' method.
	* tests/basic.sh: Add test.

2016-09-11  David Craven  <david@craven.ch>

	service: Honor #:log-file in make-forkexec-constructor.
	* modules/shepherd/service.scm (exec-command): Redirect stdout and
	  stderr to log-file.
	  (fork+exec-command): Pass log-file to exec-command.
	  (make-forkexec-constructor): Cleanup log-file. Pass log-file to
	  fork+exec-command.
	* doc/shepherd.texi (@deffn): Update documentation.

2016-03-23  Ludovic Courtès  <ludo@gnu.org>

	Update 'NEWS'.

	Update 'NEWS'.

	build: Bump to 0.3.1.
	* configure.ac: Bump to version 0.3.1.

2016-03-23  Ludovic Courtès  <ludo@gnu.org>

	herd: Display the last respawn time.
	Suggested by Danny Milosavljevic <dannym@scratchpost.org>.

	* modules/shepherd/scripts/herd.scm (display-service-status): Display
	'last-respawns'.
	* tests/respawn-throttling.sh: Test it.

2016-03-23  Ludovic Courtès  <ludo@gnu.org>

	service: Improve wording of 'waitpid' "error" message.
	* modules/shepherd/service.scm (waitpid*): Change "error" message to
	"warning", and improve wording.

	service: Choose a respawn limit slightly more lax.
	* modules/shepherd/service.scm (respawn-limit): Change to '(5 . 7).

2016-03-23  Ludovic Courtès  <ludo@gnu.org>

	service: Make sure the respawn limit is honored.
	This fixes a bug whereby services would be respawned forever because the
	'start' method would reset the 'last-respawns' field each time it
	respawns a service.  Regression introduced in version 0.3 (commit
	063d09b2a29768e957a3d867fca5f2f7cd2489ab.)

	Reported by Danny Milosavljevic <dannym@scratchpost.org>
	at <http://debbugs.gnu.org/cgi/bugreport.cgi?bug=23064>.

	* modules/shepherd/service.scm (start): Leave the 'last-respawns' field
	unchanged.
	(stop): Reset the 'last-respawns' field.
	* tests/respawn-throttling.sh: New file.
	* Makefile.am (TESTS): Add it.

2016-03-23  Ludovic Courtès  <ludo@gnu.org>

	service: Fix harmless typo.
	* modules/shepherd/service.scm (root-service): Fix typo.

2016-02-06  Ludovic Courtès  <ludo@gnu.org>

	support: Adjust 'mkdir-p' to GNU/Hurd behavior.
	Reported by David Michael <fedora.dm0@gmail.com>.

	* modules/shepherd/support.scm (mkdir-p): If we get an error other than
	EEXIST but PATH exists and is a directory, keep going.

2016-02-05  Ludovic Courtès  <ludo@gnu.org>

	service: Export '&action-runtime-error'.
	* modules/shepherd/service.scm: Export &action-runtime-error and related
	bindings.

2016-02-04  Ludovic Courtès  <ludo@gnu.org>

	tests: Add test with exception thrown in 'start'.
	* tests/basic.sh: Add test with service 'broken'.

2016-01-28  Mathieu Lirzin  <mthl@gnu.org>

	doc: Move man pages to the 'doc' directory.
	* Makefile.am (man-page-target): Delete function.
	(dist_man1_MANS, dist_man8_MANS): Prefix each element with 'doc/'.
	(shepherd.1): Rename to ...
	(doc/shepherd.1): ... this.
	(doc/%.1, doc/%.8): New targets.
	(gen_man): New variable.
	* .gitignore: Update it.

	doc: Move manual to the 'doc' directory.
	* doc/shepherd.texi: Moved from the root directory.
	* doc/fdl-1.3.texi: Likewise.
	* Makefile.am (info_TEXINFOS): Add a 'doc/' prefix to 'shepherd.texi'.
	(EXTRA_DIST): Remove 'fdl-1.3.texi'.
	(doc_shepherd_TEXINFOS): New variable.
	* .gitignore: Update it.

	doc: Move examples to the 'doc/examples' directory.
	* doc/examples/README: moved from 'examples' directory.
	* doc/examples/_unknown.scm: Likewise.
	* doc/examples/wolfgangj.scm: Likewise.
	* shepherd.texi (Jump Start): Adapt a reference to those examples.
	* examples/Makefile.am: Delete file.
	* configure.ac (AC_CONFIG_FILES): Adapt to it.
	* Makefile.am (EXTRA_DIST): Add files from "doc/examples" directory.
	(SUBDIRS): Delete variable.

2016-01-27  Ludovic Courtès  <ludo@gnu.org>

	build: Unset 'GUILE_LOAD_COMPILED_PATH' while building.
	* Makefile.am (%.go): Unset GUILE_LOAD_COMPILED_PATH.

	services: Add 'eval' action to 'root'.
	* modules/shepherd/support.scm (eval-in-user-module): New procedure.
	* modules/shepherd/service.scm (root-service): Add 'eval' action.
	* tests/basic.sh: Add tests.
	* modules/shepherd/scripts/herd.scm (run-command): Add special case for
	'eval'.
	* shepherd.texi (The root and unknown services): Document it.
	* NEWS: Mention it.

	Update 'NEWS'.

	doc: Improve the introduction.
	* shepherd.texi (Introduction): Mention "GNU Daemon Shepherd"; reword a
	few things.

	doc: Document the sexp protocol.
	* shepherd.texi (Communication): Document the sexp protocol.

	comm: Buffer the communication socket on the server side.
	* modules/shepherd.scm (main): Add 'setvbuf' call.
	* modules/shepherd/comm.scm (write-reply): Add 'force-output' call.

	comm: Buffer the communication socket on the client side.
	* modules/shepherd/comm.scm (open-connection): Add 'setvbuf' call.
	(write-command): Add 'force-output' call.

	comm: The 'arguments' of a command is a list.
	* modules/shepherd/comm.scm (read-command): Expect 'arguments' to be a
	list.
	(write-command): Send 'arguments' as a list instead of splicing it.

	build: Really make sure installed .go files are newer.
	* Makefile.am (shepherd_install_go_files): Remove 'nobase_'.
	(shepherdsub_install_go_files, scripts_install_go_files): New variables
	and targets.

	Default system-wide config file is now /etc/shepherd.scm.
	* modules/shepherd/support.scm (default-config-file): Remove ".conf".
	* shepherd.texi (Jump Start): Adjust accordingly.

	build: Build man pages.
	* Makefile.am (AM_V_HELP2MAN, AM_V_HELP2MAN_, AM_V_HELP2MAN_0)
	(HELP2MANFLAGS): New variables.
	(man-page-target): New function.
	(shepherd.1): New target.
	(dist_man1_MANS, dist_man8_MANS): New variables.
	* configure.ac: Use AM_MISSING_PROG for 'HELP2MAN'.

	build: Install Guile modules to the usual place.
	* Makefile.am (shepherddir): Remove.
	(dist_shepherd_DATA): Rename to...
	(dist_guilemodule_DATA): ... this.
	(nodist_shepherd_DATA): Rename to...
	(nodist_guilemodule_DATA): ... this.
	* configure.ac: Define and substitute 'guilemoduledir'.

	Move commands to (shepherd scripts xyz).
	* Makefile.am (dist_shepherd_DATA): Remove {herd,halt,reboot}.scm.
	(scriptsdir, dist_scripts_DATA, nodist_scripts_DATA): New variables.
	(CLEANFILES): Add $(nodist_scripts_DATA).
	* modules/halt.scm, modules/herd.scm, modules/reboot.scm: Move to...
	* modules/scripts/{halt,herd,reboot}.scm: ... here.
	* halt.in, herd.in, reboot.in: Adjust accordingly.

	Add the list of conflicting services to the status sexp.
	* modules/shepherd/service.scm (service->sexp): Add 'conflicts'.
	* modules/herd.scm (display-service-status): Display it.
	* tests/status-sexp.sh: Adjust accordingly.

	Canonicalize the running value to valid read syntax.
	* modules/shepherd/service.scm (service->sexp): Pass the 'running' value
	through 'result->sexp'.
	* tests/basic.sh: Add test.

2016-01-27  Alex Kost  <alezost@gmail.com>

	service: 'conflicts-with' returns a list of services.
	This fixes a regression introduced in commit
	cb168150d4581ffbc357ab6cdcd45d59051ee821.

	If 'conflicts-with' returns a list of names, 'conflicts-with-running'
	fails because 'running?' cannot be applied to a symbol.

	* modules/shepherd/service.scm (conflicts-with): Return a list of
	  services instead of names.
	  (start): Adjust accordingly.

2016-01-26  Ludovic Courtès  <ludo@gnu.org>

	tests: Do not fail when $HOME or $XDG_CONFIG_HOME are erroneous.
	* tests/sigint.sh: Specify --log.  This is useful when $XDG_CONFIG_HOME
	happens to be unusable.

	Add record type for service actions.
	* modules/shepherd/service.scm (<action>): New record type.
	(make-actions): Use 'make-action' instead of 'cons'.
	(action:name, action:proc, action:doc): Remove.  Adjust callers to use
	'action-name', 'action-procedure', and 'action-documentation' instead.
	(lookup-action): Adjust to use 'find'.
	(action): Remove 'apply-if-proc', use 'and=>' instead.

2016-01-26  Alex Kost  <alezost@gmail.com>

	Remove utils.
	* utils/Makefile.am: Remove file.
	* utils/dmd-gettext.scm: Remove file.
	* utils/sysvconfig.scm: Remove file.
	* Makefile.am (SUBDIRS): Remove 'utils'.
	* configure.ac: Remove 'utils/Makefile'.
	* .gitignore: Likewise.

	Replace "dmd" with "shepherd" in comments and strings.
	* modules/shepherd/support.scm: Use "shepherd" instead of "dmd"
	  everywhere.
	* configure.ac: Likewise.
	* tests/no-home.sh: Likewise.
	* tests/sigint.sh: Likewise.

	support: Rename state file.
	* modules/shepherd/support.scm (default-persistency-state-file): Use
	  "shepherd" instead of "dmd".

	Rename default system configuration file.
	* modules/shepherd/support.scm (default-config-file): Rename
	  "dmdconf.scm" to "shepherd.conf.scm".
	* shepherd.texi (Jump Start): Likewise.

	support: Rename 'make-dmd-user-module' to 'make-user-module'.
	* modules/shepherd/support.scm (make-dmd-user-module): Rename to...
	(make-user-module): ... this.
	(load-in-user-module): Adjust accordingly.

	ChangeLog: Rename git repository.
	* ChangeLog: Use shepherd source.

	tests: Rename 'dmd_pid' to 'shepherd_pid'.
	* tests/basic.sh: Rename 'dmd_pid' to 'shepherd_pid'.
	* tests/misbehaved-client.sh: Likewise.
	* tests/no-home.sh: Likewise.
	* tests/respawn.sh: Likewise.
	* tests/status-sexp.sh: Likewise.

2016-01-26  Alex Kost  <alezost@gmail.com>

	tests: misbehaved-client: Rename 'dmd' to 'root'.
	This is a followup to commit cddf6a5aed5c66f91b93a84afa4b5dadde743b13.

	* tests/misbehaved-client.sh: Use 'root' service name instead of 'dmd'.

2016-01-26  Alex Kost  <alezost@gmail.com>

	service: Improve 'service-list'.
	* modules/shepherd/service.scm (service-list): Use
	  'lookup-canonical-service' on each name instead of removing duplicates
	  from the final list.

2016-01-25  Ludovic Courtès  <ludo@gnu.org>

	doc: Make the "Internals" section less personal.
	* shepherd.texi (Internals): Remove the personal introduction.  Replace
	it by a paragraph pointing to mailing lists.
	(Coding standards): Xref "Coding Style" in Guix.
	(Design decisions, Runlevel evolution): Add note to mention that it's
	historical material.

2016-01-25  Ludovic Courtès  <ludo@gnu.org>

	Use 'with-directory-excursion' for user-supplied directories.
	Before that the directory supplied in the command would change that
	current working directory of shepherd, and it would not be changed
	back.

	* modules/shepherd/support.scm (with-directory-excursion): New macro.
	* modules/shepherd.scm (process-command): Remove 'chdir' call.  Use
	'with-directory-excursion' instead.
	* tests/basic.sh: Test 'herd load root some-conf.scm'.

2016-01-25  Alex Kost  <alezost@gmail.com>

	Update .gitignore.
	This is a followup to commit 9f902c716537be551eadecd4c30118fc9ad12b60.

	* .gitignore: Add files for "misbehaved-client.sh" test.

2016-01-25  Alex Kost  <alezost@gmail.com>

	reboot, halt: Rename 'dmd' to 'root'.
	This is a followup to commit cddf6a5aed5c66f91b93a84afa4b5dadde743b13.

	* modules/halt.scm (main): Use 'root' service name instead of 'dmd'.
	* modules/reboot.scm (main): Likewise.

2016-01-25  Ludovic Courtès  <ludo@gnu.org>

	service: Add #:pid-file to 'make-forkexec-constructor'.
	* modules/shepherd/service.scm (read-pid-file): New procedure.
	(make-forkexec-constructor): Add #:pid-file parameter and honor it.
	* tests/respawn.sh: Change 'test2' to use #:pid-file.  Use 'test -f'
	instead of 'wait_for_file' for $service2_pid.
	* shepherd.texi (Service De- and Constructors): Adjust accordingly.

2016-01-24  Ludovic Courtès  <ludo@gnu.org>

	'herd help' displays a help message.
	* modules/shepherd/service.scm (root-service): Add 'help' action.
	* modules/herd.scm (run-command): Add special-case for 'help'.
	(main): Allow 'herd help' without a service name.

	Update 'AUTHORS'.

2016-01-24  Alex Kost  <alezost@gmail.com>

	Rename 'dmd' service to 'root'.
	* modules/shepherd/service.scm (dmd-service): Rename to...
	(shepherd-service): ... this.  Provide both 'root' and 'shepherd' names.
	Adjust the rest file accordingly.
	* modules/shepherd.scm: Likewise.
	* modules/herd.scm: Likewise.
	* modules/halt.scm: Likewise.
	* modules/reboot.scm: Likewise.
	* modules/shepherd/support.scm (make-bare-init-file): Likewise.
	* shepherd.texi: Likewise.
	* tests/basic.sh: Likewise.
	* tests/no-home.sh: Likewise.
	* tests/status-sexp.sh: Likewise.

	service: Add docstring to 'lookup-services'.
	* modules/shepherd/service.scm (lookup-services): Use docstring instead
	  of a comment.

	service: 'service-list' returns unique services.
	* modules/shepherd/service.scm (service-list): Remove duplicates from
	  the final list.

	service: Improve style of 'for-each-service'.
	* modules/shepherd/service.scm (lookup-canonical-service): New procedure.
	(for-each-service): Use it.  Use 'hash-for-each' instead of 'hash-fold'.

	service: Rename 'services' variable to '%services'.
	* modules/shepherd/service.scm (services): Rename to...
	(%services): ... this.
	(for-each-service, service-list, find-service, lookup-services,
	register-services, deregister-service): Adjust accordingly.

2016-01-23  Ludovic Courtès  <ludo@gnu.org>

	Asking for the doc of unknown actions raises an error.
	* modules/shepherd/service.scm (doc): Raise &unknown-action-error when
	asked for the doc of an unknown action.
	* tests/basic.sh: Add test.

	comm: Add missing quotes in error message.
	* modules/shepherd/comm.scm (report-command-error): Quote action name.

	shepherd: Protect against unrecognized sexps.
	* modules/shepherd/comm.scm (read-command): Return #f for anything that
	doesn't match the expected form.
	* tests/misbehaved-client.sh: Add test.

	shepherd: Protect against 'read' errors.
	* modules/shepherd/comm.scm (read-command): Catch 'read-error'
	exceptions.  Return #f upon EOF.
	* modules/shepherd.scm (process-connection): Adjust accordingly.
	* tests/misbehaved-client.sh: Add test with invalid sexp.

2016-01-23  Ludovic Courtès  <ludo@gnu.org>

	tests: Do not leave processes behind.
	Before that, shepherd processes were left behind because we would always
	remove the PID file before checking for its existence.

	* tests/basic.sh, tests/misbehaved-client.sh, tests/no-home.sh,
	tests/respawn.sh, tests/sigint.sh, tests/status-sexp.sh: Remove $pid
	only after it has been used to kill the daemon.

2016-01-23  Ludovic Courtès  <ludo@gnu.org>

	shepherd: Check for client EOF.
	* modules/shepherd/comm.scm (read-command): Check for 'eof-object?' and
	return it as is when it occurs.
	* modules/shepherd.scm (process-connection): Likewise.
	* tests/misbehaved-client.sh: Add test.

2016-01-23  Alex Kost  <alezost@gmail.com>

	Rename 'dmd-command' to 'shepherd-command'.
	* modules/shepherd/comm.scm (<dmd-command>): Rename record type and its
	accessors to...
	(<shepherd-command>): ... this.
	(read-command, write-command): Adjust accordingly.
	* modules/halt.scm (main): Likewise.
	* modules/herd.scm (run-command): Likewise.
	* modules/reboot.scm (main): Likewise.
	* modules/shepherd.scm (process-command, process-textual-commands): Likewise.
	* tests/status-sexp.sh, tests/misbehaved-client.sh: Likewise.
	* shepherd.texi (Communication): Likewise.

	Rename 'dmd-output-port' to 'shepherd-output-port'.
	* modules/shepherd/comm.scm (make-dmd-output-port): Rename to...
	(make-shepherd-output-port): ... this.
	(dmd-output-port): Rename to...
	(shepherd-output-port): ... this.
	* modules/shepherd.scm (main): Adjust accordingly.

2016-01-23  Ludovic Courtès  <ludo@gnu.org>

	shepherd: Ignore SIGPIPE.
	* modules/shepherd.scm (main): Call 'sigaction' to ignore SIGPIPE.
	* tests/misbehaved-client.sh: New file.
	* Makefile.am (TESTS): Add it.

2016-01-22  Ludovic Courtès  <ludo@gnu.org>

	reboot, halt: Adjust to sexp replies.
	* modules/reboot.scm (main): Read the reply in sexp format.
	* modules/halt.scm (main): Ditto.

	comm: Add 'report-command-error'.
	* modules/herd.scm (run-command): Move error interpretation to...
	* modules/shepherd/comm.scm (report-command-error): ... here.  New
	procedure.

	support: Add 'display-line'.
	* modules/shepherd/support.scm (display-line): New procedure.
	* modules/herd.scm (println): Remove.
	(run-command): Use 'display-line' instead of 'println'.

	Move 'report-error' to (shepherd support).
	* modules/herd.scm (program-name): Remove.
	(report-error): Remove.
	(main): Parametrize 'program-name'.
	* modules/reboot.scm (program-name): Remove.
	(main): Parametrize 'program-name'.
	* modules/halt.scm (program-name): Remove.
	(main): Parametrize 'program-name'.
	* modules/shepherd.scm (program-name): Remove.
	* modules/shepherd/support.scm (display-version): #:program-name
	defaults to (program-name).
	(program-name): New variable.
	(report-error): New macro, moved from herd.scm.

	herd: Report errors according to the GNU standards.
	* modules/herd.scm (service-list-error): Remove.
	(report-error): New macro.
	(run-command): Use it instead of 'format'.

2016-01-20  Ludovic Courtès  <ludo@gnu.org>

	Add '&action-runtime-error'.
	* modules/shepherd/service.scm (&action-runtime-error): New error
	condition type.
	(report-exception): New procedure.
	(condition->sexp): Handle it.
	(start): Use 'report-exception' instead of 'caught-error'.
	(action): Remove use of 'can-apply?'.  Use 'report-exception' instead of
	'caught-error'.
	(load-config): Remove 'catch'.
	* modules/shepherd/support.scm (can-apply?): Remove.
	* modules/herd.scm (run-command): Handle 'action-exception' errors.
	* tests/basic.sh: Test the exit code of 'herd' for wrong-arg-num and
	system-error exceptions.

	doc: Mention exit code of 'herd'.
	* shepherd.texi (Invoking herd): Mention exit code.

	herd: Interpret 'start' failures as an error.
	* modules/shepherd/service.scm (launch-service): Return #f on failure.
	Remove 'local-output' call.
	* modules/herd.scm (run-command): Add case to interpret the result of
	'start'.
	* tests/basic.sh: Test exit code with disable/start/enable.

	Add '&unknown-action-error'.
	* modules/shepherd/service.scm (&unknown-action-error): New error
	condition type.
	(condition->sexp): Handle it.
	(action)[default-action]: Raise it instead of using 'local-output'.
	Adjust body so that SRFI-34 exception is not swallowed.
	* modules/shepherd.scm (process-command): Guard against 'service-error?'
	in general.
	* modules/herd.scm (run-command): Handle 'action-not-found' errors.

	Command replies are always sexps.
	* modules/shepherd/comm.scm (<command-reply>): New type.
	(write-reply): New procedure.
	(result->sexp): New generic function.
	* modules/shepherd/service.scm (condition->sexp): New procedure.
	(action) <status>: Return OBJ instead of calling 'local-output'.
	(service->sexp): Turn into a regular procedure.
	(result->sexp): New method.
	(action): Return the list of results.
	(dmd-service) <status>: Return the service list.  Remove 'local-output'
	call.
	* modules/shepherd.scm (process-connection): Remove 'paramterize' form.
	(%not-newline): New variable.
	(process-command): Add 'port' parameter. Parametrize
	%CURRENT-CLIENT-SOCKET to a string output port.  Use 'write-reply' to
	send the reply.
	(process-textual-commands): Pass PORT to 'process-command'.
	* modules/herd.scm (display-status-summary): Expect SERVICES to be a
	regular list.
	(display-detailed-status): Likewise.
	(display-service-status): Remove 'error' cases.
	(println): New procedure.
	(run-command): Match against 'reply' sexp.
	* tests/basic.sh: Check the return code of "herd start" and "herd stop"
	in addition to "herd status" for nonexistent services.
	* tests/status-sexp.sh: Adjust to new protocol.

2016-01-18  Ludovic Courtès  <ludo@gnu.org>

	service: Raise specific error conditions for missing services.
	This fixes a regression introduced in 2f204c9 whereby
	"herd status does-not-exist" would spit out a backtrace on a 'match'
	error.

	* modules/shepherd/service.scm (&service-error, &missing-service-error):
	New error conditions.
	(launch-service, stop, action, deregister-service): Raise it instead of
	using 'local-output' when the designated service is missing.
	* modules/shepherd.scm (process-command): Guard against
	&missing-service-error and handle it.
	* modules/herd.scm (display-service-status): Handle 'error' sexps.
	* tests/basic.sh: Test exit code of "herd status does-not-exist".
	* tests/status-sexp.sh: Test sexp returned for nonexistent services.

2016-01-18  Ludovic Courtès  <ludo@gnu.org>

	tests: Poll less aggressively.
	Among other things, this makes test logs *much* shorter.

	* tests/basic.sh: Use "sleep 0.3" instead of ":" in loops that poll for
	"$pid".
	* tests/no-home.sh: Likewise.
	* tests/status-sexp.sh: Likewise.

2016-01-18  Mathieu Lirzin  <mthl@gnu.org>

	support: Rename user-dmddir to %user-config-dir.
	* modules/shepherd/support.scm (user-dmddir): Rename to ...
	(%user-config-dir): ... this.  Honor XDG_CONFIG_HOME and use
	'$HOME/.config/shepherd' as default value.  All consumers changed.
	(mkdir-p): New procedure.  Export it.
	(default-config-file): Use it.
	(verify-dir): Likewise.
	* shepherd.texi (Jump Start, Invoking shepherd): Document the new user
	configuration directory.
	* tests/basic.sh: Check if XDG_CONFIG_HOME is honored.
	* Makefile.am (AM_TESTS_ENVIRONMENT): Unset it.

2016-01-18  Ludovic Courtès  <ludo@gnu.org>

	service: Rewrite 'conflicts-with' in functional style.
	* modules/shepherd/service.scm (conflicts-with): Rewrite using
	'append-map' and 'filter-map'.
	(conflicts-with-running): Rewrite in terms of 'conflicts-with'.

	Change "dmd" to "Shepherd" in README.
	* README: Adjust.

2016-01-17  Mathieu Lirzin  <mthl@gnu.org>

	support: Add a keyword argument '#:secure?' to verify-dir.
	* modules/shepherd.scm (verify-dir): Replace argument INSECURE by a
	keyword argument #:SECURE?.  All callers changed.  Improve the logic of
	the implementation.

	maint: Add .dir-locals.el.
	* .dir-locals.el: New file.

	maint: Fix version checking for Guile.
	* configure.ac: Replace an ocurrence of "major-version" with
	"minor-version".

	maint: Update .gitignore.
	*.gitignore: Replace dmd with shepherd in .gitignore.

	build: Improve display for silent rules.
	* Makefile.am (AM_V_INSTANTIATE, AM_V_INSTANTIATE_, AM_V_INSTANTIATE_0):
	Delete variables.
	(%): Use the predefined variable AM_V_GEN instead of AM_V_INSTANTIATE.
	(AM_V_GUILEC_0): Fix spacing between the command and the file name.
	(%.go): Close standard output when silent rules are enabled, to prevent
	'guild compile' to make any noise.

2016-01-17  Fabian Harfert  <fhmgufs@web.de>
	    Ludovic Courtès  <ludo@gnu.org>

	Rename 'deco' command to 'herd'.
	* deco.in: Rename to...
	* herd.in: ... this.
	* modules/deco.scm: Rename to...
	* modules/herd.scm: ... this.
	* modules/shepherd.scm, modules/shepherd/comm.scm,
	modules/shepherd/service.scm, modules/shepherd/support.scm,
	tests/basic.sh, tests/no-home.sh, tests/respawn.sh,
	tests/sigint.sh, tests/status-sexp.sh: Adjust accordingly.
	* Makefile.am (bin_SCRIPTS, template, dist_shepherd_DATA): Adjust
	accordingly.
	* shepherd.texi: Change 'deco' to 'herd'.
	(Invoking herd): Rename to...
	(Invoking deco): ... this.
	(deco and shepherd): Rename to...
	(herd and shepherd): ... this.  Explain the name 'herd' and mention
	'deco' in a footnote.

2016-01-17  Mathieu Lirzin  <mthl@gnu.org>

	build: Add missing backslash in AM_TESTS_ENVIRONMENT.
	* Makefile.am (AM_TESTS_ENVIRONMENT): Add missing backslash.

2016-01-13  Ludovic Courtès  <ludo@gnu.org>

	Remove manual hash table resizing code.
	* modules/shepherd/service.scm (services-max-cnt, services-cnt): Remove.
	(register-services)[register-single-service]: Remove manual hash table
	resizing code.
	(deregister-service)[deregister]: Likewise.
	* modules/shepherd/support.scm (copy-hashq-table): Remove.

	service: Improve style of 'lookup-running-or-providing'.
	* modules/shepherd/service.scm (lookup-running-or-providing): Rewrite
	using 'match'.
	(service?): New procedure.

	service: Rewrite 'launch-service' in functional style.
	* modules/shepherd/service.scm (launch-service): Rewrite in a functional
	style.

2016-01-12  Ludovic Courtès  <ludo@gnu.org>

	build: Support silent rules; enable them by default.
	* Makefile.am (AM_V_INSTANTIATE, AM_V_INSTANTIATE_)
	(AM_V_INSTANTIATE_0): New variables.
	(%: %.in): Use it.
	(AM_V_GUILEC, AM_V_GUILEC_, AM_V_GUILEC_0): New variables.
	(%.go: %.scm): Use it.
	* configure.ac: Use 'AM_SILENT_RULES'.

	Avoid uses of 'call/ec'.
	* modules/shepherd/args.scm (process-args)[find-short-option]: Use
	'find' instead of 'call/ec' + 'for-each'.
	* modules/shepherd/service.scm (start, launch-service): Likewise.
	(depends-resolved?): Use 'every' instead of 'call/ec'.

	Update copyright year in --version output.
	* modules/shepherd/support.scm (display-version): Update copyright
	year.  Replace people's names with "the Shepherd authors".

	shepherd: Remove undocumented 'dmd-status' command.
	* modules/shepherd.scm (process-command): Remove 'dmd-status' case.

	Rename state directory and log file.
	* Makefile.am (install-data-local): Change "/run/dmd" to
	"/run/shepherd".
	* modules/shepherd/support.scm (%system-socket-dir): Likewise.
	(default-logfile): Change "dmd.log" to "shepherd.log".
	* shepherd.texi: Adjust accordingly.

2016-01-11  Ludovic Courtès  <ludo@gnu.org>

	doc: Rename.
	* dmd.texi: Rename to...
	* shepherd.texi: ... this.  Change "dmd" to "the Shepherd", and
	"@command{dmd}" to "@command{shepherd}".
	* Makefile.am (info_TEXINFOS): Adjust accordingly.

	Rename 'dmd' command to 'shepherd'.
	* modules/dmd.scm: Rename to...
	* modules/shepherd.scm: ... this.
	(program-name): Change to "shepherd".
	* configure.ac: Adjust accordingly.
	* dmd.in: Rename to...
	* shepherd.in: ... this.
	* tests/basic.sh, tests/no-home.sh, tests/respawn.sh,
	tests/sigint.sh, tests/status-sexp.sh: Invoke 'shepherd' instead of
	'dmd'.
	* Makefile.am (templates, bin_SCRIPTS): Adjust accordingly.
	(dist_shepherd_DATA): Likewise.

	Rename modules to (shepherd ...).
	* modules/dmd: Rename directory to...
	* modules/shepherd: ... this.  Adjust module names accordingly.
	* modules/deco.scm, modules/dmd.scm, modules/halt.scm,
	modules/reboot.scm, tests/status-sexp.sh: Use the new module names.
	* configure.ac: Adjust to the new file names.
	* Makefile.am (templates, BUILT_SOURCES): Adjust file names.
	(modules/dmd/config.scm): Rename target to...
	(modules/shepherd/config.scm): ... this.
	(dmddir, dmdsubdir): Rename to...
	(shepherddir, shepherdsubdir): ... these.  Adjust corresponding variable
	names accordingly.
	(install-exec-hook): Adjust accordingly.
	(dmd_install_go_files): Rename to...
	(shepherd_install_go_files): ... this.

	build: Change package name to "GNU Shepherd".
	* configure.ac: Change name to "GNU Shepherd".  Bump version to 0.3.

2016-01-11  Ludovic Courtès  <ludo@gnu.org>

	License headers refer to "the GNU Shepherd".
	This is the result of applying this sed script:

	  s/This file is part of GNU dmd/This file is part of the GNU Shepherd/;
	  s/GNU dmd is free software/The GNU Shepherd is free software/;
	  s/GNU dmd is distributed/The GNU Shepherd is distributed/;
	  s/along with GNU dmd/along with the GNU Shepherd/

2016-01-09  Ludovic Courtès  <ludo@gnu.org>

	service: 'status' always returns an sexp; 'deco' interprets it.
	This moves formatting (and localization) of 'status' command outputs to
	the client side.

	* modules/dmd/service.scm (action)[status]: Write (service->sexp obj)
	instead of calling 'dmd-status'.
	(dmd-status): Remove.
	* modules/dmd/service.scm (dmd-service) <actions>: Remove 'sexp-status'
	and 'detailed-status'; 'status' now does what 'sexp-status' used to do.
	* modules/deco.scm (service-list-error, service-canonical-name)
	(display-status-summary, display-detailed-status)
	(display-service-status): New procedure.
	(alist-let*): New macro.
	* modules/deco.scm (run-command): Special-case the 'status' and
	'detailed-status' commands, using the above procedures.  Close SOCK
	before returning.
	* Makefile.am (AM_TESTS_ENVIRONMENT): Add 'GUILE', 'GUILE_LOAD_PATH',
	and 'GUILE_LOAD_COMPILED_PATH'.
	* tests/status-sexp.sh (fetch_status): New variable.
	Use "$GUILE" when invoking Guile.  Use the (dmd comm) module and
	FETCH_STATUS to fetch the status sexp.

2016-01-09  Ludovic Courtès  <ludo@gnu.org>

	deco: 'run-command' expects symbols.
	* modules/deco.scm (run-command): Expect SERVICE and ACTION to be
	symbols.
	(main): Adjust accordingly.

2016-01-08  Ludovic Courtès  <ludo@gnu.org>

	service: Clear supplementary groups only when asked to.
	* modules/dmd/service.scm (exec-command): Move 'setgroups' under 'when
	group'.

	Write the PID file atomically.
	* modules/dmd/support.scm (with-atomic-file-output): New file.
	* modules/dmd.scm (main): Use it.

	deco: "deco status" is equivalent to "deco status dmd".
	* modules/deco.scm (run-command): New procedure.
	(main): Use it.  Allow the 'service' argument to be omitted for the
	"status" and "detailed-status" actions.
	* tests/basic.sh, tests/respawn.sh: Use "deco status" instead of "deco
	status dmd" in some places.
	* dmd.texi (Jump Start): Simplify the examples accordingly.
	(Invoking deco): Document the change.

	service: Add 'status-sexp' action for dmd.
	* modules/dmd/service.scm (service->sexp, service-list): New
	procedures.
	(dmd-service)[status-sexp]: New action.
	* tests/status-sexp.sh: New file.
	* Makefile.am (TESTS): Add it.

2016-01-07  Ludovic Courtès  <ludo@gnu.org>

	services: 'last-respawns' is no longer circular.
	Before this change, the 'last-respawns' slot was a circular list.

	* modules/dmd/service.scm (respawn-limit-hit?): New procedure.
	(<service>)[last-respawns]: Initialize to the empty list.
	(respawn-service): Use 'respawn-limit-hit?'.  Always append to the
	'last-respawns' slot.
	(start): Reset 'last-respawns' slot.

2016-01-07  Ludovic Courtès  <ludo@gnu.org>

	build: Install 'shutdown' as a symlink to 'halt'.
	* Makefile.am (install-exec-hook): Depend on
	'install-executable-symlinks'.
	(install-executable-symlinks, uninstall-hook): New targets.

	'halt' and 'reboot' connect to the system socket.
	* modules/dmd/support.scm (%system-socket-dir): New variable.
	(default-socket-dir): Use it.
	(%system-socket-file): New variable.
	* modules/halt.scm (main): Use %SYSTEM-SOCKET-FILE.
	* modules/reboot.scm (main): Likewise.

2016-01-06  Ludovic Courtès  <ludo@gnu.org>

	'exec-command' clears the list of supplementary groups.
	* modules/dmd/service.scm (exec-command): Add call to 'setgroups'.

2016-01-06  David Thompson  <dthompson2@worcester.edu>

	service: Change GID before UID when dropping privileges.
	* modules/dmd/service.scm (exec-command): Move 'setgid' call before
	'setuid' call.

2016-01-06  Ludovic Courtès  <ludo@gnu.org>

	tests: Remove race condition in respawn test.
	Fixes <http://bugs.gnu.org/22130>.
	Reported by Mark H Weaver <mhw@netris.org>.

	* tests/respawn.sh: Use 'wait_for_file' instead of 'test -f' when
	checking for service PID files right after services have been started.

2015-11-20  Ludovic Courtès  <ludo@gnu.org>

	halt, reboot: Clarify usage line in '--help'.
	Reported by sebboh on #guix.

	* modules/halt.scm (main): Remove "ARGS..." string in 'process-args'
	  argument.
	* modules/reboot.scm (main): Ditto.

2015-09-04  David Thompson  <dthompson2@worcester.edu>

	service: Export provided-by procedure.
	* modules/dmd/service.scm: Export provided-by.

2015-08-20  Ludovic Courtès  <ludo@gnu.org>

	Add Andy to 'AUTHORS'.

2015-08-20  Andy Wingo  <wingo@pobox.com>

	Add ability to set user and group before exec'ing a command
	* dmd.texi (Service De- and Constructors): Document #:user and #:group
	  options.
	* modules/dmd/service.scm (exec-command, fork+exec-command):
	  (make-forkexec-constructor): Add #:user and #:group keyword arguments.

2015-05-03  David Thompson  <dthompson2@worcester.edu>

	doc: Fix location of default user dmd configuration file.
	* dmd.texi ("Jump Start"): Document the real default user config file.

2015-02-08  Ludovic Courtès  <ludo@gnu.org>

	services: Export 'make-actions'.
	* modules/dmd/service.scm: Export 'make-actions', which is documented.

2014-11-05  Ludovic Courtès  <ludo@gnu.org>

	dmd: Autoload (ice-9 readline).
	* modules/dmd.scm: Autoload (ice-9 readline) since it's rarely needed
	  anyway.

	dmd: Ignore 'daemonize' command when running as PID 1.
	* modules/dmd/service.scm (dmd-service)[daemonizing]: Do nothing
	  when (getpid) returns 1.

2014-07-16  Ludovic Courtès  <ludo@gnu.org>

	dmd: Stop the 'dmd' service upon SIGINT.
	* modules/dmd.scm (main): Add 'sigaction' call.
	* tests/sigint.sh: New file.
	* Makefile.am (TESTS): Add it.

2014-07-11  David Michael  <fedora.dm0@gmail.com>

	build: Support cross-compilation.
	* Makefile.am (%.go): Specify the target platform.

2014-07-09  David Michael  <fedora.dm0@gmail.com>

	dmd: Find the system dmdconf.scm in the configured sysconfdir
	* Makefile.am (instantiate): Substitute the sysconfdir value.
	* modules/dmd/config.scm.in (%sysconfdir): New variable.
	* modules/dmd/support.scm (default-config-file): Use %sysconfdir in
	  place of prefix+"/etc".

2014-07-07  Ludovic Courtès  <ludo@gnu.org>

	Update 'NEWS'.
	* NEWS: Update.

	Display the value of the 'running' slot in 'status' commands.
	* modules/dmd/service.scm (dmd-status): When OBJ is running, show the
	  value of the 'running' slot.

2014-07-04  Ludovic Courtès  <ludo@gnu.org>

	build: Bump to 0.2.
	* configure.ac: Bump to version 0.2.

	services: Use / as the execution directory when $HOME is nonexistent.
	* modules/dmd/service.scm (default-service-directory): Add
	  'ensure-valid' procedure and use it.
	* tests/respawn.sh: Add some debugging output.

2014-07-04  Ludovic Courtès  <ludo@gnu.org>

	dmd: Don't create configuration file when '-c' is passed.
	Fixes a bug where 'dmd' would fail in 'default-config-file' when $HOME
	is not writable, even if '-c' was passed.

	* modules/dmd.scm (main): Delay call to 'default-config-file'.
	* tests/no-home.sh: New file.
	* Makefile.am (TESTS): Add it.

2014-06-24  Ludovic Courtès  <ludo@gnu.org>

	Introduce 'fork+exec-command'.
	* modules/dmd/service.scm (fork+exec-command): New procedure.
	  (make-forkexec-constructor): Use it.
	* dmd.texi (Service De- and Constructors): Document it.

	Export and document 'exec-command'.
	* modules/dmd/service.scm (exec-command): Export.  Augment docstring.
	* dmd.texi (Service De- and Constructors): Document it.

2014-06-23  Ludovic Courtès  <ludo@gnu.org>

	Make sure file descriptor zero is open.
	* modules/dmd/service.scm (exec-command): Open /dev/null on file
	  descriptor 0.

2014-06-19  Ludovic Courtès  <ludo@gnu.org>

	doc: Mention the 'status' command in "Jump Start".
	* dmd.texi (Jump Start): Mention 'deco status dmd', 'deco
	  detailed-status dmd', and 'deco status apache'.

2014-05-09  Ludovic Courtès  <ludo@gnu.org>

	Close the current log output port in 'stop-logging'.
	* modules/dmd/comm.scm (stop-logging): Add 'close-port' call.

2014-05-07  Ludovic Courtès  <ludo@gnu.org>

	Open the log file in append mode.
	* modules/dmd/comm.scm (start-logging): Open FILE in append mode.

	dmd: Make SIGALRM hack conditional on multi-threading support.
	* modules/dmd.scm (main): Move SIGALRM hack under (provided? 'threads)
	  condition.

	Make sure the SIGCHLD handler doesn't run concurrently with 'stop'.
	* modules/dmd/service.scm (stop <service>): Wrap in
	  'call-with-blocked-asyncs'.  Remove 'running-value' variable; set the
	  'running' slot of OBJ to #f when its 'stop' procedure has completed.
	  (respawn-service): Fix comment about asynchronous signal delivery.

	Change so that $HOME prevails over /etc/passwd.
	* modules/dmd/support.scm (user-homedir): Move (getenv "HOME") first.

	Turn 'default-config-files' into a procedure so side effects are under control.
	* modules/dmd/support.scm (default-config-file): Turn into a procedure,
	  so the side effect doesn't happen at random times.
	* modules/dmd.scm (main): Adjust accordingly.

2014-04-10  Ludovic Courtès  <ludo@gnu.org>

	Enrich 'system-error' exceptions thrown by 'connect'.
	* modules/dmd/comm.scm (open-connection): Wrap 'connect' call in
	  'catch'.

2014-04-10  Ludovic Courtès  <ludo@gnu.org>

	Gracefully handle connection errors in client programs.
	Suggested by Cyprien Nicolas <cyprien@nicolas.tf>.

	* modules/dmd/support.scm (call-with-system-error-handling): New
	  procedure.
	  (with-system-error-handling): New macro.
	* modules/deco.scm (main): Wrap body in 'with-system-error-handling'.
	* modules/halt.scm (main): Likewise.
	* modules/reboot.scm (main): Likewise.

2014-04-07  Ludovic Courtès  <ludo@gnu.org>

	Update 'errno' procedure from Guix.
	* modules/dmd/system.scm.in (errno): Update definition, copied from
	  Guix.

2014-03-31  Ludovic Courtès  <ludo@gnu.org>

	Correctly handle one-argument deprecated form of 'make-forkexec-constructor'.
	* modules/dmd/service.scm (make-forkexec-constructor): Add
	  'warn-deprecated-form' thunk.  In the main lambda, check whether
	  COMMAND is a string, and convert it to a list and call
	  'warn-deprecated-form'.

2014-03-25  Ludovic Courtès  <ludo@gnu.org>

	Add #:directory and #:environment-variables for 'make-forkexec-constructor'.
	* modules/dmd/service.scm (default-service-directory,
	  default-environment-variables, exec-command): New procedures.
	  (make-forkexec-constructor): Rewrite using 'case-lambda*', add new
	  form with keyword parameters, and deprecate the old form.  Use
	  'exec-command'.
	* tests/respawn.sh <configuration>: Use the non-deprecated form.
	* dmd.texi (Service De- and Constructors): Adjust
	  'make-forkexec-constructor' documentation accordingly.

2014-03-25  Alex Sassmannshausen  <alex.sassmannshausen@gmail.com>

	dmd: Add dmd action 'reload': unload all; load.
	* modules/dmd/service.scm (load-config): New procedure.
	  (dmd-service): Re-factor 'load', add new action: 'reload'.
	* dmd.texi (The 'dmd' and 'unknown' services): Document 'reload'.
	* tests/basic.sh: Add 'reload' test.

2014-03-12  Ludovic Courtès  <ludo@gnu.org>

	Don't warn about processes that die and don't have an associated service.
	* modules/dmd/service.scm (respawn-service): Comment out warning.

2014-03-12  Alex Sassmannshausen  <alex.sassmannshausen@gmail.com>

	dmd: Add dmd action unload: unload known services.
	* modules/dmd/service.scm (deregister-services): New procedure.
	  (dmd-service): Add new action: unload.
	* dmd.texi (The 'dmd' and 'unknown' services): Document 'unload'.
	* tests/basic.sh: Add 'unload' tests (stop single service  & 'all').

2014-02-18  Ludovic Courtès  <ludo@gnu.org>

	Help Emacs traverse support.scm.
	* modules/dmd/support.scm (make-bare-init-file): Move opening
	  parentheses away from the first column so that Emacs is not confused.

	dmd: Add '--pid' option.
	* modules/dmd.scm (main): Add '--pid' option and honor it.
	* tests/basic.sh: Run dmd with '--pid'.  Wait for the PID file to be
	  available, for synchronization.
	* tests/respawn.sh: Likewise.
	* dmd.texi (Invoking dmd): Document '--pid'.

2014-02-05  Ludovic Courtès  <ludo@gnu.org>

	Augment 'AUTHORS'.

2014-02-05  Alex Sassmannshausen  <alex.sassmannshausen@gmail.com>

	dmd: Make config file if necessary when not run as root.
	* modules/dmd/support.scm (make-bare-init-file): new procedure to
	  generate basic init file.
	  (default-logfile): Check for init file, create it if necessary.

2014-02-04  Alex Sassmannshausen  <alex.sassmannshausen@gmail.com>

	dmd: Use ~/.dmd.d/ by default when not run as root.
	* modules/dmd/support.scm: Add copyright.
	  (user-dmddir): New variable.
	  (default-logfile): Use it instead of user-homedir.
	  (default-persistency-state-file): Use it instead of user-homedir.
	  (default-configfile): Use it instead of user-homedir, use init.scm
	  as default name for configfile, ensure .dmd.d exists.
	  (default-socket-dir): Add check for root, if #f, use user-dmddir as
	  base for socket.

2014-01-24  Alex Sassmannshausen  <alex.sassmannshausen@gmail.com>

	Doc: Introduction: rewrite for style and clarity.
	* dmd.texi (Introduction): Rewrite for style and clarity.

2013-12-15  Ludovic Courtès  <ludo@gnu.org>

	Start gracefully even when /etc/{passwd,shadow} are missing.
	* modules/dmd/support.scm (user-homedir): Gracefully handle 'getpwuid'
	  failure.

2013-12-03  Ludovic Courtès  <ludo@gnu.org>

	doc: Update outdated documentation of communication facilities.
	* dmd.texi (Invoking dmd): Remove mention of special socket name 'none';
	  replace with text about '-'.
	  (Communication): Mention (dmd comm).  Remove documentation of
	  <receiver>, <sender>, receive-data, and send-data.  Document
	  'open-connection', 'write-command', and 'read-command'.

	Change Alfred's address.

2013-12-02  Ludovic Courtès  <ludo@gnu.org>

	build: Change 'respawn.sh' test to use two services.
	* tests/respawn.sh: Add second service.  Use
	  'assert_killed_service_is_respawned' on both services.

	dmd: SIGCHLD handler iterates over all the dead processes.
	* modules/dmd/service.scm (waitpid*): New procedure.
	  (respawn-service): Use it, and pass WNOHANG.  Use 'match', and loop
	  until 'waitpid*' returns a PID of 0.

	dmd: Don't get SIGCHLD for processes that stop.
	* modules/dmd/service.scm: Pass SA_NOCLDSTOP as a 'sigaction' flag.

	Change log file to $localstatedir/log/dmd.log when running as 'root'.
	* modules/dmd/support.scm (default-logfile): Add '/log'.
	* modules/dmd/comm.scm (start-logging): Make sure FILE's directory
	  exists.

2013-12-01  Ludovic Courtès  <ludo@gnu.org>

	Clarify SIGCHLD handler.
	* modules/dmd/service.scm (find-service): New function.
	  (respawn-service): Use it, and fold the body of 'handler' into
	  'respawn-service'.  Emit warning about unknown child processes.

	build: Add test for respawnable services.
	* tests/respawn.sh: New file.
	* Makefile.am (TESTS): Add it.
	  (AM_TESTS_ENVIRONMENT): Set 'SHELL' variable.

	dmd: Work around unreliable signal delivery.
	* modules/dmd.scm (main): Add 'sigaction' and 'alarm' call to wake up
	  every second.  Argh.

	Use 'EINTR-safe' for 'accept' calls.
	* modules/dmd/service.scm (EINTR-safe): Move to...
	* modules/dmd/support.scm (EINTR-safe): ... here.
	* modules/dmd.scm (main): Use 'EINTR-safe' instead of
	  'catch-system-error' for 'accept' calls.

2013-11-30  Ludovic Courtès  <ludo@gnu.org>

	build: Change test to build a local log file rather than under $HOME.
	* tests/basic.sh: Use a temporary log file under $PWD.

	build: Add a basic test.
	* tests/basic.sh: New file.
	* configure.ac: Add 'color-tests' Automake option.
	* Makefile.am (TESTS, TEST_EXTENSIONS, AM_TESTS_ENVIRONMENT,
	  SH_LOG_COMPILER, AM_SH_LOG_FLAGS): New variables.
	  (EXTRA_DIST): Add $(TESTS).

	build: Generate 'ChangeLog' upon 'make dist'.
	* ChangeLog: Rename to...
	* ChangeLog-2003: ... this.
	* ChangeLog: New file.
	* Makefile.am (EXTRA_DIST): Add 'ChangeLog-2003'.
	  (gen-ChangeLog, dist-hook): New targets.
	* build-aux/gitlog-to-changelog: New file, from Gnulib.

	Provide EINTR-safe versions of 'system' and 'system*' for Guile < 2.0.10.
	* modules/dmd/service.scm (EINTR-safe, system*, system): New
	  procedures.

	Update 'NEWS' for 0.1.

	Change 'NEWS' to Org-mode.

	Update 'README' and 'AUTHORS'.

	build: Use Automake's 'std-options' flag.
	* configure.ac: Add 'std-options' to 'AM_INIT_AUTOMAKE'.

	build: Make commands usable before install; relocate them upon install.
	* Makefile.am (install-exec-hook): New target.
	  (instantiate): Remove %DMDDIR%; use %modsrcdir% and %modbuilddir%
	  instead.
	* deco.in, dmd.in, halt.in, reboot.in: Use them instead of %DMDDIR%.

	build: Clean leftover 'halt' and 'reboot' files.
	* Makefile.am (CLEANFILES): Add $(sbin_SCRIPTS).

	doc: Switch license to GNU FDL 1.3+.
	* dmd.texi: Change @copying to FDL 1.3+.  Update master menu.
	  (GNU Free Documentation License): New appendix.
	* fdl-1.3.texi: New file.
	* Makefile.am (EXTRA_DIST): Add it.
	* COPYING.DOC: Remove.

	doc: Assorted improvements.
	* dmd.texi: Change title to "GNU dmd Manual".  Use @copying.  Add
	  directory entry for deco, reboot, and halt.  Set encoding to UTF-8.
	  Use @contents.
	  (Introduction): Fix cross-ref to Guile's Top node.
	  (deco and dmd): Update menu.
	  (Invoking dmd): Add reference to "Services".  Clarify text of
	  '--insecure'.  Remove '--silent'.  Give exact socket file name.
	  (Invoking deco): Improve wording an typography.  Remove non-existent
	  '--insecure' option.
	  (Invoking reboot, Invoking halt): New nodes.
	  (Services): Add cross-ref to GOOPS.  Mention the (dmd service) module.
	  (Service De- and Constructors): Use @var and @dots appropriately.
	  Update 'make-forkexec-constructor' documentation to mention closed
	  file descriptors.
	  (The dmd and unknown services): Use @table @code; remove redundant
	  @code.  Mention the execution environment for 'load'.

2013-11-29  Ludovic Courtès  <ludo@gnu.org>

	doc: Cosmetic updates.
	* dmd.texi (YEARS): Rename to...
	  (OLD-YEARS): ... this.
	  (NEW-YEARS): New variable.
	  Add myself as copyright holder, and add copyright line.
	  (Introduction): Mention use as an init system and as a user.  Link to
	  Guile's manual.
	  (Jump Start): Update socket file name.  Mention 'networking', not
	  'network'.  Remove the 'silent' and 'verbose' actions.
	  (Coding standards): Remove hint about formatting of 'if'.

	Add licensing and copyright information in '--version'.
	* modules/dmd/support.scm: Rewrite as UTF-8.
	  (display-version): Show copyright and licensing info.

	Add 'halt' and 'reboot' commands.
	* halt.in, reboot.in, modules/halt.scm, modules/reboot.scm: New files.
	* Makefile.am (sbin_SCRIPTS): New variable.
	  (templates): Add halt.in and reboot.in.
	  (dist_dmd_DATA): Add halt.scm and reboot.scm.
	  (maybe_executable): New variable.
	  (%:%.in): Use it.
	  (deco, dmd): Remove targets.

	build: Factorize socket directory handling.
	* Makefile.am (install-data-local): Use $(localstatedir), not
	  ${prefix}/var.  Change mode to 700, not 777.  Add '-'.
	  (install-data-hook): Remove.

	deco: Use line buffering for the input.
	* modules/deco.scm (main): Add 'setvbuf' call before receiving input.

	Have 'make-forkexec-constructor' close all file descriptors after 'fork'.
	* configure.ac: Check for '_SC_OPEN_MAX' and substitute it.
	* modules/dmd/system.scm.in (_SC_OPEN_MAX): New variable.
	  (sysconf, max-file-descriptors): New procedures.
	* modules/dmd/service.scm (make-forkexec-constructor): Close all the
	  file descriptors except stdout and stderr before calling 'execlp'.

2013-11-28  Ludovic Courtès  <ludo@gnu.org>

	dmd: The 'load' action loads in a fresh module.
	* modules/dmd.scm (make-dmd-user-module): Move to support.scm.
	  (main): Use 'load-in-user-module' instead of 'primitive-load' and
	  'make-dmd-user-module'.
	* modules/dmd/service.scm (dmd-service)[load]: Use
	  'load-in-user-module'.
	* modules/dmd/support.scm (make-dmd-user-module, load-in-user-module):
	  New procedures.

	Change SIGCHLD handler to dismiss services not backed by a process.
	* modules/dmd/service.scm (respawn-service)[handler]: Deal with
	  'running' slots that are not a number.

	build: Chmod 700 $localstatedir/run/dmd.
	* Makefile.am (install-data-hook): New target.

	Allow non-respawnable services to be stopped.
	* modules/dmd/service.scm (stop): Always clear the 'running' slot before
	  calling OBJ's 'stop'.  Restore its value upon exception.

	dmd: Fix race condition when a service's process dies immediately at startup.
	* modules/dmd/service.scm (start): Wrap call to OBJ's 'start' field in
	  'call-with-blocked-asyncs'.
	  (respawn-service): Disable services whose process just died, even if
	  the service is not respawnable.

2013-11-27  Ludovic Courtès  <ludo@gnu.org>

	Catch 'system-error' in 'make-forkexec-constructor'.
	* modules/dmd/service.scm (make-forkexec-constructor): Catch and handle
	  'system-error'.

	dmd: Catch 'system-error' exceptions in 'accept' call.
	* modules/dmd.scm (main): Wrap 'accept' call in 'catch-system-error'.

	build: Bump to 0.1.
	* configure.ac: Set version to 0.1.

	dmd: Evaluate the configuration file in a fresh module.
	* modules/dmd.scm (make-dmd-user-module): New procedure.
	  (main): Use it.  Load CONFIG-FILE with 'primitive-load', in the
	  context of a fresh module.
	* dmd.texi (Jump Start): Write "reads and evaluates".
	  (Invoking dmd): Likewise.  Make the evaluation context explicit.

	dmd: Adjust command reading from stdin.
	* modules/dmd.scm (main): Remove (not socket-file) case; call
	  'process-textual-commands' in that case.
	  (process-textual-commands): New procedure.

	system: Report the 'errno' value upon 'reboot' failure.
	* modules/dmd/system.scm.in (%libc-reboot): Call 'errno' upon failure,
	  and throw an exception.
	  (%libc-errno-pointer, errno): New procedures.

2013-11-25  Ludovic Courtès  <ludo@gnu.org>

	build: Ensure the templates are instantiated before anything is compiled.
	* Makefile.am (.scm.go): Change to...
	  (%.go:%.scm): ... this.  Add dependency on the instantiated
	  templates.

	deco: Remove '--insecure'.
	* modules/deco.scm (main): Remove '--insecure' option.

	dmd: Simplify output port handling.
	* modules/dmd/comm.scm: Unsplice code formerly in 'begin-dmd' form.
	  Strip export list.  Remove top-level call to 'set-current-output-port'.
	  (make-dmd-output-port): New procedure.
	  (dmd-output-port): Use it.
	  (silent, be-silent, be-verbose): Remove.
	* modules/dmd/service.scm (dmd-service): Remove the 'silent' and
	  'verbose' actions.
	* modules/dmd/support.scm (begin-dmd): Remove.
	* modules/dmd.scm (main): Call 'set-current-output-port' from here.
	  Remove use of 'be-silent'.  '--silent' and '--quiet' are now no-ops.

	Remove now-useless variable.
	* modules/dmd/comm.scm (terminating-string): Remove.

2013-11-24  Ludovic Courtès  <ludo@gnu.org>

	Avoid use of deprecated interface to procedure arities.
	* modules/dmd/support.scm (can-apply?): Use 'procedure-minimum-arity'
	  instead of 'procedure-property'.

	dmd: Write to stdout only as a last resort.
	* modules/dmd/comm.scm (dmd-output-port): When (%current-client-socket)
	  is true, send data only to that.

	Use a single socket for communication; change to an sexp-based protocol.
	* modules/dmd/comm.scm (<sender>, initialize, send-data, <receiver>,
	  initialize, receive-data): Remove.
	  (<dmd-command>): New record type.
	  (dmd-command, open-connection, read-command, write-command): New
	  procedures.
	  (extra-output-sender, open-extra-sender, close-extra-sender,
	  without-extra-output): Remove.
	  (%current-client-socket): New variable.
	* modules/dmd/service.scm (respawn-service): Remove use of
	  'without-extra-output'.
	* modules/dmd/support.scm (default-socket-file): Change to /socket.
	  (default-deco-socket-file): Remove.
	* modules/deco.scm (main): Remove --result-socket option.  Use
	  'open-connection' instead of <sender> and <receiver>.  Use
	  'write-command' instead of 'send-data'.  Use 'read-line' instead of
	  'receive-data'.
	* modules/dmd.scm (open-server-socket): New procedure.
	  (main): Use it.  Remove handshake.
	  (process-connection): New procedure.
	  (process-command): Expect COMMAND to be a <dmd-command>; use 'match'.

	Fix invocation of dmd's and deco's 'main' procedures.
	* modules/deco.scm (main): Turn 'args' into a rest argument.
	  Remove invocation at end of file.
	* modules/dmd.scm (main): Likewise.
	  Remove invocation at end of file.

2013-11-20  Ludovic Courtès  <ludo@gnu.org>

	dmd-service: Really halt/power-off.
	* modules/dmd/service.scm (dmd-service): Change 'halt' and 'power-off'
	  handler for 'quit' to accept one argument.  Move message to the handler.
	* modules/dmd.scm (process-command): Add "Rebooting..." message before
	  call to 'reboot'.

	build: Make 'deco' and 'dmd' executable.
	* Makefile.am (deco, dmd): New targets.

	deco: Gracefully handle not-enough-arguments conditions.
	* modules/deco.scm (main): Gracefully handle not-enough-arguments
	  conditions.

2013-11-14  Ludovic Courtès  <ludo@gnu.org>

	dmd-service: Add 'halt' and 'power-off' actions.
	* modules/dmd/service.scm (shutdown-services): New procedure.  Code
	  moved from...
	  (dmd-service)[#:stop]: ... here.
	  [#:actions]: Add 'halt' and 'power-off'.

	'deco stop dmd' reboots instead of panicking.
	* modules/dmd.scm (process-command): In 'quit' handler: when running as
	  root, call 'reboot' instead of 'quit'.
	* modules/dmd/service.scm (dmd-service)[daemonize]: Exit with
	  'primitive-exit'.

	dmd-service: Use 'when' in contexts for effect.
	* modules/dmd/service.scm (dmd-service): Use 'when' instead of 'if' or
	  'and' when in effect context.

	Add (dmd system).
	* modules/dmd/system.scm.in: New file.
	* Makefile.am (templates): Add it.
	  (nodist_dmdsub_DATA): Add modules/dmd/system.{scm,go}.
	* configure.ac: Bump Autoconf requirement, for 'AC_COMPUTE_INT'.  Use
	  'AC_CANONICAL_HOST'.  Add 'AC_COMPUTE_INT' invocations for RB_*
	  constants.  Output modules/dmd/system.scm.

2013-11-03  Ludovic Courtès  <ludo@gnu.org>

	Upgrade to GPLv3+.

	Augment '.gitignore'.

	Change '--help' output to match current GNU standard.
	* modules/dmd/config.scm.in (package-url): New variable.
	* Makefile.am (instantiate): Substitute %PACKAGE_URL%.
	* modules/dmd/args.scm (process-args): Change '--help' message to comply
	  with current GNU standards.

	Commands don't start a shell, and avoid auto-compilation.
	* deco.in, dmd.in: Rewrite in Scheme; add '--no-auto-compile'.

	Install the current locale.
	* modules/deco.scm (main): Add 'setlocale' call.
	* modules/dmd.scm (main): Likewise.

	Change '--version' output to match current GNU standard.
	* modules/dmd/config.scm.in (package-name): New variable.
	* Makefile.am (instantiate): Substitute %PACKAGE_NAME%.
	* modules/dmd/support.scm (display-version): Use the standard GNU
	  format.

2013-09-27  Ludovic Courtès  <ludo@gnu.org>

	Honor --localstatedir; change socket file to be independent from the user.
	* modules/dmd/support.scm (default-socket-dir): Change to be independent
	  of the calling user.  Use '%localstatedir', not 'Prefix-dir'.
	  (default-persistency-state-file): Use '%localstatedir'.

	Use 'lambda*' instead of 'opt-lambda'.
	* modules/dmd/support.scm (opt-lambda): Remove.
	* modules/dmd/service.scm (make-kill-destructor, dmd-service): Use
	  'lambda*' instead of 'opt-lambda'.

	doc: Use @ifnottex, not @ifinfo, for the 'Top' node.
	* dmd.texi (Top): Use @ifnottex instead of @ifinfo, as recommended by
	  makeinfo.

2013-09-21  Ludovic Courtès  <ludo@gnu.org>

	Update 'NEWS'.

	Fix typo in 'local-output'.
	* modules/dmd/support.scm (local-output): Actually write to the current
	  output port.

	build: Use the package bug-report address.
	* Makefile.am (instantiate): Add @PACKAGE_BUGREPORT@.
	* modules/dmd/config.scm.in (bug-address): Use @PACKAGE_BUGREPORT@.

	build: Use Automake with '-Wall -Wno-portability'.
	* configure.ac: Use '-Wall -Wno-portability' for Automake.

2013-09-20  Ludovic Courtès  <ludo@gnu.org>

	Update '.gitignore'.

	Become the session leader when forking a service.
	* modules/dmd/service.scm (make-forkexec-constructor): Call 'setsid'.

	service: Rewrite 'make-actions' as a 'syntax-rules' macro.
	* modules/dmd/service.scm (make-actions): Move above first use; rewrite
	  using 'syntax-rules'.

2013-09-19  Ludovic Courtès  <ludo@gnu.org>

	build: Store 'dmd.log' under $localstatedir.
	* Makefile.am (instantiate): Add %localstatedir%.
	* modules/dmd/config.scm.in (%localstatedir): New variable.
	* modules/dmd/support.scm (default-logfile): As root, set to
	  (string-append %localstatedir "/dmd.log").

	Remove generated file.
	* modules/dmd/config.scm: Remove.

	build: Substitute $(GUILE) in scripts.
	* Makefile.am (instantiate): Substitute %GUILE%.
	* deco.in, dmd.in: Use %GUILE%.

	build: Factorize sed expression for template instantiation.
	* Makefile.am (instantiate): New variable.
	  (%, modules/dmd/config.scm): Use it.

	Consistently use 'make-forkexec-constructor'.
	* dmd.texi (Service De- and Constructors): Change
	  'make-childexec-constructor' to 'make-forkexec-constructor'.
	* examples/wolfgangj.scm: Likewise.

2013-09-13  Ludovic Courtès  <ludo@gnu.org>

	build: Use $(SED).
	* configure.ac: Add 'AC_PROG_SED'.
	* Makefile.am: Use it.

	build: Fix 'distcheck'.
	* Makefile.am (dmd_DATA): Rename to...
	  (dist_dmd_DATA): ...this.
	  (nodist_dmd_DATA): Adjust accordingly.
	  (dmdsub_DATA): Rename to...
	  (dist_dmdsub_DATA): ... this.
	  (nodist_dmdsub_DATA): Adjust accordingly.
	  (CLEANFILES): Add $(bin_SCRIPTS).
	  (modules/dmd/config.scm): New target.
	  (BUILT_SOURCES): New variable.

	doc: Use better name for the Texinfo directory entry.
	* dmd.texi: Change direntry name to "dmd".

2013-02-14  Ludovic Courtès  <ludo@gnu.org>

	build: Compile and install `.go' files.
	* Makefile.am (nodist_dmd_DATA): New variable.
	  (nodist_dmdsub_DATA): Add .go files.
	  (.scm.go): New rule.
	  (SUFFIXES, dmd_install_go_files): New variable.
	  ($(dmd_install_go_files)): New rule.
	* configure.ac: Check for `guild'.
	* deco.in, dmd.in: Set `GUILE_LOAD_COMPILED_PATH'.

2013-02-10  Ludovic Courtès  <ludo@gnu.org>

	build: Use modern `configure.ac'.
	* configure.in: Rename to...
	* configure.ac: ... this.  Use current `AC_INIT' and `AM_INIT_AUTOMAKE'
	  invocations.  Add `AC_CONFIG_SRCDIR' and `AC_CONFIG_AUX_DIR'.

2013-02-09  Ludovic Courtès  <ludo@gnu.org>

	Use modules instead of `load'.
	* args.scm, comm.scm, config.scm.in, runlevel.scm, service.scm,
	  support.scm: Move under modules/dmd and turn into modules.  Fix
	  various small issues.
	* deco.scm, dmd.scm: Move under modules/ and turn into modules.  Shuffle
	  around global variables to other places.
	* self.scm: Remove.  Move `dmd-service' variable to
	  modules/dmd/service.scm.
	* configure.in: Adjust `AC_INIT' call accordingly.  Use
	  `AC_PROG_MKDIR_P'.
	* Makefile.am (templates): Adjust accordingly.
	  (dmd_data): Remove.
	  (dmd_DATA, dmdsubdir, dmdsub_DATA, nodist_dmdsub_DATA): New
	  variables.
	  (%: %.in): Make the target's parent directory first.

	Remove more generated files.

	Remove uses of `debug-enable'.
	* deco.scm, dmd.scm: Remove `debug-enable'.

	build: Remove generated files.

	Adjust to Guile 2.0 macrology.
	* support.scm (define-syntax-rule): Remove.
	  (begin-dmd): Implement using `syntax-case'.
	* dmd.scm, deco.scm: Don't use (ice-9 syncase).
	* runlevel.scm (enter): Fix erroneous `let' form.
