man: document user slice sd-login calls we added a while back
authorLennart Poettering <lennart@poettering.net>
Tue, 23 Jun 2015 19:22:56 +0000 (21:22 +0200)
committerDaniel Mack <daniel@zonque.org>
Wed, 8 Jul 2015 17:53:42 +0000 (13:53 -0400)
Makefile-man.am
man/sd_pid_get_session.xml

index 08d22b3..218a299 100644 (file)
@@ -1937,11 +1937,13 @@ MANPAGES_ALIAS += \
        man/sd_peer_get_session.3 \
        man/sd_peer_get_slice.3 \
        man/sd_peer_get_unit.3 \
+       man/sd_peer_get_user_slice.3 \
        man/sd_peer_get_user_unit.3 \
        man/sd_pid_get_machine_name.3 \
        man/sd_pid_get_owner_uid.3 \
        man/sd_pid_get_slice.3 \
        man/sd_pid_get_unit.3 \
+       man/sd_pid_get_user_slice.3 \
        man/sd_pid_get_user_unit.3 \
        man/sd_seat_can_graphical.3 \
        man/sd_seat_can_multi_session.3 \
@@ -1979,11 +1981,13 @@ man/sd_peer_get_owner_uid.3: man/sd_pid_get_session.3
 man/sd_peer_get_session.3: man/sd_pid_get_session.3
 man/sd_peer_get_slice.3: man/sd_pid_get_session.3
 man/sd_peer_get_unit.3: man/sd_pid_get_session.3
+man/sd_peer_get_user_slice.3: man/sd_pid_get_session.3
 man/sd_peer_get_user_unit.3: man/sd_pid_get_session.3
 man/sd_pid_get_machine_name.3: man/sd_pid_get_session.3
 man/sd_pid_get_owner_uid.3: man/sd_pid_get_session.3
 man/sd_pid_get_slice.3: man/sd_pid_get_session.3
 man/sd_pid_get_unit.3: man/sd_pid_get_session.3
+man/sd_pid_get_user_slice.3: man/sd_pid_get_session.3
 man/sd_pid_get_user_unit.3: man/sd_pid_get_session.3
 man/sd_seat_can_graphical.3: man/sd_seat_get_active.3
 man/sd_seat_can_multi_session.3: man/sd_seat_get_active.3
@@ -2049,6 +2053,9 @@ man/sd_peer_get_slice.html: man/sd_pid_get_session.html
 man/sd_peer_get_unit.html: man/sd_pid_get_session.html
        $(html-alias)
 
+man/sd_peer_get_user_slice.html: man/sd_pid_get_session.html
+       $(html-alias)
+
 man/sd_peer_get_user_unit.html: man/sd_pid_get_session.html
        $(html-alias)
 
@@ -2064,6 +2071,9 @@ man/sd_pid_get_slice.html: man/sd_pid_get_session.html
 man/sd_pid_get_unit.html: man/sd_pid_get_session.html
        $(html-alias)
 
+man/sd_pid_get_user_slice.html: man/sd_pid_get_session.html
+       $(html-alias)
+
 man/sd_pid_get_user_unit.html: man/sd_pid_get_session.html
        $(html-alias)
 
index b46d471..9c6706c 100644 (file)
     <refname>sd_pid_get_owner_uid</refname>
     <refname>sd_pid_get_machine_name</refname>
     <refname>sd_pid_get_slice</refname>
+    <refname>sd_pid_get_user_slice</refname>
     <refname>sd_peer_get_session</refname>
     <refname>sd_peer_get_unit</refname>
     <refname>sd_peer_get_user_unit</refname>
     <refname>sd_peer_get_owner_uid</refname>
     <refname>sd_peer_get_machine_name</refname>
     <refname>sd_peer_get_slice</refname>
-    <refpurpose>Determine session, service, owner of a
-    session, container/VM or slice of a specific
-    PID or socket peer</refpurpose>
+    <refname>sd_peer_get_user_slice</refname>
+    <refpurpose>Determine session, unit, owner of a session,
+    container/VM or slice of a specific PID or socket
+    peer</refpurpose>
   </refnamediv>
 
   <refsynopsisdiv>
       </funcprototype>
 
       <funcprototype>
+        <funcdef>int <function>sd_pid_get_user_slice</function></funcdef>
+        <paramdef>pid_t <parameter>pid</parameter></paramdef>
+        <paramdef>char **<parameter>slice</parameter></paramdef>
+      </funcprototype>
+
+      <funcprototype>
         <funcdef>int <function>sd_peer_get_session</function></funcdef>
         <paramdef>int <parameter>fd</parameter></paramdef>
         <paramdef>char **<parameter>session</parameter></paramdef>
         <paramdef>int <parameter>fd</parameter></paramdef>
         <paramdef>char **<parameter>slice</parameter></paramdef>
       </funcprototype>
