]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
Merge pull request #986 from karelzak/monitor
authorLennart Poettering <lennart@poettering.net>
Tue, 22 Sep 2015 12:31:58 +0000 (14:31 +0200)
committerLennart Poettering <lennart@poettering.net>
Tue, 22 Sep 2015 12:31:58 +0000 (14:31 +0200)
mount: use libmount to monitor mountinfo & utab

1  2 
Makefile.am
src/core/manager.c
src/core/manager.h

diff --combined Makefile.am
index 5b1431c866cad43f564f589994ad7bd0453f55e2,57dfee7cc8c9e1aa1e4e8dd0bfc9890cb09cf90a..3cc27cbbfce7c85e1efdb79a55fbb8d32f663e33
@@@ -474,7 -474,6 +474,7 @@@ dist_systemunit_DATA = 
        units/getty.target \
        units/halt.target \
        units/kexec.target \
 +      units/exit.target \
        units/local-fs.target \
        units/local-fs-pre.target \
        units/initrd.target \
@@@ -551,7 -550,6 +551,7 @@@ nodist_systemunit_DATA = 
        units/systemd-poweroff.service \
        units/systemd-reboot.service \
        units/systemd-kexec.service \
 +      units/systemd-exit.service \
        units/systemd-fsck@.service \
        units/systemd-fsck-root.service \
        units/systemd-machine-id-commit.service \
@@@ -603,7 -601,6 +603,7 @@@ EXTRA_DIST += 
        units/systemd-poweroff.service.in \
        units/systemd-reboot.service.in \
        units/systemd-kexec.service.in \
 +      units/systemd-exit.service.in \
        units/user/systemd-exit.service.in \
        units/systemd-fsck@.service.in \
        units/systemd-fsck-root.service.in \
@@@ -1330,7 -1327,8 +1330,8 @@@ systemd_SOURCES = 
  
  systemd_CFLAGS = \
        $(AM_CFLAGS) \
-       $(SECCOMP_CFLAGS)
+       $(SECCOMP_CFLAGS) \
+       $(MOUNT_CFLAGS)
  
  systemd_LDADD = \
        libcore.la
@@@ -1370,9 -1368,7 +1371,9 @@@ manual_tests += 
        test-watchdog \
        test-log \
        test-ipcrm \
 -      test-btrfs
 +      test-btrfs \
 +      test-acd \
 +      test-ipv4ll-manual
  
  if HAVE_LIBIPTC
  manual_tests += \
@@@ -1537,7 -1533,8 +1538,8 @@@ test_engine_SOURCES = 
  
  test_engine_CFLAGS = \
        $(AM_CFLAGS) \
-       $(SECCOMP_CFLAGS)
+       $(SECCOMP_CFLAGS) \
+       $(MOUNT_CFLAGS)
  
  test_engine_LDADD = \
        libcore.la
@@@ -1547,7 -1544,8 +1549,8 @@@ test_job_type_SOURCES = 
  
  test_job_type_CFLAGS = \
        $(AM_CFLAGS) \
-       $(SECCOMP_CFLAGS)
+       $(SECCOMP_CFLAGS) \
+       $(MOUNT_CFLAGS)
  
  test_job_type_LDADD = \
        libcore.la
@@@ -1597,7 -1595,8 +1600,8 @@@ test_unit_name_SOURCES = 
  
  test_unit_name_CFLAGS = \
        $(AM_CFLAGS) \
-       $(SECCOMP_CFLAGS)
+       $(SECCOMP_CFLAGS) \
+       $(MOUNT_CFLAGS)
  
  test_unit_name_LDADD = \
        libcore.la
@@@ -1607,7 -1606,8 +1611,8 @@@ test_unit_file_SOURCES = 
  
  test_unit_file_CFLAGS = \
        $(AM_CFLAGS) \
-       $(SECCOMP_CFLAGS)
+       $(SECCOMP_CFLAGS) \
+       $(MOUNT_CFLAGS)
  
  test_unit_file_LDADD = \
        libcore.la
