Michal Schmidt e43452
From caaed693b9e8b16102c794fa52850bbcb7cc6fd9 Mon Sep 17 00:00:00 2001
Michal Schmidt e43452
From: Lennart Poettering <lennart@poettering.net>
Michal Schmidt e43452
Date: Mon, 19 Dec 2011 03:02:17 +0100
Michal Schmidt f1996e
Subject: [PATCH] man: document the sd-login interfaces (cherry picked from
Michal Schmidt f1996e
 commit 0b3b020a178cf3b957fed627de13c895773995ec)
Michal Schmidt e43452
Michal Schmidt e43452
---
Michal Schmidt e43452
 man/sd_get_seats.xml         |  125 +++++++++++++++++++++++++++++
Michal Schmidt e43452
 man/sd_login_monitor_new.xml |  172 +++++++++++++++++++++++++++++++++++++++
Michal Schmidt e43452
 man/sd_pid_get_session.xml   |  136 +++++++++++++++++++++++++++++++
Michal Schmidt e43452
 man/sd_seat_get_active.xml   |  150 ++++++++++++++++++++++++++++++++++
Michal Schmidt e43452
 man/sd_session_is_active.xml |  134 +++++++++++++++++++++++++++++++
Michal Schmidt e43452
 man/sd_uid_get_state.xml     |  182 ++++++++++++++++++++++++++++++++++++++++++
Michal Schmidt e43452
 6 files changed, 899 insertions(+), 0 deletions(-)
Michal Schmidt e43452
 create mode 100644 man/sd_get_seats.xml
Michal Schmidt e43452
 create mode 100644 man/sd_login_monitor_new.xml
Michal Schmidt e43452
 create mode 100644 man/sd_pid_get_session.xml
Michal Schmidt e43452
 create mode 100644 man/sd_seat_get_active.xml
Michal Schmidt e43452
 create mode 100644 man/sd_session_is_active.xml
Michal Schmidt e43452
 create mode 100644 man/sd_uid_get_state.xml
