X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=elogind.git;a=blobdiff_plain;f=man%2Fdaemon.xml;h=88dd082a33e356d2a3ece0deedc0aaa406ff109e;hp=1fe4546f009519576fb2f8ec58e63e5b88f21a10;hb=deb480d1a7c3f3178c44f0aa73765181c0e2317f;hpb=e0e009c067aa7237f9683c46e5845bbb11ec67c2 diff --git a/man/daemon.xml b/man/daemon.xml index 1fe4546f0..88dd082a3 100644 --- a/man/daemon.xml +++ b/man/daemon.xml @@ -74,8 +74,8 @@ Close all open file - descriptors except STDIN, STDOUT, - STDERR (i.e. the first three file + descriptors except stdin, stdout, + stderr (i.e. the first three file descriptors 0, 1, 2). This ensures that no accidentally passed file descriptor stays around in the daemon @@ -128,8 +128,8 @@ In the daemon process, connect /dev/null - to STDIN, STDOUT, - STDERR. + to standard input, output, and error. + In the daemon process, reset the umask to 0, so that the file @@ -223,15 +223,16 @@ service. Note that new-style init systems - guarantee execution of daemon processes in - a clean process context: it is guaranteed that + guarantee execution of daemon processes in a + clean process context: it is guaranteed that the environment block is sanitized, that the signal handlers and mask is reset and that no left-over file descriptors are passed. Daemons - will be executed in their own session, and - STDIN/STDOUT/STDERR connected to + will be executed in their own session, with + standard input/output/error connected to /dev/null unless - otherwise configured. The umask is reset. + otherwise configured. The umask is reset. + It is recommended for new-style daemons to implement the following: @@ -324,7 +325,7 @@ Instead of using the syslog() call to log directly to the system syslog service, a new-style daemon may - choose to simply log to STDERR via + choose to simply log to standard error via fprintf(), which is then forwarded to syslog by the init system. If log priorities are necessary, these can be @@ -765,12 +766,19 @@ PKG_PROG_PKG_CONFIG AC_ARG_WITH([systemdsystemunitdir], - AS_HELP_STRING([--with-systemdsystemunitdir=DIR], [Directory for systemd service files]), - [], [with_systemdsystemunitdir=$($PKG_CONFIG --variable=systemdsystemunitdir systemd)]) -if test "x$with_systemdsystemunitdir" != xno; then - AC_SUBST([systemdsystemunitdir], [$with_systemdsystemunitdir]) -fi -AM_CONDITIONAL(HAVE_SYSTEMD, [test -n "$with_systemdsystemunitdir" -a "x$with_systemdsystemunitdir" != xno ]) + [AS_HELP_STRING([--with-systemdsystemunitdir=DIR], [Directory for systemd service files])],, + [with_systemdsystemunitdir=auto]) +AS_IF([test "x$with_systemdsystemunitdir" = "xyes" -o "x$with_systemdsystemunitdir" = "xauto"], [ + def_systemdsystemunitdir=$($PKG_CONFIG --variable=systemdsystemunitdir systemd) + + AS_IF([test "x$def_systemdsystemunitdir" = "x"], + [AS_IF([test "x$with_systemdsystemunitdir" = "xyes"], + [AC_MSG_ERROR([systemd support requested but pkg-config unable to query systemd package])]) + with_systemdsystemunitdir=no], + [with_systemdsystemunitdir="$def_systemdsystemunitdir"])]) +AS_IF([test "x$with_systemdsystemunitdir" != "xno"], + [AC_SUBST([systemdsystemunitdir], [$with_systemdsystemunitdir])]) +AM_CONDITIONAL([HAVE_SYSTEMD], [test "x$with_systemdsystemunitdir" != "xno"]) This snippet allows automatic installation of the unit files on systemd