chiark / gitweb /
service: ignore dependencies on $syslog and $local_fs in LSB scripts
authorLennart Poettering <lennart@poettering.net>
Wed, 16 Jan 2013 20:09:03 +0000 (21:09 +0100)
committerLennart Poettering <lennart@poettering.net>
Wed, 16 Jan 2013 20:34:09 +0000 (21:34 +0100)
We no longer allow early-boot init scripts, however in late boot the
syslog socket and local mounts are established anyway, so let's simplify
our dep graph a bit.

If $syslog doesn't resolve to syslog.target anymore there's no reason to
keep syslog.target around anymore. Let's remove it.

Note that many 3rd party service unit files order themselves after
syslog.target. These will be dangling dependencies now, which should be
unproblematic, however.

Makefile.am
man/systemd.special.xml
src/core/service.c
src/core/special.h
units/syslog.socket
units/syslog.target [deleted file]
units/systemd-journald.socket

index 5692077b34ca0d7d56bec39d75e507cf888999b6..db68522bf61fd11f0349c976218b090806270faf 100644 (file)
@@ -291,7 +291,6 @@ dist_systemunit_DATA = \
        units/quotaon.service \
        units/systemd-ask-password-wall.path \
        units/systemd-ask-password-console.path \
        units/quotaon.service \
        units/systemd-ask-password-wall.path \
        units/systemd-ask-password-console.path \
-       units/syslog.target \
        units/systemd-udevd-control.socket \
        units/systemd-udevd-kernel.socket \
        units/system-update.target
        units/systemd-udevd-control.socket \
        units/systemd-udevd-kernel.socket \
        units/system-update.target
index 81374c2ade1dfc22c6035f80c5c9363f1ac27034..6acba91428f8dd719af5da266e6873c644df81a4 100644 (file)
@@ -93,7 +93,6 @@
                 <filename>swap.target</filename>,
                 <filename>sysinit.target</filename>,
                 <filename>syslog.socket</filename>,
                 <filename>swap.target</filename>,
                 <filename>sysinit.target</filename>,
                 <filename>syslog.socket</filename>,
-                <filename>syslog.target</filename>,
                 <filename>system-update.target</filename>,
                 <filename>time-sync.target</filename>,
                 <filename>umount.target</filename></para>
                 <filename>system-update.target</filename>,
                 <filename>time-sync.target</filename>,
                 <filename>umount.target</filename></para>
                                         <option>auto</option> and
                                         <option>comment=systemd.mount</option>
                                         mount options set.</para>
                                         <option>auto</option> and
                                         <option>comment=systemd.mount</option>
                                         mount options set.</para>
-
-                                        <para>systemd automatically
-                                        adds dependencies of type
-                                        After for this target unit to
-                                        all SysV init script service
-                                        units with an LSB header
-                                        referring to the
-                                        <literal>$local_fs</literal>
-                                        facility.</para>
                                 </listitem>
                         </varlistentry>
                         <varlistentry>
                                 </listitem>
                         </varlistentry>
                         <varlistentry>
                                         document.</para>
                                 </listitem>
                         </varlistentry>
                                         document.</para>
                                 </listitem>
                         </varlistentry>
-                        <varlistentry>
-                                <term><filename>syslog.target</filename></term>
-                                <listitem>
-                                        <para>systemd automatically
-                                        adds dependencies of type
-                                        After for this target unit to
-                                        all SysV init script service
-                                        units with an LSB header
-                                        referring to the
-                                        <literal>$syslog</literal>
-                                        facility.</para>
-                                </listitem>
-                        </varlistentry>
                         <varlistentry>
                                 <term><filename>system-update.target</filename></term>
                                 <listitem>
                         <varlistentry>
                                 <term><filename>system-update.target</filename></term>
                                 <listitem>
