diff options
78 files changed, 2208 insertions, 146 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..15781ba44a 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) @@ -1708,6 +1995,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 +2179,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..2a79a2a683 100644 --- a/Makefile.am +++ b/Makefile.am @@ -3460,10 +3460,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 +3491,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 +5531,7 @@ pam_systemd_la_SOURCES = \ pam_systemd_la_CFLAGS = \ $(AM_CFLAGS) \ - $(PAM_CFLAGS) \ - -fvisibility=hidden + $(PAM_CFLAGS) pam_systemd_la_LDFLAGS = \ $(AM_LDFLAGS) \ @@ -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/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/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/fdset.c b/src/basic/fdset.c index 6101b628ec..a4823e6659 100644 --- a/src/basic/fdset.c +++ b/src/basic/fdset.c @@ -267,8 +267,7 @@ bool fdset_isempty(FDSet *fds) { int fdset_iterate(FDSet *s, Iterator *i) { void *p; - p = set_iterate(MAKE_SET(s), i); - if (!p) + if (!set_iterate(MAKE_SET(s), i, &p)) return -ENOENT; return PTR_TO_FD(p); diff --git a/src/basic/hashmap.c b/src/basic/hashmap.c index 20d599d04b..0ee2f3bd31 100644 --- a/src/basic/hashmap.c +++ b/src/basic/hashmap.c @@ -733,29 +733,33 @@ static unsigned hashmap_iterate_entry(HashmapBase *h, Iterator *i) { : hashmap_iterate_in_internal_order(h, i); } -void *internal_hashmap_iterate(HashmapBase *h, Iterator *i, const void **key) { +bool internal_hashmap_iterate(HashmapBase *h, Iterator *i, void **value, const void **key) { struct hashmap_base_entry *e; void *data; unsigned idx; idx = hashmap_iterate_entry(h, i); if (idx == IDX_NIL) { + if (value) + *value = NULL; if (key) *key = NULL; - return NULL; + return false; } e = bucket_at(h, idx); data = entry_value(h, e); + if (value) + *value = data; if (key) *key = e->key; - return data; + return true; } -void *set_iterate(Set *s, Iterator *i) { - return internal_hashmap_iterate(HASHMAP_BASE(s), i, NULL); +bool set_iterate(Set *s, Iterator *i, void **value) { + return internal_hashmap_iterate(HASHMAP_BASE(s), i, value, NULL); } #define HASHMAP_FOREACH_IDX(idx, h, i) \ diff --git a/src/basic/hashmap.h b/src/basic/hashmap.h index a03ee5812a..5723f09ca9 100644 --- a/src/basic/hashmap.h +++ b/src/basic/hashmap.h @@ -65,6 +65,7 @@ typedef struct { } Iterator; #define _IDX_ITERATOR_FIRST (UINT_MAX - 1) +#define _IDX_ITERATOR_NIL (UINT_MAX) #define ITERATOR_FIRST ((Iterator) { .idx = _IDX_ITERATOR_FIRST, .next_key = NULL }) typedef unsigned long (*hash_func_t)(const void *p, const uint8_t hash_key[HASH_KEY_SIZE]); @@ -296,12 +297,12 @@ static inline unsigned ordered_hashmap_buckets(OrderedHashmap *h) { return internal_hashmap_buckets(HASHMAP_BASE(h)); } -void *internal_hashmap_iterate(HashmapBase *h, Iterator *i, const void **key); -static inline void *hashmap_iterate(Hashmap *h, Iterator *i, const void **key) { - return internal_hashmap_iterate(HASHMAP_BASE(h), i, key); +bool internal_hashmap_iterate(HashmapBase *h, Iterator *i, void **value, const void **key); +static inline bool hashmap_iterate(Hashmap *h, Iterator *i, void **value, const void **key) { + return internal_hashmap_iterate(HASHMAP_BASE(h), i, value, key); } -static inline void *ordered_hashmap_iterate(OrderedHashmap *h, Iterator *i, const void **key) { - return internal_hashmap_iterate(HASHMAP_BASE(h), i, key); +static inline bool ordered_hashmap_iterate(OrderedHashmap *h, Iterator *i, void **value, const void **key) { + return internal_hashmap_iterate(HASHMAP_BASE(h), i, value, key); } void internal_hashmap_clear(HashmapBase *h); @@ -386,24 +387,16 @@ static inline char **ordered_hashmap_get_strv(OrderedHashmap *h) { * It is safe to remove the current entry. */ #define HASHMAP_FOREACH(e, h, i) \ - for ((i) = ITERATOR_FIRST, (e) = hashmap_iterate((h), &(i), NULL); \ - (e); \ - (e) = hashmap_iterate((h), &(i), NULL)) + for ((i) = ITERATOR_FIRST; hashmap_iterate((h), &(i), (void**)&(e), NULL); ) #define ORDERED_HASHMAP_FOREACH(e, h, i) \ - for ((i) = ITERATOR_FIRST, (e) = ordered_hashmap_iterate((h), &(i), NULL); \ - (e); \ - (e) = ordered_hashmap_iterate((h), &(i), NULL)) + for ((i) = ITERATOR_FIRST; ordered_hashmap_iterate((h), &(i), (void**)&(e), NULL); ) #define HASHMAP_FOREACH_KEY(e, k, h, i) \ - for ((i) = ITERATOR_FIRST, (e) = hashmap_iterate((h), &(i), (const void**) &(k)); \ - (e); \ - (e) = hashmap_iterate((h), &(i), (const void**) &(k))) + for ((i) = ITERATOR_FIRST; hashmap_iterate((h), &(i), (void**)&(e), (const void**) &(k)); ) #define ORDERED_HASHMAP_FOREACH_KEY(e, k, h, i) \ - for ((i) = ITERATOR_FIRST, (e) = ordered_hashmap_iterate((h), &(i), (const void**) &(k)); \ - (e); \ - (e) = ordered_hashmap_iterate((h), &(i), (const void**) &(k))) + for ((i) = ITERATOR_FIRST; ordered_hashmap_iterate((h), &(i), (void**)&(e), (const void**) &(k)); ) DEFINE_TRIVIAL_CLEANUP_FUNC(Hashmap*, hashmap_free); DEFINE_TRIVIAL_CLEANUP_FUNC(Hashmap*, hashmap_free_free); 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/ordered-set.h b/src/basic/ordered-set.h index 766a1f2e83..6c617ab305 100644 --- a/src/basic/ordered-set.h +++ b/src/basic/ordered-set.h @@ -47,12 +47,12 @@ static inline bool ordered_set_isempty(OrderedSet *s) { return ordered_hashmap_isempty((OrderedHashmap*) s); } -static inline void *ordered_set_iterate(OrderedSet *s, Iterator *i) { - return ordered_hashmap_iterate((OrderedHashmap*) s, i, NULL); +static inline bool ordered_set_iterate(OrderedSet *s, Iterator *i, void **value) { + return ordered_hashmap_iterate((OrderedHashmap*) s, i, value, NULL); } #define ORDERED_SET_FOREACH(e, s, i) \ - for ((i) = ITERATOR_FIRST, (e) = ordered_set_iterate((s), &(i)); (e); (e) = ordered_set_iterate((s), &(i))) + for ((i) = ITERATOR_FIRST; ordered_set_iterate((s), &(i), (void**)&(e)); ) DEFINE_TRIVIAL_CLEANUP_FUNC(OrderedSet*, ordered_set_free); diff --git a/src/basic/rm-rf.c b/src/basic/rm-rf.c index bafd483be2..dbbe817684 100644 --- a/src/basic/rm-rf.c +++ b/src/basic/rm-rf.c @@ -182,7 +182,7 @@ int rm_rf(const char *path, RemoveFlags flags) { if (r >= 0) return r; - if (r != -ENOTTY && r != -EINVAL) + if (r != -ENOTTY && r != -EINVAL && r != -ENOTDIR) return r; /* Not btrfs or not a subvolume */ diff --git a/src/basic/set.h b/src/basic/set.h index 4dffecd39d..51e40d3a6c 100644 --- a/src/basic/set.h +++ b/src/basic/set.h @@ -91,7 +91,7 @@ static inline unsigned set_buckets(Set *s) { return internal_hashmap_buckets(HASHMAP_BASE(s)); } -void *set_iterate(Set *s, Iterator *i); +bool set_iterate(Set *s, Iterator *i, void **value); static inline void set_clear(Set *s) { internal_hashmap_clear(HASHMAP_BASE(s)); @@ -125,7 +125,7 @@ int set_put_strdup(Set *s, const char *p); int set_put_strdupv(Set *s, char **l); #define SET_FOREACH(e, s, i) \ - for ((i) = ITERATOR_FIRST, (e) = set_iterate((s), &(i)); (e); (e) = set_iterate((s), &(i))) + for ((i) = ITERATOR_FIRST; set_iterate((s), &(i), (void**)&(e)); ) DEFINE_TRIVIAL_CLEANUP_FUNC(Set*, set_free); DEFINE_TRIVIAL_CLEANUP_FUNC(Set*, set_free_free); diff --git a/src/basic/signal-util.c b/src/basic/signal-util.c index d24730d439..90abe8af81 100644 --- a/src/basic/signal-util.c +++ b/src/basic/signal-util.c @@ -167,7 +167,7 @@ int sigprocmask_many(int how, sigset_t *old, ...) { if (sigemptyset(&ss) < 0) return -errno; - va_start(ap, how); + va_start(ap, old); r = sigset_add_many_ap(&ss, ap); va_end(ap); diff --git a/src/basic/util.c b/src/basic/util.c index b7c70af541..e0c5069ff8 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 diff --git a/src/core/execute.c b/src/core/execute.c index 444865da86..a6ff5ac56e 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) 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-message.c b/src/libsystemd/sd-bus/bus-message.c index c38b2a5fa5..983e2f62cd 100644 --- a/src/libsystemd/sd-bus/bus-message.c +++ b/src/libsystemd/sd-bus/bus-message.c @@ -803,7 +803,7 @@ _public_ int sd_bus_message_new_method_errorf( const char *format, ...) { - _cleanup_free_ sd_bus_error error = SD_BUS_ERROR_NULL; + _cleanup_bus_error_free_ sd_bus_error error = SD_BUS_ERROR_NULL; va_list ap; assert_return(name, -EINVAL); @@ -822,7 +822,7 @@ _public_ int sd_bus_message_new_method_errno( int error, const sd_bus_error *p) { - _cleanup_free_ sd_bus_error berror = SD_BUS_ERROR_NULL; + _cleanup_bus_error_free_ sd_bus_error berror = SD_BUS_ERROR_NULL; if (sd_bus_error_is_set(p)) return sd_bus_message_new_method_error(call, m, p); @@ -839,7 +839,7 @@ _public_ int sd_bus_message_new_method_errnof( const char *format, ...) { - _cleanup_free_ sd_bus_error berror = SD_BUS_ERROR_NULL; + _cleanup_bus_error_free_ sd_bus_error berror = SD_BUS_ERROR_NULL; va_list ap; va_start(ap, format); 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/bus-track.c b/src/libsystemd/sd-bus/bus-track.c index ec9340f8e1..e43891be25 100644 --- a/src/libsystemd/sd-bus/bus-track.c +++ b/src/libsystemd/sd-bus/bus-track.c @@ -248,7 +248,7 @@ _public_ const char* sd_bus_track_first(sd_bus_track *track) { track->modified = false; track->iterator = ITERATOR_FIRST; - hashmap_iterate(track->names, &track->iterator, (const void**) &n); + hashmap_iterate(track->names, &track->iterator, NULL, (const void**) &n); return n; } @@ -261,7 +261,7 @@ _public_ const char* sd_bus_track_next(sd_bus_track *track) { if (track->modified) return NULL; - hashmap_iterate(track->names, &track->iterator, (const void**) &n); + hashmap_iterate(track->names, &track->iterator, NULL, (const void**) &n); return n; } diff --git a/src/libsystemd/sd-bus/sd-bus.c b/src/libsystemd/sd-bus/sd-bus.c index 2805b29839..0881b4779a 100644 --- a/src/libsystemd/sd-bus/sd-bus.c +++ b/src/libsystemd/sd-bus/sd-bus.c @@ -2952,22 +2952,35 @@ _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. Also, when on kdbus don't install driver + * matches server side. */ + if (scope == BUS_MATCH_GENERIC || + (!bus->is_kernel && scope == BUS_MATCH_DRIVER)) { + + 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-device/sd-device.c b/src/libsystemd/sd-device/sd-device.c index 8e63b9ef56..b274f71093 100644 --- a/src/libsystemd/sd-device/sd-device.c +++ b/src/libsystemd/sd-device/sd-device.c @@ -1371,6 +1371,8 @@ _public_ int sd_device_get_usec_since_initialized(sd_device *device, uint64_t *u } _public_ const char *sd_device_get_tag_first(sd_device *device) { + void *v; + assert_return(device, NULL); (void) device_read_db(device); @@ -1378,10 +1380,13 @@ _public_ const char *sd_device_get_tag_first(sd_device *device) { device->tags_iterator_generation = device->tags_generation; device->tags_iterator = ITERATOR_FIRST; - return set_iterate(device->tags, &device->tags_iterator); + set_iterate(device->tags, &device->tags_iterator, &v); + return v; } _public_ const char *sd_device_get_tag_next(sd_device *device) { + void *v; + assert_return(device, NULL); (void) device_read_db(device); @@ -1389,10 +1394,13 @@ _public_ const char *sd_device_get_tag_next(sd_device *device) { if (device->tags_iterator_generation != device->tags_generation) return NULL; - return set_iterate(device->tags, &device->tags_iterator); + set_iterate(device->tags, &device->tags_iterator, &v); + return v; } _public_ const char *sd_device_get_devlink_first(sd_device *device) { + void *v; + assert_return(device, NULL); (void) device_read_db(device); @@ -1400,10 +1408,13 @@ _public_ const char *sd_device_get_devlink_first(sd_device *device) { device->devlinks_iterator_generation = device->devlinks_generation; device->devlinks_iterator = ITERATOR_FIRST; - return set_iterate(device->devlinks, &device->devlinks_iterator); + set_iterate(device->devlinks, &device->devlinks_iterator, &v); + return v; } _public_ const char *sd_device_get_devlink_next(sd_device *device) { + void *v; + assert_return(device, NULL); (void) device_read_db(device); @@ -1411,7 +1422,8 @@ _public_ const char *sd_device_get_devlink_next(sd_device *device) { if (device->devlinks_iterator_generation != device->devlinks_generation) return NULL; - return set_iterate(device->devlinks, &device->devlinks_iterator); + set_iterate(device->devlinks, &device->devlinks_iterator, &v); + return v; } static int device_properties_prepare(sd_device *device) { @@ -1482,7 +1494,7 @@ _public_ const char *sd_device_get_property_first(sd_device *device, const char device->properties_iterator_generation = device->properties_generation; device->properties_iterator = ITERATOR_FIRST; - value = ordered_hashmap_iterate(device->properties, &device->properties_iterator, (const void**)&key); + ordered_hashmap_iterate(device->properties, &device->properties_iterator, (void**)&value, (const void**)&key); if (_value) *_value = value; @@ -1504,7 +1516,7 @@ _public_ const char *sd_device_get_property_next(sd_device *device, const char * if (device->properties_iterator_generation != device->properties_generation) return NULL; - value = ordered_hashmap_iterate(device->properties, &device->properties_iterator, (const void**)&key); + ordered_hashmap_iterate(device->properties, &device->properties_iterator, (void**)&value, (const void**)&key); if (_value) *_value = value; @@ -1562,6 +1574,7 @@ static int device_sysattrs_read_all(sd_device *device) { } _public_ const char *sd_device_get_sysattr_first(sd_device *device) { + void *v; int r; assert_return(device, NULL); @@ -1576,16 +1589,20 @@ _public_ const char *sd_device_get_sysattr_first(sd_device *device) { device->sysattrs_iterator = ITERATOR_FIRST; - return set_iterate(device->sysattrs, &device->sysattrs_iterator); + set_iterate(device->sysattrs, &device->sysattrs_iterator, &v); + return v; } _public_ const char *sd_device_get_sysattr_next(sd_device *device) { + void *v; + assert_return(device, NULL); if (!device->sysattrs_read) return NULL; - return set_iterate(device->sysattrs, &device->sysattrs_iterator); + set_iterate(device->sysattrs, &device->sysattrs_iterator, &v); + return v; } _public_ int sd_device_has_tag(sd_device *device, const char *tag) { 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/libsystemd/sd-hwdb/sd-hwdb.c b/src/libsystemd/sd-hwdb/sd-hwdb.c index 2a0e00f7d2..40aa77ee5c 100644 --- a/src/libsystemd/sd-hwdb/sd-hwdb.c +++ b/src/libsystemd/sd-hwdb/sd-hwdb.c @@ -449,7 +449,8 @@ _public_ int sd_hwdb_seek(sd_hwdb *hwdb, const char *modalias) { } _public_ int sd_hwdb_enumerate(sd_hwdb *hwdb, const char **key, const char **value) { - const void *k, *v; + const void *k; + void *v; assert_return(hwdb, -EINVAL); assert_return(key, -EINVAL); @@ -458,7 +459,7 @@ _public_ int sd_hwdb_enumerate(sd_hwdb *hwdb, const char **key, const char **val if (hwdb->properties_modified) return -EAGAIN; - v = ordered_hashmap_iterate(hwdb->properties, &hwdb->properties_iterator, &k); + ordered_hashmap_iterate(hwdb->properties, &hwdb->properties_iterator, &v, &k); if (!k) return 0; diff --git a/src/login/logind-core.c b/src/login/logind-core.c index 440c32aa2c..f9e6ddfb3f 100644 --- a/src/login/logind-core.c +++ b/src/login/logind-core.c @@ -360,7 +360,7 @@ int manager_get_user_by_pid(Manager *m, pid_t pid, User **user) { int manager_get_idle_hint(Manager *m, dual_timestamp *t) { Session *s; bool idle_hint; - dual_timestamp ts = { 0, 0 }; + dual_timestamp ts = DUAL_TIMESTAMP_NULL; Iterator i; assert(m); diff --git a/src/login/logind-dbus.c b/src/login/logind-dbus.c index b272401e5b..e6f9ec7845 100644 --- a/src/login/logind-dbus.c +++ b/src/login/logind-dbus.c @@ -158,7 +158,7 @@ static int property_get_idle_since_hint( sd_bus_error *error) { Manager *m = userdata; - dual_timestamp t; + dual_timestamp t = DUAL_TIMESTAMP_NULL; assert(bus); assert(reply); @@ -243,6 +243,24 @@ static int property_get_scheduled_shutdown( static BUS_DEFINE_PROPERTY_GET_ENUM(property_get_handle_action, handle_action, HandleAction); +static int property_get_docked( + sd_bus *bus, + const char *path, + const char *interface, + const char *property, + sd_bus_message *reply, + void *userdata, + sd_bus_error *error) { + + Manager *m = userdata; + + assert(bus); + assert(reply); + assert(m); + + return sd_bus_message_append(reply, "b", manager_is_docked_or_multiple_displays(m)); +} + static int method_get_session(sd_bus_message *message, void *userdata, sd_bus_error *error) { _cleanup_free_ char *p = NULL; Manager *m = userdata; @@ -2406,6 +2424,7 @@ const sd_bus_vtable manager_vtable[] = { SD_BUS_PROPERTY("PreparingForShutdown", "b", property_get_preparing, 0, 0), SD_BUS_PROPERTY("PreparingForSleep", "b", property_get_preparing, 0, 0), SD_BUS_PROPERTY("ScheduledShutdown", "(st)", property_get_scheduled_shutdown, 0, 0), + SD_BUS_PROPERTY("Docked", "b", property_get_docked, 0, 0), SD_BUS_METHOD("GetSession", "s", "o", method_get_session, SD_BUS_VTABLE_UNPRIVILEGED), SD_BUS_METHOD("GetSessionByPID", "u", "o", method_get_session_by_pid, SD_BUS_VTABLE_UNPRIVILEGED), diff --git a/src/login/logind-inhibit.c b/src/login/logind-inhibit.c index 68304a1610..855c85402c 100644 --- a/src/login/logind-inhibit.c +++ b/src/login/logind-inhibit.c @@ -371,7 +371,7 @@ bool manager_is_inhibited( Inhibitor *i; Iterator j; - struct dual_timestamp ts = { 0, 0 }; + struct dual_timestamp ts = DUAL_TIMESTAMP_NULL; bool inhibited = false; assert(m); diff --git a/src/login/logind-seat.c b/src/login/logind-seat.c index 11d24ce5b4..3c30eeaa95 100644 --- a/src/login/logind-seat.c +++ b/src/login/logind-seat.c @@ -599,7 +599,7 @@ bool seat_can_graphical(Seat *s) { int seat_get_idle_hint(Seat *s, dual_timestamp *t) { Session *session; bool idle_hint = true; - dual_timestamp ts = { 0, 0 }; + dual_timestamp ts = DUAL_TIMESTAMP_NULL; assert(s); diff --git a/src/login/logind-session-dbus.c b/src/login/logind-session-dbus.c index debaa31a29..563153e2d9 100644 --- a/src/login/logind-session-dbus.c +++ b/src/login/logind-session-dbus.c @@ -163,7 +163,7 @@ static int property_get_idle_since_hint( sd_bus_error *error) { Session *s = userdata; - dual_timestamp t; + dual_timestamp t = DUAL_TIMESTAMP_NULL; uint64_t u; int r; diff --git a/src/login/logind-user-dbus.c b/src/login/logind-user-dbus.c index 8a710cef13..0f72d70b10 100644 --- a/src/login/logind-user-dbus.c +++ b/src/login/logind-user-dbus.c @@ -138,7 +138,7 @@ static int property_get_idle_since_hint( sd_bus_error *error) { User *u = userdata; - dual_timestamp t; + dual_timestamp t = DUAL_TIMESTAMP_NULL; uint64_t k; assert(bus); diff --git a/src/login/logind-user.c b/src/login/logind-user.c index a9cf529e12..6720899def 100644 --- a/src/login/logind-user.c +++ b/src/login/logind-user.c @@ -619,7 +619,7 @@ int user_finalize(User *u) { int user_get_idle_hint(User *u, dual_timestamp *t) { Session *s; bool idle_hint = true; - dual_timestamp ts = { 0, 0 }; + dual_timestamp ts = DUAL_TIMESTAMP_NULL; assert(u); diff --git a/src/machine/machine-dbus.c b/src/machine/machine-dbus.c index 0892479a9a..9f026beb13 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 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/systemctl/systemctl.c b/src/systemctl/systemctl.c index 40bea87dfa..23fc946fbf 100644 --- a/src/systemctl/systemctl.c +++ b/src/systemctl/systemctl.c @@ -1183,7 +1183,7 @@ static int list_timers(sd_bus *bus, char **args) { for (u = unit_infos; u < unit_infos + n; u++) { _cleanup_strv_free_ char **triggered = NULL; - dual_timestamp next = {}; + dual_timestamp next = DUAL_TIMESTAMP_NULL; usec_t m, last = 0; if (!endswith(u->id, ".timer")) 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-hashmap-plain.c b/src/test/test-hashmap-plain.c index c1a5ccf1f5..057b6c1dc1 100644 --- a/src/test/test-hashmap-plain.c +++ b/src/test/test-hashmap-plain.c @@ -465,6 +465,7 @@ static void test_hashmap_foreach_key(void) { hashmap_put(m, key, (void*) (const char*) "my dummy val"); HASHMAP_FOREACH_KEY(s, key, m, i) { + assert(s); if (!key_found[0] && streq(key, "key 1")) key_found[0] = true; else if (!key_found[1] && streq(key, "key 2")) 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..5ce11606c9 100644 --- a/src/udev/udevd.c +++ b/src/udev/udevd.c @@ -735,14 +735,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); |