@@@ -1816,7 -1816,8 +1821,8 @@@ test_tables_CPPFLAGS = 
  
  test_tables_CFLAGS = \
        $(AM_CFLAGS) \
-       $(SECCOMP_CFLAGS)
+       $(SECCOMP_CFLAGS) \
+       $(MOUNT_CFLAGS)
  
  test_tables_LDADD = \
        libjournal-core.la \
@@@ -1942,7 -1943,8 +1948,8 @@@ test_cgroup_mask_SOURCES = 
        src/test/test-cgroup-mask.c
  
  test_cgroup_mask_CPPFLAGS = \
-       $(AM_CPPFLAGS)
+       $(AM_CPPFLAGS) \
+       $(MOUNT_CFLAGS)
  
  test_cgroup_mask_CFLAGS = \
        $(AM_CFLAGS) \
@@@ -1985,7 -1987,8 +1992,8 @@@ test_path_SOURCES = 
        src/test/test-path.c
  
  test_path_CFLAGS = \
-       $(AM_CFLAGS)
+       $(AM_CFLAGS) \
+       $(MOUNT_CFLAGS)
  
  test_path_LDADD = \
        libcore.la
@@@ -1994,7 -1997,8 +2002,8 @@@ test_execute_SOURCES = 
        src/test/test-execute.c
  
  test_execute_CFLAGS = \
-       $(AM_CFLAGS)
+       $(AM_CFLAGS) \
+       $(MOUNT_CFLAGS)
  
  test_execute_LDADD = \
        libcore.la
@@@ -2021,7 -2025,8 +2030,8 @@@ test_sched_prio_SOURCES = 
        src/test/test-sched-prio.c
  
  test_sched_prio_CPPFLAGS = \
-       $(AM_CPPFLAGS)
+       $(AM_CPPFLAGS) \
+       $(MOUNT_CFLAGS)
  
  test_sched_prio_CFLAGS = \
        $(AM_CFLAGS) \
@@@ -2108,7 -2113,8 +2118,8 @@@ systemd_analyze_SOURCES = 
  
  systemd_analyze_CFLAGS = \
        $(AM_CFLAGS) \
-       $(SECCOMP_CFLAGS)
+       $(SECCOMP_CFLAGS) \
+       $(MOUNT_CFLAGS)
  
  systemd_analyze_LDADD = \
        libcore.la
@@@ -3203,7 -3209,6 +3214,7 @@@ libsystemd_network_la_SOURCES = 
        src/systemd/sd-dhcp-server.h \
        src/systemd/sd-dhcp-lease.h \
        src/systemd/sd-ipv4ll.h \
 +      src/systemd/sd-ipv4acd.h \
        src/systemd/sd-icmp6-nd.h \
        src/systemd/sd-dhcp6-client.h \
        src/systemd/sd-dhcp6-lease.h \
        src/libsystemd-network/dhcp-lease-internal.h \
        src/libsystemd-network/sd-dhcp-lease.c \
        src/libsystemd-network/sd-ipv4ll.c \
 -      src/libsystemd-network/ipv4ll-network.c \
 -      src/libsystemd-network/ipv4ll-packet.c \
 -      src/libsystemd-network/ipv4ll-internal.h \
 +      src/libsystemd-network/sd-ipv4acd.c \
 +      src/libsystemd-network/arp-util.h \
 +      src/libsystemd-network/arp-util.c \
        src/libsystemd-network/sd-pppoe.c \
        src/libsystemd-network/network-internal.c \
        src/libsystemd-network/network-internal.h \