index 017d292a8b70d3db51003c45b5ec1d7171c50a90..ebd0baea8961b84ddaa5073e9efa714d12a70966 100644 (file)
@@ -322,7 +322,8 @@ static void service_done(Unit *u) {
 static char *sysv_translate_name(const char *name) {
         char *r;
 
 static char *sysv_translate_name(const char *name) {
         char *r;
 
-        if (!(r = new(char, strlen(name) + sizeof(".service"))))
+        r = new(char, strlen(name) + sizeof(".service"));
+        if (!r)
                 return NULL;
 
         if (endswith(name, ".sh"))
                 return NULL;
 
         if (endswith(name, ".sh"))
@@ -348,16 +349,12 @@ static int sysv_translate_facility(const char *name, const char *filename, char
 
         static const char * const table[] = {
                 /* LSB defined facilities */
 
         static const char * const table[] = {
                 /* LSB defined facilities */
-                "local_fs",             SPECIAL_LOCAL_FS_TARGET,
-                /* Due to unfortunate name selection in Mandriva,
-                 * $network is provided by network-up which is ordered
-                 * after network which actually starts interfaces.
-                 * To break the loop, just ignore it */
+                "local_fs",             NULL,
                 "network",              SPECIAL_NETWORK_TARGET,
                 "named",                SPECIAL_NSS_LOOKUP_TARGET,
                 "portmap",              SPECIAL_RPCBIND_TARGET,
                 "remote_fs",            SPECIAL_REMOTE_FS_TARGET,
                 "network",              SPECIAL_NETWORK_TARGET,
                 "named",                SPECIAL_NSS_LOOKUP_TARGET,
                 "portmap",              SPECIAL_RPCBIND_TARGET,
                 "remote_fs",            SPECIAL_REMOTE_FS_TARGET,
-                "syslog",               SPECIAL_SYSLOG_TARGET,
+                "syslog",               NULL,
                 "time",                 SPECIAL_TIME_SYNC_TARGET,
         };
 
                 "time",                 SPECIAL_TIME_SYNC_TARGET,
         };
 
@@ -378,8 +375,9 @@ static int sysv_translate_facility(const char *name, const char *filename, char
                 if (!table[i+1])
                         return 0;
 
                 if (!table[i+1])
                         return 0;
 
-                if (!(r = strdup(table[i+1])))
-                        return -ENOMEM;
+                r = strdup(table[i+1]);
+                if (!r)
+                        return log_oom();
 
                 goto finish;
         }
 
                 goto finish;
         }
index 626e816922d2f27210f89501dc1293b0291aed7e..99c0e1222e6764b9af914428bcc62b3cbd066fb5 100644 (file)
@@ -46,7 +46,7 @@
 /* Early boot targets */
 #define SPECIAL_SYSINIT_TARGET "sysinit.target"
 #define SPECIAL_SOCKETS_TARGET "sockets.target"
 /* Early boot targets */
 #define SPECIAL_SYSINIT_TARGET "sysinit.target"
 #define SPECIAL_SOCKETS_TARGET "sockets.target"
-#define SPECIAL_LOCAL_FS_TARGET "local-fs.target"         /* LSB's $local_fs */
+#define SPECIAL_LOCAL_FS_TARGET "local-fs.target"
 #define SPECIAL_LOCAL_FS_PRE_TARGET "local-fs-pre.target"
 #define SPECIAL_REMOTE_FS_TARGET "remote-fs.target"       /* LSB's $remote_fs */
 #define SPECIAL_REMOTE_FS_PRE_TARGET "remote-fs-pre.target"
 #define SPECIAL_LOCAL_FS_PRE_TARGET "local-fs-pre.target"
 #define SPECIAL_REMOTE_FS_TARGET "remote-fs.target"       /* LSB's $remote_fs */
 #define SPECIAL_REMOTE_FS_PRE_TARGET "remote-fs-pre.target"
@@ -57,7 +57,6 @@
 #define SPECIAL_NETWORK_TARGET "network.target"           /* LSB's $network */
 #define SPECIAL_NSS_LOOKUP_TARGET "nss-lookup.target"     /* LSB's $named */
 #define SPECIAL_RPCBIND_TARGET "rpcbind.target"           /* LSB's $portmap */
 #define SPECIAL_NETWORK_TARGET "network.target"           /* LSB's $network */
 #define SPECIAL_NSS_LOOKUP_TARGET "nss-lookup.target"     /* LSB's $named */
 #define SPECIAL_RPCBIND_TARGET "rpcbind.target"           /* LSB's $portmap */
-#define SPECIAL_SYSLOG_TARGET "syslog.target"             /* LSB's $syslog */
 #define SPECIAL_TIME_SYNC_TARGET "time-sync.target"       /* LSB's $time */
 
 /*
 #define SPECIAL_TIME_SYNC_TARGET "time-sync.target"       /* LSB's $time */
 
 /*
index c784357627e04e0388f7172ad8f901deb651a4c4..e6e9cf8525a66817b7c94f42627dead97a873a96 100644 (file)
@@ -10,14 +10,11 @@ Description=Syslog Socket
 Documentation=man:systemd.special(7)
 Documentation=http://www.freedesktop.org/wiki/Software/systemd/syslog
 DefaultDependencies=no
 Documentation=man:systemd.special(7)
 Documentation=http://www.freedesktop.org/wiki/Software/systemd/syslog
 DefaultDependencies=no
-Before=sockets.target syslog.target shutdown.target
+Before=sockets.target shutdown.target
 
 # Don't allow logging until the very end
 Conflicts=shutdown.target
 
 
 # Don't allow logging until the very end
 Conflicts=shutdown.target
 
-# Pull in syslog.target to tell people that /dev/log is now accessible
-Wants=syslog.target
-
 [Socket]
 ListenDatagram=/run/systemd/journal/syslog
 SocketMode=0666
 [Socket]
 ListenDatagram=/run/systemd/journal/syslog
 SocketMode=0666
diff --git a/units/syslog.target b/units/syslog.target
deleted file mode 100644 (file)
index 423fef3..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-#  This file is part of systemd.
-#
-#  systemd is free software; you can redistribute it and/or modify it
-#  under the terms of the GNU Lesser General Public License as published by
-#  the Free Software Foundation; either version 2.1 of the License, or
-#  (at your option) any later version.
-
-# This exists mostly for compatibility with SysV/LSB units, and
-# implementations lacking socket/bus activation.
-
-[Unit]
-Description=Syslog
-Documentation=man:systemd.special(7)
-Documentation=http://www.freedesktop.org/wiki/Software/systemd/syslog
-
-# Avoid that we conflict with shutdown.target, so that we can stay
-# until the very end and do not cancel shutdown.target if we should
-# happen to be activated very late.
-DefaultDependencies=no
index dbe8882c0ed5b3e2ca971f60639c4d4d743c544a..4f0619d2581d37bf7d53e5b23deb4ad3bf5fd919 100644 (file)
@@ -9,7 +9,7 @@
 Description=Journal Socket
 Documentation=man:systemd-journald.service(8) man:journald.conf(5)
 DefaultDependencies=no
 Description=Journal Socket
 Documentation=man:systemd-journald.service(8) man:journald.conf(5)
 DefaultDependencies=no
-Before=sockets.target syslog.target
+Before=sockets.target
 
 # Mount and swap units need this. If this socket unit is removed by an
 # isolate request the mount and and swap units would be removed too,
 
 # Mount and swap units need this. If this socket unit is removed by an
 # isolate request the mount and and swap units would be removed too,