Michal Schmidt e43452
Michal Schmidt e43452
diff --git a/man/sd_get_seats.xml b/man/sd_get_seats.xml
Michal Schmidt e43452
new file mode 100644
Michal Schmidt e43452
index 0000000..bbc396a
Michal Schmidt e43452
--- /dev/null
Michal Schmidt e43452
+++ b/man/sd_get_seats.xml
Michal Schmidt e43452
@@ -0,0 +1,125 @@
Michal Schmidt e43452
+ 
Michal Schmidt e43452
+
Michal Schmidt e43452
+        "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
Michal Schmidt e43452
+
Michal Schmidt e43452
+
Michal Schmidt e43452
+  This file is part of systemd.
Michal Schmidt e43452
+
Michal Schmidt e43452
+  Copyright 2010 Lennart Poettering
Michal Schmidt e43452
+
Michal Schmidt e43452
+  systemd is free software; you can redistribute it and/or modify it
Michal Schmidt e43452
+  under the terms of the GNU General Public License as published by
Michal Schmidt e43452
+  the Free Software Foundation; either version 2 of the License, or
Michal Schmidt e43452
+  (at your option) any later version.
Michal Schmidt e43452
+
Michal Schmidt e43452
+  systemd is distributed in the hope that it will be useful, but
Michal Schmidt e43452
+  WITHOUT ANY WARRANTY; without even the implied warranty of
Michal Schmidt e43452
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Michal Schmidt e43452
+  General Public License for more details.
Michal Schmidt e43452
+
Michal Schmidt e43452
+  You should have received a copy of the GNU General Public License
Michal Schmidt e43452
+  along with systemd; If not, see <http://www.gnu.org/licenses/>.
Michal Schmidt e43452
+-->
Michal Schmidt e43452
+
Michal Schmidt e43452
+<refentry id="sd_get_seats">
Michal Schmidt e43452
+
Michal Schmidt e43452
+        <refentryinfo>
Michal Schmidt e43452
+                <title>sd_get_seats</title>
Michal Schmidt e43452
+                <productname>systemd</productname>
Michal Schmidt e43452
+
Michal Schmidt e43452
+                <authorgroup>
Michal Schmidt e43452
+                        <author>
Michal Schmidt e43452
+                                <contrib>Developer</contrib>
Michal Schmidt e43452
+                                <firstname>Lennart</firstname>
Michal Schmidt e43452
+                                <surname>Poettering</surname>
Michal Schmidt e43452
+                                <email>lennart@poettering.net</email>
Michal Schmidt e43452
+                        </author>
Michal Schmidt e43452
+                </authorgroup>
Michal Schmidt e43452
+        </refentryinfo>
Michal Schmidt e43452
+
Michal Schmidt e43452
+        <refmeta>
Michal Schmidt e43452
+                <refentrytitle>sd_get_seats</refentrytitle>
Michal Schmidt e43452
+                <manvolnum>3</manvolnum>
Michal Schmidt e43452
+        </refmeta>
Michal Schmidt e43452
+
Michal Schmidt e43452
+        <refnamediv>
Michal Schmidt e43452
+                <refname>sd_get_seats</refname>
Michal Schmidt e43452
+                <refname>sd_get_sessions</refname>
Michal Schmidt e43452
+                <refname>sd_get_uids</refname>
Michal Schmidt e43452
+                <refpurpose>Determine available seats, sessions and logged in users</refpurpose>
Michal Schmidt e43452
+        </refnamediv>
Michal Schmidt e43452
+
Michal Schmidt e43452
+        <refsynopsisdiv>
Michal Schmidt e43452
+                <funcsynopsis>
Michal Schmidt e43452
+                        <funcsynopsisinfo>#include <systemd/sd-login.h></funcsynopsisinfo>
Michal Schmidt e43452
+
Michal Schmidt e43452
+                        <funcprototype>
Michal Schmidt e43452
+                                <funcdef>int <function>sd_get_seats</function></funcdef>
Michal Schmidt e43452
+                                <paramdef>char*** <parameter>seats</parameter></paramdef>
Michal Schmidt e43452
+                        </funcprototype>
Michal Schmidt e43452
+
Michal Schmidt e43452
+                        <funcprototype>
Michal Schmidt e43452
+                                <funcdef>int <function>sd_get_sessions</function></funcdef>
Michal Schmidt e43452
+                                <paramdef>char*** <parameter>sessions</parameter></paramdef>
Michal Schmidt e43452
+                        </funcprototype>
Michal Schmidt e43452
+
Michal Schmidt e43452
+                        <funcprototype>
Michal Schmidt e43452
+                                <funcdef>int <function>sd_get_uids</function></funcdef>
Michal Schmidt e43452
+                                <paramdef>char*** <parameter>sessions</parameter></paramdef>
Michal Schmidt e43452
+                        </funcprototype>
Michal Schmidt e43452
+
Michal Schmidt e43452
+                </funcsynopsis>
Michal Schmidt e43452
+        </refsynopsisdiv>
Michal Schmidt e43452
+
Michal Schmidt e43452
+        <refsect1>
Michal Schmidt e43452
+                <title>Description</title>
Michal Schmidt e43452
+
Michal Schmidt e43452
+                <para><function>sd_get_seats()</function> may be used
Michal Schmidt e43452
+                to determine all currently available local
Michal Schmidt e43452
+                seats. Returns an array of seat identifiers. The
Michal Schmidt e43452
+                returned array and all strings it references need to
Michal Schmidt e43452
+                be freed with the libc
Michal Schmidt e43452
+                <citerefentry><refentrytitle>free</refentrytitle><manvolnum>3</manvolnum></citerefentry>
Michal Schmidt e43452
+                call after use.</para>
Michal Schmidt e43452
+
Michal Schmidt e43452
+                <para>Similar, <function>sd_get_sessions()</function> may
Michal Schmidt e43452
+                be used to determine all current login sessions.</para>
Michal Schmidt e43452
+
Michal Schmidt e43452
+                <para>Similar, <function>sd_get_uids()</function> may
Michal Schmidt e43452
+                be used to determine all Unix users who currently have login sessions.</para>
Michal Schmidt e43452
+        </refsect1>
Michal Schmidt e43452
+
Michal Schmidt e43452
+        <refsect1>
Michal Schmidt e43452
+                <title>Return Value</title>
Michal Schmidt e43452
+
Michal Schmidt e43452
+                <para>On success <function>sd_get_seats()</function>,
Michal Schmidt e43452
+                <function>sd_get_sessions()</function> and
Michal Schmidt e43452
+                <function>sd_get_uids()</function> return the number
Michal Schmidt e43452
+                of entries in the arrays. On failure, these calls
Michal Schmidt e43452
+                return a negative errno-style error code.</para>
Michal Schmidt e43452
+        </refsect1>
Michal Schmidt e43452
+
Michal Schmidt e43452
+        <refsect1>
Michal Schmidt e43452
+                <title>Notes</title>
Michal Schmidt e43452
+
Michal Schmidt e43452
+                <para>The <function>sd_get_seats()</function>,
Michal Schmidt e43452
+                <function>sd_get_sessions()</function> and
Michal Schmidt e43452
+                <function>sd_get_uids()</function> interfaces
Michal Schmidt e43452
+                are available as shared library, which can be compiled
Michal Schmidt e43452
+                and linked to with the
Michal Schmidt e43452
+                <literal>libsystemd-login</literal>
Michal Schmidt e43452
+                <citerefentry><refentrytitle>pkg-config</refentrytitle><manvolnum>1</manvolnum></citerefentry>
Michal Schmidt e43452
+                file.</para>
Michal Schmidt e43452
+        </refsect1>
Michal Schmidt e43452
+
Michal Schmidt e43452
+        <refsect1>
Michal Schmidt e43452
+                <title>See Also</title>
Michal Schmidt e43452
+
Michal Schmidt e43452
+                <para>
Michal Schmidt e43452
+                        <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
Michal Schmidt e43452
+                        <citerefentry><refentrytitle>sd-login</refentrytitle><manvolnum>7</manvolnum></citerefentry>,
Michal Schmidt e43452
+                        <citerefentry><refentrytitle>sd_session_get_seat</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
Michal Schmidt e43452
+                </para>
Michal Schmidt e43452
+        </refsect1>
Michal Schmidt e43452
+
Michal Schmidt e43452
+</refentry>
Michal Schmidt e43452
diff --git a/man/sd_login_monitor_new.xml b/man/sd_login_monitor_new.xml
Michal Schmidt e43452
new file mode 100644
Michal Schmidt e43452
index 0000000..2b37f00
Michal Schmidt e43452
--- /dev/null
Michal Schmidt e43452
+++ b/man/sd_login_monitor_new.xml
Michal Schmidt e43452
@@ -0,0 +1,172 @@
Michal Schmidt e43452
+ 
Michal Schmidt e43452
+
Michal Schmidt e43452
+        "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
Michal Schmidt e43452
+
Michal Schmidt e43452
+
Michal Schmidt e43452
+  This file is part of systemd.
Michal Schmidt e43452
+
Michal Schmidt e43452
+  Copyright 2010 Lennart Poettering
Michal Schmidt e43452
+
Michal Schmidt e43452
+  systemd is free software; you can redistribute it and/or modify it
Michal Schmidt e43452
+  under the terms of the GNU General Public License as published by
Michal Schmidt e43452
+  the Free Software Foundation; either version 2 of the License, or
Michal Schmidt e43452
+  (at your option) any later version.
Michal Schmidt e43452
+
Michal Schmidt e43452
+  systemd is distributed in the hope that it will be useful, but
Michal Schmidt e43452
+  WITHOUT ANY WARRANTY; without even the implied warranty of
Michal Schmidt e43452
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Michal Schmidt e43452
+  General Public License for more details.
Michal Schmidt e43452
+
Michal Schmidt e43452
+  You should have received a copy of the GNU General Public License
Michal Schmidt e43452
+  along with systemd; If not, see <http://www.gnu.org/licenses/>.
Michal Schmidt e43452
+-->
Michal Schmidt e43452
+
Michal Schmidt e43452
+<refentry id="sd_login_monitor_new">
Michal Schmidt e43452
+
Michal Schmidt e43452
+        <refentryinfo>
Michal Schmidt e43452
+                <title>sd_login_monitor_new</title>
Michal Schmidt e43452
+                <productname>systemd</productname>
Michal Schmidt e43452
+
Michal Schmidt e43452
+                <authorgroup>
Michal Schmidt e43452
+                        <author>
Michal Schmidt e43452
+                                <contrib>Developer</contrib>
Michal Schmidt e43452
+                                <firstname>Lennart</firstname>
Michal Schmidt e43452
+                                <surname>Poettering</surname>
Michal Schmidt e43452
+                                <email>lennart@poettering.net</email>
Michal Schmidt e43452
+                        </author>
Michal Schmidt e43452
+                </authorgroup>
Michal Schmidt e43452
+        </refentryinfo>
Michal Schmidt e43452
+
Michal Schmidt e43452
+        <refmeta>
Michal Schmidt e43452
+                <refentrytitle>sd_login_monitor_new</refentrytitle>
Michal Schmidt e43452
+                <manvolnum>3</manvolnum>
Michal Schmidt e43452
+        </refmeta>
Michal Schmidt e43452
+
Michal Schmidt e43452
+        <refnamediv>
Michal Schmidt e43452
+                <refname>sd_login_monitor_new</refname>
Michal Schmidt e43452
+                <refname>sd_login_monitor_unref</refname>
Michal Schmidt e43452
+                <refname>sd_login_monitor_flush</refname>
Michal Schmidt e43452
+                <refname>sd_login_monitor_get_fd</refname>
Michal Schmidt e43452
+                <refpurpose>Monitor login sessions, seats and users</refpurpose>
Michal Schmidt e43452
+        </refnamediv>
Michal Schmidt e43452
+
Michal Schmidt e43452
+        <refsynopsisdiv>
Michal Schmidt e43452
+                <funcsynopsis>
Michal Schmidt e43452
+                        <funcsynopsisinfo>#include <systemd/sd-login.h></funcsynopsisinfo>
Michal Schmidt e43452
+
Michal Schmidt e43452
+                        <funcprototype>
Michal Schmidt e43452
+                                <funcdef>int <function>sd_login_monitor_new</function></funcdef>
Michal Schmidt e43452
+                                <paramdef>const char* <parameter>category</parameter></paramdef>
Michal Schmidt e43452
+                                <paramdef>sd_login_monitor** <parameter>ret</parameter></paramdef>
Michal Schmidt e43452
+                        </funcprototype>
Michal Schmidt e43452
+
Michal Schmidt e43452
+                        <funcprototype>
Michal Schmidt e43452
+                                <funcdef>sd_login_monitor* <function>sd_login_monitor_unref</function></funcdef>
Michal Schmidt e43452
+                                <paramdef>sd_login_monitor* <parameter>m</parameter></paramdef>
Michal Schmidt e43452
+                        </funcprototype>
Michal Schmidt e43452
+
Michal Schmidt e43452
+                        <funcprototype>
Michal Schmidt e43452
+                                <funcdef>int <function>sd_login_monitor_flush</function></funcdef>
Michal Schmidt e43452
+                                <paramdef>sd_login_monitor* <parameter>m</parameter></paramdef>
Michal Schmidt e43452
+                        </funcprototype>
Michal Schmidt e43452
+
Michal Schmidt e43452
+                        <funcprototype>
Michal Schmidt e43452
+                                <funcdef>int <function>sd_login_monitor_get_fd</function></funcdef>
Michal Schmidt e43452
+                                <paramdef>sd_login_monitor* <parameter>m</parameter></paramdef>
Michal Schmidt e43452
+                        </funcprototype>
Michal Schmidt e43452
+
Michal Schmidt e43452
+                </funcsynopsis>
Michal Schmidt e43452
+        </refsynopsisdiv>
Michal Schmidt e43452
+
Michal Schmidt e43452
+        <refsect1>
Michal Schmidt e43452
+                <title>Description</title>
Michal Schmidt e43452
+
Michal Schmidt e43452
+                <para><function>sd_login_monitor_new()</function> may
Michal Schmidt e43452
+                be used to monitor login session, users and seats. Via
Michal Schmidt e43452
+                a monitor object a file descriptor can be integrated
Michal Schmidt e43452
+                into an application defined event loop which is woken
Michal Schmidt e43452
+                up each time a user logs in, logs out or a seat is
Michal Schmidt e43452
+                added or removed, or a session, user, or seat changes
Michal Schmidt e43452
+                state otherwise. The first parameter takes a string
Michal Schmidt e43452
+                which can be either <literal>seat</literal> (to get
Michal Schmidt e43452
+                only notifications about seats being added, removed or
Michal Schmidt e43452
+                changed), <literal>session</literal> (to get only
Michal Schmidt e43452
+                notifications about sessions being created or removed
Michal Schmidt e43452
+                or changed) or <literal>uid</literal> (to get only
Michal Schmidt e43452
+                notifications when a user changes state in respect to
Michal Schmidt e43452
+                logins). If notifications shall be generated in all
Michal Schmidt e43452
+                these conditions, NULL may be passed. Note that in
Michal Schmidt e43452
+                future additional categories may be defined. The
Michal Schmidt e43452
+                second parameter returns a monitor object and needs to
Michal Schmidt e43452
+                be freed with the
Michal Schmidt e43452
+                <function>sd_login_monitor_unref()</function> call
Michal Schmidt e43452
+                after use.</para>
Michal Schmidt e43452
+
Michal Schmidt e43452
+                <para><function>sd_login_monitor_unref()</function>
Michal Schmidt e43452
+                may be used to destroy a monitor object. Note that
Michal Schmidt e43452
+                this will invalidate any file descriptor returned by
Michal Schmidt e43452
+                <function>sd_login_monitor_get_fd()</function>.</para>
Michal Schmidt e43452
+
Michal Schmidt e43452
+                <para><function>sd_login_monitor_flush()</function>
Michal Schmidt e43452
+                may be used to reset the wakeup state of the monitor
Michal Schmidt e43452
+                object. Whenever an event causes the monitor to wake
Michal Schmidt e43452
+                up the event loop via the file descriptor this
Michal Schmidt e43452
+                function needs to be called to reset the wake-up
Michal Schmidt e43452
+                state. If this call is not invoked the file descriptor
Michal Schmidt e43452
+                will immediately wake up the event loop again.</para>
Michal Schmidt e43452
+
Michal Schmidt e43452
+                <para><function>sd_login_monitor_get_fd()</function>
Michal Schmidt e43452
+                may be used to retrieve the file descriptor of the
Michal Schmidt e43452
+                monitor object that may be integrated in an
Michal Schmidt e43452
+                application defined event loop, based around
Michal Schmidt e43452
+                <citerefentry><refentrytitle>poll</refentrytitle><manvolnum>2</manvolnum></citerefentry>
Michal Schmidt e43452
+                or a similar interface. The application should include
Michal Schmidt e43452
+                the returned file descriptor as wake up source for
Michal Schmidt e43452
+                POLLIN events. Whenever a wake-up is triggered the
Michal Schmidt e43452
+                file descriptor needs to be reset via
Michal Schmidt e43452
+                <function>sd_login_monitor_flush()</function>. An
Michal Schmidt e43452
+                application needs to reread the login state with a
Michal Schmidt e43452
+                function like
Michal Schmidt e43452
+                <citerefentry><refentrytitle>sd_get_seats</refentrytitle><manvolnum>3</manvolnum></citerefentry>
Michal Schmidt e43452
+                or similar to determine what changed.</para>
Michal Schmidt e43452
+        </refsect1>
Michal Schmidt e43452
+
Michal Schmidt e43452
+        <refsect1>
Michal Schmidt e43452
+                <title>Return Value</title>
Michal Schmidt e43452
+
Michal Schmidt e43452
+                <para>On success
Michal Schmidt e43452
+                <function>sd_login_monitor_new()</function> and
Michal Schmidt e43452
+                <function>sd_login_monitor_flush()</function> return 0
Michal Schmidt e43452
+                or a positive integer. On success
Michal Schmidt e43452
+                <function>sd_login_monitor_get_fd()</function> returns
Michal Schmidt e43452
+                a Unix file descriptor. On failure, these calls return
Michal Schmidt e43452
+                a negative errno-style error code.</para>
Michal Schmidt e43452
+
Michal Schmidt e43452
+                <para><function>sd_login_monitor_unref()</function>
Michal Schmidt e43452
+                always returns NULL.</para>
Michal Schmidt e43452
+        </refsect1>
Michal Schmidt e43452
+
Michal Schmidt e43452
+        <refsect1>
Michal Schmidt e43452
+                <title>Notes</title>
Michal Schmidt e43452
+
Michal Schmidt e43452
+                <para>The <function>sd_login_monitor_new()</function>,
Michal Schmidt e43452
+                <function>sd_login_monitor_unref()</function>, <function>sd_login_monitor_flush()</function> and
Michal Schmidt e43452
+                <function>sd_login_monitor_get_fd()</function> interfaces
Michal Schmidt e43452
+                are available as shared library, which can be compiled
Michal Schmidt e43452
+                and linked to with the
Michal Schmidt e43452
+                <literal>libsystemd-login</literal>
Michal Schmidt e43452
+                <citerefentry><refentrytitle>pkg-config</refentrytitle><manvolnum>1</manvolnum></citerefentry>
Michal Schmidt e43452
+                file.</para>
Michal Schmidt e43452
+        </refsect1>
Michal Schmidt e43452
+
Michal Schmidt e43452
+        <refsect1>
Michal Schmidt e43452
+                <title>See Also</title>
Michal Schmidt e43452
+
Michal Schmidt e43452
+                <para>
Michal Schmidt e43452
+                        <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
Michal Schmidt e43452
+                        <citerefentry><refentrytitle>sd-login</refentrytitle><manvolnum>7</manvolnum></citerefentry>,
Michal Schmidt e43452
+                        <citerefentry><refentrytitle>sd_get_seats</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
Michal Schmidt e43452
+                </para>
Michal Schmidt e43452
+        </refsect1>
Michal Schmidt e43452
+
Michal Schmidt e43452
+</refentry>
Michal Schmidt e43452
diff --git a/man/sd_pid_get_session.xml b/man/sd_pid_get_session.xml
Michal Schmidt e43452
new file mode 100644
Michal Schmidt e43452
index 0000000..9176433
Michal Schmidt e43452
--- /dev/null
Michal Schmidt e43452
+++ b/man/sd_pid_get_session.xml
Michal Schmidt e43452
@@ -0,0 +1,136 @@
Michal Schmidt e43452
+ 
Michal Schmidt e43452
+
Michal Schmidt e43452
+        "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
Michal Schmidt e43452
+
Michal Schmidt e43452
+
Michal Schmidt e43452
+  This file is part of systemd.
Michal Schmidt e43452
+
Michal Schmidt e43452
+  Copyright 2010 Lennart Poettering
Michal Schmidt e43452
+
Michal Schmidt e43452
+  systemd is free software; you can redistribute it and/or modify it
Michal Schmidt e43452
+  under the terms of the GNU General Public License as published by
Michal Schmidt e43452
+  the Free Software Foundation; either version 2 of the License, or
Michal Schmidt e43452
+  (at your option) any later version.
Michal Schmidt e43452
+
Michal Schmidt e43452
+  systemd is distributed in the hope that it will be useful, but
Michal Schmidt e43452
+  WITHOUT ANY WARRANTY; without even the implied warranty of
Michal Schmidt e43452
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Michal Schmidt e43452
+  General Public License for more details.
Michal Schmidt e43452
+
Michal Schmidt e43452
+  You should have received a copy of the GNU General Public License
Michal Schmidt e43452
+  along with systemd; If not, see <http://www.gnu.org/licenses/>.
Michal Schmidt e43452
+-->
Michal Schmidt e43452
+
Michal Schmidt e43452
+<refentry id="sd_pid_get_session">
Michal Schmidt e43452
+
Michal Schmidt e43452
+        <refentryinfo>
Michal Schmidt e43452
+                <title>sd_pid_get_session</title>
Michal Schmidt e43452
+                <productname>systemd</productname>
Michal Schmidt e43452
+
Michal Schmidt e43452
+                <authorgroup>
Michal Schmidt e43452
+                        <author>
Michal Schmidt e43452
+                                <contrib>Developer</contrib>
Michal Schmidt e43452
+                                <firstname>Lennart</firstname>
Michal Schmidt e43452
+                                <surname>Poettering</surname>
Michal Schmidt e43452
+                                <email>lennart@poettering.net</email>
Michal Schmidt e43452
+                        </author>
Michal Schmidt e43452
+                </authorgroup>
Michal Schmidt e43452
+        </refentryinfo>
Michal Schmidt e43452
+
Michal Schmidt e43452
+        <refmeta>
Michal Schmidt e43452
+                <refentrytitle>sd_pid_get_session</refentrytitle>
Michal Schmidt e43452
+                <manvolnum>3</manvolnum>
Michal Schmidt e43452
+        </refmeta>
Michal Schmidt e43452
+
Michal Schmidt e43452
+        <refnamediv>
Michal Schmidt e43452
+                <refname>sd_pid_get_session</refname>
Michal Schmidt e43452
+                <refname>sd_pid_get_owner_uid</refname>
Michal Schmidt e43452
+                <refpurpose>Determine session or owner of a session of a specific PID</refpurpose>
Michal Schmidt e43452
+        </refnamediv>
Michal Schmidt e43452
+
Michal Schmidt e43452
+        <refsynopsisdiv>
Michal Schmidt e43452
+                <funcsynopsis>
Michal Schmidt e43452
+                        <funcsynopsisinfo>#include <systemd/sd-login.h></funcsynopsisinfo>
Michal Schmidt e43452
+
Michal Schmidt e43452
+                        <funcprototype>
Michal Schmidt e43452
+                                <funcdef>int <function>sd_pid_get_session</function></funcdef>
Michal Schmidt e43452
+                                <paramdef>pid_t <parameter>pid</parameter></paramdef>
Michal Schmidt e43452
+                                <paramdef>char** <parameter>session</parameter></paramdef>
Michal Schmidt e43452
+                        </funcprototype>
Michal Schmidt e43452
+
Michal Schmidt e43452
+                        <funcprototype>
Michal Schmidt e43452
+                                <funcdef>int <function>sd_pid_get_owner_uid</function></funcdef>
Michal Schmidt e43452
+                                <paramdef>pid_t <parameter>pid</parameter></paramdef>
Michal Schmidt e43452
+                                <paramdef>uid_t* <parameter>uid</parameter></paramdef>
Michal Schmidt e43452
+                        </funcprototype>
Michal Schmidt e43452
+                </funcsynopsis>
Michal Schmidt e43452
+        </refsynopsisdiv>
Michal Schmidt e43452
+
Michal Schmidt e43452
+        <refsect1>
Michal Schmidt e43452
+                <title>Description</title>
Michal Schmidt e43452
+
Michal Schmidt e43452
+                <para><function>sd_pid_get_session()</function> may be
Michal Schmidt e43452
+                used to determine the login session identifier of a
Michal Schmidt e43452
+                process identified by the specified process identifier. The session
Michal Schmidt e43452
+                identifier is a short string (up to 64 characters),
Michal Schmidt e43452
+                consisting only of the characters a-zA-Z0-9 as well as
Michal Schmidt e43452
+                '-' and '_'. It is suitable for usage in file system
Michal Schmidt e43452
+                paths. Note that not all processes are part of a login
Michal Schmidt e43452
+                session (e.g. system service processes and user
Michal Schmidt e43452
+                processes that are shared between multiple sessions of
Michal Schmidt e43452
+                the same user). For processes not being part of a
Michal Schmidt e43452
+                login session this function will fail. The returned
Michal Schmidt e43452
+                string needs to be freed with the libc
Michal Schmidt e43452
+                <citerefentry><refentrytitle>free</refentrytitle><manvolnum>3</manvolnum></citerefentry>
Michal Schmidt e43452
+                call after use.</para>
Michal Schmidt e43452
+
Michal Schmidt e43452
+                <para><function>sd_pid_get_owner_uid()</function> may
Michal Schmidt e43452
+                be used to determine the Unix user identifier of the
Michal Schmidt e43452
+                owner of the session of a process identified the
Michal Schmidt e43452
+                specified PID. Note that this function will succeed
Michal Schmidt e43452
+                for user processes which are shared between multiple
Michal Schmidt e43452
+                login sessions of the same user, where
Michal Schmidt e43452
+                <function>sd_pid_get_session()</function> will
Michal Schmidt e43452
+                fail. For processes not being part of a login session
Michal Schmidt e43452
+                and not being a shared process of a user this function
Michal Schmidt e43452
+                will fail.</para>
Michal Schmidt e43452
+        </refsect1>
Michal Schmidt e43452
+
Michal Schmidt e43452
+        <refsect1>
Michal Schmidt e43452
+                <title>Return Value</title>
Michal Schmidt e43452
+
Michal Schmidt e43452
+                <para>On success these calls return 0 or a positive
Michal Schmidt e43452
+                integer. On failure, these calls return a negative
Michal Schmidt e43452
+                errno-style error code.</para>
Michal Schmidt e43452
+        </refsect1>
Michal Schmidt e43452
+
Michal Schmidt e43452
+        <refsect1>
Michal Schmidt e43452
+                <title>Notes</title>
Michal Schmidt e43452
+
Michal Schmidt e43452
+                <para>The <function>sd_pid_get_session()</function>
Michal Schmidt e43452
+                and <function>sd_pid_get_owner_uid()</function>
Michal Schmidt e43452
+                interfaces are available as shared library, which can
Michal Schmidt e43452
+                be compiled and linked to with the
Michal Schmidt e43452
+                <literal>libsystemd-login</literal>
Michal Schmidt e43452
+                <citerefentry><refentrytitle>pkg-config</refentrytitle><manvolnum>1</manvolnum></citerefentry>
Michal Schmidt e43452
+                file.</para>
Michal Schmidt e43452
+
Michal Schmidt e43452
+                <para>Note that the login session identifier as
Michal Schmidt e43452
+                returned by <function>sd_pid_get_session()</function>
Michal Schmidt e43452
+                is completely unrelated to the process session
Michal Schmidt e43452
+                identifier as returned by
Michal Schmidt e43452
+                <citerefentry><refentrytitle>getsid</refentrytitle><manvolnum>2</manvolnum></citerefentry>.</para>
Michal Schmidt e43452
+        </refsect1>
Michal Schmidt e43452
+
Michal Schmidt e43452
+        <refsect1>
Michal Schmidt e43452
+                <title>See Also</title>
Michal Schmidt e43452
+
Michal Schmidt e43452
+                <para>
Michal Schmidt e43452
+                        <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
Michal Schmidt e43452
+                        <citerefentry><refentrytitle>sd-login</refentrytitle><manvolnum>7</manvolnum></citerefentry>,
Michal Schmidt e43452
+                        <citerefentry><refentrytitle>sd_session_is_active</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
Michal Schmidt e43452
+                        <citerefentry><refentrytitle>getsid</refentrytitle><manvolnum>2</manvolnum></citerefentry>
Michal Schmidt e43452
+                </para>
Michal Schmidt e43452
+        </refsect1>
Michal Schmidt e43452
+
Michal Schmidt e43452
+</refentry>
Michal Schmidt e43452
diff --git a/man/sd_seat_get_active.xml b/man/sd_seat_get_active.xml
Michal Schmidt e43452
new file mode 100644
Michal Schmidt e43452
index 0000000..e729a65
Michal Schmidt e43452
--- /dev/null
Michal Schmidt e43452
+++ b/man/sd_seat_get_active.xml
Michal Schmidt e43452
@@ -0,0 +1,150 @@
Michal Schmidt e43452
+ 
Michal Schmidt e43452
+
Michal Schmidt e43452
+        "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
Michal Schmidt e43452
+
Michal Schmidt e43452
+
Michal Schmidt e43452
+  This file is part of systemd.
Michal Schmidt e43452
+
Michal Schmidt e43452
+  Copyright 2010 Lennart Poettering
Michal Schmidt e43452
+
Michal Schmidt e43452
+  systemd is free software; you can redistribute it and/or modify it
Michal Schmidt e43452
+  under the terms of the GNU General Public License as published by
Michal Schmidt e43452
+  the Free Software Foundation; either version 2 of the License, or
Michal Schmidt e43452
+  (at your option) any later version.
Michal Schmidt e43452
+
Michal Schmidt e43452
+  systemd is distributed in the hope that it will be useful, but
Michal Schmidt e43452
+  WITHOUT ANY WARRANTY; without even the implied warranty of
Michal Schmidt e43452
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Michal Schmidt e43452
+  General Public License for more details.
Michal Schmidt e43452
+
Michal Schmidt e43452
+  You should have received a copy of the GNU General Public License
Michal Schmidt e43452
+  along with systemd; If not, see <http://www.gnu.org/licenses/>.
Michal Schmidt e43452
+-->
Michal Schmidt e43452
+
Michal Schmidt e43452
+<refentry id="sd_seat_get_active">
Michal Schmidt e43452
+
Michal Schmidt e43452
+        <refentryinfo>
Michal Schmidt e43452
+                <title>sd_seat_get_active</title>
Michal Schmidt e43452
+                <productname>systemd</productname>
Michal Schmidt e43452
+
Michal Schmidt e43452
+                <authorgroup>
Michal Schmidt e43452
+                        <author>
Michal Schmidt e43452
+                                <contrib>Developer</contrib>
Michal Schmidt e43452
+                                <firstname>Lennart</firstname>
Michal Schmidt e43452
+                                <surname>Poettering</surname>
Michal Schmidt e43452
+                                <email>lennart@poettering.net</email>
Michal Schmidt e43452
+                        </author>
Michal Schmidt e43452
+                </authorgroup>
Michal Schmidt e43452
+        </refentryinfo>
Michal Schmidt e43452
+
Michal Schmidt e43452
+        <refmeta>
Michal Schmidt e43452
+                <refentrytitle>sd_seat_get_active</refentrytitle>
Michal Schmidt e43452
+                <manvolnum>3</manvolnum>
Michal Schmidt e43452
+        </refmeta>
Michal Schmidt e43452
+
Michal Schmidt e43452
+        <refnamediv>
Michal Schmidt e43452
+                <refname>sd_seat_get_active</refname>
Michal Schmidt e43452
+                <refname>sd_seat_get_sessions</refname>
Michal Schmidt e43452
+                <refname>sd_seat_can_multi_session</refname>
Michal Schmidt e43452
+                <refpurpose>Determine state of a specific seat</refpurpose>
Michal Schmidt e43452
+        </refnamediv>
Michal Schmidt e43452
+
Michal Schmidt e43452
+        <refsynopsisdiv>
Michal Schmidt e43452
+                <funcsynopsis>
Michal Schmidt e43452
+                        <funcsynopsisinfo>#include <systemd/sd-login.h></funcsynopsisinfo>
Michal Schmidt e43452
+
Michal Schmidt e43452
+                        <funcprototype>
Michal Schmidt e43452
+                                <funcdef>int <function>sd_seat_get_active</function></funcdef>
Michal Schmidt e43452
+                                <paramdef>const char* <parameter>seat</parameter></paramdef>
Michal Schmidt e43452
+                                <paramdef>char** <parameter>session</parameter></paramdef>
Michal Schmidt e43452
+                                <paramdef>uid_t* <parameter>uid</parameter></paramdef>
Michal Schmidt e43452
+                        </funcprototype>
Michal Schmidt e43452
+
Michal Schmidt e43452
+                        <funcprototype>
Michal Schmidt e43452
+                                <funcdef>int <function>sd_seat_get_sessions</function></funcdef>
Michal Schmidt e43452
+                                <paramdef>const char* <parameter>seat</parameter></paramdef>
Michal Schmidt e43452
+                                <paramdef>char*** <parameter>sessions</parameter></paramdef>
Michal Schmidt e43452
+                                <paramdef>uid_t** <parameter>uid</parameter></paramdef>
Michal Schmidt e43452
+                                <paramdef>unsigned* <parameter>n_uids</parameter></paramdef>
Michal Schmidt e43452
+                        </funcprototype>
Michal Schmidt e43452
+
Michal Schmidt e43452
+                        <funcprototype>
Michal Schmidt e43452
+                                <funcdef>int <function>sd_seat_can_multi_session</function></funcdef>
Michal Schmidt e43452
+                                <paramdef>const char* <parameter>session</parameter></paramdef>
Michal Schmidt e43452
+                        </funcprototype>
Michal Schmidt e43452
+                </funcsynopsis>
Michal Schmidt e43452
+        </refsynopsisdiv>
Michal Schmidt e43452
+
Michal Schmidt e43452
+        <refsect1>
Michal Schmidt e43452
+                <title>Description</title>
Michal Schmidt e43452
+
Michal Schmidt e43452
+                <para><function>sd_seat_get_active()</function> may be
Michal Schmidt e43452
+                used to determine which session is currently active on
Michal Schmidt e43452
+                a seat, if there is any. Returns the session
Michal Schmidt e43452
+                identifier and the user identifier of the Unix user
Michal Schmidt e43452
+                the session is belonging to. Either the session or the
Michal Schmidt e43452
+                user identifier parameter can be be passed NULL, in
Michal Schmidt e43452
+                case only one of the parameters shall be queried. The
Michal Schmidt e43452
+                returned string needs to be freed with the libc
Michal Schmidt e43452
+                <citerefentry><refentrytitle>free</refentrytitle><manvolnum>3</manvolnum></citerefentry>
Michal Schmidt e43452
+                call after use.</para>
Michal Schmidt e43452
+
Michal Schmidt e43452
+                <para><function>sd_seat_get_sessions()</function> may
Michal Schmidt e43452
+                be used to determine all sessions on the specified
Michal Schmidt e43452
+                seat. Returns two arrays, one (NULL terminated) with
Michal Schmidt e43452
+                the session identifiers of the sessions and one with
Michal Schmidt e43452
+                the user identifiers of the Unix users the sessions
Michal Schmidt e43452
+                belong to. An additional parameter may be used to
Michal Schmidt e43452
+                return the number of entries in the latter array. The
Michal Schmidt e43452
+                two arrays and the latter parameter may be passed as
Michal Schmidt e43452
+                NULL in case these values need not to be
Michal Schmidt e43452
+                determined. The arrays and the strings referenced by
Michal Schmidt e43452
+                them need to be freed with the libc
Michal Schmidt e43452
+                <citerefentry><refentrytitle>free</refentrytitle><manvolnum>3</manvolnum></citerefentry>
Michal Schmidt e43452
+                call after use.</para>
Michal Schmidt e43452
+
Michal Schmidt e43452
+                <para><function>sd_seat_can_multi_session()</function>
Michal Schmidt e43452
+                may be used to determine whether a specific seat is
Michal Schmidt e43452
+                capable of multi-session, i.e. allows multiple login
Michal Schmidt e43452
+                sessions in parallel (whith only one being active at a
Michal Schmidt e43452
+                time).</para>
Michal Schmidt e43452
+        </refsect1>
Michal Schmidt e43452
+
Michal Schmidt e43452
+        <refsect1>
Michal Schmidt e43452
+                <title>Return Value</title>
Michal Schmidt e43452
+
Michal Schmidt e43452
+                <para> On success
Michal Schmidt e43452
+                <function>sd_seat_get_active()</function> return
Michal Schmidt e43452
+                return 0 or a positive integer. On success
Michal Schmidt e43452
+                <function>sd_seat_get_sessions()</function> returns
Michal Schmidt e43452
+                the number of entries in the session identifier
Michal Schmidt e43452
+                array. If the test succeeds
Michal Schmidt e43452
+                <function>sd_seat_can_multi_session</function> returns
Michal Schmidt e43452
+                a positive integer, if it fails 0. On failure, these
Michal Schmidt e43452
+                calls return a negative errno-style error code.</para>
Michal Schmidt e43452
+        </refsect1>
Michal Schmidt e43452
+
Michal Schmidt e43452
+        <refsect1>
Michal Schmidt e43452
+                <title>Notes</title>
Michal Schmidt e43452
+
Michal Schmidt e43452
+                <para>The <function>sd_seat_get_active()</function>,
Michal Schmidt e43452
+                <function>sd_seat_get_sessions()</function>, and
Michal Schmidt e43452
+                <function>sd_seat_can_multi_session()</function> interfaces
Michal Schmidt e43452
+                are available as shared library, which can be compiled
Michal Schmidt e43452
+                and linked to with the
Michal Schmidt e43452
+                <literal>libsystemd-login</literal>
Michal Schmidt e43452
+                <citerefentry><refentrytitle>pkg-config</refentrytitle><manvolnum>1</manvolnum></citerefentry>
Michal Schmidt e43452
+                file.</para>
Michal Schmidt e43452
+        </refsect1>
Michal Schmidt e43452
+
Michal Schmidt e43452
+        <refsect1>
Michal Schmidt e43452
+                <title>See Also</title>
Michal Schmidt e43452
+
Michal Schmidt e43452
+                <para>
Michal Schmidt e43452
+                        <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
Michal Schmidt e43452
+                        <citerefentry><refentrytitle>sd-login</refentrytitle><manvolnum>7</manvolnum></citerefentry>,
Michal Schmidt e43452
+                        <citerefentry><refentrytitle>sd_session_get_seat</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
Michal Schmidt e43452
+                </para>
Michal Schmidt e43452
+        </refsect1>
Michal Schmidt e43452
+
Michal Schmidt e43452
+</refentry>
Michal Schmidt e43452
diff --git a/man/sd_session_is_active.xml b/man/sd_session_is_active.xml
Michal Schmidt e43452
new file mode 100644
Michal Schmidt e43452
index 0000000..82919f8
Michal Schmidt e43452
--- /dev/null
Michal Schmidt e43452
+++ b/man/sd_session_is_active.xml
Michal Schmidt e43452
@@ -0,0 +1,134 @@
Michal Schmidt e43452
+ 
Michal Schmidt e43452
+
Michal Schmidt e43452
+        "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
Michal Schmidt e43452
+
Michal Schmidt e43452
+
Michal Schmidt e43452
+  This file is part of systemd.
Michal Schmidt e43452
+
Michal Schmidt e43452
+  Copyright 2010 Lennart Poettering
Michal Schmidt e43452
+
Michal Schmidt e43452
+  systemd is free software; you can redistribute it and/or modify it
Michal Schmidt e43452
+  under the terms of the GNU General Public License as published by
Michal Schmidt e43452
+  the Free Software Foundation; either version 2 of the License, or
Michal Schmidt e43452
+  (at your option) any later version.
Michal Schmidt e43452
+
Michal Schmidt e43452
+  systemd is distributed in the hope that it will be useful, but
Michal Schmidt e43452
+  WITHOUT ANY WARRANTY; without even the implied warranty of
Michal Schmidt e43452
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Michal Schmidt e43452
+  General Public License for more details.
Michal Schmidt e43452
+
Michal Schmidt e43452
+  You should have received a copy of the GNU General Public License
Michal Schmidt e43452
+  along with systemd; If not, see <http://www.gnu.org/licenses/>.
Michal Schmidt e43452
+-->
Michal Schmidt e43452
+
Michal Schmidt e43452
+<refentry id="sd_session_is_active">
Michal Schmidt e43452
+
Michal Schmidt e43452
+        <refentryinfo>
Michal Schmidt e43452
+                <title>sd_session_is_active</title>
Michal Schmidt e43452
+                <productname>systemd</productname>
Michal Schmidt e43452
+
Michal Schmidt e43452
+                <authorgroup>
Michal Schmidt e43452
+                        <author>
Michal Schmidt e43452
+                                <contrib>Developer</contrib>
Michal Schmidt e43452
+                                <firstname>Lennart</firstname>
Michal Schmidt e43452
+                                <surname>Poettering</surname>
Michal Schmidt e43452
+                                <email>lennart@poettering.net</email>
Michal Schmidt e43452
+                        </author>
Michal Schmidt e43452
+                </authorgroup>
Michal Schmidt e43452
+        </refentryinfo>
Michal Schmidt e43452
+
Michal Schmidt e43452
+        <refmeta>
Michal Schmidt e43452
+                <refentrytitle>sd_session_is_active</refentrytitle>
Michal Schmidt e43452
+                <manvolnum>3</manvolnum>
Michal Schmidt e43452
+        </refmeta>
Michal Schmidt e43452
+
Michal Schmidt e43452
+        <refnamediv>
Michal Schmidt e43452
+                <refname>sd_session_is_active</refname>
Michal Schmidt e43452
+                <refname>sd_session_get_uid</refname>
Michal Schmidt e43452
+                <refname>sd_session_get_seat</refname>
Michal Schmidt e43452
+                <refpurpose>Determine state of a specific session</refpurpose>
Michal Schmidt e43452
+        </refnamediv>
Michal Schmidt e43452
+
Michal Schmidt e43452
+        <refsynopsisdiv>
Michal Schmidt e43452
+                <funcsynopsis>
Michal Schmidt e43452
+                        <funcsynopsisinfo>#include <systemd/sd-login.h></funcsynopsisinfo>
Michal Schmidt e43452
+
Michal Schmidt e43452
+                        <funcprototype>
Michal Schmidt e43452
+                                <funcdef>int <function>sd_session_is_active</function></funcdef>
Michal Schmidt e43452
+                                <paramdef>const char* <parameter>session</parameter></paramdef>
Michal Schmidt e43452
+                        </funcprototype>
Michal Schmidt e43452
+
Michal Schmidt e43452
+                        <funcprototype>
Michal Schmidt e43452
+                                <funcdef>int <function>sd_session_get_uid</function></funcdef>
Michal Schmidt e43452
+                                <paramdef>const char* <parameter>session</parameter></paramdef>
Michal Schmidt e43452
+                                <paramdef>uid_t* <parameter>uid</parameter></paramdef>
Michal Schmidt e43452
+                        </funcprototype>
Michal Schmidt e43452
+
Michal Schmidt e43452
+                        <funcprototype>
Michal Schmidt e43452
+                                <funcdef>int <function>sd_session_get_seat</function></funcdef>
Michal Schmidt e43452
+                                <paramdef>const char* <parameter>session</parameter></paramdef>
Michal Schmidt e43452
+                                <paramdef>char** <parameter>seat</parameter></paramdef>
Michal Schmidt e43452
+                        </funcprototype>
Michal Schmidt e43452
+                </funcsynopsis>
Michal Schmidt e43452
+        </refsynopsisdiv>
Michal Schmidt e43452
+
Michal Schmidt e43452
+        <refsect1>
Michal Schmidt e43452
+                <title>Description</title>
Michal Schmidt e43452
+
Michal Schmidt e43452
+                <para><function>sd_session_is_active()</function> may
Michal Schmidt e43452
+                be used to determine whether the session identified by
Michal Schmidt e43452
+                the specified session identifier is currently active
Michal Schmidt e43452
+                (i.e. currently in the foreground and available for
Michal Schmidt e43452
+                user input) or not.</para>
Michal Schmidt e43452
+
Michal Schmidt e43452
+                <para><function>sd_session_get_uid()</function> may be
Michal Schmidt e43452
+                used to determine the user identifier of the Unix user the session
Michal Schmidt e43452
+                identified by the specified session identifier belongs
Michal Schmidt e43452
+                to.</para>
Michal Schmidt e43452
+
Michal Schmidt e43452
+                <para><function>sd_session_get_seat()</function> may
Michal Schmidt e43452
+                be used to determine the seat identifier of the seat
Michal Schmidt e43452
+                the session identified by the specified session
Michal Schmidt e43452
+                identifier belongs to. Note that not all sessions are
Michal Schmidt e43452
+                attached to a seat, this call will fail for them. The
Michal Schmidt e43452
+                returned string needs to be freed with the libc
Michal Schmidt e43452
+                <citerefentry><refentrytitle>free</refentrytitle><manvolnum>3</manvolnum></citerefentry>
Michal Schmidt e43452
+                call after use.</para>
Michal Schmidt e43452
+        </refsect1>
Michal Schmidt e43452
+
Michal Schmidt e43452
+        <refsect1>
Michal Schmidt e43452
+                <title>Return Value</title>
Michal Schmidt e43452
+
Michal Schmidt e43452
+                <para>If the test succeeds
Michal Schmidt e43452
+                <function>sd_session_is_active()</function> returns a
Michal Schmidt e43452
+                positive integer, if it fails 0.  On success
Michal Schmidt e43452
+                <function>sd_session_get_uid()</function> and
Michal Schmidt e43452
+                <function>sd_session_get_seat()</function> return 0 or
Michal Schmidt e43452
+                a positive integer. On failure, these calls return a
Michal Schmidt e43452
+                negative errno-style error code.</para>
Michal Schmidt e43452
+        </refsect1>
Michal Schmidt e43452
+
Michal Schmidt e43452
+        <refsect1>
Michal Schmidt e43452
+                <title>Notes</title>
Michal Schmidt e43452
+
Michal Schmidt e43452
+                <para>The <function>sd_session_is_active()</function>,
Michal Schmidt e43452
+                <function>sd_session_get_uid()</function>, and
Michal Schmidt e43452
+                <function>sd_session_get_seat()</function> interfaces
Michal Schmidt e43452
+                are available as shared library, which can be compiled
Michal Schmidt e43452
+                and linked to with the
Michal Schmidt e43452
+                <literal>libsystemd-login</literal>
Michal Schmidt e43452
+                <citerefentry><refentrytitle>pkg-config</refentrytitle><manvolnum>1</manvolnum></citerefentry>
Michal Schmidt e43452
+                file.</para>
Michal Schmidt e43452
+        </refsect1>
Michal Schmidt e43452
+
Michal Schmidt e43452
+        <refsect1>
Michal Schmidt e43452
+                <title>See Also</title>
Michal Schmidt e43452
+
Michal Schmidt e43452
+                <para>
Michal Schmidt e43452
+                        <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
Michal Schmidt e43452
+                        <citerefentry><refentrytitle>sd-login</refentrytitle><manvolnum>7</manvolnum></citerefentry>,
Michal Schmidt e43452
+                        <citerefentry><refentrytitle>sd_pid_get_session</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
Michal Schmidt e43452
+                </para>
Michal Schmidt e43452
+        </refsect1>
Michal Schmidt e43452
+
Michal Schmidt e43452
+</refentry>
Michal Schmidt e43452
diff --git a/man/sd_uid_get_state.xml b/man/sd_uid_get_state.xml
Michal Schmidt e43452
new file mode 100644
Michal Schmidt e43452
index 0000000..a4e9e73
Michal Schmidt e43452
--- /dev/null
Michal Schmidt e43452
+++ b/man/sd_uid_get_state.xml
Michal Schmidt e43452
@@ -0,0 +1,182 @@
Michal Schmidt e43452
+ 
Michal Schmidt e43452
+
Michal Schmidt e43452
+        "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
Michal Schmidt e43452
+
Michal Schmidt e43452
+
Michal Schmidt e43452
+  This file is part of systemd.
Michal Schmidt e43452
+
Michal Schmidt e43452
+  Copyright 2010 Lennart Poettering
Michal Schmidt e43452
+
Michal Schmidt e43452
+  systemd is free software; you can redistribute it and/or modify it
Michal Schmidt e43452
+  under the terms of the GNU General Public License as published by
Michal Schmidt e43452
+  the Free Software Foundation; either version 2 of the License, or
Michal Schmidt e43452
+  (at your option) any later version.
Michal Schmidt e43452
+
Michal Schmidt e43452
+  systemd is distributed in the hope that it will be useful, but
Michal Schmidt e43452
+  WITHOUT ANY WARRANTY; without even the implied warranty of
Michal Schmidt e43452
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Michal Schmidt e43452
+  General Public License for more details.
Michal Schmidt e43452
+
Michal Schmidt e43452
+  You should have received a copy of the GNU General Public License
Michal Schmidt e43452
+  along with systemd; If not, see <http://www.gnu.org/licenses/>.
Michal Schmidt e43452
+-->
Michal Schmidt e43452
+
Michal Schmidt e43452
+<refentry id="sd_uid_get_state">
Michal Schmidt e43452
+
Michal Schmidt e43452
+        <refentryinfo>
Michal Schmidt e43452
+                <title>sd_uid_get_state</title>
Michal Schmidt e43452
+                <productname>systemd</productname>
Michal Schmidt e43452
+
Michal Schmidt e43452
+                <authorgroup>
Michal Schmidt e43452
+                        <author>
Michal Schmidt e43452
+                                <contrib>Developer</contrib>
Michal Schmidt e43452
+                                <firstname>Lennart</firstname>
Michal Schmidt e43452
+                                <surname>Poettering</surname>
Michal Schmidt e43452
+                                <email>lennart@poettering.net</email>
Michal Schmidt e43452
+                        </author>
Michal Schmidt e43452
+                </authorgroup>
Michal Schmidt e43452
+        </refentryinfo>
Michal Schmidt e43452
+
Michal Schmidt e43452
+        <refmeta>
Michal Schmidt e43452
+                <refentrytitle>sd_uid_get_state</refentrytitle>
Michal Schmidt e43452
+                <manvolnum>3</manvolnum>
Michal Schmidt e43452
+        </refmeta>
Michal Schmidt e43452
+
Michal Schmidt e43452
+        <refnamediv>
Michal Schmidt e43452
+                <refname>sd_uid_get_state</refname>
Michal Schmidt e43452
+                <refname>sd_uid_is_on_seat</refname>
Michal Schmidt e43452
+                <refname>sd_uid_get_sessions</refname>
Michal Schmidt e43452
+                <refname>sd_uid_get_seats</refname>
Michal Schmidt e43452
+                <refpurpose>Determine login state of a specific Unix user ID</refpurpose>
Michal Schmidt e43452
+        </refnamediv>
Michal Schmidt e43452
+
Michal Schmidt e43452
+        <refsynopsisdiv>
Michal Schmidt e43452
+                <funcsynopsis>
Michal Schmidt e43452
+                        <funcsynopsisinfo>#include <systemd/sd-login.h></funcsynopsisinfo>
Michal Schmidt e43452
+
Michal Schmidt e43452
+                        <funcprototype>
Michal Schmidt e43452
+                                <funcdef>int <function>sd_uid_get_state</function></funcdef>
Michal Schmidt e43452
+                                <paramdef>uid_t <parameter>pid</parameter></paramdef>
Michal Schmidt e43452
+                                <paramdef>char** <parameter>state</parameter></paramdef>
Michal Schmidt e43452
+                        </funcprototype>
Michal Schmidt e43452
+
Michal Schmidt e43452
+                        <funcprototype>
Michal Schmidt e43452
+                                <funcdef>int <function>sd_uid_is_on_seat</function></funcdef>
Michal Schmidt e43452
+                                <paramdef>uid_t <parameter>pid</parameter></paramdef>
Michal Schmidt e43452
+                                <paramdef>int <parameter>require_active</parameter></paramdef>
Michal Schmidt e43452
+                                <paramdef>const char* <parameter>seat</parameter></paramdef>
Michal Schmidt e43452
+                        </funcprototype>
Michal Schmidt e43452
+
Michal Schmidt e43452
+                        <funcprototype>
Michal Schmidt e43452
+                                <funcdef>int <function>sd_uid_get_sessions</function></funcdef>
Michal Schmidt e43452
+                                <paramdef>uid_t <parameter>pid</parameter></paramdef>
Michal Schmidt e43452
+                                <paramdef>int <parameter>require_active</parameter></paramdef>
Michal Schmidt e43452
+                                <paramdef>char*** <parameter>sessions</parameter></paramdef>
Michal Schmidt e43452
+                        </funcprototype>
Michal Schmidt e43452
+
Michal Schmidt e43452
+                        <funcprototype>
Michal Schmidt e43452
+                                <funcdef>int <function>sd_uid_get_seats</function></funcdef>
Michal Schmidt e43452
+                                <paramdef>uid_t <parameter>pid</parameter></paramdef>
Michal Schmidt e43452
+                                <paramdef>int <parameter>require_active</parameter></paramdef>
Michal Schmidt e43452
+                                <paramdef>char*** <parameter>seats</parameter></paramdef>
Michal Schmidt e43452
+                        </funcprototype>
Michal Schmidt e43452
+                </funcsynopsis>
Michal Schmidt e43452
+        </refsynopsisdiv>
Michal Schmidt e43452
+
Michal Schmidt e43452
+        <refsect1>
Michal Schmidt e43452
+                <title>Description</title>
Michal Schmidt e43452
+
Michal Schmidt e43452
+                <para><function>sd_uid_get_state()</function> may be
Michal Schmidt e43452
+                used to determine the login state of a specific Unix
Michal Schmidt e43452
+                user identifier. The following states are currently
Michal Schmidt e43452
+                known: <literal>offline</literal> (user not logged in
Michal Schmidt e43452
+                at all), <literal>lingering</literal> (user not logged
Michal Schmidt e43452
+                in, but some user services running),
Michal Schmidt e43452
+                <literal>online</literal> (user logged in, but not
Michal Schmidt e43452
+                active), <literal>active</literal> (user logged in on
Michal Schmidt e43452
+                an active seat). In the future additional states might
Michal Schmidt e43452
+                be defined, client code should be written to be robust
Michal Schmidt e43452
+                in regards to additional state strings being
Michal Schmidt e43452
+                returned. The returned string needs to be freed with
Michal Schmidt e43452
+                the libc
Michal Schmidt e43452
+                <citerefentry><refentrytitle>free</refentrytitle><manvolnum>3</manvolnum></citerefentry>
Michal Schmidt e43452
+                call after use.</para>
Michal Schmidt e43452
+
Michal Schmidt e43452
+                <para><function>sd_uid_is_on_seat()</function> may be
Michal Schmidt e43452
+                used to determine whether a specific user is logged in
Michal Schmidt e43452
+                or active on a specific seat. Accepts a Unix user
Michal Schmidt e43452
+                identifier and a seat identifier string as
Michal Schmidt e43452
+                parameters. The <parameter>require_active</parameter>
Michal Schmidt e43452
+                parameter is a boolean. If non-zero (true) this
Michal Schmidt e43452
+                function will test if the user is active (i.e. has a
Michal Schmidt e43452
+                session that is in the foreground and accepting user
Michal Schmidt e43452
+                input) on the specified seat, otherwise (false) only
Michal Schmidt e43452
+                if the user is logged in (and possibly inactive) on
Michal Schmidt e43452
+                the specified seat.</para>
Michal Schmidt e43452
+
Michal Schmidt e43452
+                <para><function>sd_uid_get_sessions()</function> may
Michal Schmidt e43452
+                be used to determine the current sessions of the
Michal Schmidt e43452
+                specified user. Acceptes a Unix user identifier as
Michal Schmidt e43452
+                parameter. The <parameter>require_active</parameter>
Michal Schmidt e43452
+                boolean parameter controls whether the returned list
Michal Schmidt e43452
+                shall consist of only those sessions where the user is
Michal Schmidt e43452
+                currently active (true) or where the user is currently
Michal Schmidt e43452
+                logged in at all, possibly inactive (false). The call
Michal Schmidt e43452
+                returns a NULL terminated string array of session
Michal Schmidt e43452
+                identifiers in <parameter>sessions</parameter> which
Michal Schmidt e43452
+                needs to be freed by the caller with the libc
Michal Schmidt e43452
+                <citerefentry><refentrytitle>free</refentrytitle><manvolnum>3</manvolnum></citerefentry>
Michal Schmidt e43452
+                call after use, including all the strings referenced. If
Michal Schmidt e43452
+                the string array parameter is passed as NULL the array
Michal Schmidt e43452
+                will not be filled in, but the return code still
Michal Schmidt e43452
+                indicates the number of current sessions.</para>
Michal Schmidt e43452
+
Michal Schmidt e43452
+                <para>Similar, <function>sd_uid_get_seats()</function>
Michal Schmidt e43452
+                may be used to determine the list of seats on which
Michal Schmidt e43452
+                the user currently has sessions. Similar semantics
Michal Schmidt e43452
+                apply, however note that the user may have
Michal Schmidt e43452
+                multiple sessions on the same seat as well as sessions
Michal Schmidt e43452
+                with no attached seat and hence the number of entries
Michal Schmidt e43452
+                in the returned array may differ from the one returned
Michal Schmidt e43452
+                by <function>sd_uid_get_sessions()</function>.</para>
Michal Schmidt e43452
+        </refsect1>
Michal Schmidt e43452
+
Michal Schmidt e43452
+        <refsect1>
Michal Schmidt e43452
+                <title>Return Value</title>
Michal Schmidt e43452
+
Michal Schmidt e43452
+                <para>On success
Michal Schmidt e43452
+                <function>sd_uid_get_state()</function> returns 0 or a
Michal Schmidt e43452
+                positive integer. If the test succeeds
Michal Schmidt e43452
+                <function>sd_uid_is_on_seat()</function> returns a
Michal Schmidt e43452
+                positive integer, if it fails
Michal Schmidt e43452
+                0. <function>sd_uid_get_sessions()</function> and
Michal Schmidt e43452
+                <function>sd_uid_get_seats()</function> return the
Michal Schmidt e43452
+                number of entries in the returned arrays. On failure,
Michal Schmidt e43452
+                these calls return a negative errno-style error
Michal Schmidt e43452
+                code.</para>
Michal Schmidt e43452
+        </refsect1>
Michal Schmidt e43452
+
Michal Schmidt e43452
+        <refsect1>
Michal Schmidt e43452
+                <title>Notes</title>
Michal Schmidt e43452
+
Michal Schmidt e43452
+                <para>The <function>sd_uid_get_state()</function>,
Michal Schmidt e43452
+                <function>sd_uid_is_on_seat()</function>,
Michal Schmidt e43452
+                <function>sd_uid_get_sessions()</function>, and
Michal Schmidt e43452
+                <function>sd_uid_get_seats()</function> interfaces are
Michal Schmidt e43452
+                available as shared library, which can be compiled and
Michal Schmidt e43452
+                linked to with the <literal>libsystemd-login</literal>
Michal Schmidt e43452
+                <citerefentry><refentrytitle>pkg-config</refentrytitle><manvolnum>1</manvolnum></citerefentry>
Michal Schmidt e43452
+                file.</para>
Michal Schmidt e43452
+        </refsect1>
Michal Schmidt e43452
+
Michal Schmidt e43452
+        <refsect1>
Michal Schmidt e43452
+                <title>See Also</title>
Michal Schmidt e43452
+
Michal Schmidt e43452
+                <para>
Michal Schmidt e43452
+                        <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
Michal Schmidt e43452
+                        <citerefentry><refentrytitle>sd-login</refentrytitle><manvolnum>7</manvolnum></citerefentry>,
Michal Schmidt e43452
+                        <citerefentry><refentrytitle>sd_pid_get_owner_uid</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
Michal Schmidt e43452
+                </para>
Michal Schmidt e43452
+        </refsect1>
Michal Schmidt e43452
+
Michal Schmidt e43452
+</refentry>
Michal Schmidt e43452
-- 
Michal Schmidt e43452
1.7.7.5
Michal Schmidt e43452