diff options
89 files changed, 2716 insertions, 445 deletions
diff --git a/CODING_STYLE b/CODING_STYLE index bdec988ce6..dbadfbdb54 100644 --- a/CODING_STYLE +++ b/CODING_STYLE @@ -210,11 +210,12 @@ c) recvmsg() must get MSG_CMSG_CLOEXEC set d) F_DUPFD_CLOEXEC should be used instead of F_DUPFD, and so on -- We never use the XDG version of basename(). glibc defines it in - libgen.h. The only reason to include that file is because dirname() +- We never use the POSIX version of basename() (which glibc defines it in + libgen.h), only the GNU version (which glibc defines in string.h). + The only reason to include libgen.h is because dirname() is needed. Everytime you need that please immediately undefine basename(), and add a comment about it, so that no code ever ends up - using the XDG version! + using the POSIX version! - Use the bool type for booleans, not integers. One exception: in public headers (i.e those in src/systemd/sd-*.h) use integers after all, as "bool" diff --git a/Makefile-man.am b/Makefile-man.am index 85579e0c0a..9e2f4ba2e3 100644 --- a/Makefile-man.am +++ b/Makefile-man.am @@ -18,6 +18,7 @@ MANPAGES += \ man/journald.conf.5 \ man/kernel-command-line.7 \ man/kernel-install.8 \ + man/libudev.3 \ man/locale.conf.5 \ man/localtime.5 \ man/machine-id.5 \ @@ -122,6 +123,17 @@ MANPAGES += \ man/tmpfiles.d.5 \ man/udev.7 \ man/udev.conf.5 \ + man/udev_device_get_syspath.3 \ + man/udev_device_has_tag.3 \ + man/udev_device_new_from_syspath.3 \ + man/udev_enumerate_add_match_subsystem.3 \ + man/udev_enumerate_new.3 \ + man/udev_enumerate_scan_devices.3 \ + man/udev_list_entry.3 \ + man/udev_monitor_filter_update.3 \ + man/udev_monitor_new_from_netlink.3 \ + man/udev_monitor_receive_device.3 \ + man/udev_new.3 \ man/udevadm.8 MANPAGES_ALIAS += \ man/SD_ALERT.3 \ @@ -233,6 +245,61 @@ MANPAGES_ALIAS += \ man/systemd-udevd.8 \ man/systemd-update-done.8 \ man/systemd-user.conf.5 \ + man/udev_device_get_action.3 \ + man/udev_device_get_devlinks_list_entry.3 \ + man/udev_device_get_devnode.3 \ + man/udev_device_get_devnum.3 \ + man/udev_device_get_devpath.3 \ + man/udev_device_get_devtype.3 \ + man/udev_device_get_driver.3 \ + man/udev_device_get_is_initialized.3 \ + man/udev_device_get_parent.3 \ + man/udev_device_get_parent_with_subsystem_devtype.3 \ + man/udev_device_get_properties_list_entry.3 \ + man/udev_device_get_property_value.3 \ + man/udev_device_get_subsystem.3 \ + man/udev_device_get_sysattr_list_entry.3 \ + man/udev_device_get_sysattr_value.3 \ + man/udev_device_get_sysname.3 \ + man/udev_device_get_sysnum.3 \ + man/udev_device_get_tags_list_entry.3 \ + man/udev_device_get_udev.3 \ + man/udev_device_new_from_device_id.3 \ + man/udev_device_new_from_devnum.3 \ + man/udev_device_new_from_environment.3 \ + man/udev_device_new_from_subsystem_sysname.3 \ + man/udev_device_ref.3 \ + man/udev_device_set_sysattr_value.3 \ + man/udev_device_unref.3 \ + man/udev_enumerate_add_match_is_initialized.3 \ + man/udev_enumerate_add_match_parent.3 \ + man/udev_enumerate_add_match_property.3 \ + man/udev_enumerate_add_match_sysattr.3 \ + man/udev_enumerate_add_match_sysname.3 \ + man/udev_enumerate_add_match_tag.3 \ + man/udev_enumerate_add_nomatch_subsystem.3 \ + man/udev_enumerate_add_nomatch_sysattr.3 \ + man/udev_enumerate_add_syspath.3 \ + man/udev_enumerate_get_list_entry.3 \ + man/udev_enumerate_get_udev.3 \ + man/udev_enumerate_ref.3 \ + man/udev_enumerate_scan_subsystems.3 \ + man/udev_enumerate_unref.3 \ + man/udev_list_entry_get_by_name.3 \ + man/udev_list_entry_get_name.3 \ + man/udev_list_entry_get_next.3 \ + man/udev_list_entry_get_value.3 \ + man/udev_monitor_enable_receiving.3 \ + man/udev_monitor_filter_add_match_subsystem_devtype.3 \ + man/udev_monitor_filter_add_match_tag.3 \ + man/udev_monitor_filter_remove.3 \ + man/udev_monitor_get_fd.3 \ + man/udev_monitor_get_udev.3 \ + man/udev_monitor_ref.3 \ + man/udev_monitor_set_receive_buffer_size.3 \ + man/udev_monitor_unref.3 \ + man/udev_ref.3 \ + man/udev_unref.3 \ man/user.conf.d.5 man/SD_ALERT.3: man/sd-daemon.3 man/SD_CRIT.3: man/sd-daemon.3 @@ -343,6 +410,61 @@ man/systemd-udevd-kernel.socket.8: man/systemd-udevd.service.8 man/systemd-udevd.8: man/systemd-udevd.service.8 man/systemd-update-done.8: man/systemd-update-done.service.8 man/systemd-user.conf.5: man/systemd-system.conf.5 +man/udev_device_get_action.3: man/udev_device_get_syspath.3 +man/udev_device_get_devlinks_list_entry.3: man/udev_device_has_tag.3 +man/udev_device_get_devnode.3: man/udev_device_get_syspath.3 +man/udev_device_get_devnum.3: man/udev_device_get_syspath.3 +man/udev_device_get_devpath.3: man/udev_device_get_syspath.3 +man/udev_device_get_devtype.3: man/udev_device_get_syspath.3 +man/udev_device_get_driver.3: man/udev_device_get_syspath.3 +man/udev_device_get_is_initialized.3: man/udev_device_get_syspath.3 +man/udev_device_get_parent.3: man/udev_device_get_syspath.3 +man/udev_device_get_parent_with_subsystem_devtype.3: man/udev_device_get_syspath.3 +man/udev_device_get_properties_list_entry.3: man/udev_device_has_tag.3 +man/udev_device_get_property_value.3: man/udev_device_has_tag.3 +man/udev_device_get_subsystem.3: man/udev_device_get_syspath.3 +man/udev_device_get_sysattr_list_entry.3: man/udev_device_has_tag.3 +man/udev_device_get_sysattr_value.3: man/udev_device_has_tag.3 +man/udev_device_get_sysname.3: man/udev_device_get_syspath.3 +man/udev_device_get_sysnum.3: man/udev_device_get_syspath.3 +man/udev_device_get_tags_list_entry.3: man/udev_device_has_tag.3 +man/udev_device_get_udev.3: man/udev_device_get_syspath.3 +man/udev_device_new_from_device_id.3: man/udev_device_new_from_syspath.3 +man/udev_device_new_from_devnum.3: man/udev_device_new_from_syspath.3 +man/udev_device_new_from_environment.3: man/udev_device_new_from_syspath.3 +man/udev_device_new_from_subsystem_sysname.3: man/udev_device_new_from_syspath.3 +man/udev_device_ref.3: man/udev_device_new_from_syspath.3 +man/udev_device_set_sysattr_value.3: man/udev_device_has_tag.3 +man/udev_device_unref.3: man/udev_device_new_from_syspath.3 +man/udev_enumerate_add_match_is_initialized.3: man/udev_enumerate_add_match_subsystem.3 +man/udev_enumerate_add_match_parent.3: man/udev_enumerate_add_match_subsystem.3 +man/udev_enumerate_add_match_property.3: man/udev_enumerate_add_match_subsystem.3 +man/udev_enumerate_add_match_sysattr.3: man/udev_enumerate_add_match_subsystem.3 +man/udev_enumerate_add_match_sysname.3: man/udev_enumerate_add_match_subsystem.3 +man/udev_enumerate_add_match_tag.3: man/udev_enumerate_add_match_subsystem.3 +man/udev_enumerate_add_nomatch_subsystem.3: man/udev_enumerate_add_match_subsystem.3 +man/udev_enumerate_add_nomatch_sysattr.3: man/udev_enumerate_add_match_subsystem.3 +man/udev_enumerate_add_syspath.3: man/udev_enumerate_scan_devices.3 +man/udev_enumerate_get_list_entry.3: man/udev_enumerate_scan_devices.3 +man/udev_enumerate_get_udev.3: man/udev_enumerate_scan_devices.3 +man/udev_enumerate_ref.3: man/udev_enumerate_new.3 +man/udev_enumerate_scan_subsystems.3: man/udev_enumerate_scan_devices.3 +man/udev_enumerate_unref.3: man/udev_enumerate_new.3 +man/udev_list_entry_get_by_name.3: man/udev_list_entry.3 +man/udev_list_entry_get_name.3: man/udev_list_entry.3 +man/udev_list_entry_get_next.3: man/udev_list_entry.3 +man/udev_list_entry_get_value.3: man/udev_list_entry.3 +man/udev_monitor_enable_receiving.3: man/udev_monitor_receive_device.3 +man/udev_monitor_filter_add_match_subsystem_devtype.3: man/udev_monitor_filter_update.3 +man/udev_monitor_filter_add_match_tag.3: man/udev_monitor_filter_update.3 +man/udev_monitor_filter_remove.3: man/udev_monitor_filter_update.3 +man/udev_monitor_get_fd.3: man/udev_monitor_receive_device.3 +man/udev_monitor_get_udev.3: man/udev_monitor_receive_device.3 +man/udev_monitor_ref.3: man/udev_monitor_new_from_netlink.3 +man/udev_monitor_set_receive_buffer_size.3: man/udev_monitor_receive_device.3 +man/udev_monitor_unref.3: man/udev_monitor_new_from_netlink.3 +man/udev_ref.3: man/udev_new.3 +man/udev_unref.3: man/udev_new.3 man/user.conf.d.5: man/systemd-system.conf.5 man/SD_ALERT.html: man/sd-daemon.html $(html-alias) @@ -671,6 +793,171 @@ man/systemd-update-done.html: man/systemd-update-done.service.html man/systemd-user.conf.html: man/systemd-system.conf.html $(html-alias) +man/udev_device_get_action.html: man/udev_device_get_syspath.html + $(html-alias) + +man/udev_device_get_devlinks_list_entry.html: man/udev_device_has_tag.html + $(html-alias) + +man/udev_device_get_devnode.html: man/udev_device_get_syspath.html + $(html-alias) + +man/udev_device_get_devnum.html: man/udev_device_get_syspath.html + $(html-alias) + +man/udev_device_get_devpath.html: man/udev_device_get_syspath.html + $(html-alias) + +man/udev_device_get_devtype.html: man/udev_device_get_syspath.html + $(html-alias) + +man/udev_device_get_driver.html: man/udev_device_get_syspath.html + $(html-alias) + +man/udev_device_get_is_initialized.html: man/udev_device_get_syspath.html + $(html-alias) + +man/udev_device_get_parent.html: man/udev_device_get_syspath.html + $(html-alias) + +man/udev_device_get_parent_with_subsystem_devtype.html: man/udev_device_get_syspath.html + $(html-alias) + +man/udev_device_get_properties_list_entry.html: man/udev_device_has_tag.html + $(html-alias) + +man/udev_device_get_property_value.html: man/udev_device_has_tag.html + $(html-alias) + +man/udev_device_get_subsystem.html: man/udev_device_get_syspath.html + $(html-alias) + +man/udev_device_get_sysattr_list_entry.html: man/udev_device_has_tag.html + $(html-alias) + +man/udev_device_get_sysattr_value.html: man/udev_device_has_tag.html + $(html-alias) + +man/udev_device_get_sysname.html: man/udev_device_get_syspath.html + $(html-alias) + +man/udev_device_get_sysnum.html: man/udev_device_get_syspath.html + $(html-alias) + +man/udev_device_get_tags_list_entry.html: man/udev_device_has_tag.html + $(html-alias) + +man/udev_device_get_udev.html: man/udev_device_get_syspath.html + $(html-alias) + +man/udev_device_new_from_device_id.html: man/udev_device_new_from_syspath.html + $(html-alias) + +man/udev_device_new_from_devnum.html: man/udev_device_new_from_syspath.html + $(html-alias) + +man/udev_device_new_from_environment.html: man/udev_device_new_from_syspath.html + $(html-alias) + +man/udev_device_new_from_subsystem_sysname.html: man/udev_device_new_from_syspath.html + $(html-alias) + +man/udev_device_ref.html: man/udev_device_new_from_syspath.html + $(html-alias) + +man/udev_device_set_sysattr_value.html: man/udev_device_has_tag.html + $(html-alias) + +man/udev_device_unref.html: man/udev_device_new_from_syspath.html + $(html-alias) + +man/udev_enumerate_add_match_is_initialized.html: man/udev_enumerate_add_match_subsystem.html + $(html-alias) + +man/udev_enumerate_add_match_parent.html: man/udev_enumerate_add_match_subsystem.html + $(html-alias) + +man/udev_enumerate_add_match_property.html: man/udev_enumerate_add_match_subsystem.html + $(html-alias) + +man/udev_enumerate_add_match_sysattr.html: man/udev_enumerate_add_match_subsystem.html + $(html-alias) + +man/udev_enumerate_add_match_sysname.html: man/udev_enumerate_add_match_subsystem.html + $(html-alias) + +man/udev_enumerate_add_match_tag.html: man/udev_enumerate_add_match_subsystem.html + $(html-alias) + +man/udev_enumerate_add_nomatch_subsystem.html: man/udev_enumerate_add_match_subsystem.html + $(html-alias) + +man/udev_enumerate_add_nomatch_sysattr.html: man/udev_enumerate_add_match_subsystem.html + $(html-alias) + +man/udev_enumerate_add_syspath.html: man/udev_enumerate_scan_devices.html + $(html-alias) + +man/udev_enumerate_get_list_entry.html: man/udev_enumerate_scan_devices.html + $(html-alias) + +man/udev_enumerate_get_udev.html: man/udev_enumerate_scan_devices.html + $(html-alias) + +man/udev_enumerate_ref.html: man/udev_enumerate_new.html + $(html-alias) + +man/udev_enumerate_scan_subsystems.html: man/udev_enumerate_scan_devices.html + $(html-alias) + +man/udev_enumerate_unref.html: man/udev_enumerate_new.html + $(html-alias) + +man/udev_list_entry_get_by_name.html: man/udev_list_entry.html + $(html-alias) + +man/udev_list_entry_get_name.html: man/udev_list_entry.html + $(html-alias) + +man/udev_list_entry_get_next.html: man/udev_list_entry.html + $(html-alias) + +man/udev_list_entry_get_value.html: man/udev_list_entry.html + $(html-alias) + +man/udev_monitor_enable_receiving.html: man/udev_monitor_receive_device.html + $(html-alias) + +man/udev_monitor_filter_add_match_subsystem_devtype.html: man/udev_monitor_filter_update.html + $(html-alias) + +man/udev_monitor_filter_add_match_tag.html: man/udev_monitor_filter_update.html + $(html-alias) + +man/udev_monitor_filter_remove.html: man/udev_monitor_filter_update.html + $(html-alias) + +man/udev_monitor_get_fd.html: man/udev_monitor_receive_device.html + $(html-alias) + +man/udev_monitor_get_udev.html: man/udev_monitor_receive_device.html + $(html-alias) + +man/udev_monitor_ref.html: man/udev_monitor_new_from_netlink.html + $(html-alias) + +man/udev_monitor_set_receive_buffer_size.html: man/udev_monitor_receive_device.html + $(html-alias) + +man/udev_monitor_unref.html: man/udev_monitor_new_from_netlink.html + $(html-alias) + +man/udev_ref.html: man/udev_new.html + $(html-alias) + +man/udev_unref.html: man/udev_new.html + $(html-alias) + man/user.conf.d.html: man/systemd-system.conf.html $(html-alias) @@ -765,7 +1052,6 @@ MANPAGES_ALIAS += \ endif -if ENABLE_KDBUS MANPAGES += \ man/sd_bus_creds_get_pid.3 \ man/sd_bus_creds_new_from_pid.3 \ @@ -1204,8 +1490,6 @@ man/sd_event_unref.html: man/sd_event_new.html man/systemd-bus-proxyd.socket.html: man/systemd-bus-proxyd@.service.html $(html-alias) -endif - if ENABLE_LOCALED MANPAGES += \ man/localectl.1 \ @@ -1708,6 +1992,7 @@ EXTRA_DIST += \ man/kernel-install.xml \ man/less-variables.xml \ man/libsystemd-pkgconfig.xml \ + man/libudev.xml \ man/locale.conf.xml \ man/localectl.xml \ man/localtime.xml \ @@ -1891,6 +2176,17 @@ EXTRA_DIST += \ man/tmpfiles.d.xml \ man/udev.conf.xml \ man/udev.xml \ + man/udev_device_get_syspath.xml \ + man/udev_device_has_tag.xml \ + man/udev_device_new_from_syspath.xml \ + man/udev_enumerate_add_match_subsystem.xml \ + man/udev_enumerate_new.xml \ + man/udev_enumerate_scan_devices.xml \ + man/udev_list_entry.xml \ + man/udev_monitor_filter_update.xml \ + man/udev_monitor_new_from_netlink.xml \ + man/udev_monitor_receive_device.xml \ + man/udev_new.xml \ man/udevadm.xml \ man/user-system-options.xml \ man/vconsole.conf.xml diff --git a/Makefile.am b/Makefile.am index 1dd6dbd5e5..7cc70445cc 100644 --- a/Makefile.am +++ b/Makefile.am @@ -338,10 +338,8 @@ INSTALL_EXEC_HOOKS += \ install-aliases-hook \ install-touch-usr-hook -if ENABLE_KDBUS INSTALL_EXEC_HOOKS += \ install-busnames-target-wants-hook -endif # ------------------------------------------------------------------------------ AM_V_M4 = $(AM_V_M4_$(V)) @@ -522,10 +520,8 @@ dist_systemunit_DATA = \ units/initrd-switch-root.target \ units/machines.target -if ENABLE_KDBUS dist_systemunit_DATA += \ $(dist_systemunit_DATA_busnames) -endif dist_systemunit_DATA_busnames += \ units/busnames.target @@ -2622,7 +2618,6 @@ systemd_gpt_auto_generator_CFLAGS = \ endif # ------------------------------------------------------------------------------ -if ENABLE_KDBUS systemgenerator_PROGRAMS += \ systemd-dbus1-generator @@ -2645,7 +2640,6 @@ dist_xinitrc_SCRIPTS = \ INSTALL_EXEC_HOOKS += dbus1-generator-install-hook UNINSTALL_EXEC_HOOKS += dbus1-generator-uninstall-hook -endif # ------------------------------------------------------------------------------ systemd_sysv_generator_SOURCES = \ @@ -2793,7 +2787,6 @@ systemd_stdio_bridge_LDADD = \ libbus-proxy-core.la \ libshared.la -if ENABLE_KDBUS nodist_systemunit_DATA += \ units/systemd-bus-proxyd.service @@ -2805,7 +2798,6 @@ nodist_userunit_DATA += \ dist_userunit_DATA += \ units/user/systemd-bus-proxyd.socket -endif EXTRA_DIST += \ units/systemd-bus-proxyd.service.m4.in \ @@ -2841,6 +2833,7 @@ libsystemd_internal_la_SOURCES = \ src/systemd/sd-network.h \ src/systemd/sd-hwdb.h \ src/systemd/sd-device.h \ + src/libsystemd/libsystemd.sym \ src/libsystemd/sd-bus/sd-bus.c \ src/libsystemd/sd-bus/bus-control.c \ src/libsystemd/sd-bus/bus-control.h \ @@ -2917,9 +2910,6 @@ libsystemd_internal_la_SOURCES = \ src/libsystemd/sd-resolve/sd-resolve.c \ src/libsystemd/sd-resolve/resolve-util.h -nodist_libsystemd_internal_la_SOURCES = \ - src/libsystemd/libsystemd.sym - libsystemd_internal_la_LIBADD = \ libbasic.la \ -lresolv @@ -2928,14 +2918,10 @@ noinst_LTLIBRARIES += \ libsystemd-internal.la EXTRA_DIST += \ - src/libsystemd/libsystemd.sym.m4 \ src/libsystemd/libsystemd.pc.in \ src/libsystemd/sd-bus/DIFFERENCES \ src/libsystemd/sd-bus/GVARIANT-SERIALIZATION -BUILT_SOURCES += \ - src/libsystemd/libsystemd.sym - libsystemd_la_SOURCES = \ $(libsystemd_internal_la_SOURCES) \ $(libsystemd_journal_internal_la_SOURCES) @@ -2950,7 +2936,7 @@ libsystemd_la_CFLAGS = \ libsystemd_la_LDFLAGS = \ $(AM_LDFLAGS) \ -version-info $(LIBSYSTEMD_CURRENT):$(LIBSYSTEMD_REVISION):$(LIBSYSTEMD_AGE) \ - -Wl,--version-script=$(top_builddir)/src/libsystemd/libsystemd.sym + -Wl,--version-script=$(top_srcdir)/src/libsystemd/libsystemd.sym libsystemd_la_LIBADD = \ $(libsystemd_internal_la_LIBADD) \ @@ -2977,14 +2963,6 @@ pkginclude_HEADERS += \ src/systemd/sd-id128.h \ src/systemd/sd-daemon.h -if ENABLE_KDBUS -pkginclude_HEADERS += \ - src/systemd/sd-utf8.h \ - src/systemd/sd-netlink.h \ - src/systemd/sd-resolve.h \ - src/systemd/sd-path.h -endif - lib_LTLIBRARIES += \ libsystemd.la @@ -3460,10 +3438,6 @@ libudev_la_SOURCES =\ src/libudev/libudev-queue.c \ src/libudev/libudev-hwdb.c -libudev_la_CFLAGS = \ - $(AM_CFLAGS) \ - -fvisibility=hidden - libudev_la_LDFLAGS = \ $(AM_LDFLAGS) \ -version-info $(LIBUDEV_CURRENT):$(LIBUDEV_REVISION):$(LIBUDEV_AGE) \ @@ -3495,10 +3469,6 @@ noinst_LTLIBRARIES += \ libudev_internal_la_SOURCES =\ $(libudev_la_SOURCES) -libudev_internal_la_CFLAGS = \ - $(AM_CFLAGS) \ - -fvisibility=default - # ------------------------------------------------------------------------------ INSTALL_DIRS += \ $(sysconfdir)/udev/rules.d @@ -5539,8 +5509,7 @@ pam_systemd_la_SOURCES = \ pam_systemd_la_CFLAGS = \ $(AM_CFLAGS) \ - $(PAM_CFLAGS) \ - -fvisibility=hidden + $(PAM_CFLAGS) pam_systemd_la_LDFLAGS = \ $(AM_LDFLAGS) \ @@ -5969,6 +5938,7 @@ substitutions = \ '|systemgidmax=$(SYSTEM_GID_MAX)|' \ '|TTY_GID=$(TTY_GID)|' \ '|systemsleepdir=$(systemsleepdir)|' \ + '|systemshutdowndir=$(systemshutdowndir)|' \ '|binfmtdir=$(binfmtdir)|' \ '|modulesloaddir=$(modulesloaddir)|' @@ -6188,10 +6158,8 @@ USER_UNIT_ALIASES += \ $(systemunitdir)/sound.target sound.target \ $(systemunitdir)/smartcard.target smartcard.target -if ENABLE_KDBUS USER_UNIT_ALIASES += \ $(systemunitdir)/busnames.target busnames.target -endif GENERAL_ALIASES += \ $(systemunitdir)/remote-fs.target $(pkgsysconfdir)/system/multi-user.target.wants/remote-fs.target \ @@ -6252,7 +6220,6 @@ DISTCHECK_CONFIGURE_FLAGS = \ --with-pamlibdir=$$dc_install_base/$(pamlibdir) \ --with-pamconfdir=$$dc_install_base/$(pamconfdir) \ --with-rootprefix=$$dc_install_base \ - --enable-kdbus \ --enable-compat-libs if HAVE_SYSV_COMPAT @@ -6313,11 +6280,6 @@ hwdb-update: http://standards.ieee.org/develop/regauth/iab/iab.txt && \ ./ids-update.pl ) -.PHONY: kdbus-update -kdbus-update: - ( cd $(top_srcdir)/src/libsystemd/sd-bus/ && \ - wget -N https://d-bus.googlecode.com/git/kdbus.h ) - .PHONY: git-tag git-tag: git tag -s "v$(VERSION)" -m "systemd $(VERSION)" @@ -28,6 +28,8 @@ External: Features: +* "systemctl daemon-reload" should result in /etc/systemd/system.conf being reloaded by systemd + * install: include generator dirs in unit file search paths * networkd: add support for configuring ipv6 privacy extensions diff --git a/configure.ac b/configure.ac index b94dbd1613..e5d3994439 100644 --- a/configure.ac +++ b/configure.ac @@ -1203,9 +1203,9 @@ AM_CONDITIONAL(ENABLE_TERMINAL, [test "x$have_terminal" = "xyes" -a "x$have_unif # ------------------------------------------------------------------------------ have_kdbus=no -AC_ARG_ENABLE(kdbus, AS_HELP_STRING([--enable-kdbus], [do connect to kdbus by default])) -if test "x$enable_kdbus" = "xyes"; then - AC_DEFINE(ENABLE_KDBUS, 1, [Define if kdbus support is to be enabled]) +AC_ARG_ENABLE(kdbus, AS_HELP_STRING([--disable-kdbus], [do not connect to kdbus by default])) +if test "x$enable_kdbus" != "xno"; then + AC_DEFINE(ENABLE_KDBUS, 1, [Define if kdbus is to be connected to by default]) have_kdbus=yes M4_DEFINES="$M4_DEFINES -DENABLE_KDBUS" fi diff --git a/man/journald.conf.xml b/man/journald.conf.xml index 8d0dbb0133..f8eb398aba 100644 --- a/man/journald.conf.xml +++ b/man/journald.conf.xml @@ -231,12 +231,13 @@ eighth of the values configured with <varname>SystemMaxUse=</varname> and <varname>RuntimeMaxUse=</varname>, so that usually seven - rotated journal files are kept as history. Specify values in - bytes or use K, M, G, T, P, E as units for the specified sizes - (equal to 1024, 1024²,... bytes). Note that size limits are - enforced synchronously when journal files are extended, and no - explicit rotation step triggered by time is - needed.</para></listitem> + rotated journal files are kept as history.</para></listitem> + + <para>Specify values in bytes or use K, M, G, T, P, E as + units for the specified sizes (equal to 1024, 1024²,... bytes). + Note that size limits are enforced synchronously when journal + files are extended, and no explicit rotation step triggered by + time is needed.</para> </varlistentry> <varlistentry> diff --git a/man/libudev.xml b/man/libudev.xml new file mode 100644 index 0000000000..5660b9d990 --- /dev/null +++ b/man/libudev.xml @@ -0,0 +1,125 @@ +<?xml version='1.0'?> <!--*-nxml-*--> +<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN" + "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd" [ +<!ENTITY % entities SYSTEM "custom-entities.ent" > +%entities; +]> + +<!-- + This file is part of systemd. + + Copyright 2015 David Herrmann <dh.herrmann@gmail.com> + + 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. + + systemd is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with systemd; If not, see <http://www.gnu.org/licenses/>. +--> + +<refentry id="libudev" + xmlns:xi="http://www.w3.org/2001/XInclude"> + + <refentryinfo> + <title>libudev</title> + <productname>systemd</productname> + + <authorgroup> + <author> + <contrib>Developer</contrib> + <firstname>David</firstname> + <surname>Herrmann</surname> + <email>dh.herrmann@gmail.com</email> + </author> + </authorgroup> + </refentryinfo> + + <refmeta> + <refentrytitle>libudev</refentrytitle> + <manvolnum>3</manvolnum> + </refmeta> + + <refnamediv> + <refname>libudev</refname> + <refpurpose>API for enumerating and introspecting local devices</refpurpose> + </refnamediv> + + <refsynopsisdiv> + <funcsynopsis> + <funcsynopsisinfo>#include <libudev.h></funcsynopsisinfo> + </funcsynopsis> + + <cmdsynopsis> + <command>pkg-config --cflags --libs libudev</command> + </cmdsynopsis> + </refsynopsisdiv> + + <refsect1> + <title>Description</title> + + <para><filename>libudev.h</filename> provides APIs to introspect + and enumerate devices on the local system.</para> + + <para>All functions require a libudev context to operate. This + context can be create via + <citerefentry><refentrytitle>udev_new</refentrytitle><manvolnum>3</manvolnum></citerefentry>. + It is used to track library state and link objects together. No + global state is used by libudev, everything is always linked to + a udev context. Furthermore, multiple different udev contexts can + be used in parallel by multiple threads. However, a single context + must not be accessed by multiple threads in parallel. The caller + is responsible of providing suitable locking if they intend to use + it from multiple threads.</para> + + <para>To introspect a local device on a system, a udev device + object can be created via + <citerefentry><refentrytitle>udev_device_new_from_syspath</refentrytitle><manvolnum>3</manvolnum></citerefentry> + and friends. The device object allows to query current state, + read and write attributes and lookup properties of the device in + question.</para> + + <para>To enumerate local devices on the system, an enumeration + object can be created via + <citerefentry><refentrytitle>udev_enumerate_new</refentrytitle><manvolnum>3</manvolnum></citerefentry>.</para> + + <para>To monitor the local system for hotplugged or unplugged + devices, a monitor can be created via + <citerefentry><refentrytitle>udev_monitor_new_from_netlink</refentrytitle><manvolnum>3</manvolnum></citerefentry>.</para> + + <para>Whenever libudev returns a list of objects, the + <citerefentry><refentrytitle>udev_list_entry</refentrytitle><manvolnum>3</manvolnum></citerefentry> + API should be used to iterate, access and modify those lists.</para> + + <para>Furthermore, libudev also exports legacy APIs that should + not be used by new software (and as such are not documented as + part of this manual). This includes the hardware-database known + as <constant>udev_hwdb</constant> (please use the new + <citerefentry><refentrytitle>sd-hwdb</refentrytitle><manvolnum>3</manvolnum></citerefentry> + API instead) and the <constant>udev_queue</constant> object to + query the udev-daemon (which should not be used by new software + at all).</para> + </refsect1> + + <refsect1> + <title>See Also</title> + <para> + <citerefentry><refentrytitle>udev_new</refentrytitle><manvolnum>3</manvolnum></citerefentry>, + <citerefentry><refentrytitle>udev_device_new_from_syspath</refentrytitle><manvolnum>3</manvolnum></citerefentry>, + <citerefentry><refentrytitle>udev_enumerate_new</refentrytitle><manvolnum>3</manvolnum></citerefentry>, + <citerefentry><refentrytitle>udev_monitor_new_from_netlink</refentrytitle><manvolnum>3</manvolnum></citerefentry>, + <citerefentry><refentrytitle>udev_list_entry</refentrytitle><manvolnum>3</manvolnum></citerefentry>, + <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>, + <citerefentry><refentrytitle>sd-device</refentrytitle><manvolnum>3</manvolnum></citerefentry>, + <citerefentry><refentrytitle>sd-hwdb</refentrytitle><manvolnum>3</manvolnum></citerefentry>, + <citerefentry project='die-net'><refentrytitle>pkg-config</refentrytitle><manvolnum>1</manvolnum></citerefentry> + </para> + </refsect1> + +</refentry> diff --git a/man/sd_bus_creds_get_pid.xml b/man/sd_bus_creds_get_pid.xml index 8a193d5a59..b9e081101b 100644 --- a/man/sd_bus_creds_get_pid.xml +++ b/man/sd_bus_creds_get_pid.xml @@ -24,7 +24,7 @@ along with systemd; If not, see <http://www.gnu.org/licenses/>. --> -<refentry id="sd_bus_creds_get_pid" conditional="ENABLE_KDBUS"> +<refentry id="sd_bus_creds_get_pid"> <refentryinfo> <title>sd_bus_creds_get_pid</title> diff --git a/man/sd_bus_creds_new_from_pid.xml b/man/sd_bus_creds_new_from_pid.xml index 695d4e1f5a..36b6bef04e 100644 --- a/man/sd_bus_creds_new_from_pid.xml +++ b/man/sd_bus_creds_new_from_pid.xml @@ -24,7 +24,7 @@ along with systemd; If not, see <http://www.gnu.org/licenses/>. --> -<refentry id="sd_bus_creds_new_from_pid" conditional="ENABLE_KDBUS"> +<refentry id="sd_bus_creds_new_from_pid"> <refentryinfo> <title>sd_bus_creds_new_from_pid</title> diff --git a/man/sd_bus_default.xml b/man/sd_bus_default.xml index 55f1b8bb69..ae0b1a05c8 100644 --- a/man/sd_bus_default.xml +++ b/man/sd_bus_default.xml @@ -24,7 +24,7 @@ along with systemd; If not, see <http://www.gnu.org/licenses/>. --> -<refentry id="sd_bus_default" conditional="ENABLE_KDBUS"> +<refentry id="sd_bus_default"> <refentryinfo> <title>sd_bus_default</title> diff --git a/man/sd_bus_error.xml b/man/sd_bus_error.xml index bd2a27984c..762f0c0d6d 100644 --- a/man/sd_bus_error.xml +++ b/man/sd_bus_error.xml @@ -24,7 +24,7 @@ along with systemd; If not, see <http://www.gnu.org/licenses/>. --> -<refentry id="sd_bus_error" conditional="ENABLE_KDBUS"> +<refentry id="sd_bus_error"> <refentryinfo> <title>sd_bus_error</title> diff --git a/man/sd_bus_message_append.xml b/man/sd_bus_message_append.xml index 91a80792e1..5025bdfefb 100644 --- a/man/sd_bus_message_append.xml +++ b/man/sd_bus_message_append.xml @@ -24,7 +24,7 @@ along with systemd; If not, see <http://www.gnu.org/licenses/>. --> -<refentry id="sd_bus_message_append" conditional="ENABLE_KDBUS" +<refentry id="sd_bus_message_append" xmlns:xi="http://www.w3.org/2001/XInclude"> <refentryinfo> diff --git a/man/sd_bus_message_append_array.xml b/man/sd_bus_message_append_array.xml index 5409893374..fc5ee2392b 100644 --- a/man/sd_bus_message_append_array.xml +++ b/man/sd_bus_message_append_array.xml @@ -24,7 +24,7 @@ along with systemd; If not, see <http://www.gnu.org/licenses/>. --> -<refentry id="sd_bus_message_append_array" conditional="ENABLE_KDBUS" +<refentry id="sd_bus_message_append_array" xmlns:xi="http://www.w3.org/2001/XInclude"> <refentryinfo> diff --git a/man/sd_bus_message_append_basic.xml b/man/sd_bus_message_append_basic.xml index 81ac6de952..82c6957122 100644 --- a/man/sd_bus_message_append_basic.xml +++ b/man/sd_bus_message_append_basic.xml @@ -24,7 +24,7 @@ along with systemd; If not, see <http://www.gnu.org/licenses/>. --> -<refentry id="sd_bus_message_append_basic" conditional="ENABLE_KDBUS"> +<refentry id="sd_bus_message_append_basic"> <refentryinfo> <title>sd_bus_message_append_basic</title> diff --git a/man/sd_bus_message_append_string_memfd.xml b/man/sd_bus_message_append_string_memfd.xml index 1fecbd5773..61c513ad75 100644 --- a/man/sd_bus_message_append_string_memfd.xml +++ b/man/sd_bus_message_append_string_memfd.xml @@ -24,7 +24,7 @@ along with systemd; If not, see <http://www.gnu.org/licenses/>. --> -<refentry id="sd_bus_message_append_string_memfd" conditional="ENABLE_KDBUS" +<refentry id="sd_bus_message_append_string_memfd" xmlns:xi="http://www.w3.org/2001/XInclude"> <refentryinfo> diff --git a/man/sd_bus_message_append_strv.xml b/man/sd_bus_message_append_strv.xml index d986b06a41..57a6864ace 100644 --- a/man/sd_bus_message_append_strv.xml +++ b/man/sd_bus_message_append_strv.xml @@ -24,7 +24,7 @@ along with systemd; If not, see <http://www.gnu.org/licenses/>. --> -<refentry id="sd_bus_message_append_strv" conditional="ENABLE_KDBUS" +<refentry id="sd_bus_message_append_strv" xmlns:xi="http://www.w3.org/2001/XInclude"> <refentryinfo> diff --git a/man/sd_bus_message_get_cookie.xml b/man/sd_bus_message_get_cookie.xml index 7795acfec3..7f762a34f7 100644 --- a/man/sd_bus_message_get_cookie.xml +++ b/man/sd_bus_message_get_cookie.xml @@ -24,7 +24,7 @@ along with systemd; If not, see <http://www.gnu.org/licenses/>. --> -<refentry id="sd_bus_message_get_cookie" conditional="ENABLE_KDBUS"> +<refentry id="sd_bus_message_get_cookie"> <refentryinfo> <title>sd_bus_message_get_cookie</title> diff --git a/man/sd_bus_message_get_monotonic_usec.xml b/man/sd_bus_message_get_monotonic_usec.xml index c109fe10a3..c8deecffbb 100644 --- a/man/sd_bus_message_get_monotonic_usec.xml +++ b/man/sd_bus_message_get_monotonic_usec.xml @@ -24,7 +24,7 @@ along with systemd; If not, see <http://www.gnu.org/licenses/>. --> -<refentry id="sd_bus_message_get_monotonic_usec" conditional="ENABLE_KDBUS"> +<refentry id="sd_bus_message_get_monotonic_usec"> <refentryinfo> <title>sd_bus_message_get_monotonic_usec</title> diff --git a/man/sd_bus_negotiate_fds.xml b/man/sd_bus_negotiate_fds.xml index 4f9204e7bc..d31cb57e5f 100644 --- a/man/sd_bus_negotiate_fds.xml +++ b/man/sd_bus_negotiate_fds.xml @@ -24,7 +24,7 @@ along with systemd; If not, see <http://www.gnu.org/licenses/>. --> -<refentry id="sd_bus_negotiate_fds" conditional="ENABLE_KDBUS"> +<refentry id="sd_bus_negotiate_fds"> <refentryinfo> <title>sd_bus_negotiate_fds</title> diff --git a/man/sd_bus_new.xml b/man/sd_bus_new.xml index bc91dd2665..c1d82bbe53 100644 --- a/man/sd_bus_new.xml +++ b/man/sd_bus_new.xml @@ -24,7 +24,7 @@ along with systemd; If not, see <http://www.gnu.org/licenses/>. --> -<refentry id="sd_bus_new" conditional="ENABLE_KDBUS"> +<refentry id="sd_bus_new"> <refentryinfo> <title>sd_bus_new</title> diff --git a/man/sd_bus_path_encode.xml b/man/sd_bus_path_encode.xml index 0a6ac80473..41c35bde02 100644 --- a/man/sd_bus_path_encode.xml +++ b/man/sd_bus_path_encode.xml @@ -24,7 +24,7 @@ along with systemd; If not, see <http://www.gnu.org/licenses/>. --> -<refentry id="sd_bus_path_encode" conditional="ENABLE_KDBUS"> +<refentry id="sd_bus_path_encode"> <refentryinfo> <title>sd_bus_path_encode</title> diff --git a/man/sd_bus_request_name.xml b/man/sd_bus_request_name.xml index 78b440b7db..a7dc9fea89 100644 --- a/man/sd_bus_request_name.xml +++ b/man/sd_bus_request_name.xml @@ -24,7 +24,7 @@ along with systemd; If not, see <http://www.gnu.org/licenses/>. --> -<refentry id="sd_bus_request_name" conditional="ENABLE_KDBUS"> +<refentry id="sd_bus_request_name"> <refentryinfo> <title>sd_bus_request_name</title> diff --git a/man/sd_event_add_child.xml b/man/sd_event_add_child.xml index 7de9f409e9..6b53c8422b 100644 --- a/man/sd_event_add_child.xml +++ b/man/sd_event_add_child.xml @@ -24,7 +24,7 @@ along with systemd; If not, see <http://www.gnu.org/licenses/>. --> -<refentry id="sd_event_add_child" conditional="ENABLE_KDBUS"> +<refentry id="sd_event_add_child"> <refentryinfo> <title>sd_event_add_child</title> diff --git a/man/sd_event_add_defer.xml b/man/sd_event_add_defer.xml index 4aabc0793a..b991b38650 100644 --- a/man/sd_event_add_defer.xml +++ b/man/sd_event_add_defer.xml @@ -24,7 +24,7 @@ along with systemd; If not, see <http://www.gnu.org/licenses/>. --> -<refentry id="sd_event_add_defer" conditional="ENABLE_KDBUS"> +<refentry id="sd_event_add_defer"> <refentryinfo> <title>sd_event_add_defer</title> diff --git a/man/sd_event_add_signal.xml b/man/sd_event_add_signal.xml index e84d5c7200..16414803f4 100644 --- a/man/sd_event_add_signal.xml +++ b/man/sd_event_add_signal.xml @@ -24,7 +24,7 @@ along with systemd; If not, see <http://www.gnu.org/licenses/>. --> -<refentry id="sd_event_add_signal" conditional="ENABLE_KDBUS"> +<refentry id="sd_event_add_signal"> <refentryinfo> <title>sd_event_add_signal</title> diff --git a/man/sd_event_add_time.xml b/man/sd_event_add_time.xml index 3c5de48cab..5fc917270c 100644 --- a/man/sd_event_add_time.xml +++ b/man/sd_event_add_time.xml @@ -24,7 +24,7 @@ along with systemd; If not, see <http://www.gnu.org/licenses/>. --> -<refentry id="sd_event_add_time" conditional="ENABLE_KDBUS"> +<refentry id="sd_event_add_time"> <refentryinfo> <title>sd_event_add_time</title> diff --git a/man/sd_event_get_fd.xml b/man/sd_event_get_fd.xml index 8f74c1e5c4..1e46665e47 100644 --- a/man/sd_event_get_fd.xml +++ b/man/sd_event_get_fd.xml @@ -24,7 +24,7 @@ along with systemd; If not, see <http://www.gnu.org/licenses/>. --> -<refentry id="sd_event_get_fd" conditional="ENABLE_KDBUS" +<refentry id="sd_event_get_fd" xmlns:xi="http://www.w3.org/2001/XInclude"> <refentryinfo> diff --git a/man/sd_event_new.xml b/man/sd_event_new.xml index d225330023..43b5b742f7 100644 --- a/man/sd_event_new.xml +++ b/man/sd_event_new.xml @@ -24,7 +24,7 @@ along with systemd; If not, see <http://www.gnu.org/licenses/>. --> -<refentry id="sd_event_new" conditional="ENABLE_KDBUS"> +<refentry id="sd_event_new"> <refentryinfo> <title>sd_event_new</title> diff --git a/man/sd_event_run.xml b/man/sd_event_run.xml index 036887d9f0..9b50b95459 100644 --- a/man/sd_event_run.xml +++ b/man/sd_event_run.xml @@ -24,7 +24,7 @@ along with systemd; If not, see <http://www.gnu.org/licenses/>. --> -<refentry id="sd_event_run" conditional="ENABLE_KDBUS"> +<refentry id="sd_event_run"> <refentryinfo> <title>sd_event_run</title> diff --git a/man/sd_event_set_name.xml b/man/sd_event_set_name.xml index 0b46414bba..eec34d1182 100644 --- a/man/sd_event_set_name.xml +++ b/man/sd_event_set_name.xml @@ -24,7 +24,7 @@ along with systemd; If not, see <http://www.gnu.org/licenses/>. --> -<refentry id="sd_event_set_name" conditional="ENABLE_KDBUS" +<refentry id="sd_event_set_name" xmlns:xi="http://www.w3.org/2001/XInclude"> <refentryinfo> diff --git a/man/sd_event_wait.xml b/man/sd_event_wait.xml index db74a96e8e..94f8b5ca45 100644 --- a/man/sd_event_wait.xml +++ b/man/sd_event_wait.xml @@ -24,7 +24,7 @@ along with systemd; If not, see <http://www.gnu.org/licenses/>. --> -<refentry id="sd_event_wait" conditional="ENABLE_KDBUS"> +<refentry id="sd_event_wait"> <refentryinfo> <title>sd_event_wait</title> diff --git a/man/systemd-bus-proxyd.xml b/man/systemd-bus-proxyd.xml index bbcf3d0981..f7b94cd481 100644 --- a/man/systemd-bus-proxyd.xml +++ b/man/systemd-bus-proxyd.xml @@ -24,7 +24,7 @@ along with systemd; If not, see <http://www.gnu.org/licenses/>. --> -<refentry id="systemd-bus-proxyd" conditional="ENABLE_KDBUS" +<refentry id="systemd-bus-proxyd" xmlns:xi="http://www.w3.org/2001/XInclude"> <refentryinfo> diff --git a/man/systemd-bus-proxyd@.service.xml b/man/systemd-bus-proxyd@.service.xml index 9dabc4dd5f..4ac6ba040c 100644 --- a/man/systemd-bus-proxyd@.service.xml +++ b/man/systemd-bus-proxyd@.service.xml @@ -24,7 +24,7 @@ along with systemd; If not, see <http://www.gnu.org/licenses/>. --> -<refentry id="systemd-bus-proxyd@.service" conditional='ENABLE_KDBUS'> +<refentry id="systemd-bus-proxyd@.service"> <refentryinfo> <title>systemd-bus-proxyd@.service</title> diff --git a/man/systemd-cgtop.xml b/man/systemd-cgtop.xml index d14564480d..969edd055e 100644 --- a/man/systemd-cgtop.xml +++ b/man/systemd-cgtop.xml @@ -85,6 +85,11 @@ <citerefentry><refentrytitle>systemd.resource-control</refentrytitle><manvolnum>5</manvolnum></citerefentry> for details.</para> + <para>The CPU load value can be between 0 and 100 times the number of + processors the system has. For example, if the system has 8 processors, + the CPU load value is going to be between 0% and 800%. The number of + processors can be found in <literal>/proc/cpuinfo</literal>.</para> + <para>To emphasize this: unless <literal>CPUAccounting=1</literal>, <literal>MemoryAccounting=1</literal> and diff --git a/man/udev_device_get_syspath.xml b/man/udev_device_get_syspath.xml new file mode 100644 index 0000000000..b3062ae4a8 --- /dev/null +++ b/man/udev_device_get_syspath.xml @@ -0,0 +1,207 @@ +<?xml version='1.0'?> <!--*-nxml-*--> +<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN" + "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd" [ +<!ENTITY % entities SYSTEM "custom-entities.ent" > +%entities; +]> + +<!-- + This file is part of systemd. + + Copyright 2015 David Herrmann <dh.herrmann@gmail.com> + + 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. + + systemd is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with systemd; If not, see <http://www.gnu.org/licenses/>. +--> + +<refentry id="udev_device_get_syspath" + xmlns:xi="http://www.w3.org/2001/XInclude"> + + <refentryinfo> + <title>udev_device_get_syspath</title> + <productname>systemd</productname> + + <authorgroup> + <author> + <contrib>Developer</contrib> + <firstname>David</firstname> + <surname>Herrmann</surname> + <email>dh.herrmann@gmail.com</email> + </author> + </authorgroup> + </refentryinfo> + + <refmeta> + <refentrytitle>udev_device_get_syspath</refentrytitle> + <manvolnum>3</manvolnum> + </refmeta> + + <refnamediv> + <refname>udev_device_get_syspath</refname> + <refname>udev_device_get_sysname</refname> + <refname>udev_device_get_sysnum</refname> + <refname>udev_device_get_devpath</refname> + <refname>udev_device_get_devnode</refname> + <refname>udev_device_get_devnum</refname> + <refname>udev_device_get_devtype</refname> + <refname>udev_device_get_subsystem</refname> + <refname>udev_device_get_driver</refname> + <refname>udev_device_get_udev</refname> + <refname>udev_device_get_parent</refname> + <refname>udev_device_get_parent_with_subsystem_devtype</refname> + <refname>udev_device_get_is_initialized</refname> + <refname>udev_device_get_action</refname> + + <refpurpose>Query device properties</refpurpose> + </refnamediv> + + <refsynopsisdiv> + <funcsynopsis> + <funcsynopsisinfo>#include <libudev.h></funcsynopsisinfo> + + <funcprototype> + <funcdef>const char *<function>udev_device_get_syspath</function></funcdef> + <paramdef>struct udev_device *<parameter>udev_device</parameter></paramdef> + </funcprototype> + + <funcprototype> + <funcdef>const char *<function>udev_device_get_sysname</function></funcdef> + <paramdef>struct udev_device *<parameter>udev_device</parameter></paramdef> + </funcprototype> + + <funcprototype> + <funcdef>const char *<function>udev_device_get_sysnum</function></funcdef> + <paramdef>struct udev_device *<parameter>udev_device</parameter></paramdef> + </funcprototype> + + <funcprototype> + <funcdef>const char *<function>udev_device_get_devpath</function></funcdef> + <paramdef>struct udev_device *<parameter>udev_device</parameter></paramdef> + </funcprototype> + + <funcprototype> + <funcdef>const char *<function>udev_device_get_devnode</function></funcdef> + <paramdef>struct udev_device *<parameter>udev_device</parameter></paramdef> + </funcprototype> + + <funcprototype> + <funcdef>dev_t <function>udev_device_get_devnum</function></funcdef> + <paramdef>struct udev_device *<parameter>udev_device</parameter></paramdef> + </funcprototype> + + <funcprototype> + <funcdef>const char *<function>udev_device_get_devtype</function></funcdef> + <paramdef>struct udev_device *<parameter>udev_device</parameter></paramdef> + </funcprototype> + + <funcprototype> + <funcdef>const char *<function>udev_device_get_subsystem</function></funcdef> + <paramdef>struct udev_device *<parameter>udev_device</parameter></paramdef> + </funcprototype> + + <funcprototype> + <funcdef>const char *<function>udev_device_get_driver</function></funcdef> + <paramdef>struct udev_device *<parameter>udev_device</parameter></paramdef> + </funcprototype> + + <funcprototype> + <funcdef>struct udev *<function>udev_device_get_udev</function></funcdef> + <paramdef>struct udev_device *<parameter>udev_device</parameter></paramdef> + </funcprototype> + + <funcprototype> + <funcdef>struct udev_device *<function>udev_device_get_parent</function></funcdef> + <paramdef>struct udev_device *<parameter>udev_device</parameter></paramdef> + </funcprototype> + + <funcprototype> + <funcdef>struct udev_device *<function>udev_device_get_parent_with_subsystem_devtype</function></funcdef> + <paramdef>struct udev_device *<parameter>udev_device</parameter></paramdef> + </funcprototype> + + <funcprototype> + <funcdef>int <function>udev_device_get_is_initialized</function></funcdef> + <paramdef>struct udev_device *<parameter>udev_device</parameter></paramdef> + </funcprototype> + + <funcprototype> + <funcdef>const char *<function>udev_device_get_action</function></funcdef> + <paramdef>struct udev_device *<parameter>udev_device</parameter></paramdef> + <paramdef>const char *<parameter>subsystem</parameter></paramdef> + <paramdef>const char *<parameter>devtype</parameter></paramdef> + </funcprototype> + + </funcsynopsis> + </refsynopsisdiv> + + <!--<refsect1> + <title>Description</title> + + <para>XXX: Add documentation.</para> + </refsect1>--> + + <refsect1> + <title>Return Value</title> + + <para>On success, <function>udev_device_get_syspath()</function>, + <function>udev_device_get_sysname()</function>, + <function>udev_device_get_sysnum()</function>, + <function>udev_device_get_devpath()</function>, + <function>udev_device_get_devnode()</function>, + <function>udev_device_get_devtype()</function>, + <function>udev_device_get_subsystem()</function>, + <function>udev_device_get_driver()</function> and + <function>udev_device_get_action()</function> return a pointer + to a constant string that describes the requested property. The + lifetime of this string is bound to the device it was requested + on. On failure, each function may return + <constant>NULL</constant>.</para> + + <para>On success, <function>udev_device_get_devnum()</function> + returns the device type of the passed device. On failure, a + device type with minor and major number set to + <constant>0</constant> is returned.</para> + + <para><function>udev_device_get_udev()</function> always returns + a valid pointer to the udev context that this device belongs + to.</para> + + <para>On success, <function>udev_device_get_parent()</function> + and + <function>udev_device_get_parent_with_subsystem_devtype()</function> + return a pointer to the parent device. No additional reference + to this device is acquired, but the child device owns a reference + to such parent device. On failure, <constant>NULL</constant> + is returned.</para> + + <para>On success, <function>udev_device_get_is_initialized()</function> + returns either <constant>1</constant> or <constant>0</constant>, + depending on whether the passed device is initialized or not. On + failure, a negative error code is returned.</para> + </refsect1> + + <refsect1> + <title>See Also</title> + + <para> + <citerefentry><refentrytitle>udev_new</refentrytitle><manvolnum>3</manvolnum></citerefentry>, + <citerefentry><refentrytitle>udev_device_new_from_syspath</refentrytitle><manvolnum>3</manvolnum></citerefentry>, + <citerefentry><refentrytitle>udev_device_has_tag</refentrytitle><manvolnum>3</manvolnum></citerefentry>, + <citerefentry><refentrytitle>udev_enumerate_new</refentrytitle><manvolnum>3</manvolnum></citerefentry>, + <citerefentry><refentrytitle>udev_monitor_new_from_netlink</refentrytitle><manvolnum>3</manvolnum></citerefentry>, + <citerefentry><refentrytitle>udev_list_entry</refentrytitle><manvolnum>3</manvolnum></citerefentry>, + <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>, + </para> + </refsect1> + +</refentry> diff --git a/man/udev_device_has_tag.xml b/man/udev_device_has_tag.xml new file mode 100644 index 0000000000..480257343c --- /dev/null +++ b/man/udev_device_has_tag.xml @@ -0,0 +1,163 @@ +<?xml version='1.0'?> <!--*-nxml-*--> +<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN" + "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd" [ +<!ENTITY % entities SYSTEM "custom-entities.ent" > +%entities; +]> + +<!-- + This file is part of systemd. + + Copyright 2015 David Herrmann <dh.herrmann@gmail.com> + + 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. + + systemd is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with systemd; If not, see <http://www.gnu.org/licenses/>. +--> + +<refentry id="udev_device_has_tag" + xmlns:xi="http://www.w3.org/2001/XInclude"> + + <refentryinfo> + <title>udev_device_has_tag</title> + <productname>systemd</productname> + + <authorgroup> + <author> + <contrib>Developer</contrib> + <firstname>David</firstname> + <surname>Herrmann</surname> + <email>dh.herrmann@gmail.com</email> + </author> + </authorgroup> + </refentryinfo> + + <refmeta> + <refentrytitle>udev_device_has_tag</refentrytitle> + <manvolnum>3</manvolnum> + </refmeta> + + <refnamediv> + <refname>udev_device_has_tag</refname> + <refname>udev_device_get_devlinks_list_entry</refname> + <refname>udev_device_get_properties_list_entry</refname> + <refname>udev_device_get_tags_list_entry</refname> + <refname>udev_device_get_sysattr_list_entry</refname> + <refname>udev_device_get_property_value</refname> + <refname>udev_device_get_sysattr_value</refname> + <refname>udev_device_set_sysattr_value</refname> + + <refpurpose>Retrieve or set device attributes</refpurpose> + </refnamediv> + + <refsynopsisdiv> + <funcsynopsis> + <funcsynopsisinfo>#include <libudev.h></funcsynopsisinfo> + + <funcprototype> + <funcdef>struct udev_list_entry *<function>udev_device_get_devlinks_list_entry</function></funcdef> + <paramdef>struct udev_device *<parameter>udev_device</parameter></paramdef> + </funcprototype> + + <funcprototype> + <funcdef>struct udev_list_entry *<function>udev_device_get_properties_list_entry</function></funcdef> + <paramdef>struct udev_device *<parameter>udev_device</parameter></paramdef> + </funcprototype> + + <funcprototype> + <funcdef>struct udev_list_entry *<function>udev_device_get_tags_list_entry</function></funcdef> + <paramdef>struct udev_device *<parameter>udev_device</parameter></paramdef> + </funcprototype> + + <funcprototype> + <funcdef>struct udev_list_entry *<function>udev_device_get_sysattr_list_entry</function></funcdef> + <paramdef>struct udev_device *<parameter>udev_device</parameter></paramdef> + </funcprototype> + + <funcprototype> + <funcdef>const char *<function>udev_device_get_property_value</function></funcdef> + <paramdef>struct udev_device *<parameter>udev_device</parameter></paramdef> + <paramdef>const char *<parameter>key</parameter></paramdef> + </funcprototype> + + <funcprototype> + <funcdef>int <function>udev_device_has_tag</function></funcdef> + <paramdef>struct udev_device *<parameter>udev_device</parameter></paramdef> + <paramdef>const char *<parameter>tag</parameter></paramdef> + </funcprototype> + + <funcprototype> + <funcdef>const char *<function>udev_device_get_sysattr_value</function></funcdef> + <paramdef>struct udev_device *<parameter>udev_device</parameter></paramdef> + <paramdef>const char *<parameter>sysattr</parameter></paramdef> + </funcprototype> + + <funcprototype> + <funcdef>int <function>udev_device_set_sysattr_value</function></funcdef> + <paramdef>struct udev_device *<parameter>udev_device</parameter></paramdef> + <paramdef>const char *<parameter>sysattr</parameter></paramdef> + <paramdef>const char *<parameter>value</parameter></paramdef> + </funcprototype> + + </funcsynopsis> + </refsynopsisdiv> + + <!--<refsect1> + <title>Description</title> + + <para>XXX: Add short description.</para> + </refsect1>--> + + <refsect1> + <title>Return Value</title> + + <para>On success, + <function>udev_device_get_devlinks_list_entry()</function>, + <function>udev_device_get_properties_list_entry()</function>, + <function>udev_device_get_tags_list_entry()</function> and + <function>udev_device_get_sysattr_list_entry()</function> return + a pointer to the first entry of the retrieved list. If that list + is empty, or if an error occurred, <constant>NULL</constant> is + returned.</para> + + <para>On success, + <function>udev_device_get_property_value()</function> and + <function>udev_device_get_sysattr_value()</function> return a + pointer to a constant string of the requested value. On error, + <constant>NULL</constant> is returned.</para> + + <para>On success, + <function>udev_device_set_sysattr_value()</function> returns + an integer greater than, or equal to, <constant>0</constant>. + On failure, a negative error code is returned.</para> + + <para>On success, <function>udev_device_has_tag()</function> + returns <constant>1</constant> or <constant>0</constant>, + depending on whether the device has the given tag or not. + On failure, a negative error code is returned.</para> + </refsect1> + + <refsect1> + <title>See Also</title> + + <para> + <citerefentry><refentrytitle>udev_new</refentrytitle><manvolnum>3</manvolnum></citerefentry>, + <citerefentry><refentrytitle>udev_device_new_from_syspath</refentrytitle><manvolnum>3</manvolnum></citerefentry>, + <citerefentry><refentrytitle>udev_device_get_syspath</refentrytitle><manvolnum>3</manvolnum></citerefentry>, + <citerefentry><refentrytitle>udev_enumerate_new</refentrytitle><manvolnum>3</manvolnum></citerefentry>, + <citerefentry><refentrytitle>udev_monitor_new_from_netlink</refentrytitle><manvolnum>3</manvolnum></citerefentry>, + <citerefentry><refentrytitle>udev_list_entry</refentrytitle><manvolnum>3</manvolnum></citerefentry>, + <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>, + </para> + </refsect1> + +</refentry> diff --git a/man/udev_device_new_from_syspath.xml b/man/udev_device_new_from_syspath.xml new file mode 100644 index 0000000000..c3c0d763e4 --- /dev/null +++ b/man/udev_device_new_from_syspath.xml @@ -0,0 +1,145 @@ +<?xml version='1.0'?> <!--*-nxml-*--> +<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN" + "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd" [ +<!ENTITY % entities SYSTEM "custom-entities.ent" > +%entities; +]> + +<!-- + This file is part of systemd. + + Copyright 2015 David Herrmann <dh.herrmann@gmail.com> + + 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. + + systemd is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with systemd; If not, see <http://www.gnu.org/licenses/>. +--> + +<refentry id="udev_device_new_from_syspath" + xmlns:xi="http://www.w3.org/2001/XInclude"> + + <refentryinfo> + <title>udev_device_new_from_syspath</title> + <productname>systemd</productname> + + <authorgroup> + <author> + <contrib>Developer</contrib> + <firstname>David</firstname> + <surname>Herrmann</surname> + <email>dh.herrmann@gmail.com</email> + </author> + </authorgroup> + </refentryinfo> + + <refmeta> + <refentrytitle>udev_device_new_from_syspath</refentrytitle> + <manvolnum>3</manvolnum> + </refmeta> + + <refnamediv> + <refname>udev_device_new_from_syspath</refname> + <refname>udev_device_new_from_devnum</refname> + <refname>udev_device_new_from_subsystem_sysname</refname> + <refname>udev_device_new_from_device_id</refname> + <refname>udev_device_new_from_environment</refname> + <refname>udev_device_ref</refname> + <refname>udev_device_unref</refname> + + <refpurpose>Create, acquire and release a udev device object</refpurpose> + </refnamediv> + + <refsynopsisdiv> + <funcsynopsis> + <funcsynopsisinfo>#include <libudev.h></funcsynopsisinfo> + + <funcprototype> + <funcdef>struct udev_device *<function>udev_device_new_from_syspath</function></funcdef> + <paramdef>struct udev *<parameter>udev</parameter></paramdef> + <paramdef>const char *<parameter>syspath</parameter></paramdef> + </funcprototype> + + <funcprototype> + <funcdef>struct udev_device *<function>udev_device_new_from_devnum</function></funcdef> + <paramdef>struct udev *<parameter>udev</parameter></paramdef> + <paramdef>char <parameter>type</parameter></paramdef> + <paramdef>dev_t <parameter>devnum</parameter></paramdef> + </funcprototype> + + <funcprototype> + <funcdef>struct udev_device *<function>udev_device_new_from_subsystem_sysname</function></funcdef> + <paramdef>struct udev *<parameter>udev</parameter></paramdef> + <paramdef>const char *<parameter>subsystem</parameter></paramdef> + <paramdef>const char *<parameter>sysname</parameter></paramdef> + </funcprototype> + + <funcprototype> + <funcdef>struct udev_device *<function>udev_device_new_from_device_id</function></funcdef> + <paramdef>struct udev *<parameter>udev</parameter></paramdef> + <paramdef>const char *<parameter>id</parameter></paramdef> + </funcprototype> + + <funcprototype> + <funcdef>struct udev_device *<function>udev_device_new_from_environment</function></funcdef> + <paramdef>struct udev *<parameter>udev</parameter></paramdef> + </funcprototype> + + <funcprototype> + <funcdef>struct udev_device *<function>udev_device_ref</function></funcdef> + <paramdef>struct udev_device *<parameter>udev_device</parameter></paramdef> + </funcprototype> + + <funcprototype> + <funcdef>struct udev_device *<function>udev_device_unref</function></funcdef> + <paramdef>struct udev_device *<parameter>udev_device</parameter></paramdef> + </funcprototype> + + </funcsynopsis> + </refsynopsisdiv> + + <!--<refsect1> + <title>Description</title> + + <para>XXX: Add some description.</para> + </refsect1>--> + + <refsect1> + <title>Return Value</title> + + <para>On success, <function>udev_device_new_from_syspath()</function>, + <function>udev_device_new_from_devnum()</function>, + <function>udev_device_new_from_subsystem_sysname()</function>, + <function>udev_device_new_from_device_id()</function> and + <function>udev_device_new_from_environment()</function> return a + pointer to the allocated udev device. On failure, + <constant>NULL</constant> is returned. + <function>udev_device_ref()</function> returns the argument + that it was passed, unmodified. + <function>udev_device_unref()</function> always returns + <constant>NULL</constant>.</para> + </refsect1> + + <refsect1> + <title>See Also</title> + + <para> + <citerefentry><refentrytitle>udev_new</refentrytitle><manvolnum>3</manvolnum></citerefentry>, + <citerefentry><refentrytitle>udev_device_get_syspath</refentrytitle><manvolnum>3</manvolnum></citerefentry>, + <citerefentry><refentrytitle>udev_device_has_tag</refentrytitle><manvolnum>3</manvolnum></citerefentry>, + <citerefentry><refentrytitle>udev_enumerate_new</refentrytitle><manvolnum>3</manvolnum></citerefentry>, + <citerefentry><refentrytitle>udev_monitor_new_from_netlink</refentrytitle><manvolnum>3</manvolnum></citerefentry>, + <citerefentry><refentrytitle>udev_list_entry</refentrytitle><manvolnum>3</manvolnum></citerefentry>, + <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>, + </para> + </refsect1> + +</refentry> diff --git a/man/udev_enumerate_add_match_subsystem.xml b/man/udev_enumerate_add_match_subsystem.xml new file mode 100644 index 0000000000..5acce00bb0 --- /dev/null +++ b/man/udev_enumerate_add_match_subsystem.xml @@ -0,0 +1,163 @@ +<?xml version='1.0'?> <!--*-nxml-*--> +<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN" + "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd" [ +<!ENTITY % entities SYSTEM "custom-entities.ent" > +%entities; +]> + +<!-- + This file is part of systemd. + + Copyright 2015 David Herrmann <dh.herrmann@gmail.com> + + 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. + + systemd is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with systemd; If not, see <http://www.gnu.org/licenses/>. +--> + +<refentry id="udev_enumerate_add_match_subsystem" + xmlns:xi="http://www.w3.org/2001/XInclude"> + + <refentryinfo> + <title>udev_enumerate_add_match_subsystem</title> + <productname>systemd</productname> + + <authorgroup> + <author> + <contrib>Developer</contrib> + <firstname>David</firstname> + <surname>Herrmann</surname> + <email>dh.herrmann@gmail.com</email> + </author> + </authorgroup> + </refentryinfo> + + <refmeta> + <refentrytitle>udev_enumerate_add_match_subsystem</refentrytitle> + <manvolnum>3</manvolnum> + </refmeta> + + <refnamediv> + <refname>udev_enumerate_add_match_subsystem</refname> + <refname>udev_enumerate_add_nomatch_subsystem</refname> + <refname>udev_enumerate_add_match_sysattr</refname> + <refname>udev_enumerate_add_nomatch_sysattr</refname> + <refname>udev_enumerate_add_match_property</refname> + <refname>udev_enumerate_add_match_sysname</refname> + <refname>udev_enumerate_add_match_tag</refname> + <refname>udev_enumerate_add_match_parent</refname> + <refname>udev_enumerate_add_match_is_initialized</refname> + + <refpurpose>Modify filters</refpurpose> + </refnamediv> + + <refsynopsisdiv> + <funcsynopsis> + <funcsynopsisinfo>#include <libudev.h></funcsynopsisinfo> + + <funcprototype> + <funcdef>int <function>udev_enumerate_add_match_subsystem</function></funcdef> + <paramdef>struct udev_enumerate *<parameter>udev_enumerate</parameter></paramdef> + <paramdef>const char *<parameter>subsystem</parameter></paramdef> + </funcprototype> + + <funcprototype> + <funcdef>int <function>udev_enumerate_add_nomatch_subsystem</function></funcdef> + <paramdef>struct udev_enumerate *<parameter>udev_enumerate</parameter></paramdef> + <paramdef>const char *<parameter>subsystem</parameter></paramdef> + </funcprototype> + + <funcprototype> + <funcdef>int <function>udev_enumerate_add_match_sysattr</function></funcdef> + <paramdef>struct udev_enumerate *<parameter>udev_enumerate</parameter></paramdef> + <paramdef>const char *<parameter>sysattr</parameter></paramdef> + <paramdef>const char *<parameter>value</parameter></paramdef> + </funcprototype> + + <funcprototype> + <funcdef>int <function>udev_enumerate_add_nomatch_sysattr</function></funcdef> + <paramdef>struct udev_enumerate *<parameter>udev_enumerate</parameter></paramdef> + <paramdef>const char *<parameter>sysattr</parameter></paramdef> + <paramdef>const char *<parameter>value</parameter></paramdef> + </funcprototype> + + <funcprototype> + <funcdef>int <function>udev_enumerate_add_match_property</function></funcdef> + <paramdef>struct udev_enumerate *<parameter>udev_enumerate</parameter></paramdef> + <paramdef>const char *<parameter>property</parameter></paramdef> + <paramdef>const char *<parameter>value</parameter></paramdef> + </funcprototype> + + <funcprototype> + <funcdef>int <function>udev_enumerate_add_match_sysname</function></funcdef> + <paramdef>struct udev_enumerate *<parameter>udev_enumerate</parameter></paramdef> + <paramdef>const char *<parameter>sysname</parameter></paramdef> + </funcprototype> + + <funcprototype> + <funcdef>int <function>udev_enumerate_add_match_tag</function></funcdef> + <paramdef>struct udev_enumerate *<parameter>udev_enumerate</parameter></paramdef> + <paramdef>const char *<parameter>tag</parameter></paramdef> + </funcprototype> + + <funcprototype> + <funcdef>int <function>udev_enumerate_add_match_parent</function></funcdef> + <paramdef>struct udev_enumerate *<parameter>udev_enumerate</parameter></paramdef> + <paramdef>struct udev_device *<parameter>parent</parameter></paramdef> + </funcprototype> + + <funcprototype> + <funcdef>int <function>udev_enumerate_add_match_is_initialized</function></funcdef> + <paramdef>struct udev_enumerate *<parameter>udev_enumerate</parameter></paramdef> + </funcprototype> + + </funcsynopsis> + </refsynopsisdiv> + + <!--<refsect1> + <title>Description</title> + + <para>XXX: Add short description.</para> + </refsect1>--> + + <refsect1> + <title>Return Value</title> + + <para>On success, + <function>udev_enumerate_add_match_subsystem</function>, + <function>udev_enumerate_add_nomatch_subsystem</function>, + <function>udev_enumerate_add_match_sysattr</function>, + <function>udev_enumerate_add_nomatch_sysattr</function>, + <function>udev_enumerate_add_match_property</function>, + <function>udev_enumerate_add_match_sysname</function>, + <function>udev_enumerate_add_match_tag</function>, + <function>udev_enumerate_add_match_parent</function> and + <function>udev_enumerate_add_match_is_initialized</function> + return an integer greater than, or equal to, + <constant>0</constant>.</para> + </refsect1> + + <refsect1> + <title>See Also</title> + + <para> + <citerefentry><refentrytitle>udev_new</refentrytitle><manvolnum>3</manvolnum></citerefentry>, + <citerefentry><refentrytitle>udev_device_new_from_syspath</refentrytitle><manvolnum>3</manvolnum></citerefentry>, + <citerefentry><refentrytitle>udev_enumerate_new</refentrytitle><manvolnum>3</manvolnum></citerefentry>, + <citerefentry><refentrytitle>udev_enumerate_scan_devices</refentrytitle><manvolnum>3</manvolnum></citerefentry>, + <citerefentry><refentrytitle>udev_monitor_new_from_netlink</refentrytitle><manvolnum>3</manvolnum></citerefentry>, + <citerefentry><refentrytitle>udev_list_entry</refentrytitle><manvolnum>3</manvolnum></citerefentry>, + <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>, + </para> + </refsect1> + +</refentry> diff --git a/man/udev_enumerate_new.xml b/man/udev_enumerate_new.xml new file mode 100644 index 0000000000..b5856c5577 --- /dev/null +++ b/man/udev_enumerate_new.xml @@ -0,0 +1,111 @@ +<?xml version='1.0'?> <!--*-nxml-*--> +<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN" + "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd" [ +<!ENTITY % entities SYSTEM "custom-entities.ent" > +%entities; +]> + +<!-- + This file is part of systemd. + + Copyright 2015 David Herrmann <dh.herrmann@gmail.com> + + 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. + + systemd is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with systemd; If not, see <http://www.gnu.org/licenses/>. +--> + +<refentry id="udev_enumerate_new" + xmlns:xi="http://www.w3.org/2001/XInclude"> + + <refentryinfo> + <title>udev_enumerate_new</title> + <productname>systemd</productname> + + <authorgroup> + <author> + <contrib>Developer</contrib> + <firstname>David</firstname> + <surname>Herrmann</surname> + <email>dh.herrmann@gmail.com</email> + </author> + </authorgroup> + </refentryinfo> + + <refmeta> + <refentrytitle>udev_enumerate_new</refentrytitle> + <manvolnum>3</manvolnum> + </refmeta> + + <refnamediv> + <refname>udev_enumerate_new</refname> + <refname>udev_enumerate_ref</refname> + <refname>udev_enumerate_unref</refname> + + <refpurpose>Create, acquire and release a udev enumerate object</refpurpose> + </refnamediv> + + <refsynopsisdiv> + <funcsynopsis> + <funcsynopsisinfo>#include <libudev.h></funcsynopsisinfo> + + <funcprototype> + <funcdef>struct udev_enumerate *<function>udev_enumerate_new</function></funcdef> + <paramdef>struct udev *<parameter>udev</parameter></paramdef> + </funcprototype> + + <funcprototype> + <funcdef>struct udev_enumerate *<function>udev_enumerate_ref</function></funcdef> + <paramdef>struct udev_enumerate *<parameter>udev_enumerate</parameter></paramdef> + </funcprototype> + + <funcprototype> + <funcdef>struct udev_enumerate *<function>udev_enumerate_unref</function></funcdef> + <paramdef>struct udev_enumerate *<parameter>udev_enumerate</parameter></paramdef> + </funcprototype> + + </funcsynopsis> + </refsynopsisdiv> + + <!--<refsect1> + <title>Description</title> + + <para>XXX: Add short description.</para> + </refsect1>--> + + <refsect1> + <title>Return Value</title> + + <para>On success, <function>udev_enumerate_new()</function> returns a + pointer to the allocated udev monitor. On failure, + <constant>NULL</constant> is returned. + <function>udev_enumerate_ref()</function> returns the argument + that it was passed, unmodified. + <function>udev_enumerate_unref()</function> always returns + <constant>NULL</constant>.</para> + </refsect1> + + <refsect1> + <title>See Also</title> + + <para> + <citerefentry><refentrytitle>udev_new</refentrytitle><manvolnum>3</manvolnum></citerefentry>, + <citerefentry><refentrytitle>udev_device_new_from_syspath</refentrytitle><manvolnum>3</manvolnum></citerefentry>, + <citerefentry><refentrytitle>udev_enumerate_add_match_subsystem</refentrytitle><manvolnum>3</manvolnum></citerefentry>, + <citerefentry><refentrytitle>udev_enumerate_scan_devices</refentrytitle><manvolnum>3</manvolnum></citerefentry>, + <citerefentry><refentrytitle>udev_monitor_new_from_netlink</refentrytitle><manvolnum>3</manvolnum></citerefentry>, + <citerefentry><refentrytitle>udev_list_entry</refentrytitle><manvolnum>3</manvolnum></citerefentry>, + <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>, + </para> + </refsect1> + +</refentry> diff --git a/man/udev_enumerate_scan_devices.xml b/man/udev_enumerate_scan_devices.xml new file mode 100644 index 0000000000..73566f5089 --- /dev/null +++ b/man/udev_enumerate_scan_devices.xml @@ -0,0 +1,133 @@ +<?xml version='1.0'?> <!--*-nxml-*--> +<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN" + "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd" [ +<!ENTITY % entities SYSTEM "custom-entities.ent" > +%entities; +]> + +<!-- + This file is part of systemd. + + Copyright 2015 David Herrmann <dh.herrmann@gmail.com> + + 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. + + systemd is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with systemd; If not, see <http://www.gnu.org/licenses/>. +--> + +<refentry id="udev_enumerate_scan_devices" + xmlns:xi="http://www.w3.org/2001/XInclude"> + + <refentryinfo> + <title>udev_enumerate_scan_devices</title> + <productname>systemd</productname> + + <authorgroup> + <author> + <contrib>Developer</contrib> + <firstname>David</firstname> + <surname>Herrmann</surname> + <email>dh.herrmann@gmail.com</email> + </author> + </authorgroup> + </refentryinfo> + + <refmeta> + <refentrytitle>udev_enumerate_scan_devices</refentrytitle> + <manvolnum>3</manvolnum> + </refmeta> + + <refnamediv> + <refname>udev_enumerate_scan_devices</refname> + <refname>udev_enumerate_scan_subsystems</refname> + <refname>udev_enumerate_get_list_entry</refname> + <refname>udev_enumerate_add_syspath</refname> + <refname>udev_enumerate_get_udev</refname> + + <refpurpose>Query or modify a udev enumerate object</refpurpose> + </refnamediv> + + <refsynopsisdiv> + <funcsynopsis> + <funcsynopsisinfo>#include <libudev.h></funcsynopsisinfo> + + <funcprototype> + <funcdef>int <function>udev_enumerate_scan_devices</function></funcdef> + <paramdef>struct udev_enumerate *<parameter>udev_enumerate</parameter></paramdef> + </funcprototype> + + <funcprototype> + <funcdef>int <function>udev_enumerate_scan_subsystems</function></funcdef> + <paramdef>struct udev_enumerate *<parameter>udev_enumerate</parameter></paramdef> + </funcprototype> + + <funcprototype> + <funcdef>struct udev_list_entry *<function>udev_enumerate_get_list_entry</function></funcdef> + <paramdef>struct udev_enumerate *<parameter>udev_enumerate</parameter></paramdef> + </funcprototype> + + <funcprototype> + <funcdef>int <function>udev_enumerate_add_syspath</function></funcdef> + <paramdef>struct udev_enumerate *<parameter>udev_enumerate</parameter></paramdef> + <paramdef>const char *<parameter>syspath</parameter></paramdef> + </funcprototype> + + <funcprototype> + <funcdef>struct udev *<function>udev_enumerate_get_udev</function></funcdef> + <paramdef>struct udev_enumerate *<parameter>udev_enumerate</parameter></paramdef> + </funcprototype> + + </funcsynopsis> + </refsynopsisdiv> + + <!--<refsect1> + <title>Description</title> + + <para>XXX: Add short description.</para> + </refsect1>--> + + <refsect1> + <title>Return Value</title> + + <para>On success, + <function>udev_enumerate_scan_devices()</function>, + <function>udev_enumerate_scan_subsystems()</function> and + <function>udev_enumerate_add_syspath()</function> + return an integer greater than, or equal to, + <constant>0</constant>.</para> + + <para>On success, + <function>udev_enumerate_get_list_entry()</function> + returns a pointer to the first entry in the list of found + devices. If the list is empty, or on failure, + <constant>NULL</constant> is returned.</para> + + <para><function>udev_enumerate_get_udev()</function> always + returns a pointer to the udev context that this enumerate + object is associated with.</para> + </refsect1> + + <refsect1> + <title>See Also</title> + + <para> + <citerefentry><refentrytitle>udev_new</refentrytitle><manvolnum>3</manvolnum></citerefentry>, + <citerefentry><refentrytitle>udev_device_new_from_syspath</refentrytitle><manvolnum>3</manvolnum></citerefentry>, + <citerefentry><refentrytitle>udev_enumerate_new</refentrytitle><manvolnum>3</manvolnum></citerefentry>, + <citerefentry><refentrytitle>udev_enumerate_add_match_subsystem</refentrytitle><manvolnum>3</manvolnum></citerefentry>, + <citerefentry><refentrytitle>udev_monitor_new_from_netlink</refentrytitle><manvolnum>3</manvolnum></citerefentry>, + <citerefentry><refentrytitle>udev_list_entry</refentrytitle><manvolnum>3</manvolnum></citerefentry>, + <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>, + </para> + </refsect1> + +</refentry> diff --git a/man/udev_list_entry.xml b/man/udev_list_entry.xml new file mode 100644 index 0000000000..6e033bdc81 --- /dev/null +++ b/man/udev_list_entry.xml @@ -0,0 +1,123 @@ +<?xml version='1.0'?> <!--*-nxml-*--> +<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN" + "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd" [ +<!ENTITY % entities SYSTEM "custom-entities.ent" > +%entities; +]> + +<!-- + This file is part of systemd. + + Copyright 2015 David Herrmann <dh.herrmann@gmail.com> + + 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. + + systemd is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with systemd; If not, see <http://www.gnu.org/licenses/>. +--> + +<refentry id="udev_list_entry" + xmlns:xi="http://www.w3.org/2001/XInclude"> + + <refentryinfo> + <title>udev_list_entry</title> + <productname>systemd</productname> + + <authorgroup> + <author> + <contrib>Developer</contrib> + <firstname>David</firstname> + <surname>Herrmann</surname> + <email>dh.herrmann@gmail.com</email> + </author> + </authorgroup> + </refentryinfo> + + <refmeta> + <refentrytitle>udev_list_entry</refentrytitle> + <manvolnum>3</manvolnum> + </refmeta> + + <refnamediv> + <refname>udev_list_entry</refname> + <refname>udev_list_entry_get_next</refname> + <refname>udev_list_entry_get_by_name</refname> + <refname>udev_list_entry_get_name</refname> + <refname>udev_list_entry_get_value</refname> + + <refpurpose>Iterate and access udev lists</refpurpose> + </refnamediv> + + <refsynopsisdiv> + <funcsynopsis> + <funcsynopsisinfo>#include <libudev.h></funcsynopsisinfo> + + <funcprototype> + <funcdef>struct udev_list_entry *<function>udev_list_entry_get_next</function></funcdef> + <paramdef>struct udev_list_entry *<parameter>list_entry</parameter></paramdef> + </funcprototype> + + <funcprototype> + <funcdef>struct udev_list_entry *<function>udev_list_entry_get_by_name</function></funcdef> + <paramdef>struct udev_list_entry *<parameter>list_entry</parameter></paramdef> + <paramdef>const char *<parameter>name</parameter></paramdef> + </funcprototype> + + <funcprototype> + <funcdef>const char *<function>udev_list_entry_get_name</function></funcdef> + <paramdef>struct udev_list_entry *<parameter>list_entry</parameter></paramdef> + </funcprototype> + + <funcprototype> + <funcdef>const char *<function>udev_list_entry_get_value</function></funcdef> + <paramdef>struct udev_list_entry *<parameter>list_entry</parameter></paramdef> + </funcprototype> + + </funcsynopsis> + </refsynopsisdiv> + + <!--<refsect1> + <title>Description</title> + + <para>XXX: Add short description.</para> + </refsect1>--> + + <refsect1> + <title>Return Value</title> + + <para>On success, + <function>udev_list_entry_get_next()</function> and + <function>udev_list_entry_get_by_name()</function> return + a pointer to the requested list entry. If no such entry can + be found, or on failure, <constant>NULL</constant> is + returned.</para> + + <para>On success, + <function>udev_list_entry_get_name()</function> and + <function>udev_list_entry_get_value()</function> return a + pointer to a constant string representing the requested value. + The string is bound to the lifetime of the list-entry itself. + On failure, <constant>NULL</constant> is returned.</para> + </refsect1> + + <refsect1> + <title>See Also</title> + + <para> + <citerefentry><refentrytitle>udev_new</refentrytitle><manvolnum>3</manvolnum></citerefentry>, + <citerefentry><refentrytitle>udev_device_new_from_syspath</refentrytitle><manvolnum>3</manvolnum></citerefentry>, + <citerefentry><refentrytitle>udev_enumerate_new</refentrytitle><manvolnum>3</manvolnum></citerefentry>, + <citerefentry><refentrytitle>udev_monitor_new_from_netlink</refentrytitle><manvolnum>3</manvolnum></citerefentry>, + <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>, + </para> + </refsect1> + +</refentry> diff --git a/man/udev_monitor_filter_update.xml b/man/udev_monitor_filter_update.xml new file mode 100644 index 0000000000..f129595618 --- /dev/null +++ b/man/udev_monitor_filter_update.xml @@ -0,0 +1,122 @@ +<?xml version='1.0'?> <!--*-nxml-*--> +<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN" + "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd" [ +<!ENTITY % entities SYSTEM "custom-entities.ent" > +%entities; +]> + +<!-- + This file is part of systemd. + + Copyright 2015 David Herrmann <dh.herrmann@gmail.com> + + 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. + + systemd is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with systemd; If not, see <http://www.gnu.org/licenses/>. +--> + +<refentry id="udev_monitor_filter_update" + xmlns:xi="http://www.w3.org/2001/XInclude"> + + <refentryinfo> + <title>udev_monitor_filter_update</title> + <productname>systemd</productname> + + <authorgroup> + <author> + <contrib>Developer</contrib> + <firstname>David</firstname> + <surname>Herrmann</surname> + <email>dh.herrmann@gmail.com</email> + </author> + </authorgroup> + </refentryinfo> + + <refmeta> + <refentrytitle>udev_monitor_filter_update</refentrytitle> + <manvolnum>3</manvolnum> + </refmeta> + + <refnamediv> + <refname>udev_monitor_filter_update</refname> + <refname>udev_monitor_filter_remove</refname> + <refname>udev_monitor_filter_add_match_subsystem_devtype</refname> + <refname>udev_monitor_filter_add_match_tag</refname> + + <refpurpose>Modify filters</refpurpose> + </refnamediv> + + <refsynopsisdiv> + <funcsynopsis> + <funcsynopsisinfo>#include <libudev.h></funcsynopsisinfo> + + <funcprototype> + <funcdef>int <function>udev_monitor_filter_update</function></funcdef> + <paramdef>struct udev_monitor *<parameter>udev_monitor</parameter></paramdef> + </funcprototype> + + <funcprototype> + <funcdef>int <function>udev_monitor_filter_remove</function></funcdef> + <paramdef>struct udev_monitor *<parameter>udev_monitor</parameter></paramdef> + </funcprototype> + + <funcprototype> + <funcdef>int <function>udev_monitor_filter_add_match_subsystem_devtype</function></funcdef> + <paramdef>struct udev_monitor *<parameter>udev_monitor</parameter></paramdef> + <paramdef>const char *<parameter>subsystem</parameter></paramdef> + <paramdef>const char *<parameter>devtype</parameter></paramdef> + </funcprototype> + + <funcprototype> + <funcdef>int <function>udev_monitor_filter_add_match_tag</function></funcdef> + <paramdef>struct udev_monitor *<parameter>udev_monitor</parameter></paramdef> + <paramdef>const char *<parameter>tag</parameter></paramdef> + </funcprototype> + + </funcsynopsis> + </refsynopsisdiv> + + <!--<refsect1> + <title>Description</title> + + <para>XXX: Add short description.</para> + </refsect1>--> + + <refsect1> + <title>Return Value</title> + + <para>On success, + <function>udev_monitor_filter_update()</function>, + <function>udev_monitor_filter_remove()</function>, + <function>udev_monitor_filter_add_match_subsystem_devtype()</function> + and + <function>udev_monitor_filter_add_match_tag()</function> + return an integer greater than, or equal to, + <constant>0</constant>. On failure, a negative error code is + returned.</para> + </refsect1> + + <refsect1> + <title>See Also</title> + + <para> + <citerefentry><refentrytitle>udev_new</refentrytitle><manvolnum>3</manvolnum></citerefentry>, + <citerefentry><refentrytitle>udev_device_new_from_syspath</refentrytitle><manvolnum>3</manvolnum></citerefentry>, + <citerefentry><refentrytitle>udev_enumerate_new</refentrytitle><manvolnum>3</manvolnum></citerefentry>, + <citerefentry><refentrytitle>udev_monitor_new_from_netlink</refentrytitle><manvolnum>3</manvolnum></citerefentry>, + <citerefentry><refentrytitle>udev_monitor_receive_device</refentrytitle><manvolnum>3</manvolnum></citerefentry>, + <citerefentry><refentrytitle>udev_list_entry</refentrytitle><manvolnum>3</manvolnum></citerefentry>, + <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>, + </para> + </refsect1> + +</refentry> diff --git a/man/udev_monitor_new_from_netlink.xml b/man/udev_monitor_new_from_netlink.xml new file mode 100644 index 0000000000..d73a4acaec --- /dev/null +++ b/man/udev_monitor_new_from_netlink.xml @@ -0,0 +1,113 @@ +<?xml version='1.0'?> <!--*-nxml-*--> +<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN" + "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd" [ +<!ENTITY % entities SYSTEM "custom-entities.ent" > +%entities; +]> + +<!-- + This file is part of systemd. + + Copyright 2015 David Herrmann <dh.herrmann@gmail.com> + + 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. + + systemd is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with systemd; If not, see <http://www.gnu.org/licenses/>. +--> + +<refentry id="udev_monitor_new_from_netlink" + xmlns:xi="http://www.w3.org/2001/XInclude"> + + <refentryinfo> + <title>udev_monitor_new_from_netlink</title> + <productname>systemd</productname> + + <authorgroup> + <author> + <contrib>Developer</contrib> + <firstname>David</firstname> + <surname>Herrmann</surname> + <email>dh.herrmann@gmail.com</email> + </author> + </authorgroup> + </refentryinfo> + + <refmeta> + <refentrytitle>udev_monitor_new_from_netlink</refentrytitle> + <manvolnum>3</manvolnum> + </refmeta> + + <refnamediv> + <refname>udev_monitor_new_from_netlink</refname> + <refname>udev_monitor_ref</refname> + <refname>udev_monitor_unref</refname> + + <refpurpose>Create, acquire and release a udev monitor object</refpurpose> + </refnamediv> + + <refsynopsisdiv> + <funcsynopsis> + <funcsynopsisinfo>#include <libudev.h></funcsynopsisinfo> + + <funcprototype> + <funcdef>struct udev_monitor *<function>udev_monitor_new_from_netlink</function></funcdef> + <paramdef>struct udev *<parameter>udev</parameter></paramdef> + <paramdef>const char *<parameter>name</parameter></paramdef> + </funcprototype> + + <funcprototype> + <funcdef>struct udev_monitor *<function>udev_monitor_ref</function></funcdef> + <paramdef>struct udev_monitor *<parameter>udev_monitor</parameter></paramdef> + </funcprototype> + + <funcprototype> + <funcdef>struct udev_monitor *<function>udev_monitor_unref</function></funcdef> + <paramdef>struct udev_monitor *<parameter>udev_monitor</parameter></paramdef> + </funcprototype> + + </funcsynopsis> + </refsynopsisdiv> + + <!--<refsect1> + <title>Description</title> + + <para>XXX: Add short description.</para> + </refsect1>--> + + <refsect1> + <title>Return Value</title> + + <para>On success, + <function>udev_monitor_new_from_netlink()</function> returns a + pointer to the allocated udev monitor. On failure, + <constant>NULL</constant> is returned. + <function>udev_monitor_ref()</function> returns the argument + that it was passed, unmodified. + <function>udev_monitor_unref()</function> always returns + <constant>NULL</constant>.</para> + </refsect1> + + <refsect1> + <title>See Also</title> + + <para> + <citerefentry><refentrytitle>udev_new</refentrytitle><manvolnum>3</manvolnum></citerefentry>, + <citerefentry><refentrytitle>udev_device_new_from_syspath</refentrytitle><manvolnum>3</manvolnum></citerefentry>, + <citerefentry><refentrytitle>udev_enumerate_new</refentrytitle><manvolnum>3</manvolnum></citerefentry>, + <citerefentry><refentrytitle>udev_monitor_filter_update</refentrytitle><manvolnum>3</manvolnum></citerefentry>, + <citerefentry><refentrytitle>udev_monitor_receive_device</refentrytitle><manvolnum>3</manvolnum></citerefentry>, + <citerefentry><refentrytitle>udev_list_entry</refentrytitle><manvolnum>3</manvolnum></citerefentry>, + <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>, + </para> + </refsect1> + +</refentry> diff --git a/man/udev_monitor_receive_device.xml b/man/udev_monitor_receive_device.xml new file mode 100644 index 0000000000..7e842f88df --- /dev/null +++ b/man/udev_monitor_receive_device.xml @@ -0,0 +1,137 @@ +<?xml version='1.0'?> <!--*-nxml-*--> +<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN" + "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd" [ +<!ENTITY % entities SYSTEM "custom-entities.ent" > +%entities; +]> + +<!-- + This file is part of systemd. + + Copyright 2015 David Herrmann <dh.herrmann@gmail.com> + + 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. + + systemd is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with systemd; If not, see <http://www.gnu.org/licenses/>. +--> + +<refentry id="udev_monitor_receive_device" + xmlns:xi="http://www.w3.org/2001/XInclude"> + + <refentryinfo> + <title>udev_monitor_receive_device</title> + <productname>systemd</productname> + + <authorgroup> + <author> + <contrib>Developer</contrib> + <firstname>David</firstname> + <surname>Herrmann</surname> + <email>dh.herrmann@gmail.com</email> + </author> + </authorgroup> + </refentryinfo> + + <refmeta> + <refentrytitle>udev_monitor_receive_device</refentrytitle> + <manvolnum>3</manvolnum> + </refmeta> + + <refnamediv> + <refname>udev_monitor_receive_device</refname> + <refname>udev_monitor_enable_receiving</refname> + <refname>udev_monitor_set_receive_buffer_size</refname> + <refname>udev_monitor_get_fd</refname> + <refname>udev_monitor_get_udev</refname> + + <refpurpose>Query and modify device monitor</refpurpose> + </refnamediv> + + <refsynopsisdiv> + <funcsynopsis> + <funcsynopsisinfo>#include <libudev.h></funcsynopsisinfo> + + <funcprototype> + <funcdef>struct udev_device *<function>udev_monitor_receive_device</function></funcdef> + <paramdef>struct udev_monitor *<parameter>udev_monitor</parameter></paramdef> + </funcprototype> + + <funcprototype> + <funcdef>int <function>udev_monitor_enable_receiving</function></funcdef> + <paramdef>struct udev_monitor *<parameter>udev_monitor</parameter></paramdef> + </funcprototype> + + <funcprototype> + <funcdef>int <function>udev_monitor_set_receive_buffer_size</function></funcdef> + <paramdef>struct udev_monitor *<parameter>udev_monitor</parameter></paramdef> + <paramdef>int <parameter>size</parameter></paramdef> + </funcprototype> + + <funcprototype> + <funcdef>int <function>udev_monitor_get_fd</function></funcdef> + <paramdef>struct udev_monitor *<parameter>udev_monitor</parameter></paramdef> + </funcprototype> + + <funcprototype> + <funcdef>struct udev *<function>udev_monitor_get_udev</function></funcdef> + <paramdef>struct udev_monitor *<parameter>udev_monitor</parameter></paramdef> + </funcprototype> + + </funcsynopsis> + </refsynopsisdiv> + + <!--<refsect1> + <title>Description</title> + + <para>XXX: Add short description.</para> + </refsect1>--> + + <refsect1> + <title>Return Value</title> + + <para>On success, + <function>udev_monitor_receive_device()</function> returns a + pointer to a newly referenced device that was received via the + monitor. The caller is responsible to drop this reference when + done. On failure, <constant>NULL</constant> is returned.</para> + + <para>On success, + <function>udev_monitor_enable_receiving()</function> and + <function>udev_monitor_set_receive_buffer_size()</function> + return an integer greater than, or equal to, + <constant>0</constant>. On failure, a negative error code is + returned.</para> + + <para>On success, <function>udev_monitor_get_fd()</function> + returns the file descriptor used by this monitor. On failure, + a negative error code is returned.</para> + + <para><function>udev_monitor_get_udev()</function> always returns + a pointer to the udev context that this monitor is associated + with.</para> + </refsect1> + + <refsect1> + <title>See Also</title> + + <para> + <citerefentry><refentrytitle>udev_new</refentrytitle><manvolnum>3</manvolnum></citerefentry>, + <citerefentry><refentrytitle>udev_device_new_from_syspath</refentrytitle><manvolnum>3</manvolnum></citerefentry>, + <citerefentry><refentrytitle>udev_enumerate_new</refentrytitle><manvolnum>3</manvolnum></citerefentry>, + <citerefentry><refentrytitle>udev_monitor_new_from_netlink</refentrytitle><manvolnum>3</manvolnum></citerefentry>, + <citerefentry><refentrytitle>udev_monitor_filter_update</refentrytitle><manvolnum>3</manvolnum></citerefentry>, + <citerefentry><refentrytitle>udev_list_entry</refentrytitle><manvolnum>3</manvolnum></citerefentry>, + <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>, + </para> + </refsect1> + +</refentry> diff --git a/man/udev_new.xml b/man/udev_new.xml new file mode 100644 index 0000000000..587835a3ca --- /dev/null +++ b/man/udev_new.xml @@ -0,0 +1,110 @@ +<?xml version='1.0'?> <!--*-nxml-*--> +<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN" + "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd" [ +<!ENTITY % entities SYSTEM "custom-entities.ent" > +%entities; +]> + +<!-- + This file is part of systemd. + + Copyright 2015 David Herrmann <dh.herrmann@gmail.com> + + 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. + + systemd is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with systemd; If not, see <http://www.gnu.org/licenses/>. +--> + +<refentry id="udev_new" + xmlns:xi="http://www.w3.org/2001/XInclude"> + + <refentryinfo> + <title>udev_new</title> + <productname>systemd</productname> + + <authorgroup> + <author> + <contrib>Developer</contrib> + <firstname>David</firstname> + <surname>Herrmann</surname> + <email>dh.herrmann@gmail.com</email> + </author> + </authorgroup> + </refentryinfo> + + <refmeta> + <refentrytitle>udev_new</refentrytitle> + <manvolnum>3</manvolnum> + </refmeta> + + <refnamediv> + <refname>udev_new</refname> + <refname>udev_ref</refname> + <refname>udev_unref</refname> + + <refpurpose>Create, acquire and release a udev context object</refpurpose> + </refnamediv> + + <refsynopsisdiv> + <funcsynopsis> + <funcsynopsisinfo>#include <libudev.h></funcsynopsisinfo> + + <funcprototype> + <funcdef>struct udev *<function>udev_new</function></funcdef> + <paramdef><parameter>void</parameter></paramdef> + </funcprototype> + + <funcprototype> + <funcdef>struct udev *<function>udev_ref</function></funcdef> + <paramdef>struct udev *<parameter>udev</parameter></paramdef> + </funcprototype> + + <funcprototype> + <funcdef>struct udev *<function>udev_unref</function></funcdef> + <paramdef>struct udev *<parameter>udev</parameter></paramdef> + </funcprototype> + + </funcsynopsis> + </refsynopsisdiv> + + <refsect1> + <title>Description</title> + + <para><function>udev_new()</function> allocates a new udev context + object and returns a pointer to it. This object is opaque and must + not be accessed by the caller via different means than functions + provided by libudev. Initially, the reference count of the context + is 1. You can acquire further references, and drop gained references + via <function>udev_ref()</function> and + <function>udev_unref()</function>. Once the reference count hits 0, + the context object is destroyed and freed.</para> + </refsect1> + + <refsect1> + <title>Return Value</title> + + <para>On success, <function>udev_new()</function> returns a pointer + to the allocated udev context. On failure, <constant>NULL</constant> + is returned. <function>udev_ref()</function> returns the argument + that it was passed, unmodified. <function>udev_unref()</function> + always returns <constant>NULL</constant>.</para> + </refsect1> + + <refsect1> + <title>See Also</title> + + <para> + <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>, + </para> + </refsect1> + +</refentry> diff --git a/src/basic/def.h b/src/basic/def.h index 011c7c667e..5aaba1fe87 100644 --- a/src/basic/def.h +++ b/src/basic/def.h @@ -63,13 +63,7 @@ #define UNIX_SYSTEM_BUS_ADDRESS "unix:path=/var/run/dbus/system_bus_socket" #define KERNEL_SYSTEM_BUS_ADDRESS "kernel:path=/sys/fs/kdbus/0-system/bus" - -#ifdef ENABLE_KDBUS -# define DEFAULT_SYSTEM_BUS_ADDRESS KERNEL_SYSTEM_BUS_ADDRESS ";" UNIX_SYSTEM_BUS_ADDRESS -#else -# define DEFAULT_SYSTEM_BUS_ADDRESS UNIX_SYSTEM_BUS_ADDRESS -#endif - +#define DEFAULT_SYSTEM_BUS_ADDRESS KERNEL_SYSTEM_BUS_ADDRESS ";" UNIX_SYSTEM_BUS_ADDRESS #define UNIX_USER_BUS_ADDRESS_FMT "unix:path=%s/bus" #define KERNEL_USER_BUS_ADDRESS_FMT "kernel:path=/sys/fs/kdbus/"UID_FMT"-user/bus" diff --git a/src/basic/macro.h b/src/basic/macro.h index cc1c9e73c0..5fa17ed208 100644 --- a/src/basic/macro.h +++ b/src/basic/macro.h @@ -248,18 +248,19 @@ static inline unsigned long ALIGN_POWER2(unsigned long u) { REENABLE_WARNING #endif +#define assert_log(expr) ((_likely_(expr)) \ + ? (true) \ + : (log_assert_failed_return(#expr, __FILE__, __LINE__, __PRETTY_FUNCTION__), false)) + #define assert_return(expr, r) \ do { \ - if (_unlikely_(!(expr))) { \ - log_assert_failed_return(#expr, __FILE__, __LINE__, __PRETTY_FUNCTION__); \ + if (!assert_log(expr)) \ return (r); \ - } \ } while (false) #define assert_return_errno(expr, r, err) \ do { \ - if (_unlikely_(!(expr))) { \ - log_assert_failed_return(#expr, __FILE__, __LINE__, __PRETTY_FUNCTION__); \ + if (!assert_log(expr)) { \ errno = err; \ return (r); \ } \ diff --git a/src/basic/util.c b/src/basic/util.c index b7c70af541..727be56f58 100644 --- a/src/basic/util.c +++ b/src/basic/util.c @@ -60,8 +60,8 @@ #include <linux/fs.h> /* When we include libgen.h because we need dirname() we immediately - * undefine basename() since libgen.h defines it as a macro to the XDG - * version which is really broken. */ + * undefine basename() since libgen.h defines it as a macro to the POSIX + * version which is really broken. We prefer GNU basename(). */ #include <libgen.h> #undef basename @@ -5209,35 +5209,6 @@ int unquote_first_word(const char **p, char **ret, UnquoteFlags flags) { break; - case VALUE_ESCAPE: - if (c == 0) { - if (flags & UNQUOTE_RELAX) - goto finish; - return -EINVAL; - } - - if (!GREEDY_REALLOC(s, allocated, sz+7)) - return -ENOMEM; - - if (flags & UNQUOTE_CUNESCAPE) { - uint32_t u; - - r = cunescape_one(*p, (size_t) -1, &c, &u); - if (r < 0) - return -EINVAL; - - (*p) += r - 1; - - if (c != 0) - s[sz++] = c; /* normal explicit char */ - else - sz += utf8_encode_unichar(s + sz, u); /* unicode chars we'll encode as utf8 */ - } else - s[sz++] = c; - - state = VALUE; - break; - case SINGLE_QUOTE: if (c == 0) { if (flags & UNQUOTE_RELAX) @@ -5256,35 +5227,6 @@ int unquote_first_word(const char **p, char **ret, UnquoteFlags flags) { break; - case SINGLE_QUOTE_ESCAPE: - if (c == 0) { - if (flags & UNQUOTE_RELAX) - goto finish; - return -EINVAL; - } - - if (!GREEDY_REALLOC(s, allocated, sz+7)) - return -ENOMEM; - - if (flags & UNQUOTE_CUNESCAPE) { - uint32_t u; - - r = cunescape_one(*p, (size_t) -1, &c, &u); - if (r < 0) - return -EINVAL; - - (*p) += r - 1; - - if (c != 0) - s[sz++] = c; - else - sz += utf8_encode_unichar(s + sz, u); - } else - s[sz++] = c; - - state = SINGLE_QUOTE; - break; - case DOUBLE_QUOTE: if (c == 0) return -EINVAL; @@ -5301,33 +5243,56 @@ int unquote_first_word(const char **p, char **ret, UnquoteFlags flags) { break; + case SINGLE_QUOTE_ESCAPE: case DOUBLE_QUOTE_ESCAPE: + case VALUE_ESCAPE: + if (!GREEDY_REALLOC(s, allocated, sz+7)) + return -ENOMEM; + if (c == 0) { + if ((flags & UNQUOTE_CUNESCAPE_RELAX) && + (state == VALUE_ESCAPE || flags & UNQUOTE_RELAX)) { + /* If we find an unquoted trailing backslash and we're in + * UNQUOTE_CUNESCAPE_RELAX mode, keep it verbatim in the + * output. + * + * Unbalanced quotes will only be allowed in UNQUOTE_RELAX + * mode, UNQUOTE_CUNESCAP_RELAX mode does not allow them. + */ + s[sz++] = '\\'; + goto finish; + } if (flags & UNQUOTE_RELAX) goto finish; return -EINVAL; } - if (!GREEDY_REALLOC(s, allocated, sz+7)) - return -ENOMEM; - if (flags & UNQUOTE_CUNESCAPE) { uint32_t u; r = cunescape_one(*p, (size_t) -1, &c, &u); - if (r < 0) + if (r < 0) { + if (flags & UNQUOTE_CUNESCAPE_RELAX) { + s[sz++] = '\\'; + s[sz++] = c; + goto end_escape; + } return -EINVAL; + } (*p) += r - 1; if (c != 0) - s[sz++] = c; + s[sz++] = c; /* normal explicit char */ else - sz += utf8_encode_unichar(s + sz, u); + sz += utf8_encode_unichar(s + sz, u); /* unicode chars we'll encode as utf8 */ } else s[sz++] = c; - state = DOUBLE_QUOTE; +end_escape: + state = (state == SINGLE_QUOTE_ESCAPE) ? SINGLE_QUOTE : + (state == DOUBLE_QUOTE_ESCAPE) ? DOUBLE_QUOTE : + VALUE; break; case SPACE: @@ -5355,6 +5320,36 @@ finish: return 1; } +int unquote_first_word_and_warn( + const char **p, + char **ret, + UnquoteFlags flags, + const char *unit, + const char *filename, + unsigned line, + const char *rvalue) { + /* Try to unquote it, if it fails, warn about it and try again but this + * time using UNQUOTE_CUNESCAPE_RELAX to keep the backslashes verbatim + * in invalid escape sequences. */ + const char *save; + int r; + + save = *p; + r = unquote_first_word(p, ret, flags); + if (r < 0 && !(flags&UNQUOTE_CUNESCAPE_RELAX)) { + /* Retry it with UNQUOTE_CUNESCAPE_RELAX. */ + *p = save; + r = unquote_first_word(p, ret, flags|UNQUOTE_CUNESCAPE_RELAX); + if (r < 0) + log_syntax(unit, LOG_ERR, filename, line, EINVAL, + "Unbalanced quoting in command line, ignoring: \"%s\"", rvalue); + else + log_syntax(unit, LOG_WARNING, filename, line, EINVAL, + "Invalid escape sequences in command line: \"%s\"", rvalue); + } + return r; +} + int unquote_many_words(const char **p, UnquoteFlags flags, ...) { va_list ap; char **l; diff --git a/src/basic/util.h b/src/basic/util.h index 7aca46d777..a1d1dd15c3 100644 --- a/src/basic/util.h +++ b/src/basic/util.h @@ -839,11 +839,13 @@ int is_dir(const char *path, bool follow); int is_device_node(const char *path); typedef enum UnquoteFlags { - UNQUOTE_RELAX = 1, - UNQUOTE_CUNESCAPE = 2, + UNQUOTE_RELAX = 1, + UNQUOTE_CUNESCAPE = 2, + UNQUOTE_CUNESCAPE_RELAX = 4, } UnquoteFlags; int unquote_first_word(const char **p, char **ret, UnquoteFlags flags); +int unquote_first_word_and_warn(const char **p, char **ret, UnquoteFlags flags, const char *unit, const char *filename, unsigned line, const char *rvalue); int unquote_many_words(const char **p, UnquoteFlags flags, ...) _sentinel_; int free_and_strdup(char **p, const char *s); diff --git a/src/bus-proxyd/bus-proxyd.c b/src/bus-proxyd/bus-proxyd.c index 3e398b53e9..3cc3b33ae7 100644 --- a/src/bus-proxyd/bus-proxyd.c +++ b/src/bus-proxyd/bus-proxyd.c @@ -239,11 +239,7 @@ static int parse_argv(int argc, char *argv[]) { if (!e) return log_oom(); -#ifdef ENABLE_KDBUS a = strjoin("x-machine-kernel:machine=", e, ";x-machine-unix:machine=", e, NULL); -#else - a = strjoin("x-machine-unix:machine=", e, NULL); -#endif if (!a) return log_oom(); diff --git a/src/bus-proxyd/stdio-bridge.c b/src/bus-proxyd/stdio-bridge.c index 61bc08ae33..f275f6705f 100644 --- a/src/bus-proxyd/stdio-bridge.c +++ b/src/bus-proxyd/stdio-bridge.c @@ -110,11 +110,7 @@ static int parse_argv(int argc, char *argv[]) { if (!e) return log_oom(); -#ifdef ENABLE_KDBUS a = strjoin("x-machine-kernel:machine=", e, ";x-machine-unix:machine=", e, NULL); -#else - a = strjoin("x-machine-unix:machine=", e, NULL); -#endif if (!a) return log_oom(); diff --git a/src/core/execute.c b/src/core/execute.c index 444865da86..94cc101738 100644 --- a/src/core/execute.c +++ b/src/core/execute.c @@ -771,7 +771,7 @@ static int setup_pam( }; pam_handle_t *handle = NULL; - sigset_t ss, old_ss; + sigset_t old_ss; int pam_code = PAM_SUCCESS; int err; char **e = NULL; @@ -868,6 +868,11 @@ static int setup_pam( /* Check if our parent process might already have * died? */ if (getppid() == parent_pid) { + sigset_t ss; + + assert_se(sigemptyset(&ss) >= 0); + assert_se(sigaddset(&ss, SIGTERM) >= 0); + for (;;) { if (sigwait(&ss, &sig) < 0) { if (errno == EINTR) @@ -1509,7 +1514,6 @@ static int exec_child( } } -#ifdef ENABLE_KDBUS if (params->bus_endpoint_fd >= 0 && context->bus_endpoint) { uid_t ep_uid = (uid == UID_INVALID) ? 0 : uid; @@ -1519,7 +1523,6 @@ static int exec_child( return r; } } -#endif /* If delegation is enabled we'll pass ownership of the cgroup * (but only in systemd's own controller hierarchy!) to the diff --git a/src/core/kmod-setup.c b/src/core/kmod-setup.c index f5584b6b14..e7a6bdc8c4 100644 --- a/src/core/kmod-setup.c +++ b/src/core/kmod-setup.c @@ -66,10 +66,8 @@ int kmod_setup(void) { /* this should never be a module */ { "unix", "/proc/net/unix", true, true, NULL }, -#ifdef ENABLE_KDBUS /* IPC is needed before we bring up any other services */ { "kdbus", "/sys/fs/kdbus", false, false, is_kdbus_wanted }, -#endif #ifdef HAVE_LIBIPTC /* netfilter is needed by networkd, nspawn among others, and cannot be autoloaded */ diff --git a/src/core/load-fragment-gperf.gperf.m4 b/src/core/load-fragment-gperf.gperf.m4 index 66c9145aa6..aae81c80cb 100644 --- a/src/core/load-fragment-gperf.gperf.m4 +++ b/src/core/load-fragment-gperf.gperf.m4 @@ -229,9 +229,7 @@ Service.BusName, config_parse_bus_name, 0, Service.FileDescriptorStoreMax, config_parse_unsigned, 0, offsetof(Service, n_fd_store_max) Service.NotifyAccess, config_parse_notify_access, 0, offsetof(Service, notify_access) Service.Sockets, config_parse_service_sockets, 0, 0 -m4_ifdef(`ENABLE_KDBUS', -`Service.BusPolicy, config_parse_bus_endpoint_policy, 0, offsetof(Service, exec_context)', -`Service.BusPolicy, config_parse_warn_compat, DISABLED_EXPERIMENTAL, 0') +Service.BusPolicy, config_parse_bus_endpoint_policy, 0, offsetof(Service, exec_context) EXEC_CONTEXT_CONFIG_ITEMS(Service)m4_dnl CGROUP_CONTEXT_CONFIG_ITEMS(Service)m4_dnl KILL_CONTEXT_CONFIG_ITEMS(Service)m4_dnl diff --git a/src/core/load-fragment.c b/src/core/load-fragment.c index df5fe6fb32..a48cb4029a 100644 --- a/src/core/load-fragment.c +++ b/src/core/load-fragment.c @@ -520,9 +520,9 @@ int config_parse_exec( void *data, void *userdata) { - ExecCommand **e = data, *nce; - char *path, **n; - unsigned k; + ExecCommand **e = data; + const char *p; + bool semicolon; int r; assert(filename); @@ -532,156 +532,154 @@ int config_parse_exec( e += ltype; + rvalue += strspn(rvalue, WHITESPACE); + p = rvalue; + if (isempty(rvalue)) { /* An empty assignment resets the list */ *e = exec_command_free_list(*e); return 0; } - /* We accept an absolute path as first argument, or - * alternatively an absolute prefixed with @ to allow - * overriding of argv[0]. */ - for (;;) { + do { int i; - const char *word, *state, *reason; - size_t l; + _cleanup_strv_free_ char **n = NULL; + size_t nlen = 0, nbufsize = 0; + _cleanup_free_ ExecCommand *nce = NULL; + _cleanup_free_ char *path = NULL, *firstword = NULL; + char *f; bool separate_argv0 = false, ignore = false; - path = NULL; - nce = NULL; - n = NULL; + semicolon = false; - rvalue += strspn(rvalue, WHITESPACE); + r = unquote_first_word_and_warn(&p, &firstword, UNQUOTE_CUNESCAPE, unit, filename, line, rvalue); + if (r <= 0) + return 0; - if (rvalue[0] == 0) - break; + f = firstword; + for (i = 0; i < 2; i++) { + /* We accept an absolute path as first argument, or + * alternatively an absolute prefixed with @ to allow + * overriding of argv[0]. */ + if (*f == '-' && !ignore) + ignore = true; + else if (*f == '@' && !separate_argv0) + separate_argv0 = true; + else + break; + f ++; + } - k = 0; - FOREACH_WORD_QUOTED(word, l, rvalue, state) { - if (k == 0) { - for (i = 0; i < 2; i++) { - if (*word == '-' && !ignore) { - ignore = true; - word ++; - } - - if (*word == '@' && !separate_argv0) { - separate_argv0 = true; - word ++; - } - } - } else if (strneq(word, ";", MAX(l, 1U))) - goto found; + if (isempty(f)) { + /* First word is either "-" or "@" with no command. */ + log_syntax(unit, LOG_ERR, filename, line, EINVAL, + "Empty path in command line, ignoring: \"%s\"", rvalue); + return 0; + } - k++; + if (!string_is_safe(f)) { + log_syntax(unit, LOG_ERR, filename, line, EINVAL, + "Executable path contains special characters, ignoring: %s", rvalue); + return 0; } - if (!isempty(state)) { - log_syntax(unit, LOG_ERR, filename, line, EINVAL, "Trailing garbage, ignoring."); + if (!path_is_absolute(f)) { + log_syntax(unit, LOG_ERR, filename, line, EINVAL, + "Executable path is not absolute, ignoring: %s", rvalue); + return 0; + } + if (endswith(f, "/")) { + log_syntax(unit, LOG_ERR, filename, line, EINVAL, + "Executable path specifies a directory, ignoring: %s", rvalue); return 0; } - found: - /* If separate_argv0, we'll move first element to path variable */ - n = new(char*, MAX(k + !separate_argv0, 1u)); - if (!n) - return log_oom(); + if (f == firstword) { + path = firstword; + firstword = NULL; + } else { + path = strdup(f); + if (!path) + return log_oom(); + } - k = 0; - FOREACH_WORD_QUOTED(word, l, rvalue, state) { - char *c; - unsigned skip; - - if (separate_argv0 ? path == NULL : k == 0) { - /* first word, very special */ - skip = separate_argv0 + ignore; - - /* skip special chars in the beginning */ - if (l <= skip) { - log_syntax(unit, LOG_ERR, filename, line, EINVAL, - "Empty path in command line, ignoring: \"%s\"", rvalue); - r = 0; - goto fail; - } + if (!separate_argv0) { + if (!GREEDY_REALLOC(n, nbufsize, nlen + 2)) + return log_oom(); + f = strdup(path); + if (!f) + return log_oom(); + n[nlen++] = f; + n[nlen] = NULL; + } - } else if (strneq(word, ";", MAX(l, 1U))) - /* new commandline */ - break; + path_kill_slashes(path); - else - skip = strneq(word, "\\;", MAX(l, 1U)); + for (;;) { + _cleanup_free_ char *word = NULL; - r = cunescape_length(word + skip, l - skip, UNESCAPE_RELAX, &c); - if (r < 0) { - log_syntax(unit, LOG_ERR, filename, line, r, "Failed to unescape command line, ignoring: %s", rvalue); - r = 0; - goto fail; + /* Check explicitly for an unquoted semicolon as + * command separator token. */ + if (p[0] == ';' && (!p[1] || strchr(WHITESPACE, p[1]))) { + p ++; + p += strspn(p, WHITESPACE); + semicolon = true; + break; } - if (!utf8_is_valid(c)) { - log_invalid_utf8(unit, LOG_ERR, filename, line, EINVAL, rvalue); - r = 0; - goto fail; + /* Check for \; explicitly, to not confuse it with \\; + * or "\;" or "\\;" etc. unquote_first_word would + * return the same for all of those. */ + if (p[0] == '\\' && p[1] == ';' && (!p[2] || strchr(WHITESPACE, p[2]))) { + p += 2; + p += strspn(p, WHITESPACE); + if (!GREEDY_REALLOC(n, nbufsize, nlen + 2)) + return log_oom(); + f = strdup(";"); + if (!f) + return log_oom(); + n[nlen++] = f; + n[nlen] = NULL; + continue; } - /* where to stuff this? */ - if (separate_argv0 && path == NULL) - path = c; - else - n[k++] = c; - } + r = unquote_first_word_and_warn(&p, &word, UNQUOTE_CUNESCAPE, unit, filename, line, rvalue); + if (r == 0) + break; + else if (r < 0) + return 0; - n[k] = NULL; + if (!GREEDY_REALLOC(n, nbufsize, nlen + 2)) + return log_oom(); + n[nlen++] = word; + n[nlen] = NULL; + word = NULL; + } - if (!n[0]) - reason = "Empty executable name or zeroeth argument"; - else if (!string_is_safe(path ?: n[0])) - reason = "Executable path contains special characters"; - else if (!path_is_absolute(path ?: n[0])) - reason = "Executable path is not absolute"; - else if (endswith(path ?: n[0], "/")) - reason = "Executable path specifies a directory"; - else - goto ok; - - log_syntax(unit, LOG_ERR, filename, line, EINVAL, "%s, ignoring: %s", reason, rvalue); - r = 0; - goto fail; - -ok: - if (!path) { - path = strdup(n[0]); - if (!path) { - r = log_oom(); - goto fail; - } + if (!n || !n[0]) { + log_syntax(unit, LOG_ERR, filename, line, EINVAL, + "Empty executable name or zeroeth argument, ignoring: %s", rvalue); + return 0; } nce = new0(ExecCommand, 1); - if (!nce) { - r = log_oom(); - goto fail; - } + if (!nce) + return log_oom(); nce->argv = n; nce->path = path; nce->ignore = ignore; - path_kill_slashes(nce->path); - exec_command_append_list(e, nce); - rvalue = state; - } - - return 0; + /* Do not _cleanup_free_ these. */ + n = NULL; + path = NULL; + nce = NULL; -fail: - n[k] = NULL; - strv_free(n); - free(path); - free(nce); + rvalue = p; + } while (semicolon); - return r; + return 0; } DEFINE_CONFIG_PARSE_ENUM(config_parse_service_type, service_type, ServiceType, "Failed to parse service type"); diff --git a/src/core/manager.c b/src/core/manager.c index eb80dd1b46..a1f37bbbb3 100644 --- a/src/core/manager.c +++ b/src/core/manager.c @@ -731,7 +731,6 @@ static int manager_setup_notify(Manager *m) { } static int manager_setup_kdbus(Manager *m) { -#ifdef ENABLE_KDBUS _cleanup_free_ char *p = NULL; assert(m); @@ -749,7 +748,6 @@ static int manager_setup_kdbus(Manager *m) { return log_debug_errno(m->kdbus_fd, "Failed to set up kdbus: %m"); log_debug("Successfully set up kdbus on %s", p); -#endif return 0; } diff --git a/src/core/mount-setup.c b/src/core/mount-setup.c index c35248eeae..42a6b952b9 100644 --- a/src/core/mount-setup.c +++ b/src/core/mount-setup.c @@ -104,10 +104,8 @@ static const MountPoint mount_table[] = { { "efivarfs", "/sys/firmware/efi/efivars", "efivarfs", NULL, MS_NOSUID|MS_NOEXEC|MS_NODEV, is_efi_boot, MNT_NONE }, #endif -#ifdef ENABLE_KDBUS { "kdbusfs", "/sys/fs/kdbus", "kdbusfs", NULL, MS_NOSUID|MS_NOEXEC|MS_NODEV, NULL, MNT_IN_CONTAINER }, -#endif }; /* These are API file systems that might be mounted by other software, diff --git a/src/core/service.c b/src/core/service.c index 71252e29e2..fa1e80b710 100644 --- a/src/core/service.c +++ b/src/core/service.c @@ -568,14 +568,12 @@ static int service_add_extras(Service *s) { s->notify_access = NOTIFY_MAIN; if (s->bus_name) { -#ifdef ENABLE_KDBUS const char *n; n = strjoina(s->bus_name, ".busname"); r = unit_add_dependency_by_name(UNIT(s), UNIT_AFTER, n, NULL, true); if (r < 0) return r; -#endif r = unit_watch_bus_name(UNIT(s), s->bus_name); if (r < 0) @@ -1180,7 +1178,6 @@ static int service_spawn( } else path = UNIT(s)->cgroup_path; -#ifdef ENABLE_KDBUS if (s->exec_context.bus_endpoint) { r = bus_kernel_create_endpoint(UNIT(s)->manager->running_as == MANAGER_SYSTEM ? "system" : "user", UNIT(s)->id, &bus_endpoint_path); @@ -1192,7 +1189,6 @@ static int service_spawn( * as the service is running. */ exec_params.bus_endpoint_fd = s->bus_endpoint_fd = r; } -#endif exec_params.argv = argv; exec_params.fds = fds; diff --git a/src/libsystemd-network/sd-dhcp-client.c b/src/libsystemd-network/sd-dhcp-client.c index 6853038b67..6a0d270739 100644 --- a/src/libsystemd-network/sd-dhcp-client.c +++ b/src/libsystemd-network/sd-dhcp-client.c @@ -928,6 +928,8 @@ static int client_initialize_time_events(sd_dhcp_client *client) { r = sd_event_source_set_priority(client->timeout_resend, client->event_priority); + if (r < 0) + goto error; r = sd_event_source_set_description(client->timeout_resend, "dhcp4-resend-timer"); if (r < 0) diff --git a/src/libsystemd/.gitignore b/src/libsystemd/.gitignore index d48e1cdd13..50a1692374 100644 --- a/src/libsystemd/.gitignore +++ b/src/libsystemd/.gitignore @@ -1,2 +1 @@ -/libsystemd.sym /libsystemd.pc diff --git a/src/libsystemd/libsystemd.sym.m4 b/src/libsystemd/libsystemd.sym index 3121e71282..809db1f6cc 100644 --- a/src/libsystemd/libsystemd.sym.m4 +++ b/src/libsystemd/libsystemd.sym @@ -459,41 +459,3 @@ global: sd_event_source_get_signal; sd_event_source_get_child_pid; } LIBSYSTEMD_220; - -m4_ifdef(`ENABLE_KDBUS', -LIBSYSTEMD_FUTURE { -global: - /* sd-utf8 */ - sd_utf8_is_valid; - sd_ascii_is_valid; - - /* sd-resolve */ - sd_resolve_default; - sd_resolve_new; - sd_resolve_ref; - sd_resolve_unref; - sd_resolve_get_fd; - sd_resolve_get_events; - sd_resolve_get_timeout; - sd_resolve_process; - sd_resolve_wait; - sd_resolve_get_tid; - sd_resolve_attach_event; - sd_resolve_detach_event; - sd_resolve_get_event; - sd_resolve_getaddrinfo; - sd_resolve_getnameinfo; - sd_resolve_res_query; - sd_resolve_res_search; - sd_resolve_query_ref; - sd_resolve_query_unref; - sd_resolve_query_is_done; - sd_resolve_query_get_userdata; - sd_resolve_query_set_userdata; - sd_resolve_query_get_resolve; - - /* sd-path */ - sd_path_home; - sd_path_search; -} LIBSYSTEMD_220; -) diff --git a/src/libsystemd/sd-bus/bus-error.c b/src/libsystemd/sd-bus/bus-error.c index dac157be16..64a5a972ae 100644 --- a/src/libsystemd/sd-bus/bus-error.c +++ b/src/libsystemd/sd-bus/bus-error.c @@ -70,9 +70,11 @@ BUS_ERROR_MAP_ELF_REGISTER const sd_bus_error_map bus_standard_errors[] = { SD_BUS_ERROR_MAP_END }; -/* GCC maps this magically to the beginning and end of the BUS_ERROR_MAP section */ -extern const sd_bus_error_map __start_BUS_ERROR_MAP[]; -extern const sd_bus_error_map __stop_BUS_ERROR_MAP[]; +/* GCC maps this magically to the beginning and end of the BUS_ERROR_MAP section. + * Hide them; for currently unknown reasons they get exported to the shared libries + * even without being listed in the sym file. */ +extern const sd_bus_error_map __start_BUS_ERROR_MAP[] _hidden_; +extern const sd_bus_error_map __stop_BUS_ERROR_MAP[] _hidden_; /* Additional maps registered with sd_bus_error_add_map() are in this * NULL terminated array */ diff --git a/src/libsystemd/sd-bus/bus-internal.h b/src/libsystemd/sd-bus/bus-internal.h index 88c058889a..c3e20ee1bf 100644 --- a/src/libsystemd/sd-bus/bus-internal.h +++ b/src/libsystemd/sd-bus/bus-internal.h @@ -141,6 +141,7 @@ struct sd_bus_slot { void *userdata; BusSlotType type:5; bool floating:1; + bool match_added:1; char *description; LIST_FIELDS(sd_bus_slot, slots); diff --git a/src/libsystemd/sd-bus/bus-kernel.c b/src/libsystemd/sd-bus/bus-kernel.c index 3aaaabf4ed..f08db2da89 100644 --- a/src/libsystemd/sd-bus/bus-kernel.c +++ b/src/libsystemd/sd-bus/bus-kernel.c @@ -29,8 +29,8 @@ #include <sys/prctl.h> /* When we include libgen.h because we need dirname() we immediately - * undefine basename() since libgen.h defines it as a macro to the XDG - * version which is really broken. */ + * undefine basename() since libgen.h defines it as a macro to the POSIX + * version which is really broken. We prefer GNU basename(). */ #include <libgen.h> #undef basename diff --git a/src/libsystemd/sd-bus/bus-match.c b/src/libsystemd/sd-bus/bus-match.c index 7c5264fad4..132b37526e 100644 --- a/src/libsystemd/sd-bus/bus-match.c +++ b/src/libsystemd/sd-bus/bus-match.c @@ -1149,3 +1149,40 @@ void bus_match_dump(struct bus_match_node *node, unsigned level) { for (c = node->child; c; c = c->next) bus_match_dump(c, level + 1); } + +enum bus_match_scope bus_match_get_scope(const struct bus_match_component *components, unsigned n_components) { + bool found_driver = false; + unsigned i; + + if (n_components <= 0) + return BUS_MATCH_GENERIC; + + assert(components); + + /* Checks whether the specified match can only match the + * pseudo-service for local messages, which we detect by + * sender, interface or path. If a match is not restricted to + * local messages, then we check if it only matches on the + * driver. */ + + for (i = 0; i < n_components; i++) { + const struct bus_match_component *c = components + i; + + if (c->type == BUS_MATCH_SENDER) { + if (streq_ptr(c->value_str, "org.freedesktop.DBus.Local")) + return BUS_MATCH_LOCAL; + + if (streq_ptr(c->value_str, "org.freedesktop.DBus")) + found_driver = true; + } + + if (c->type == BUS_MATCH_INTERFACE && streq_ptr(c->value_str, "org.freedesktop.DBus.Local")) + return BUS_MATCH_LOCAL; + + if (c->type == BUS_MATCH_PATH && streq_ptr(c->value_str, "/org/freedesktop/DBus/Local")) + return BUS_MATCH_LOCAL; + } + + return found_driver ? BUS_MATCH_DRIVER : BUS_MATCH_GENERIC; + +} diff --git a/src/libsystemd/sd-bus/bus-match.h b/src/libsystemd/sd-bus/bus-match.h index af5f65d073..56516be9fa 100644 --- a/src/libsystemd/sd-bus/bus-match.h +++ b/src/libsystemd/sd-bus/bus-match.h @@ -73,6 +73,12 @@ struct bus_match_component { char *value_str; }; +enum bus_match_scope { + BUS_MATCH_GENERIC, + BUS_MATCH_LOCAL, + BUS_MATCH_DRIVER, +}; + int bus_match_run(sd_bus *bus, struct bus_match_node *root, sd_bus_message *m); int bus_match_add(struct bus_match_node *root, struct bus_match_component *components, unsigned n_components, struct match_callback *callback); @@ -90,3 +96,5 @@ enum bus_match_node_type bus_match_node_type_from_string(const char *k, size_t n int bus_match_parse(const char *match, struct bus_match_component **_components, unsigned *_n_components); void bus_match_parse_free(struct bus_match_component *components, unsigned n_components); char *bus_match_to_string(struct bus_match_component *components, unsigned n_components); + +enum bus_match_scope bus_match_get_scope(const struct bus_match_component *components, unsigned n_components); diff --git a/src/libsystemd/sd-bus/bus-slot.c b/src/libsystemd/sd-bus/bus-slot.c index 8060e9882c..c452477566 100644 --- a/src/libsystemd/sd-bus/bus-slot.c +++ b/src/libsystemd/sd-bus/bus-slot.c @@ -89,7 +89,7 @@ void bus_slot_disconnect(sd_bus_slot *slot) { case BUS_MATCH_CALLBACK: - if (slot->bus->bus_client) + if (slot->match_added) bus_remove_match_internal(slot->bus, slot->match_callback.match_string, slot->match_callback.cookie); slot->bus->match_callbacks_modified = true; diff --git a/src/libsystemd/sd-bus/sd-bus.c b/src/libsystemd/sd-bus/sd-bus.c index 2805b29839..5dd6468707 100644 --- a/src/libsystemd/sd-bus/sd-bus.c +++ b/src/libsystemd/sd-bus/sd-bus.c @@ -1239,18 +1239,9 @@ int bus_set_address_user(sd_bus *b) { if (!ee) return -ENOMEM; -#ifdef ENABLE_KDBUS (void) asprintf(&b->address, KERNEL_USER_BUS_ADDRESS_FMT ";" UNIX_USER_BUS_ADDRESS_FMT, getuid(), ee); -#else - (void) asprintf(&b->address, UNIX_USER_BUS_ADDRESS_FMT, ee); -#endif - } else { -#ifdef ENABLE_KDBUS + } else (void) asprintf(&b->address, KERNEL_USER_BUS_ADDRESS_FMT, getuid()); -#else - return -ECONNREFUSED; -#endif - } if (!b->address) return -ENOMEM; @@ -1372,11 +1363,7 @@ int bus_set_address_system_machine(sd_bus *b, const char *machine) { if (!e) return -ENOMEM; -#ifdef ENABLE_KDBUS b->address = strjoin("x-machine-kernel:machine=", e, ";x-machine-unix:machine=", e, NULL); -#else - b->address = strjoin("x-machine-unix:machine=", e, NULL); -#endif if (!b->address) return -ENOMEM; @@ -2952,22 +2939,33 @@ _public_ int sd_bus_add_match( s->match_callback.cookie = ++bus->match_cookie; if (bus->bus_client) { + enum bus_match_scope scope; - if (!bus->is_kernel) { - /* When this is not a kernel transport, we - * store the original match string, so that we - * can use it to remove the match again */ + scope = bus_match_get_scope(components, n_components); - s->match_callback.match_string = strdup(match); - if (!s->match_callback.match_string) { - r = -ENOMEM; - goto finish; + /* Do not install server-side matches for matches + * against the local service, interface or bus + * path. */ + if (scope != BUS_MATCH_LOCAL) { + + if (!bus->is_kernel) { + /* When this is not a kernel transport, we + * store the original match string, so that we + * can use it to remove the match again */ + + s->match_callback.match_string = strdup(match); + if (!s->match_callback.match_string) { + r = -ENOMEM; + goto finish; + } } - } - r = bus_add_match_internal(bus, s->match_callback.match_string, components, n_components, s->match_callback.cookie); - if (r < 0) - goto finish; + r = bus_add_match_internal(bus, s->match_callback.match_string, components, n_components, s->match_callback.cookie); + if (r < 0) + goto finish; + + s->match_added = true; + } } bus->match_callbacks_modified = true; diff --git a/src/libsystemd/sd-bus/test-bus-match.c b/src/libsystemd/sd-bus/test-bus-match.c index 40c67046da..a1687b1c7b 100644 --- a/src/libsystemd/sd-bus/test-bus-match.c +++ b/src/libsystemd/sd-bus/test-bus-match.c @@ -77,6 +77,15 @@ static int match_add(sd_bus_slot *slots, struct bus_match_node *root, const char return r; } +static void test_match_scope(const char *match, enum bus_match_scope scope) { + struct bus_match_component *components = NULL; + unsigned n_components = 0; + + assert_se(bus_match_parse(match, &components, &n_components) >= 0); + assert_se(bus_match_get_scope(components, n_components) == scope); + bus_match_parse_free(components, n_components); +} + int main(int argc, char *argv[]) { struct bus_match_node root = { .type = BUS_MATCH_ROOT, @@ -142,5 +151,12 @@ int main(int argc, char *argv[]) { bus_match_free(&root); + test_match_scope("interface='foobar'", BUS_MATCH_GENERIC); + test_match_scope("", BUS_MATCH_GENERIC); + test_match_scope("interface='org.freedesktop.DBus.Local'", BUS_MATCH_LOCAL); + test_match_scope("sender='org.freedesktop.DBus.Local'", BUS_MATCH_LOCAL); + test_match_scope("member='gurke',path='/org/freedesktop/DBus/Local'", BUS_MATCH_LOCAL); + test_match_scope("arg2='piep',sender='org.freedesktop.DBus',member='waldo'", BUS_MATCH_DRIVER); + return 0; } diff --git a/src/libsystemd/sd-event/sd-event.c b/src/libsystemd/sd-event/sd-event.c index 00880c983b..76964aa0cc 100644 --- a/src/libsystemd/sd-event/sd-event.c +++ b/src/libsystemd/sd-event/sd-event.c @@ -468,24 +468,22 @@ static bool event_pid_changed(sd_event *e) { return e->original_pid != getpid(); } -static int source_io_unregister(sd_event_source *s) { +static void source_io_unregister(sd_event_source *s) { int r; assert(s); assert(s->type == SOURCE_IO); if (event_pid_changed(s->event)) - return 0; + return; if (!s->io.registered) - return 0; + return; r = epoll_ctl(s->event->epoll_fd, EPOLL_CTL_DEL, s->io.fd, NULL); - if (r < 0) - return -errno; + assert_log(r >= 0); s->io.registered = false; - return 0; } static int source_io_register( @@ -1457,10 +1455,7 @@ _public_ int sd_event_source_set_enabled(sd_event_source *s, int m) { switch (s->type) { case SOURCE_IO: - r = source_io_unregister(s); - if (r < 0) - return r; - + source_io_unregister(s); s->enabled = m; break; diff --git a/src/login/logind-button.c b/src/login/logind-button.c index 8079d0b5aa..210b889c4f 100644 --- a/src/login/logind-button.c +++ b/src/login/logind-button.c @@ -100,7 +100,7 @@ static void button_lid_switch_handle_action(Manager *manager, bool is_edge) { assert(manager); /* If we are docked, handle the lid switch differently */ - if (manager_is_docked_or_multiple_displays(manager)) + if (manager_is_docked_or_external_displays(manager)) handle_action = manager->handle_lid_switch_docked; else handle_action = manager->handle_lid_switch; diff --git a/src/login/logind-core.c b/src/login/logind-core.c index f9e6ddfb3f..a6c01f7d85 100644 --- a/src/login/logind-core.c +++ b/src/login/logind-core.c @@ -477,7 +477,7 @@ int manager_spawn_autovt(Manager *m, unsigned int vtnr) { return r; } -bool manager_is_docked(Manager *m) { +static bool manager_is_docked(Manager *m) { Iterator i; Button *b; @@ -488,7 +488,7 @@ bool manager_is_docked(Manager *m) { return false; } -int manager_count_displays(Manager *m) { +static int manager_count_external_displays(Manager *m) { _cleanup_udev_enumerate_unref_ struct udev_enumerate *e = NULL; struct udev_list_entry *item = NULL, *first = NULL; int r; @@ -510,7 +510,8 @@ int manager_count_displays(Manager *m) { udev_list_entry_foreach(item, first) { _cleanup_udev_device_unref_ struct udev_device *d = NULL; struct udev_device *p; - const char *status; + const char *status, *enabled, *dash, *nn, *i; + bool external = false; d = udev_device_new_from_syspath(m->udev, udev_list_entry_get_name(item)); if (!d) @@ -526,6 +527,40 @@ int manager_count_displays(Manager *m) { if (!streq_ptr(udev_device_get_subsystem(p), "drm")) continue; + nn = udev_device_get_sysname(d); + if (!nn) + continue; + + /* Ignore internal displays: the type is encoded in + * the sysfs name, as the second dash seperated item + * (the first is the card name, the last the connector + * number). We implement a whitelist of external + * displays here, rather than a whitelist, to ensure + * we don't block suspends too eagerly. */ + dash = strchr(nn, '-'); + if (!dash) + continue; + + dash++; + FOREACH_STRING(i, "VGA-", "DVI-I-", "DVI-D-", "DVI-A-" + "Composite-", "SVIDEO-", "Component-", + "DIN-", "DP-", "HDMI-A-", "HDMI-B-", "TV-") { + + if (startswith(dash, i)) { + external = true; + break; + } + } + if (!external) + continue; + + /* Ignore ports that are not enabled */ + enabled = udev_device_get_sysattr_value(d, "enabled"); + if (!enabled) + continue; + if (!streq_ptr(enabled, "enabled")) + continue; + /* We count any connector which is not explicitly * "disconnected" as connected. */ status = udev_device_get_sysattr_value(d, "status"); @@ -536,7 +571,7 @@ int manager_count_displays(Manager *m) { return n; } -bool manager_is_docked_or_multiple_displays(Manager *m) { +bool manager_is_docked_or_external_displays(Manager *m) { int n; /* If we are docked don't react to lid closing */ @@ -547,11 +582,11 @@ bool manager_is_docked_or_multiple_displays(Manager *m) { /* If we have more than one display connected, * assume that we are docked. */ - n = manager_count_displays(m); + n = manager_count_external_displays(m); if (n < 0) log_warning_errno(n, "Display counting failed: %m"); - else if (n > 1) { - log_debug("Multiple (%i) displays connected.", n); + else if (n >= 1) { + log_debug("External (%i) displays connected.", n); return true; } diff --git a/src/login/logind-dbus.c b/src/login/logind-dbus.c index e6f9ec7845..8ebcd3f5ca 100644 --- a/src/login/logind-dbus.c +++ b/src/login/logind-dbus.c @@ -258,7 +258,7 @@ static int property_get_docked( assert(reply); assert(m); - return sd_bus_message_append(reply, "b", manager_is_docked_or_multiple_displays(m)); + return sd_bus_message_append(reply, "b", manager_is_docked_or_external_displays(m)); } static int method_get_session(sd_bus_message *message, void *userdata, sd_bus_error *error) { diff --git a/src/login/logind-user.c b/src/login/logind-user.c index 6720899def..21d7268120 100644 --- a/src/login/logind-user.c +++ b/src/login/logind-user.c @@ -36,9 +36,10 @@ #include "bus-error.h" #include "conf-parser.h" #include "clean-ipc.h" -#include "logind-user.h" #include "smack-util.h" #include "formats-util.h" +#include "label.h" +#include "logind-user.h" User* user_new(Manager *m, uid_t uid, gid_t gid, const char *name) { User *u; @@ -105,7 +106,7 @@ void user_free(User *u) { free(u); } -int user_save(User *u) { +static int user_save_internal(User *u) { _cleanup_free_ char *temp_path = NULL; _cleanup_fclose_ FILE *f = NULL; int r; @@ -113,9 +114,6 @@ int user_save(User *u) { assert(u); assert(u->state_file); - if (!u->started) - return 0; - r = mkdir_safe_label("/run/systemd/users", 0755, 0, 0); if (r < 0) goto finish; @@ -258,6 +256,15 @@ finish: return r; } +int user_save(User *u) { + assert(u); + + if (!u->started) + return 0; + + return user_save_internal (u); +} + int user_load(User *u) { _cleanup_free_ char *display = NULL, *realtime = NULL, *monotonic = NULL; Session *s = NULL; @@ -323,7 +330,7 @@ static int user_mkdir_runtime_path(User *u) { if (path_is_mount_point(p, 0) <= 0) { _cleanup_free_ char *t = NULL; - (void) mkdir(p, 0700); + (void) mkdir_label(p, 0700); if (mac_smack_use()) r = asprintf(&t, "mode=0700,smackfsroot=*,uid=" UID_FMT ",gid=" GID_FMT ",size=%zu", u->uid, u->gid, u->manager->runtime_dir_size); @@ -351,6 +358,10 @@ static int user_mkdir_runtime_path(User *u) { goto fail; } } + + r = label_fix(p, false, false); + if (r < 0) + log_warning_errno(r, "Failed to fix label of '%s', ignoring: %m", p); } u->runtime_path = p; @@ -453,6 +464,12 @@ int user_start(User *u) { if (r < 0) return r; + /* Save the user data so far, because pam_systemd will read the + * XDG_RUNTIME_DIR out of it while starting up systemd --user. + * We need to do user_save_internal() because we have not + * "officially" started yet. */ + user_save_internal(u); + /* Spawn user systemd */ r = user_start_service(u); if (r < 0) @@ -704,7 +721,7 @@ UserState user_get_state(User *u) { if (u->stopping) return USER_CLOSING; - if (u->slice_job || u->service_job) + if (!u->started || u->slice_job || u->service_job) return USER_OPENING; if (u->sessions) { diff --git a/src/login/logind.h b/src/login/logind.h index cd226f55fc..feb381d0b1 100644 --- a/src/login/logind.h +++ b/src/login/logind.h @@ -156,9 +156,7 @@ int manager_get_idle_hint(Manager *m, dual_timestamp *t); int manager_get_user_by_pid(Manager *m, pid_t pid, User **user); int manager_get_session_by_pid(Manager *m, pid_t pid, Session **session); -bool manager_is_docked(Manager *m); -int manager_count_displays(Manager *m); -bool manager_is_docked_or_multiple_displays(Manager *m); +bool manager_is_docked_or_external_displays(Manager *m); extern const sd_bus_vtable manager_vtable[]; diff --git a/src/login/pam_systemd.c b/src/login/pam_systemd.c index b5d419000c..0ebdfdf19e 100644 --- a/src/login/pam_systemd.c +++ b/src/login/pam_systemd.c @@ -177,7 +177,6 @@ static int export_legacy_dbus_address( uid_t uid, const char *runtime) { -#ifdef ENABLE_KDBUS _cleanup_free_ char *s = NULL; int r; @@ -195,7 +194,7 @@ static int export_legacy_dbus_address( pam_syslog(handle, LOG_ERR, "Failed to set bus variable."); return r; } -#endif + return PAM_SUCCESS; } diff --git a/src/machine/machine-dbus.c b/src/machine/machine-dbus.c index 0892479a9a..7813a0bcc7 100644 --- a/src/machine/machine-dbus.c +++ b/src/machine/machine-dbus.c @@ -24,8 +24,8 @@ #include <sys/mount.h> /* When we include libgen.h because we need dirname() we immediately - * undefine basename() since libgen.h defines it as a macro to the XDG - * version which is really broken. */ + * undefine basename() since libgen.h defines it as a macro to the POSIX + * version which is really broken. We prefer GNU basename(). */ #include <libgen.h> #undef basename @@ -509,11 +509,7 @@ int bus_machine_method_open_login(sd_bus_message *message, void *userdata, sd_bu if (r < 0) return r; -#ifdef ENABLE_KDBUS # define ADDRESS_FMT "x-machine-kernel:pid=%1$" PID_PRI ";x-machine-unix:pid=%1$" PID_PRI -#else -# define ADDRESS_FMT "x-machine-unix:pid=%1$" PID_PRI -#endif if (asprintf(&address, ADDRESS_FMT, m->leader) < 0) return log_oom(); diff --git a/src/nspawn/nspawn.c b/src/nspawn/nspawn.c index eea994d0b3..3c31629d1e 100644 --- a/src/nspawn/nspawn.c +++ b/src/nspawn/nspawn.c @@ -1013,6 +1013,9 @@ static int parse_argv(int argc, char *argv[]) { return -EINVAL; } + if (arg_userns && access("/proc/self/uid_map", F_OK) < 0) + return log_error_errno(EOPNOTSUPP, "--private-users= is not supported, kernel compiled without user namespace support."); + arg_retain = (arg_retain | plus | (arg_private_network ? 1ULL << CAP_NET_ADMIN : 0)) & ~minus; if (arg_boot && arg_kill_signal <= 0) diff --git a/src/shared/bus-util.c b/src/shared/bus-util.c index 8fcc289957..11350dad71 100644 --- a/src/shared/bus-util.c +++ b/src/shared/bus-util.c @@ -545,7 +545,6 @@ int bus_open_system_systemd(sd_bus **_bus) { * directly to the system instance, instead of going via the * bus */ -#ifdef ENABLE_KDBUS r = sd_bus_new(&bus); if (r < 0) return r; @@ -564,7 +563,6 @@ int bus_open_system_systemd(sd_bus **_bus) { } bus = sd_bus_unref(bus); -#endif r = sd_bus_new(&bus); if (r < 0) @@ -598,7 +596,6 @@ int bus_open_user_systemd(sd_bus **_bus) { assert(_bus); -#ifdef ENABLE_KDBUS r = sd_bus_new(&bus); if (r < 0) return r; @@ -616,7 +613,6 @@ int bus_open_user_systemd(sd_bus **_bus) { } bus = sd_bus_unref(bus); -#endif e = secure_getenv("XDG_RUNTIME_DIR"); if (!e) @@ -2034,15 +2030,22 @@ int bus_path_decode_unique(const char *path, const char *prefix, char **ret_send bool is_kdbus_wanted(void) { _cleanup_free_ char *value = NULL; +#ifdef ENABLE_KDBUS + const bool configured = true; +#else + const bool configured = false; +#endif + int r; - if (get_proc_cmdline_key("kdbus", NULL) <= 0) { - r = get_proc_cmdline_key("kdbus=", &value); - if (r <= 0 || parse_boolean(value) != 1) - return false; - } + if (get_proc_cmdline_key("kdbus", NULL) > 0) + return true; + + r = get_proc_cmdline_key("kdbus=", &value); + if (r <= 0) + return configured; - return true; + return parse_boolean(value) == 1; } bool is_kdbus_available(void) { diff --git a/src/shared/logs-show.c b/src/shared/logs-show.c index ac5eb16f62..068da465d9 100644 --- a/src/shared/logs-show.c +++ b/src/shared/logs-show.c @@ -274,8 +274,10 @@ static int output_short( if (r < 0) return log_error_errno(r, "Failed to get journal fields: %m"); - if (!message) + if (!message) { + log_debug("Skipping message without MESSAGE= field."); return 0; + } if (!(flags & OUTPUT_SHOW_ALL)) strip_tab_ansi(&message, &message_len); diff --git a/src/shared/watchdog.c b/src/shared/watchdog.c index 2fe4eb81cf..9d39beb340 100644 --- a/src/shared/watchdog.c +++ b/src/shared/watchdog.c @@ -60,8 +60,13 @@ static int update_timeout(void) { flags = WDIOS_ENABLECARD; r = ioctl(watchdog_fd, WDIOC_SETOPTIONS, &flags); - if (r < 0) - return log_warning_errno(errno, "Failed to enable hardware watchdog: %m"); + if (r < 0) { + /* ENOTTY means the watchdog is always enabled so we're fine */ + log_full(errno == ENOTTY ? LOG_DEBUG : LOG_WARNING, + "Failed to enable hardware watchdog: %m"); + if (errno != ENOTTY) + return -errno; + } r = ioctl(watchdog_fd, WDIOC_KEEPALIVE, 0); if (r < 0) diff --git a/src/test/test-cgroup-mask.c b/src/test/test-cgroup-mask.c index 289dddbaac..72f874d8a9 100644 --- a/src/test/test-cgroup-mask.c +++ b/src/test/test-cgroup-mask.c @@ -77,12 +77,12 @@ static int test_cgroup_mask(void) { assert_se(unit_get_members_mask(root) == (CGROUP_CPU | CGROUP_CPUACCT | CGROUP_BLKIO | CGROUP_MEMORY)); /* Verify aggregation of sibling masks. */ - assert_se(unit_get_siblings_mask(son) == ((CGROUP_CPU | CGROUP_CPUACCT | CGROUP_MEMORY) & m->cgroup_supported)); - assert_se(unit_get_siblings_mask(daughter) == ((CGROUP_CPU | CGROUP_CPUACCT | CGROUP_MEMORY) & m->cgroup_supported)); + assert_se(unit_get_siblings_mask(son) == (CGROUP_CPU | CGROUP_CPUACCT | CGROUP_MEMORY)); + assert_se(unit_get_siblings_mask(daughter) == (CGROUP_CPU | CGROUP_CPUACCT | CGROUP_MEMORY)); assert_se(unit_get_siblings_mask(grandchild) == 0); - assert_se(unit_get_siblings_mask(parent_deep) == ((CGROUP_CPU | CGROUP_CPUACCT | CGROUP_MEMORY) & m->cgroup_supported)); - assert_se(unit_get_siblings_mask(parent) == ((CGROUP_CPU | CGROUP_CPUACCT | CGROUP_BLKIO | CGROUP_MEMORY) & m->cgroup_supported)); - assert_se(unit_get_siblings_mask(root) == ((CGROUP_CPU | CGROUP_CPUACCT | CGROUP_BLKIO | CGROUP_MEMORY) & m->cgroup_supported)); + assert_se(unit_get_siblings_mask(parent_deep) == (CGROUP_CPU | CGROUP_CPUACCT | CGROUP_MEMORY)); + assert_se(unit_get_siblings_mask(parent) == (CGROUP_CPU | CGROUP_CPUACCT | CGROUP_BLKIO | CGROUP_MEMORY)); + assert_se(unit_get_siblings_mask(root) == (CGROUP_CPU | CGROUP_CPUACCT | CGROUP_BLKIO | CGROUP_MEMORY)); /* Verify aggregation of target masks. */ assert_se(unit_get_target_mask(son) == ((CGROUP_CPU | CGROUP_CPUACCT | CGROUP_MEMORY) & m->cgroup_supported)); diff --git a/src/test/test-unit-file.c b/src/test/test-unit-file.c index a8025c825b..8358789e6f 100644 --- a/src/test/test-unit-file.c +++ b/src/test/test-unit-file.c @@ -145,19 +145,19 @@ static void test_config_parse_exec(void) { assert_se(r == 0); assert_se(c1->command_next == NULL); - log_info("/* no command, check for bad memory access */"); + log_info("/* no command, whitespace only, reset */"); r = config_parse_exec(NULL, "fake", 3, "section", 1, "LValue", 0, " ", &c, NULL); assert_se(r == 0); - assert_se(c1->command_next == NULL); + assert_se(c == NULL); log_info("/* ignore && honour_argv0 */"); r = config_parse_exec(NULL, "fake", 4, "section", 1, "LValue", 0, "-@/RValue///slashes3 argv0a r1", &c, NULL); assert_se(r >= 0); - c1 = c1->command_next; + c1 = c; check_execcommand(c1, "/RValue/slashes3", "argv0a", "r1", NULL, true); log_info("/* ignore && honour_argv0 */"); @@ -195,6 +195,19 @@ static void test_config_parse_exec(void) { c1 = c1->command_next; check_execcommand(c1, "/goo/goo", NULL, "boo", NULL, false); + log_info("/* two semicolons in a row */"); + r = config_parse_exec(NULL, "fake", 5, "section", 1, + "LValue", 0, + "-@/RValue argv0 r1 ; ; " + "/goo/goo boo", + &c, NULL); + assert_se(r >= 0); + c1 = c1->command_next; + check_execcommand(c1, "/RValue", "argv0", "r1", NULL, true); + + /* second command fails because the executable name is ";" */ + assert_se(c1->command_next == NULL); + log_info("/* trailing semicolon */"); r = config_parse_exec(NULL, "fake", 5, "section", 1, "LValue", 0, @@ -206,6 +219,26 @@ static void test_config_parse_exec(void) { assert_se(c1->command_next == NULL); + log_info("/* trailing semicolon, no whitespace */"); + r = config_parse_exec(NULL, "fake", 5, "section", 1, + "LValue", 0, + "-@/RValue argv0 r1 ;", + &c, NULL); + assert_se(r >= 0); + c1 = c1->command_next; + check_execcommand(c1, "/RValue", "argv0", "r1", NULL, true); + + assert_se(c1->command_next == NULL); + + log_info("/* trailing semicolon in single quotes */"); + r = config_parse_exec(NULL, "fake", 5, "section", 1, + "LValue", 0, + "-@/RValue argv0 r1 ';'", + &c, NULL); + assert_se(r >= 0); + c1 = c1->command_next; + check_execcommand(c1, "/RValue", "argv0", "r1", ";", true); + log_info("/* escaped semicolon */"); r = config_parse_exec(NULL, "fake", 5, "section", 1, "LValue", 0, @@ -218,12 +251,22 @@ static void test_config_parse_exec(void) { log_info("/* escaped semicolon with following arg */"); r = config_parse_exec(NULL, "fake", 5, "section", 1, "LValue", 0, - "/sbin/find \\; x", + "/sbin/find \\; /x", + &c, NULL); + assert_se(r >= 0); + c1 = c1->command_next; + check_execcommand(c1, + "/sbin/find", NULL, ";", "/x", false); + + log_info("/* escaped semicolon as part of an expression */"); + r = config_parse_exec(NULL, "fake", 5, "section", 1, + "LValue", 0, + "/sbin/find \\;x", &c, NULL); assert_se(r >= 0); c1 = c1->command_next; check_execcommand(c1, - "/sbin/find", NULL, ";", "x", false); + "/sbin/find", NULL, "\\;x", NULL, false); log_info("/* encoded semicolon */"); r = config_parse_exec(NULL, "fake", 5, "section", 1, @@ -234,6 +277,25 @@ static void test_config_parse_exec(void) { c1 = c1->command_next; check_execcommand(c1, "/bin/find", NULL, ";", NULL, false); + log_info("/* quoted semicolon */"); + r = config_parse_exec(NULL, "fake", 5, "section", 1, + "LValue", 0, + "/bin/find \";\"", + &c, NULL); + assert_se(r >= 0); + c1 = c1->command_next; + check_execcommand(c1, "/bin/find", NULL, ";", NULL, false); + + log_info("/* quoted semicolon with following arg */"); + r = config_parse_exec(NULL, "fake", 5, "section", 1, + "LValue", 0, + "/sbin/find \";\" /x", + &c, NULL); + assert_se(r >= 0); + c1 = c1->command_next; + check_execcommand(c1, + "/sbin/find", NULL, ";", "/x", false); + log_info("/* spaces in the filename */"); r = config_parse_exec(NULL, "fake", 5, "section", 1, "LValue", 0, diff --git a/src/test/test-util.c b/src/test/test-util.c index ed8db45115..ad9ea3bcce 100644 --- a/src/test/test-util.c +++ b/src/test/test-util.c @@ -1304,6 +1304,244 @@ static void test_unquote_first_word(void) { assert_se(streq(t, "pi\360\237\222\251le")); free(t); assert_se(p == original + 32); + + p = original = "fooo\\"; + assert_se(unquote_first_word(&p, &t, UNQUOTE_RELAX) > 0); + assert_se(streq(t, "fooo")); + free(t); + assert_se(p == original + 5); + + p = original = "fooo\\"; + assert_se(unquote_first_word(&p, &t, UNQUOTE_CUNESCAPE_RELAX) > 0); + assert_se(streq(t, "fooo\\")); + free(t); + assert_se(p == original + 5); + + p = original = "fooo\\"; + assert_se(unquote_first_word(&p, &t, UNQUOTE_CUNESCAPE_RELAX|UNQUOTE_RELAX) > 0); + assert_se(streq(t, "fooo\\")); + free(t); + assert_se(p == original + 5); + + p = original = "fooo\\"; + assert_se(unquote_first_word(&p, &t, UNQUOTE_CUNESCAPE|UNQUOTE_CUNESCAPE_RELAX) > 0); + assert_se(streq(t, "fooo\\")); + free(t); + assert_se(p == original + 5); + + p = original = "\"foo\\"; + assert_se(unquote_first_word(&p, &t, 0) == -EINVAL); + assert_se(p == original + 5); + + p = original = "\"foo\\"; + assert_se(unquote_first_word(&p, &t, UNQUOTE_RELAX) > 0); + assert_se(streq(t, "foo")); + free(t); + assert_se(p == original + 5); + + p = original = "\"foo\\"; + assert_se(unquote_first_word(&p, &t, UNQUOTE_CUNESCAPE_RELAX) == -EINVAL); + assert_se(p == original + 5); + + p = original = "\"foo\\"; + assert_se(unquote_first_word(&p, &t, UNQUOTE_CUNESCAPE_RELAX|UNQUOTE_RELAX) > 0); + assert_se(streq(t, "foo\\")); + free(t); + assert_se(p == original + 5); + + p = original = "\"foo\\"; + assert_se(unquote_first_word(&p, &t, UNQUOTE_CUNESCAPE|UNQUOTE_CUNESCAPE_RELAX|UNQUOTE_RELAX) > 0); + assert_se(streq(t, "foo\\")); + free(t); + assert_se(p == original + 5); + + p = original = "fooo\\ bar quux"; + assert_se(unquote_first_word(&p, &t, UNQUOTE_RELAX) > 0); + assert_se(streq(t, "fooo bar")); + free(t); + assert_se(p == original + 10); + + p = original = "fooo\\ bar quux"; + assert_se(unquote_first_word(&p, &t, UNQUOTE_CUNESCAPE_RELAX) > 0); + assert_se(streq(t, "fooo bar")); + free(t); + assert_se(p == original + 10); + + p = original = "fooo\\ bar quux"; + assert_se(unquote_first_word(&p, &t, UNQUOTE_CUNESCAPE_RELAX|UNQUOTE_RELAX) > 0); + assert_se(streq(t, "fooo bar")); + free(t); + assert_se(p == original + 10); + + p = original = "fooo\\ bar quux"; + assert_se(unquote_first_word(&p, &t, UNQUOTE_CUNESCAPE) == -EINVAL); + assert_se(p == original + 5); + + p = original = "fooo\\ bar quux"; + assert_se(unquote_first_word(&p, &t, UNQUOTE_CUNESCAPE|UNQUOTE_CUNESCAPE_RELAX) > 0); + assert_se(streq(t, "fooo\\ bar")); + free(t); + assert_se(p == original + 10); + + p = original = "\\w+@\\K[\\d.]+"; + assert_se(unquote_first_word(&p, &t, UNQUOTE_CUNESCAPE) == -EINVAL); + assert_se(p == original + 1); + + p = original = "\\w+@\\K[\\d.]+"; + assert_se(unquote_first_word(&p, &t, UNQUOTE_CUNESCAPE|UNQUOTE_CUNESCAPE_RELAX) > 0); + assert_se(streq(t, "\\w+@\\K[\\d.]+")); + free(t); + assert_se(p == original + 12); + + p = original = "\\w+\\b"; + assert_se(unquote_first_word(&p, &t, UNQUOTE_CUNESCAPE|UNQUOTE_CUNESCAPE_RELAX) > 0); + assert_se(streq(t, "\\w+\b")); + free(t); + assert_se(p == original + 5); +} + +static void test_unquote_first_word_and_warn(void) { + const char *p, *original; + char *t; + + p = original = "foobar waldo"; + assert_se(unquote_first_word_and_warn(&p, &t, 0, NULL, "fake", 1, original) > 0); + assert_se(streq(t, "foobar")); + free(t); + assert_se(p == original + 7); + + assert_se(unquote_first_word_and_warn(&p, &t, 0, NULL, "fake", 1, original) > 0); + assert_se(streq(t, "waldo")); + free(t); + assert_se(p == original + 12); + + assert_se(unquote_first_word_and_warn(&p, &t, 0, NULL, "fake", 1, original) == 0); + assert_se(!t); + assert_se(p == original + 12); + + p = original = "\"foobar\" \'waldo\'"; + assert_se(unquote_first_word_and_warn(&p, &t, 0, NULL, "fake", 1, original) > 0); + assert_se(streq(t, "foobar")); + free(t); + assert_se(p == original + 9); + + assert_se(unquote_first_word_and_warn(&p, &t, 0, NULL, "fake", 1, original) > 0); + assert_se(streq(t, "waldo")); + free(t); + assert_se(p == original + 16); + + assert_se(unquote_first_word_and_warn(&p, &t, 0, NULL, "fake", 1, original) == 0); + assert_se(!t); + assert_se(p == original + 16); + + p = original = "\""; + assert_se(unquote_first_word_and_warn(&p, &t, 0, NULL, "fake", 1, original) == -EINVAL); + assert_se(p == original + 1); + + p = original = "\'"; + assert_se(unquote_first_word_and_warn(&p, &t, 0, NULL, "fake", 1, original) == -EINVAL); + assert_se(p == original + 1); + + p = original = "\'fooo"; + assert_se(unquote_first_word_and_warn(&p, &t, 0, NULL, "fake", 1, original) == -EINVAL); + assert_se(p == original + 5); + + p = original = "\'fooo"; + assert_se(unquote_first_word_and_warn(&p, &t, UNQUOTE_RELAX, NULL, "fake", 1, original) > 0); + assert_se(streq(t, "fooo")); + free(t); + assert_se(p == original + 5); + + p = original = " foo\\ba\\x6ar "; + assert_se(unquote_first_word_and_warn(&p, &t, UNQUOTE_CUNESCAPE, NULL, "fake", 1, original) > 0); + assert_se(streq(t, "foo\ba\x6ar")); + free(t); + assert_se(p == original + 13); + + p = original = " foo\\ba\\x6ar "; + assert_se(unquote_first_word_and_warn(&p, &t, 0, NULL, "fake", 1, original) > 0); + assert_se(streq(t, "foobax6ar")); + free(t); + assert_se(p == original + 13); + + p = original = " f\\u00f6o \"pi\\U0001F4A9le\" "; + assert_se(unquote_first_word_and_warn(&p, &t, UNQUOTE_CUNESCAPE, NULL, "fake", 1, original) > 0); + assert_se(streq(t, "föo")); + free(t); + assert_se(p == original + 13); + + assert_se(unquote_first_word_and_warn(&p, &t, UNQUOTE_CUNESCAPE, NULL, "fake", 1, original) > 0); + assert_se(streq(t, "pi\360\237\222\251le")); + free(t); + assert_se(p == original + 32); + + p = original = "fooo\\"; + assert_se(unquote_first_word_and_warn(&p, &t, UNQUOTE_RELAX, NULL, "fake", 1, original) > 0); + assert_se(streq(t, "fooo")); + free(t); + assert_se(p == original + 5); + + p = original = "fooo\\"; + assert_se(unquote_first_word_and_warn(&p, &t, 0, NULL, "fake", 1, original) > 0); + assert_se(streq(t, "fooo\\")); + free(t); + assert_se(p == original + 5); + + p = original = "fooo\\"; + assert_se(unquote_first_word_and_warn(&p, &t, UNQUOTE_CUNESCAPE, NULL, "fake", 1, original) > 0); + assert_se(streq(t, "fooo\\")); + free(t); + assert_se(p == original + 5); + + p = original = "\"foo\\"; + assert_se(unquote_first_word_and_warn(&p, &t, 0, NULL, "fake", 1, original) == -EINVAL); + assert_se(p == original + 5); + + p = original = "\"foo\\"; + assert_se(unquote_first_word_and_warn(&p, &t, UNQUOTE_RELAX, NULL, "fake", 1, original) > 0); + assert_se(streq(t, "foo")); + free(t); + assert_se(p == original + 5); + + p = original = "\"foo\\"; + assert_se(unquote_first_word_and_warn(&p, &t, UNQUOTE_CUNESCAPE, NULL, "fake", 1, original) == -EINVAL); + assert_se(p == original + 5); + + p = original = "\"foo\\"; + assert_se(unquote_first_word_and_warn(&p, &t, UNQUOTE_CUNESCAPE|UNQUOTE_RELAX, NULL, "fake", 1, original) > 0); + assert_se(streq(t, "foo")); + free(t); + assert_se(p == original + 5); + + p = original = "fooo\\ bar quux"; + assert_se(unquote_first_word_and_warn(&p, &t, UNQUOTE_RELAX, NULL, "fake", 1, original) > 0); + assert_se(streq(t, "fooo bar")); + free(t); + assert_se(p == original + 10); + + p = original = "fooo\\ bar quux"; + assert_se(unquote_first_word_and_warn(&p, &t, 0, NULL, "fake", 1, original) > 0); + assert_se(streq(t, "fooo bar")); + free(t); + assert_se(p == original + 10); + + p = original = "fooo\\ bar quux"; + assert_se(unquote_first_word_and_warn(&p, &t, UNQUOTE_CUNESCAPE, NULL, "fake", 1, original) > 0); + assert_se(streq(t, "fooo\\ bar")); + free(t); + assert_se(p == original + 10); + + p = original = "\\w+@\\K[\\d.]+"; + assert_se(unquote_first_word_and_warn(&p, &t, UNQUOTE_CUNESCAPE, NULL, "fake", 1, original) > 0); + assert_se(streq(t, "\\w+@\\K[\\d.]+")); + free(t); + assert_se(p == original + 12); + + p = original = "\\w+\\b"; + assert_se(unquote_first_word_and_warn(&p, &t, UNQUOTE_CUNESCAPE, NULL, "fake", 1, original) > 0); + assert_se(streq(t, "\\w+\b")); + free(t); + assert_se(p == original + 5); } static void test_unquote_many_words(void) { @@ -1610,6 +1848,7 @@ int main(int argc, char *argv[]) { test_glob_exists(); test_execute_directory(); test_unquote_first_word(); + test_unquote_first_word_and_warn(); test_unquote_many_words(); test_parse_proc_cmdline(); test_raw_clone(); diff --git a/src/tmpfiles/tmpfiles.c b/src/tmpfiles/tmpfiles.c index 027a5c2ca8..42f757c4b7 100644 --- a/src/tmpfiles/tmpfiles.c +++ b/src/tmpfiles/tmpfiles.c @@ -496,9 +496,10 @@ static int dir_cleanup( } if (mountpoint && S_ISREG(s.st_mode)) - if ((streq(dent->d_name, ".journal") && s.st_uid == 0) || - streq(dent->d_name, "aquota.user") || - streq(dent->d_name, "aquota.group")) { + if (s.st_uid == 0 && STR_IN_SET(dent->d_name, + ".journal", + "aquota.user", + "aquota.group")) { log_debug("Skipping \"%s\".", sub_path); continue; } diff --git a/src/udev/udevd.c b/src/udev/udevd.c index d3797bb5e6..11f1f6372e 100644 --- a/src/udev/udevd.c +++ b/src/udev/udevd.c @@ -43,6 +43,7 @@ #include "sd-daemon.h" #include "sd-event.h" +#include "terminal-util.h" #include "signal-util.h" #include "event-util.h" #include "netlink-util.h" @@ -735,14 +736,14 @@ static void manager_exit(Manager *manager) { "STATUS=Starting shutdown..."); /* close sources of new events and discard buffered events */ - manager->ctrl = udev_ctrl_unref(manager->ctrl); manager->ctrl_event = sd_event_source_unref(manager->ctrl_event); + manager->ctrl = udev_ctrl_unref(manager->ctrl); - manager->fd_inotify = safe_close(manager->fd_inotify); manager->inotify_event = sd_event_source_unref(manager->inotify_event); + manager->fd_inotify = safe_close(manager->fd_inotify); - manager->monitor = udev_monitor_unref(manager->monitor); manager->uevent_event = sd_event_source_unref(manager->uevent_event); + manager->monitor = udev_monitor_unref(manager->monitor); /* discard queued events and kill workers */ event_queue_cleanup(manager, EVENT_QUEUED); @@ -1687,6 +1688,10 @@ int main(int argc, char *argv[]) { log_info("starting version " VERSION); + /* connect /dev/null to stdin, stdout, stderr */ + if (log_get_max_level() < LOG_DEBUG) + (void) make_null_stdio(); + pid = fork(); switch (pid) { case 0: diff --git a/sysusers.d/systemd.conf.m4 b/sysusers.d/systemd.conf.m4 index 23175de1f5..81b1d79c37 100644 --- a/sysusers.d/systemd.conf.m4 +++ b/sysusers.d/systemd.conf.m4 @@ -6,9 +6,7 @@ # (at your option) any later version. g systemd-journal - - -m4_ifdef(`ENABLE_KDBUS', u systemd-bus-proxy - "systemd Bus Proxy" -)m4_dnl m4_ifdef(`ENABLE_NETWORKD', u systemd-network - "systemd Network Management" )m4_dnl diff --git a/units/systemd-networkd.service.m4.in b/units/systemd-networkd.service.m4.in index 7f216f331c..64d9130c24 100644 --- a/units/systemd-networkd.service.m4.in +++ b/units/systemd-networkd.service.m4.in @@ -17,13 +17,11 @@ Before=network.target multi-user.target shutdown.target Conflicts=shutdown.target Wants=network.target -m4_ifdef(`ENABLE_KDBUS', # On kdbus systems we pull in the busname explicitly, because it # carries policy that allows the daemon to acquire its name. Wants=org.freedesktop.network1.busname After=org.freedesktop.network1.busname -)m4_dnl [Service] Type=notify Restart=on-failure diff --git a/units/systemd-resolved.service.m4.in b/units/systemd-resolved.service.m4.in index 98ae564af6..dce5402458 100644 --- a/units/systemd-resolved.service.m4.in +++ b/units/systemd-resolved.service.m4.in @@ -10,13 +10,11 @@ Description=Network Name Resolution Documentation=man:systemd-resolved.service(8) After=systemd-networkd.service network.target -m4_ifdef(`ENABLE_KDBUS', # On kdbus systems we pull in the busname explicitly, because it # carries policy that allows the daemon to acquire its name. Wants=org.freedesktop.resolve1.busname After=org.freedesktop.resolve1.busname -)m4_dnl [Service] Type=notify Restart=always |