[systemd-commits] 6 commits - Makefile-man.am TODO man/sd_bus_default.xml man/sd_bus_open_user.xml src/core src/libsystemd src/shared src/test
Lennart Poettering
lennart at kemper.freedesktop.org
Wed Apr 29 16:54:28 PDT 2015
Makefile-man.am | 36 +++--
TODO | 6
man/sd_bus_default.xml | 263 +++++++++++++++++++++++++++++++++++++
man/sd_bus_open_user.xml | 217 ------------------------------
src/core/automount.c | 4
src/core/bus-policy.c | 7
src/core/busname.c | 3
src/core/device.c | 3
src/core/manager.c | 2
src/core/swap.c | 2
src/core/unit.c | 16 +-
src/core/unit.h | 8 -
src/libsystemd/sd-bus/bus-kernel.c | 17 ++
src/shared/cgroup-util.c | 212 ++++++++++++++++++++---------
src/shared/login-shared.c | 6
src/shared/util.c | 5
src/test/test-cgroup-util.c | 18 ++
17 files changed, 507 insertions(+), 318 deletions(-)
New commits:
commit f06944d65b1a9012a5564b364608796d1fad45d2
Author: Lennart Poettering <lennart at poettering.net>
Date: Thu Apr 30 01:54:18 2015 +0200
update TODO
diff --git a/TODO b/TODO
index f2c4704..c881af3 100644
--- a/TODO
+++ b/TODO
@@ -51,6 +51,8 @@ Before 220:
Features:
+* when detecting kdbus support in busname.c make sure to check kdbus kernel ioctl version
+
* intrdouce sd_pid_get_user_slice() and friends
* journalctl: -m should access container journals directly by enumerating them via machined, and also watch containers coming and going. Benefit: nspawn --ephemeral would start working nicely with the journal.
commit 4a2af8d76f71064f2605c538102e23dc31b31cb2
Author: Lennart Poettering <lennart at poettering.net>
Date: Thu Apr 30 01:52:39 2015 +0200
man: update sd_bus_open() documentation
Update for current function prototypes.
Also, document -ESOCKTNOSUPPORT as being returned when protocol version
mismatches are detected.
diff --git a/Makefile-man.am b/Makefile-man.am
index e297b21..85579e0 100644
--- a/Makefile-man.am
+++ b/Makefile-man.am
@@ -769,6 +769,7 @@ if ENABLE_KDBUS
MANPAGES += \
man/sd_bus_creds_get_pid.3 \
man/sd_bus_creds_new_from_pid.3 \
+ man/sd_bus_default.3 \
man/sd_bus_error.3 \
man/sd_bus_message_append.3 \
man/sd_bus_message_append_array.3 \
@@ -779,7 +780,6 @@ MANPAGES += \
man/sd_bus_message_get_monotonic_usec.3 \
man/sd_bus_negotiate_fds.3 \
man/sd_bus_new.3 \
- man/sd_bus_open_user.3 \
man/sd_bus_path_encode.3 \
man/sd_bus_request_name.3 \
man/sd_event_add_child.3 \
@@ -850,9 +850,11 @@ MANPAGES_ALIAS += \
man/sd_bus_message_get_seqnum.3 \
man/sd_bus_negotiate_creds.3 \
man/sd_bus_negotiate_timestamps.3 \
+ man/sd_bus_open.3 \
man/sd_bus_open_system.3 \
- man/sd_bus_open_system_container.3 \
+ man/sd_bus_open_system_machine.3 \
man/sd_bus_open_system_remote.3 \
+ man/sd_bus_open_user.3 \
man/sd_bus_path_decode.3 \
man/sd_bus_ref.3 \
man/sd_bus_release_name.3 \
@@ -909,8 +911,8 @@ man/sd_bus_creds_has_inheritable_cap.3: man/sd_bus_creds_get_pid.3
man/sd_bus_creds_has_permitted_cap.3: man/sd_bus_creds_get_pid.3
man/sd_bus_creds_ref.3: man/sd_bus_creds_new_from_pid.3
man/sd_bus_creds_unref.3: man/sd_bus_creds_new_from_pid.3
-man/sd_bus_default_system.3: man/sd_bus_open_user.3
-man/sd_bus_default_user.3: man/sd_bus_open_user.3
+man/sd_bus_default_system.3: man/sd_bus_default.3
+man/sd_bus_default_user.3: man/sd_bus_default.3
man/sd_bus_error_copy.3: man/sd_bus_error.3
man/sd_bus_error_free.3: man/sd_bus_error.3
man/sd_bus_error_get_errno.3: man/sd_bus_error.3
@@ -930,9 +932,11 @@ man/sd_bus_message_get_reply_cookie.3: man/sd_bus_message_get_cookie.3
man/sd_bus_message_get_seqnum.3: man/sd_bus_message_get_monotonic_usec.3
man/sd_bus_negotiate_creds.3: man/sd_bus_negotiate_fds.3
man/sd_bus_negotiate_timestamps.3: man/sd_bus_negotiate_fds.3
-man/sd_bus_open_system.3: man/sd_bus_open_user.3
-man/sd_bus_open_system_container.3: man/sd_bus_open_user.3
-man/sd_bus_open_system_remote.3: man/sd_bus_open_user.3
+man/sd_bus_open.3: man/sd_bus_default.3
+man/sd_bus_open_system.3: man/sd_bus_default.3
+man/sd_bus_open_system_machine.3: man/sd_bus_default.3
+man/sd_bus_open_system_remote.3: man/sd_bus_default.3
+man/sd_bus_open_user.3: man/sd_bus_default.3
man/sd_bus_path_decode.3: man/sd_bus_path_encode.3
man/sd_bus_ref.3: man/sd_bus_new.3
man/sd_bus_release_name.3: man/sd_bus_request_name.3
@@ -1059,10 +1063,10 @@ man/sd_bus_creds_ref.html: man/sd_bus_creds_new_from_pid.html
man/sd_bus_creds_unref.html: man/sd_bus_creds_new_from_pid.html
$(html-alias)
-man/sd_bus_default_system.html: man/sd_bus_open_user.html
+man/sd_bus_default_system.html: man/sd_bus_default.html
$(html-alias)
-man/sd_bus_default_user.html: man/sd_bus_open_user.html
+man/sd_bus_default_user.html: man/sd_bus_default.html
$(html-alias)
man/sd_bus_error_copy.html: man/sd_bus_error.html
@@ -1122,13 +1126,19 @@ man/sd_bus_negotiate_creds.html: man/sd_bus_negotiate_fds.html
man/sd_bus_negotiate_timestamps.html: man/sd_bus_negotiate_fds.html
$(html-alias)
-man/sd_bus_open_system.html: man/sd_bus_open_user.html
+man/sd_bus_open.html: man/sd_bus_default.html
+ $(html-alias)
+
+man/sd_bus_open_system.html: man/sd_bus_default.html
+ $(html-alias)
+
+man/sd_bus_open_system_machine.html: man/sd_bus_default.html
$(html-alias)
-man/sd_bus_open_system_container.html: man/sd_bus_open_user.html
+man/sd_bus_open_system_remote.html: man/sd_bus_default.html
$(html-alias)
-man/sd_bus_open_system_remote.html: man/sd_bus_open_user.html
+man/sd_bus_open_user.html: man/sd_bus_default.html
$(html-alias)
man/sd_bus_path_decode.html: man/sd_bus_path_encode.html
@@ -1721,6 +1731,7 @@ EXTRA_DIST += \
man/sd_booted.xml \
man/sd_bus_creds_get_pid.xml \
man/sd_bus_creds_new_from_pid.xml \
+ man/sd_bus_default.xml \
man/sd_bus_error.xml \
man/sd_bus_message_append.xml \
man/sd_bus_message_append_array.xml \
@@ -1731,7 +1742,6 @@ EXTRA_DIST += \
man/sd_bus_message_get_monotonic_usec.xml \
man/sd_bus_negotiate_fds.xml \
man/sd_bus_new.xml \
- man/sd_bus_open_user.xml \
man/sd_bus_path_encode.xml \
man/sd_bus_request_name.xml \
man/sd_event_add_child.xml \
diff --git a/man/sd_bus_default.xml b/man/sd_bus_default.xml
new file mode 100644
index 0000000..98ec04e
--- /dev/null
+++ b/man/sd_bus_default.xml
@@ -0,0 +1,263 @@
+<?xml version='1.0'?> <!--*- Mode: nxml; nxml-child-indent: 2; indent-tabs-mode: nil -*-->
+<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
+"http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
+
+<!--
+ This file is part of systemd.
+
+ Copyright 2014 Zbigniew Jędrzejewski-Szmek
+
+ 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="sd_bus_default" conditional="ENABLE_KDBUS">
+
+ <refentryinfo>
+ <title>sd_bus_default</title>
+ <productname>systemd</productname>
+
+ <authorgroup>
+ <author>
+ <contrib>A monkey with a typewriter</contrib>
+ <firstname>Zbigniew</firstname>
+ <surname>Jędrzejewski-Szmek</surname>
+ <email>zbyszek at in.waw.pl</email>
+ </author>
+ </authorgroup>
+ </refentryinfo>
+
+ <refmeta>
+ <refentrytitle>sd_bus_default</refentrytitle>
+ <manvolnum>3</manvolnum>
+ </refmeta>
+
+ <refnamediv>
+ <refname>sd_bus_default</refname>
+ <refname>sd_bus_default_user</refname>
+ <refname>sd_bus_default_system</refname>
+
+ <refname>sd_bus_open</refname>
+ <refname>sd_bus_open_user</refname>
+ <refname>sd_bus_open_system</refname>
+ <refname>sd_bus_open_system_remote</refname>
+ <refname>sd_bus_open_system_machine</refname>
+
+ <refpurpose>Acquire a connection to a system or user bus</refpurpose>
+ </refnamediv>
+
+ <refsynopsisdiv>
+ <funcsynopsis>
+ <funcsynopsisinfo>#include <systemd/sd-bus.h></funcsynopsisinfo>
+
+ <funcprototype>
+ <funcdef>int <function>sd_bus_default</function></funcdef>
+ <paramdef>sd_bus **<parameter>bus</parameter></paramdef>
+ </funcprototype>
+
+ <funcprototype>
+ <funcdef>int <function>sd_bus_default_user</function></funcdef>
+ <paramdef>sd_bus **<parameter>bus</parameter></paramdef>
+ </funcprototype>
+
+ <funcprototype>
+ <funcdef>int <function>sd_bus_default_system</function></funcdef>
+ <paramdef>sd_bus **<parameter>bus</parameter></paramdef>
+ </funcprototype>
+
+ <funcprototype>
+ <funcdef>int <function>sd_bus_open</function></funcdef>
+ <paramdef>sd_bus **<parameter>bus</parameter></paramdef>
+ </funcprototype>
+
+ <funcprototype>
+ <funcdef>int <function>sd_bus_open_user</function></funcdef>
+ <paramdef>sd_bus **<parameter>bus</parameter></paramdef>
+ </funcprototype>
+
+ <funcprototype>
+ <funcdef>int <function>sd_bus_open_system</function></funcdef>
+ <paramdef>sd_bus **<parameter>bus</parameter></paramdef>
+ </funcprototype>
+
+ <funcprototype>
+ <funcdef>int <function>sd_bus_open_system_remote</function></funcdef>
+ <paramdef>sd_bus **<parameter>bus</parameter></paramdef>
+ <paramdef>const char *<parameter>host</parameter></paramdef>
+ </funcprototype>
+
+ <funcprototype>
+ <funcdef>int <function>sd_bus_open_system_machine</function></funcdef>
+ <paramdef>sd_bus **<parameter>bus</parameter></paramdef>
+ <paramdef>const char *<parameter>machine</parameter></paramdef>
+ </funcprototype>
+
+ </funcsynopsis>
+ </refsynopsisdiv>
+
+ <refsect1>
+ <title>Description</title>
+
+ <para><function>sd_bus_default()</function> acquires a bus
+ connection object to the user bus when invoked in user context or
+ to the system bus otherwise. The connection object is associated
+ to the calling thread. Each time the function is invoked from the
+ same thread the same object is returned, but its reference count
+ increased by one, as long as at least one reference is kept. When
+ the last reference to the connection is dropped (using the
+ <function>sd_bus_unref()</function> call), the connection is
+ terminated. Note that the connection is not automatically
+ terminated when the associated thread ends. It is important to
+ drop the last reference to the bus connection explicitly before
+ the thread ends or otherwise the connection will be leaked.</para>
+
+ <para><function>sd_bus_default_user()</function> returns a user
+ bus connection object associated to the calling thread.
+ <function>sd_bus_default_system()</function> is similar, but
+ connects to the system bus.</para>
+
+ <para><function>sd_bus_open()</function> creates a new,
+ independent bus connection to the user bus when invoked in user
+ context or the system bus
+ otherwise. <function>sd_bus_open_user()</function> is similar, but
+ connects only to the user bus.
+ <function>sd_bus_open_system()</function> does the same, but
+ connects to the system bus. In contrast to
+ <function>sd_bus_default()</function>,
+ <function>sd_bus_default_user()</function>,
+ <function>sd_bus_default_system()</function> these calls return
+ new, independent connection objects that are not associated with
+ the invoking thread and are not shared between multiple
+ invocations. It is recommended to share connections per thread to
+ efficiently make use the available resources. Thus, it is
+ recommended to use <function>sd_bus_default()</function>,
+ <function>sd_bus_default_user()</function>,
+ <function>sd_bus_default_system()</function> to connect to the
+ user or system busses.</para>
+
+ <para>If the <varname>$DBUS_SESSION_BUS_ADDRESS</varname> environment
+ variable is set
+ (cf. <citerefentry project='man-pages'><refentrytitle>environ</refentrytitle><manvolnum>7</manvolnum></citerefentry>),
+ it will be used as the address of the user bus. This variable can
+ contain multiple addresses separated by <literal>;</literal>. If
+ this variable is not set, a suitable default for the default user
+ D-Bus instance will be used.</para>
+
+ <para>If the <varname>$DBUS_SYSTEM_BUS_ADDRESS</varname>
+ environment variable is set, it will be used as the address of the
+ system bus. This variable uses the same syntax as
+ <varname>$DBUS_SESSION_BUS_ADDRESS</varname>. If this variable is
+ not set, a suitable default for the default system D-Bus instance
+ will be used.</para>
+
+ <para><function>sd_bus_open_system_remote()</function> connects to
+ the system bus on the specified <parameter>host</parameter> using
+ SSH. <parameter>host</parameter> consists of an optional user name
+ followed by the <literal>@</literal> symbol, and the hostname.
+ </para>
+
+ <para><function>sd_bus_open_system_container()</function> connects
+ to the system bus in the specified <parameter>machine</parameter>,
+ where <parameter>machine</parameter> is the name of a local
+ container. See
+ <citerefentry><refentrytitle>machinectl</refentrytitle><manvolnum>1</manvolnum></citerefentry>
+ for more information about "machines".</para>
+
+ </refsect1>
+
+ <refsect1>
+ <title>Return Value</title>
+
+ <para>On success, these calls return 0 or a positive
+ integer. On failure, these calls return a negative
+ errno-style error code.</para>
+ </refsect1>
+
+ <refsect1>
+ <title>Reference ownership</title>
+ <para>The functions <function>sd_bus_open_user()</function>,
+ <function>sd_bus_open()</function>,
+ <function>sd_bus_open_system()</function>,
+ <function>sd_bus_open_system_remote()</function>, and
+ <function>sd_bus_open_system_machine()</function> return a new
+ object and the caller owns the sole reference. When not needed
+ anymore, this reference should be destroyed with
+ <citerefentry><refentrytitle>sd_bus_unref</refentrytitle><manvolnum>3</manvolnum></citerefentry>.
+ </para>
+
+ <para>The functions <function>sd_bus_default()</function>,
+ <function>sd_bus_default_user()</function> and
+ <function>sd_bus_default_system()</function> do not necessarily
+ create a new object, but increase the connection reference by
+ one. Use
+ <citerefentry><refentrytitle>sd_bus_unref</refentrytitle><manvolnum>3</manvolnum></citerefentry>
+ to drop the reference.</para>
+ </refsect1>
+
+ <refsect1>
+ <title>Errors</title>
+
+ <para>Returned errors may indicate the following problems:</para>
+
+ <variablelist>
+
+ <varlistentry>
+ <term><constant>-EINVAL</constant></term>
+
+ <listitem><para>The specified parameters are invalid.</para></listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><constant>-ENOMEM</constant></term>
+
+ <listitem><para>Memory allocation failed.</para></listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><constant>-ESOCKTNOSUPPORT</constant></term>
+
+ <listitem><para>The protocol version required to connect to the selected bus is not supported.</para></listitem>
+ </varlistentry>
+ </variablelist>
+
+ <para>In addition, any further connection-related errors may be
+ by returned. See <citerefentry><refentrytitle>sd_bus_send</refentrytitle><manvolnum>3</manvolnum></citerefentry>.</para>
+ </refsect1>
+
+ <refsect1>
+ <title>Notes</title>
+
+ <para><function>sd_bus_open_user()</function> and the other
+ functions described here are available as a shared library, which
+ can be compiled and linked to with the
+ <constant>libsystemd</constant> <citerefentry
+ project='die-net'><refentrytitle>pkg-config</refentrytitle><manvolnum>1</manvolnum></citerefentry>
+ file.</para>
+ </refsect1>
+
+ <refsect1>
+ <title>See Also</title>
+
+ <para>
+ <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
+ <citerefentry><refentrytitle>sd-bus</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
+ <citerefentry><refentrytitle>sd_bus_new</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
+ <citerefentry><refentrytitle>sd_bus_ref</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
+ <citerefentry><refentrytitle>sd_bus_unref</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
+ <citerefentry project='die-net'><refentrytitle>ssh</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
+ <citerefentry><refentrytitle>systemd-machined.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
+ <citerefentry><refentrytitle>machinectl</refentrytitle><manvolnum>1</manvolnum></citerefentry>
+ </para>
+ </refsect1>
+
+</refentry>
diff --git a/man/sd_bus_open_user.xml b/man/sd_bus_open_user.xml
deleted file mode 100644
index 3c16eac..0000000
--- a/man/sd_bus_open_user.xml
+++ /dev/null
@@ -1,217 +0,0 @@
-<?xml version='1.0'?> <!--*- Mode: nxml; nxml-child-indent: 2; indent-tabs-mode: nil -*-->
-<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
-"http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
-
-<!--
- This file is part of systemd.
-
- Copyright 2014 Zbigniew Jędrzejewski-Szmek
-
- 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="sd_bus_open_user" conditional="ENABLE_KDBUS">
-
- <refentryinfo>
- <title>sd_bus_open_user</title>
- <productname>systemd</productname>
-
- <authorgroup>
- <author>
- <contrib>A monkey with a typewriter</contrib>
- <firstname>Zbigniew</firstname>
- <surname>Jędrzejewski-Szmek</surname>
- <email>zbyszek at in.waw.pl</email>
- </author>
- </authorgroup>
- </refentryinfo>
-
- <refmeta>
- <refentrytitle>sd_bus_open_user</refentrytitle>
- <manvolnum>3</manvolnum>
- </refmeta>
-
- <refnamediv>
- <refname>sd_bus_open_user</refname>
- <refname>sd_bus_open_system</refname>
- <refname>sd_bus_open_system_remote</refname>
- <refname>sd_bus_open_system_container</refname>
-
- <refname>sd_bus_default_user</refname>
- <refname>sd_bus_default_system</refname>
-
- <refpurpose>Open a connection to the system or user bus</refpurpose>
- </refnamediv>
-
- <refsynopsisdiv>
- <funcsynopsis>
- <funcsynopsisinfo>#include <systemd/sd-bus.h></funcsynopsisinfo>
-
- <funcprototype>
- <funcdef>int <function>sd_bus_open_user</function></funcdef>
- <paramdef>sd_bus **<parameter>bus</parameter></paramdef>
- </funcprototype>
-
- <funcprototype>
- <funcdef>int <function>sd_bus_open_system</function></funcdef>
- <paramdef>sd_bus **<parameter>bus</parameter></paramdef>
- </funcprototype>
-
- <funcprototype>
- <funcdef>int <function>sd_bus_open_system_remote</function></funcdef>
- <paramdef>const char *<parameter>host</parameter></paramdef>
- <paramdef>sd_bus **<parameter>bus</parameter></paramdef>
- </funcprototype>
-
- <funcprototype>
- <funcdef>int <function>sd_bus_open_system_container</function></funcdef>
- <paramdef>const char *<parameter>machine</parameter></paramdef>
- <paramdef>sd_bus **<parameter>bus</parameter></paramdef>
- </funcprototype>
-
- <funcprototype>
- <funcdef>int <function>sd_bus_default_user</function></funcdef>
- <paramdef>sd_bus **<parameter>bus</parameter></paramdef>
- </funcprototype>
-
- <funcprototype>
- <funcdef>int <function>sd_bus_default_system</function></funcdef>
- <paramdef>sd_bus **<parameter>bus</parameter></paramdef>
- </funcprototype>
- </funcsynopsis>
- </refsynopsisdiv>
-
- <refsect1>
- <title>Description</title>
-
- <para><function>sd_bus_open_user()</function> creates a new bus
- object and opens a connection to the user bus.
- <function>sd_bus_open_system()</function> does the same, but
- connects to the system bus.</para>
-
- <para>If the <varname>$DBUS_SESSION_BUS_ADDRESS</varname> environment
- variable is set
- (cf. <citerefentry project='man-pages'><refentrytitle>environ</refentrytitle><manvolnum>7</manvolnum></citerefentry>),
- it will be used as the address of the user bus. This variable can
- contain multiple addresses separated by <literal>;</literal>. If
- this variable is not set, a suitable default for the default user
- D-Bus instance will be used.</para>
-
- <para>If the <varname>$DBUS_SYSTEM_BUS_ADDRESS</varname> environment
- variable is set, it will be used as the address of the system
- bus. This variable uses the same syntax as
- <varname>$DBUS_SESSION_BUS_ADDRESS</varname>/. If this variable is
- not set, a suitable default for the default system D-Bus instance
- will be used.</para>
-
- <para><function>sd_bus_open_system_remote()</function> connects to
- the system bus on the specified <parameter>host</parameter> using
- SSH. <parameter>host</parameter> consists of an optional user name
- followed by the <literal>@</literal> symbol, and the hostname.
- </para>
-
- <para><function>sd_bus_open_system_container()</function> connects
- to the system bus in the specified <parameter>machine</parameter>,
- where <parameter>machine</parameter> is the name of a container.
- See
- <citerefentry><refentrytitle>machinectl</refentrytitle><manvolnum>1</manvolnum></citerefentry>
- for more information about "machines".</para>
-
- <para><function>sd_bus_default_user()</function> returns a bus
- object connected to the user bus. Each thread has its own object, but it
- may be passed around. It is created on the first invocation of
- <function>sd_bus_default_user()</function>, and subsequent
- invocations returns a reference to the same object.</para>
-
- <para><function>sd_bus_default_system()</function> is similar to
- <function>sd_bus_default_user()</function>, but connects to the
- system bus.</para>
- </refsect1>
-
- <refsect1>
- <title>Return Value</title>
-
- <para>On success, these calls return 0 or a positive
- integer. On failure, these calls return a negative
- errno-style error code.</para>
- </refsect1>
-
- <refsect1>
- <title>Reference ownership</title>
- <para>Functions <function>sd_bus_open_user()</function>,
- <function>sd_bus_open_system()</function>,
- <function>sd_bus_open_system_remote()</function>, and
- <function>sd_bus_open_system_machine()</function> return a new
- object and the caller owns the sole reference. When not needed
- anymore, this reference should be destroyed with
- <citerefentry><refentrytitle>sd_bus_unref</refentrytitle><manvolnum>3</manvolnum></citerefentry>.
- </para>
-
- <para>The functions <function>sd_bus_default_user()</function> and
- <function>sd_bus_default_system()</function> do not create a new
- reference.</para>
- </refsect1>
-
- <refsect1>
- <title>Errors</title>
-
- <para>Returned errors may indicate the following problems:</para>
-
- <variablelist>
-
- <varlistentry>
- <term><constant>-EINVAL</constant></term>
-
- <listitem><para>Specified parameter is invalid
- (<constant>NULL</constant> in case of output
- parameters).</para></listitem>
- </varlistentry>
-
- <varlistentry>
- <term><constant>-ENOMEM</constant></term>
-
- <listitem><para>Memory allocation failed.</para></listitem>
- </varlistentry>
-
- <para>In addition, any further connection-related errors may be
- by returned. See <citerefentry><refentrytitle>sd_bus_send</refentrytitle><manvolnum>3</manvolnum></citerefentry>.</para>
- </variablelist>
- </refsect1>
-
- <refsect1>
- <title>Notes</title>
-
- <para><function>sd_bus_open_user()</function> and other functions
- described here are available as a shared library, which can be
- compiled and linked to with the
- <constant>libsystemd</constant> <citerefentry project='die-net'><refentrytitle>pkg-config</refentrytitle><manvolnum>1</manvolnum></citerefentry>
- file.</para>
- </refsect1>
-
- <refsect1>
- <title>See Also</title>
-
- <para>
- <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
- <citerefentry><refentrytitle>sd-bus</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
- <citerefentry><refentrytitle>sd_bus_new</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
- <citerefentry><refentrytitle>sd_bus_ref</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
- <citerefentry><refentrytitle>sd_bus_unref</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
- <citerefentry project='die-net'><refentrytitle>ssh</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
- <citerefentry><refentrytitle>systemd-machined.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
- <citerefentry><refentrytitle>machinectl</refentrytitle><manvolnum>1</manvolnum></citerefentry>
- </para>
- </refsect1>
-
-</refentry>
commit 1c2e9646e4a1720fc8ad35c705c195ae1a2c5ce0
Author: Lennart Poettering <lennart at poettering.net>
Date: Thu Apr 30 01:29:00 2015 +0200
core: simplify unit type detection logic
Introduce a new call unit_type_supported() and make use of it
everywhere.
Also, drop Manager parameter from per-type supported method prototype.
diff --git a/src/core/automount.c b/src/core/automount.c
index b1109bd..73b75f1 100644
--- a/src/core/automount.c
+++ b/src/core/automount.c
@@ -1012,11 +1012,9 @@ static void automount_reset_failed(Unit *u) {
a->result = AUTOMOUNT_SUCCESS;
}
-static bool automount_supported(Manager *m) {
+static bool automount_supported(void) {
static int supported = -1;
- assert(m);
-
if (supported < 0)
supported = access("/dev/autofs", F_OK) >= 0;
diff --git a/src/core/busname.c b/src/core/busname.c
index 94db122..20d49fe 100644
--- a/src/core/busname.c
+++ b/src/core/busname.c
@@ -984,9 +984,8 @@ static int busname_get_timeout(Unit *u, uint64_t *timeout) {
return 1;
}
-static bool busname_supported(Manager *m) {
+static bool busname_supported(void) {
static int supported = -1;
- assert(m);
if (supported < 0)
supported = access("/sys/fs/kdbus", F_OK) >= 0;
diff --git a/src/core/device.c b/src/core/device.c
index 5656c96..f8e65b8 100644
--- a/src/core/device.c
+++ b/src/core/device.c
@@ -750,9 +750,8 @@ static int device_dispatch_io(sd_event_source *source, int fd, uint32_t revents,
return 0;
}
-static bool device_supported(Manager *m) {
+static bool device_supported(void) {
static int read_only = -1;
- assert(m);
/* If /sys is read-only we don't support device units, and any
* attempts to start one should fail immediately. */
diff --git a/src/core/manager.c b/src/core/manager.c
index cf7337e..b494521 100644
--- a/src/core/manager.c
+++ b/src/core/manager.c
@@ -975,7 +975,7 @@ int manager_enumerate(Manager *m) {
for (c = 0; c < _UNIT_TYPE_MAX; c++) {
int q;
- if (unit_vtable[c]->supported && !unit_vtable[c]->supported(m)) {
+ if (!unit_type_supported(c)) {
log_debug("Unit type .%s is not supported on this system.", unit_type_to_string(c));
continue;
}
diff --git a/src/core/swap.c b/src/core/swap.c
index ae45b80..a9834a7 100644
--- a/src/core/swap.c
+++ b/src/core/swap.c
@@ -1407,7 +1407,7 @@ static int swap_get_timeout(Unit *u, uint64_t *timeout) {
return 1;
}
-static bool swap_supported(Manager *m) {
+static bool swap_supported(void) {
static int supported = -1;
/* If swap support is not available in the kernel, or we are
diff --git a/src/core/unit.c b/src/core/unit.c
index 7ef8dbb..6071bd5 100644
--- a/src/core/unit.c
+++ b/src/core/unit.c
@@ -1448,7 +1448,7 @@ int unit_start(Unit *u) {
return unit_start(following);
}
- if (UNIT_VTABLE(u)->supported && !UNIT_VTABLE(u)->supported(u->manager))
+ if (!unit_supported(u))
return -EOPNOTSUPP;
/* If it is stopped, but we cannot start it, then fail */
@@ -2855,7 +2855,7 @@ int unit_add_node_link(Unit *u, const char *what, bool wants) {
/* When device units aren't supported (such as in a
* container), don't create dependencies on them. */
- if (unit_vtable[UNIT_DEVICE]->supported && !unit_vtable[UNIT_DEVICE]->supported(u->manager))
+ if (!unit_type_supported(UNIT_DEVICE))
return 0;
e = unit_name_from_path(what, ".device");
@@ -3690,6 +3690,18 @@ int unit_setup_exec_runtime(Unit *u) {
return exec_runtime_make(rt, unit_get_exec_context(u), u->id);
}
+bool unit_type_supported(UnitType t) {
+ if (_unlikely_(t < 0))
+ return false;
+ if (_unlikely_(t >= _UNIT_TYPE_MAX))
+ return false;
+
+ if (!unit_vtable[t]->supported)
+ return true;
+
+ return unit_vtable[t]->supported();
+}
+
static const char* const unit_active_state_table[_UNIT_ACTIVE_STATE_MAX] = {
[UNIT_ACTIVE] = "active",
[UNIT_RELOADING] = "reloading",
diff --git a/src/core/unit.h b/src/core/unit.h
index 1a44271..31b1215 100644
--- a/src/core/unit.h
+++ b/src/core/unit.h
@@ -402,7 +402,7 @@ struct UnitVTable {
/* If this function is set and return false all jobs for units
* of this type will immediately fail. */
- bool (*supported)(Manager *m);
+ bool (*supported)(void);
/* The interface name */
const char *bus_interface;
@@ -601,6 +601,12 @@ int unit_make_transient(Unit *u);
int unit_require_mounts_for(Unit *u, const char *path);
+bool unit_type_supported(UnitType t);
+
+static inline bool unit_supported(Unit *u) {
+ return unit_type_supported(u->type);
+}
+
const char *unit_active_state_to_string(UnitActiveState i) _const_;
UnitActiveState unit_active_state_from_string(const char *s) _pure_;
commit 524d896ac17518b824b2c94b3b0b2a23c23da08f
Author: Lennart Poettering <lennart at poettering.net>
Date: Thu Apr 30 01:24:48 2015 +0200
sd-bus: when we get ENOTTY on the HELLO ioctl assume incompatible API version
As perparation for future incompatible kdbus kernel API changes.
diff --git a/src/core/bus-policy.c b/src/core/bus-policy.c
index 064eee1..a6a8fcd 100644
--- a/src/core/bus-policy.c
+++ b/src/core/bus-policy.c
@@ -150,8 +150,11 @@ int bus_kernel_make_starter(
hello->attach_flags_send = _KDBUS_ATTACH_ANY;
hello->attach_flags_recv = _KDBUS_ATTACH_ANY;
- if (ioctl(fd, KDBUS_CMD_HELLO, hello) < 0)
+ if (ioctl(fd, KDBUS_CMD_HELLO, hello) < 0) {
+ if (errno == ENOTTY) /* Major API change */
+ return -ESOCKTNOSUPPORT;
return -errno;
+ }
/* not interested in any output values */
cmd_free.offset = hello->offset;
@@ -160,7 +163,7 @@ int bus_kernel_make_starter(
/* The higher 32bit of the bus_flags fields are considered
* 'incompatible flags'. Refuse them all for now. */
if (hello->bus_flags > 0xFFFFFFFFULL)
- return -EOPNOTSUPP;
+ return -ESOCKTNOSUPPORT;
return fd;
}
diff --git a/src/libsystemd/sd-bus/bus-kernel.c b/src/libsystemd/sd-bus/bus-kernel.c
index 556b5eb..8e3b643 100644
--- a/src/libsystemd/sd-bus/bus-kernel.c
+++ b/src/libsystemd/sd-bus/bus-kernel.c
@@ -962,8 +962,16 @@ int bus_kernel_take_fd(sd_bus *b) {
}
r = ioctl(b->input_fd, KDBUS_CMD_HELLO, hello);
- if (r < 0)
+ if (r < 0) {
+ if (errno == ENOTTY)
+ /* If the ioctl is not supported we assume that the
+ * API version changed in a major incompatible way,
+ * let's indicate an API incompatibility in this
+ * case. */
+ return -ESOCKTNOSUPPORT;
+
return -errno;
+ }
if (!b->kdbus_buffer) {
b->kdbus_buffer = mmap(NULL, KDBUS_POOL_SIZE, PROT_READ, MAP_SHARED, b->input_fd, 0);
@@ -977,7 +985,7 @@ int bus_kernel_take_fd(sd_bus *b) {
/* The higher 32bit of the bus_flags fields are considered
* 'incompatible flags'. Refuse them all for now. */
if (hello->bus_flags > 0xFFFFFFFFULL) {
- r = -EOPNOTSUPP;
+ r = -ESOCKTNOSUPPORT;
goto fail;
}
@@ -1611,6 +1619,11 @@ int bus_kernel_create_bus(const char *name, bool world, char **s) {
if (ioctl(fd, KDBUS_CMD_BUS_MAKE, make) < 0) {
safe_close(fd);
+
+ /* Major API change? then the ioctls got shuffled around. */
+ if (errno == ENOTTY)
+ return -ESOCKTNOSUPPORT;
+
return -errno;
}
commit 765027454b70c15afdf5507e85ff23cb16e1f889
Author: Lennart Poettering <lennart at poettering.net>
Date: Thu Apr 30 00:49:31 2015 +0200
update TODO
diff --git a/TODO b/TODO
index a4f37f9..f2c4704 100644
--- a/TODO
+++ b/TODO
@@ -49,11 +49,9 @@ Before 220:
* introduce argv0array=
-* sd_bus_creds: allow distinguishing "missing data" and "data not applicable" when querying data
-
Features:
-* sd_bus_send() without bus argument?
+* intrdouce sd_pid_get_user_slice() and friends
* journalctl: -m should access container journals directly by enumerating them via machined, and also watch containers coming and going. Benefit: nspawn --ephemeral would start working nicely with the journal.
commit 8b0849e9710d721c5d0b775aaf0fd662eefa1449
Author: Lennart Poettering <lennart at poettering.net>
Date: Thu Apr 30 00:47:41 2015 +0200
core: rework cgroup path parse logic
Various cleanups, be stricter when parsing unit paths.
Most importantly: return the root slice "-.slice" when asked for slice
of paths that contain no slice component.
diff --git a/src/shared/cgroup-util.c b/src/shared/cgroup-util.c
index 7521b8b..67e6f70 100644
--- a/src/shared/cgroup-util.c
+++ b/src/shared/cgroup-util.c
@@ -40,6 +40,7 @@
#include "fileio.h"
#include "special.h"
#include "mkdir.h"
+#include "login-shared.h"
int cg_enumerate_processes(const char *controller, const char *path, FILE **_f) {
_cleanup_free_ char *fs = NULL;
@@ -1140,13 +1141,17 @@ int cg_pid_get_path_shifted(pid_t pid, const char *root, char **cgroup) {
}
int cg_path_decode_unit(const char *cgroup, char **unit){
- char *e, *c, *s;
+ char *c, *s;
+ size_t n;
assert(cgroup);
assert(unit);
- e = strchrnul(cgroup, '/');
- c = strndupa(cgroup, e - cgroup);
+ n = strcspn(cgroup, "/");
+ if (n < 3)
+ return -ENXIO;
+
+ c = strndupa(cgroup, n);
c = cg_unescape(c);
if (!unit_name_is_valid(c, TEMPLATE_INVALID))
@@ -1160,7 +1165,31 @@ int cg_path_decode_unit(const char *cgroup, char **unit){
return 0;
}
+static bool valid_slice_name(const char *p, size_t n) {
+
+ if (!p)
+ return false;
+
+ if (n < strlen("x.slice"))
+ return false;
+
+ if (memcmp(p + n - 6, ".slice", 6) == 0) {
+ char buf[n+1], *c;
+
+ memcpy(buf, p, n);
+ buf[n] = 0;
+
+ c = cg_unescape(buf);
+
+ return unit_name_is_valid(c, TEMPLATE_INVALID);
+ }
+
+ return false;
+}
+
static const char *skip_slices(const char *p) {
+ assert(p);
+
/* Skips over all slice assignments */
for (;;) {
@@ -1169,22 +1198,35 @@ static const char *skip_slices(const char *p) {
p += strspn(p, "/");
n = strcspn(p, "/");
- if (n <= 6 || memcmp(p + n - 6, ".slice", 6) != 0)
+ if (!valid_slice_name(p, n))
return p;
p += n;
}
}
-int cg_path_get_unit(const char *path, char **unit) {
+int cg_path_get_unit(const char *path, char **ret) {
const char *e;
+ char *unit;
+ int r;
assert(path);
- assert(unit);
+ assert(ret);
e = skip_slices(path);
- return cg_path_decode_unit(e, unit);
+ r = cg_path_decode_unit(e, &unit);
+ if (r < 0)
+ return r;
+
+ /* We skipped over the slices, don't accept any now */
+ if (endswith(unit, ".slice")) {
+ free(unit);
+ return -ENXIO;
+ }
+
+ *ret = unit;
+ return 0;
}
int cg_pid_get_unit(pid_t pid, char **unit) {
@@ -1206,18 +1248,35 @@ int cg_pid_get_unit(pid_t pid, char **unit) {
static const char *skip_session(const char *p) {
size_t n;
- assert(p);
+ if (isempty(p))
+ return NULL;
p += strspn(p, "/");
n = strcspn(p, "/");
- if (n < strlen("session-x.scope") || memcmp(p, "session-", 8) != 0 || memcmp(p + n - 6, ".scope", 6) != 0)
+ if (n < strlen("session-x.scope"))
return NULL;
- p += n;
- p += strspn(p, "/");
+ if (memcmp(p, "session-", 8) == 0 && memcmp(p + n - 6, ".scope", 6) == 0) {
+ char buf[n - 8 - 6 + 1];
+
+ memcpy(buf, p + 8, n - 8 - 6);
+ buf[n - 8 - 6] = 0;
+
+ /* Note that session scopes never need unescaping,
+ * since they cannot conflict with the kernel's own
+ * names, hence we don't need to call cg_unescape()
+ * here. */
+
+ if (!session_id_valid(buf))
+ return false;
- return p;
+ p += n;
+ p += strspn(p, "/");
+ return p;
+ }
+
+ return NULL;
}
/**
@@ -1226,25 +1285,45 @@ static const char *skip_session(const char *p) {
static const char *skip_user_manager(const char *p) {
size_t n;
- assert(p);
+ if (isempty(p))
+ return NULL;
p += strspn(p, "/");
n = strcspn(p, "/");
- if (n < strlen("user at x.service") || memcmp(p, "user@", 5) != 0 || memcmp(p + n - 8, ".service", 8) != 0)
+ if (n < strlen("user at x.service"))
return NULL;
- p += n;
- p += strspn(p, "/");
+ if (memcmp(p, "user@", 5) == 0 && memcmp(p + n - 8, ".service", 8) == 0) {
+ char buf[n - 5 - 8 + 1];
+
+ memcpy(buf, p + 5, n - 5 - 8);
+ buf[n - 5 - 8] = 0;
+
+ /* Note that user manager services never need unescaping,
+ * since they cannot conflict with the kernel's own
+ * names, hence we don't need to call cg_unescape()
+ * here. */
+
+ if (parse_uid(buf, NULL) < 0)
+ return NULL;
+
+ p += n;
+ p += strspn(p, "/");
+
+ return p;
+ }
- return p;
+ return NULL;
}
-int cg_path_get_user_unit(const char *path, char **unit) {
+int cg_path_get_user_unit(const char *path, char **ret) {
const char *e, *t;
+ char *unit;
+ int r;
assert(path);
- assert(unit);
+ assert(ret);
/* We always have to parse the path from the beginning as unit
* cgroups might have arbitrary child cgroups and we shouldn't get
@@ -1253,17 +1332,30 @@ int cg_path_get_user_unit(const char *path, char **unit) {
/* Skip slices, if there are any */
e = skip_slices(path);
- /* Skip the session scope or user manager... */
- t = skip_session(e);
+ /* Skip the user manager... */
+ t = skip_user_manager(e);
+
+ /* Alternatively skip the user session... */
if (!t)
- t = skip_user_manager(e);
+ t = skip_session(e);
if (!t)
return -ENXIO;
/* ... and skip more slices if there are any */
e = skip_slices(t);
- return cg_path_decode_unit(e, unit);
+ r = cg_path_decode_unit(e, &unit);
+ if (r < 0)
+ return r;
+
+ /* We skipped over the slices, don't accept any now */
+ if (endswith(unit, ".slice")) {
+ free(unit);
+ return -ENXIO;
+ }
+
+ *ret = unit;
+ return 0;
}
int cg_pid_get_user_unit(pid_t pid, char **unit) {
@@ -1308,36 +1400,35 @@ int cg_pid_get_machine_name(pid_t pid, char **machine) {
}
int cg_path_get_session(const char *path, char **session) {
- const char *e, *n, *x, *y;
- char *s;
+ _cleanup_free_ char *unit = NULL;
+ char *start, *end;
+ int r;
assert(path);
- /* Skip slices, if there are any */
- e = skip_slices(path);
+ r = cg_path_get_unit(path, &unit);
+ if (r < 0)
+ return r;
- n = strchrnul(e, '/');
- if (e == n)
+ start = startswith(unit, "session-");
+ if (!start)
return -ENXIO;
-
- s = strndupa(e, n - e);
- s = cg_unescape(s);
-
- x = startswith(s, "session-");
- if (!x)
+ end = endswith(start, ".scope");
+ if (!end)
return -ENXIO;
- y = endswith(x, ".scope");
- if (!y || x == y)
+
+ *end = 0;
+ if (!session_id_valid(start))
return -ENXIO;
if (session) {
- char *r;
+ char *rr;
- r = strndup(x, y - x);
- if (!r)
+ rr = strdup(start);
+ if (!rr)
return -ENOMEM;
- *session = r;
+ *session = rr;
}
return 0;
@@ -1356,9 +1447,7 @@ int cg_pid_get_session(pid_t pid, char **session) {
int cg_path_get_owner_uid(const char *path, uid_t *uid) {
_cleanup_free_ char *slice = NULL;
- const char *start, *end;
- char *s;
- uid_t u;
+ char *start, *end;
int r;
assert(path);
@@ -1370,20 +1459,14 @@ int cg_path_get_owner_uid(const char *path, uid_t *uid) {
start = startswith(slice, "user-");
if (!start)
return -ENXIO;
- end = endswith(slice, ".slice");
+ end = endswith(start, ".slice");
if (!end)
return -ENXIO;
- s = strndupa(start, end - start);
- if (!s)
+ *end = 0;
+ if (parse_uid(start, uid) < 0)
return -ENXIO;
- if (parse_uid(s, &u) < 0)
- return -ENXIO;
-
- if (uid)
- *uid = u;
-
return 0;
}
@@ -1400,7 +1483,6 @@ int cg_pid_get_owner_uid(pid_t pid, uid_t *uid) {
int cg_path_get_slice(const char *p, char **slice) {
const char *e = NULL;
- size_t m = 0;
assert(p);
assert(slice);
@@ -1411,23 +1493,23 @@ int cg_path_get_slice(const char *p, char **slice) {
p += strspn(p, "/");
n = strcspn(p, "/");
- if (n <= 6 || memcmp(p + n - 6, ".slice", 6) != 0) {
- char *s;
+ if (!valid_slice_name(p, n)) {
- if (!e)
- return -ENXIO;
+ if (!e) {
+ char *s;
- s = strndup(e, m);
- if (!s)
- return -ENOMEM;
+ s = strdup("-.slice");
+ if (!s)
+ return -ENOMEM;
- *slice = s;
- return 0;
+ *slice = s;
+ return 0;
+ }
+
+ return cg_path_decode_unit(e, slice);
}
e = p;
- m = n;
-
p += n;
}
}
diff --git a/src/shared/login-shared.c b/src/shared/login-shared.c
index 054c775..64650a9 100644
--- a/src/shared/login-shared.c
+++ b/src/shared/login-shared.c
@@ -23,7 +23,9 @@
#include "def.h"
bool session_id_valid(const char *id) {
- assert(id);
- return id[0] && id[strspn(id, LETTERS DIGITS)] == '\0';
+ if (isempty(id))
+ return false;
+
+ return id[strspn(id, LETTERS DIGITS)] == '\0';
}
diff --git a/src/shared/util.c b/src/shared/util.c
index 6a883d7..2c7254e 100644
--- a/src/shared/util.c
+++ b/src/shared/util.c
@@ -350,7 +350,6 @@ int parse_uid(const char *s, uid_t* ret_uid) {
int r;
assert(s);
- assert(ret_uid);
r = safe_atolu(s, &ul);
if (r < 0)
@@ -369,7 +368,9 @@ int parse_uid(const char *s, uid_t* ret_uid) {
if (uid == (uid_t) 0xFFFF)
return -ENXIO;
- *ret_uid = uid;
+ if (ret_uid)
+ *ret_uid = uid;
+
return 0;
}
diff --git a/src/test/test-cgroup-util.c b/src/test/test-cgroup-util.c
index fff9ec2..759ca44 100644
--- a/src/test/test-cgroup-util.c
+++ b/src/test/test-cgroup-util.c
@@ -125,6 +125,23 @@ static void test_path_get_owner_uid(void) {
check_p_g_o_u("", -ENXIO, 0);
}
+static void check_p_g_slice(const char *path, int code, const char *result) {
+ _cleanup_free_ char *s = NULL;
+
+ assert_se(cg_path_get_slice(path, &s) == code);
+ assert_se(streq_ptr(s, result));
+}
+
+static void test_path_get_slice(void) {
+ check_p_g_slice("/user.slice", 0, "user.slice");
+ check_p_g_slice("/foobar", 0, "-.slice");
+ check_p_g_slice("/user.slice/user-waldo.slice", 0, "user-waldo.slice");
+ check_p_g_slice("", 0, "-.slice");
+ check_p_g_slice("foobar", 0, "-.slice");
+ check_p_g_slice("foobar.slice", 0, "foobar.slice");
+ check_p_g_slice("foo.slice/foo-bar.slice/waldo.service", 0, "foo-bar.slice");
+}
+
static void test_get_paths(void) {
_cleanup_free_ char *a = NULL;
@@ -255,6 +272,7 @@ int main(void) {
test_path_get_user_unit();
test_path_get_session();
test_path_get_owner_uid();
+ test_path_get_slice();
TEST_REQ_RUNNING_SYSTEMD(test_get_paths());
test_proc();
TEST_REQ_RUNNING_SYSTEMD(test_escape());
More information about the systemd-commits
mailing list