@@@ -3279,29 -3284,13 +3290,29 @@@ test_dhcp_server_LDADD = 
  
  test_ipv4ll_SOURCES = \
        src/systemd/sd-ipv4ll.h \
 -      src/libsystemd-network/ipv4ll-internal.h \
 +      src/libsystemd-network/arp-util.h \
        src/libsystemd-network/test-ipv4ll.c
  
  test_ipv4ll_LDADD = \
        libsystemd-network.la \
        libshared.la
  
 +test_ipv4ll_manual_SOURCES = \
 +      src/systemd/sd-ipv4ll.h \
 +      src/libsystemd-network/test-ipv4ll-manual.c
 +
 +test_ipv4ll_manual_LDADD = \
 +      libsystemd-network.la \
 +      libshared.la
 +
 +test_acd_SOURCES = \
 +      src/systemd/sd-ipv4acd.h \
 +      src/libsystemd-network/test-acd.c
 +
 +test_acd_LDADD = \
 +      libsystemd-network.la \
 +      libshared.la
 +
  test_pppoe_SOURCES = \
        src/systemd/sd-pppoe.h \
        src/libsystemd-network/test-pppoe.c
diff --combined src/core/manager.c
index 4e672a8c485a62862ef2967eded7d3ecf4d6014b,bb1009081a82a8ca142208c399e5746c4825f74e..98ef561aae15fa9286ef5a9b98bd761750d4a8d7
@@@ -571,16 -571,14 +571,16 @@@ int manager_new(ManagerRunningAs runnin
          m->idle_pipe[0] = m->idle_pipe[1] = m->idle_pipe[2] = m->idle_pipe[3] = -1;
  
          m->pin_cgroupfs_fd = m->notify_fd = m->signal_fd = m->time_change_fd =
-                 m->dev_autofs_fd = m->private_listen_fd = m->kdbus_fd = m->utab_inotify_fd =
-                 m->cgroup_inotify_fd = -1;
+                 m->dev_autofs_fd = m->private_listen_fd = m->kdbus_fd = m->cgroup_inotify_fd = -1;
          m->current_job_id = 1; /* start as id #1, so that we can leave #0 around as "null-like" value */
  
          m->ask_password_inotify_fd = -1;
          m->have_ask_password = -EINVAL; /* we don't know */
          m->first_boot = -1;
  
 +        m->cgroup_netclass_registry_last = CGROUP_NETCLASS_FIXED_MAX;
 +
          m->test_run = test_run;
  
          /* Reboot immediately if the user hits C-A-D more often than 7x per 2s */
@@@ -962,8 -960,6 +962,8 @@@ Manager* manager_free(Manager *m) 
          hashmap_free(m->cgroup_unit);
          set_free_free(m->unit_path_cache);
  
 +        hashmap_free(m->cgroup_netclass_registry);
 +
          free(m->switch_root);
          free(m->switch_root_init);
  
diff --combined src/core/manager.h
index 1384eb33a4c3ae06b5273539fffb8e48cbc5976d,7b896f9bc749dc47858078a21ec83bf4aef88d5d..cc0e5e3361b0b76efb808e7bff4174ee7092e012
@@@ -23,6 -23,7 +23,7 @@@
  
  #include <stdbool.h>
  #include <stdio.h>
+ #include <libmount.h>
  
  #include "sd-bus.h"
  #include "sd-event.h"
@@@ -176,10 -177,8 +177,8 @@@ struct Manager 
          Hashmap *devices_by_sysfs;
  
          /* Data specific to the mount subsystem */
-         FILE *proc_self_mountinfo;
+         struct libmnt_monitor *mount_monitor;
          sd_event_source *mount_event_source;
-         int utab_inotify_fd;
-         sd_event_source *mount_utab_event_source;
  
          /* Data specific to the swap filesystem */
          FILE *proc_swaps;
  
          bool test_run:1;
  
 +        /* If non-zero, exit with the following value when the systemd
 +         * process terminate. Useful for containers: systemd-nspawn could get
 +         * the return value. */
 +        uint8_t return_value;
 +
          ShowStatus show_status;
          bool confirm_spawn;
          bool no_console_output;
          const char *unit_log_format_string;
  
          int first_boot;
 +
 +        /* Used for NetClass=auto units */
 +        Hashmap *cgroup_netclass_registry;
 +        uint32_t cgroup_netclass_registry_last;
  };
  
  int manager_new(ManagerRunningAs running_as, bool test_run, Manager **m);