[systemd-commits] src/network units/systemd-networkd.service.in

Tom Gundersen tomegun at kemper.freedesktop.org
Fri Nov 22 17:28:45 PST 2013


 src/network/networkd.c            |   23 ++++++++++++++++-------
 units/systemd-networkd.service.in |    2 +-
 2 files changed, 17 insertions(+), 8 deletions(-)

New commits:
commit 4b6141c42497dc199618f95fa3f359615eecfaa0
Author: Tom Gundersen <teg at jklm.no>
Date:   Sat Nov 23 02:07:08 2013 +0100

    networkd: use Type=notify
    
    Also start earlier during boot.

diff --git a/src/network/networkd.c b/src/network/networkd.c
index 7697830..6b13812 100644
--- a/src/network/networkd.c
+++ b/src/network/networkd.c
@@ -35,28 +35,37 @@ int main(int argc, char *argv[]) {
 
         if (argc != 1) {
                 log_error("This program takes no arguments.");
-                return EXIT_FAILURE;
+                r = -EINVAL;
+                goto out;
         }
 
         r = manager_new(&m);
         if (r < 0)
-                return EXIT_FAILURE;
+                goto out;
 
         r = manager_udev_listen(m);
         if (r < 0)
-                return EXIT_FAILURE;
+                goto out;
 
         r = manager_udev_enumerate_links(m);
         if (r < 0)
-                return EXIT_FAILURE;
+                goto out;
 
         r = manager_rtnl_listen(m);
         if (r < 0)
-                return EXIT_FAILURE;
+                goto out;
+
+        sd_notify(false,
+                  "READY=1\n"
+                  "STATUS=Processing requests...");
 
         r = sd_event_loop(m->event);
         if (r < 0)
-                return EXIT_FAILURE;
+                goto out;
+
+out:
+        sd_notify(false,
+                  "STATUS=Shutting down...");
 
-        return  EXIT_SUCCESS;
+        return r < 0 ? EXIT_FAILURE : EXIT_SUCCESS;
 }
diff --git a/units/systemd-networkd.service.in b/units/systemd-networkd.service.in
index 52c04ed..066d852 100644
--- a/units/systemd-networkd.service.in
+++ b/units/systemd-networkd.service.in
@@ -9,11 +9,11 @@
 Description=Network Service
 Documentation=man:systemd-networkd.service(8)
 DefaultDependencies=no
-After=sysinit.target
 Before=network.target
 Wants=network.target
 
 [Service]
+Type=notify
 Restart=always
 RestartSec=0
 ExecStart=@rootlibexecdir@/systemd-networkd



More information about the systemd-commits mailing list