chiark / gitweb /
man: extend sd-login(7) in regards to mixing D-Bus and synchronous library calls...
[elogind.git] / man / sd-login.xml
index 62ec6ffefd07e3dc6e8bfef5547233b03c6cc479..3fc0e16f698c7a177da7e2544445ad20cbb15fbf 100644 (file)
                 actively make changes to the seat configuration,
                 terminate login sessions, or switch session on a seat
                 you need to utilize the D-Bus API of
                 actively make changes to the seat configuration,
                 terminate login sessions, or switch session on a seat
                 you need to utilize the D-Bus API of
-                systemd-logind.</para>
+                systemd-logind, instead.</para>
+
+                <para>These functions synchronously access data in
+                <filename>/proc</filename>,
+                <filename>/sys/fs/cgroup</filename> and
+                <filename>/run</filename>. All of these are virtual
+                file systems, hence the runtime cost of the accesses
+                is relatively cheap.</para>
+
+                <para>It is possible (and often a very good choice) to
+                mix calls to the synchronous interface of
+                <filename>sd-login.h</filename> with the asynchronous
+                D-Bus interface of systemd-logind. However, if this is
+                done you need to think a bit about possible races
+                since the stream of events from D-Bus and from
+                <filename>sd-login.h</filename> interfaces such as the
+                login monitor are asynchronous and not ordered against
+                each other.</para>
+
+                <para>If the functions return string arrays, these are
+                generally NULL terminated and need to be freed by the
+                caller with the libc
+                <citerefentry><refentrytitle>free</refentrytitle><manvolnum>3</manvolnum></citerefentry>
+                call after use, including the strings referenced
+                therein. Similar, individual strings returned need to
+                be freed, as well.</para>
+
+                <para>As a special exception, instead of an empty
+                string array NULL may be returned, which should be
+                treated equivalent to an empty string array.</para>
 
                 <para>See
                 <citerefentry><refentrytitle>sd_pid_get_session</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
 
                 <para>See
                 <citerefentry><refentrytitle>sd_pid_get_session</refentrytitle><manvolnum>3</manvolnum></citerefentry>,