+
+      <funcprototype>
+        <funcdef>int <function>sd_peer_get_user_slice</function></funcdef>
+        <paramdef>int <parameter>fd</parameter></paramdef>
+        <paramdef>char **<parameter>slice</parameter></paramdef>
+      </funcprototype>
     </funcsynopsis>
   </refsynopsisdiv>
 
     call after use.</para>
 
     <para><function>sd_pid_get_unit()</function> may be used to
-    determine the systemd system unit (i.e. system service) identifier
-    of a process identified by the specified PID. The unit name is a
-    short string, suitable for usage in file system paths. Note that
-    not all processes are part of a system unit/service (e.g. user
-    processes, or kernel threads). For processes not being part of a
-    systemd system unit this function will fail with -ENXIO (More
-    specifically: this call will not work for processes that are part
-    of user units, use <function>sd_pid_get_user_unit()</function> for
-    that.) The returned string needs to be freed with the libc
-    <citerefentry
+    determine the systemd system unit (i.e. system service or scope
+    unit) identifier of a process identified by the specified PID. The
+    unit name is a short string, suitable for usage in file system
+    paths. Note that not all processes are part of a system
+    unit/service (e.g. user processes, or kernel threads). For
+    processes not being part of a systemd system unit this function
+    will fail with -ENXIO (More specifically: this call will not work
+    for kernel threads.) The returned string needs to be freed with
+    the libc <citerefentry
     project='man-pages'><refentrytitle>free</refentrytitle><manvolnum>3</manvolnum></citerefentry>
     call after use.</para>
 
     <para><function>sd_pid_get_user_unit()</function> may be used to
-    determine the systemd user unit (i.e. user service) identifier of
-    a process identified by the specified PID. This is similar to
-    <function>sd_pid_get_unit()</function> but applies to user units
-    instead of system units.</para>
+    determine the systemd user unit (i.e. user service or scope unit)
+    identifier of a process identified by the specified PID. This is
+    similar to <function>sd_pid_get_unit()</function> but applies to
+    user units instead of system units.</para>
 
     <para><function>sd_pid_get_owner_uid()</function> may be used to
-    determine the Unix user identifier of the owner of the session of
-    a process identified the specified PID. Note that this function
-    will succeed for user processes which are shared between multiple
-    login sessions of the same user, where
+    determine the Unix UID (user identifier) of the owner of the
+    session of a process identified the specified PID. Note that this
+    function will succeed for user processes which are shared between
+    multiple login sessions of the same user, where
     <function>sd_pid_get_session()</function> will fail. For processes
     not being part of a login session and not being a shared process
     of a user this function will fail with -ENXIO.</para>
     <citerefentry project='man-pages'><refentrytitle>free</refentrytitle><manvolnum>3</manvolnum></citerefentry>
     call after use.</para>
 
+    <para>Similar, <function>sd_pid_get_user_slice()</function>
+    returns the user slice (as managed by the user's systemd instance)
+    of a process.</para>
+
     <para>If the <varname>pid</varname> parameter of any of these
     functions is passed as 0, the operation is executed for the
     calling process.</para>
     <function>sd_peer_get_unit()</function>,
     <function>sd_peer_get_user_unit()</function>,
     <function>sd_peer_get_owner_uid()</function>,
-    <function>sd_peer_get_machine_name()</function> and
-    <function>sd_peer_get_slice()</function> calls operate similar to
-    their PID counterparts, but operate on a connected AF_UNIX socket
-    and retrieve information about the connected peer process.</para>
+    <function>sd_peer_get_machine_name()</function>,
+    <function>sd_peer_get_slice()</function> and
+    <function>sd_peer_get_user_slice()</function> calls operate
+    similar to their PID counterparts, but operate on a connected
+    AF_UNIX socket and retrieve information about the connected peer
+    process. Note that these fields are retrieved via
+    <filename>/proc</filename>, and hence are not suitable for
+    authorization purposes, as they are subject to races.</para>
   </refsect1>
 
   <refsect1>
     <function>sd_pid_get_owner_uid()</function>,
     <function>sd_pid_get_machine_name()</function>,
     <function>sd_pid_get_slice()</function>,
+    <function>sd_pid_get_user_slice()</function>,
     <function>sd_peer_get_session()</function>,
     <function>sd_peer_get_unit()</function>,
     <function>sd_peer_get_user_unit()</function>,
     <function>sd_peer_get_owner_uid()</function>,
-    <function>sd_peer_get_machine_name()</function> and
-    <function>sd_peer_get_slice()</function> interfaces 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>
+    <function>sd_peer_get_machine_name()</function>,
+    <function>sd_peer_get_slice()</function> and
+    <function>sd_peer_get_user_slice()</function> interfaces 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>
 
     <para>Note that the login session identifier as