From 5d4caf565471ff3401bd9b53aa814c8545a18a93 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Wed, 16 Jan 2013 21:09:03 +0100 Subject: [PATCH] service: ignore dependencies on $syslog and $local_fs in LSB scripts 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 | 1 - man/systemd.special.xml | 23 ----------------------- src/core/service.c | 16 +++++++--------- src/core/special.h | 3 +-- units/syslog.socket | 5 +---- units/syslog.target | 19 ------------------- units/systemd-journald.socket | 2 +- 7 files changed, 10 insertions(+), 59 deletions(-) delete mode 100644 units/syslog.target diff --git a/Makefile.am b/Makefile.am index 5692077b3..db68522bf 100644 --- a/Makefile.am +++ b/Makefile.am @@ -291,7 +291,6 @@ dist_systemunit_DATA = \ 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 diff --git a/man/systemd.special.xml b/man/systemd.special.xml index 81374c2ad..6acba9142 100644 --- a/man/systemd.special.xml +++ b/man/systemd.special.xml @@ -93,7 +93,6 @@ swap.target, sysinit.target, syslog.socket, - syslog.target, system-update.target, time-sync.target, umount.target @@ -335,15 +334,6 @@ and mount options set. - - 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 - $local_fs - facility. @@ -679,19 +669,6 @@ document. - - syslog.target - - 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 - $syslog - facility. - - system-update.target diff --git a/src/core/service.c b/src/core/service.c index 017d292a8..ebd0baea8 100644 --- a/src/core/service.c +++ b/src/core/service.c @@ -322,7 +322,8 @@ static void service_done(Unit *u) { 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")) @@ -348,16 +349,12 @@ static int sysv_translate_facility(const char *name, const char *filename, char 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, - "syslog", SPECIAL_SYSLOG_TARGET, + "syslog", NULL, "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 (!(r = strdup(table[i+1]))) - return -ENOMEM; + r = strdup(table[i+1]); + if (!r) + return log_oom(); goto finish; } diff --git a/src/core/special.h b/src/core/special.h index 626e81692..99c0e1222 100644 --- a/src/core/special.h +++ b/src/core/special.h @@ -46,7 +46,7 @@ /* 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" @@ -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_SYSLOG_TARGET "syslog.target" /* LSB's $syslog */ #define SPECIAL_TIME_SYNC_TARGET "time-sync.target" /* LSB's $time */ /* diff --git a/units/syslog.socket b/units/syslog.socket index c78435762..e6e9cf852 100644 --- a/units/syslog.socket +++ b/units/syslog.socket @@ -10,14 +10,11 @@ Description=Syslog Socket 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 -# Pull in syslog.target to tell people that /dev/log is now accessible -Wants=syslog.target - [Socket] ListenDatagram=/run/systemd/journal/syslog SocketMode=0666 diff --git a/units/syslog.target b/units/syslog.target deleted file mode 100644 index 423fef30a..000000000 --- a/units/syslog.target +++ /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 diff --git a/units/systemd-journald.socket b/units/systemd-journald.socket index dbe8882c0..4f0619d25 100644 --- a/units/systemd-journald.socket +++ b/units/systemd-journald.socket @@ -9,7 +9,7 @@ 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, -- 2.30.2