diff --git a/man/sd_get_seats.xml b/man/sd_get_seats.xml
new file mode 100644
index 0000000000..bbc396a09b
--- /dev/null
+++ b/man/sd_get_seats.xml
@@ -0,0 +1,125 @@
+
+
+
+
+
+
+
+
+ sd_get_seats
+ systemd
+
+
+
+ Developer
+ Lennart
+ Poettering
+ lennart@poettering.net
+
+
+
+
+
+ sd_get_seats
+ 3
+
+
+
+ sd_get_seats
+ sd_get_sessions
+ sd_get_uids
+ Determine available seats, sessions and logged in users
+
+
+
+
+ #include <systemd/sd-login.h>
+
+
+ int sd_get_seats
+ char*** seats
+
+
+
+ int sd_get_sessions
+ char*** sessions
+
+
+
+ int sd_get_uids
+ char*** sessions
+
+
+
+
+
+
+ Description
+
+ sd_get_seats() may be used
+ to determine all currently available local
+ seats. Returns an array of seat identifiers. The
+ returned array and all strings it references need to
+ be freed with the libc
+ free3
+ call after use.
+
+ Similar, sd_get_sessions() may
+ be used to determine all current login sessions.
+
+ Similar, sd_get_uids() may
+ be used to determine all Unix users who currently have login sessions.
+
+
+
+ Return Value
+
+ On success sd_get_seats(),
+ sd_get_sessions() and
+ sd_get_uids() return the number
+ of entries in the arrays. On failure, these calls
+ return a negative errno-style error code.
+
+
+
+ Notes
+
+ The sd_get_seats(),
+ sd_get_sessions() and
+ sd_get_uids() interfaces
+ are available as shared library, which can be compiled
+ and linked to with the
+ libsystemd-login
+ pkg-config1
+ file.
+
+
+
+ See Also
+
+
+ systemd1,
+ sd-login7,
+ sd_session_get_seat3,
+
+
+
+
diff --git a/man/sd_login_monitor_new.xml b/man/sd_login_monitor_new.xml
new file mode 100644
index 0000000000..2b37f00d30
--- /dev/null
+++ b/man/sd_login_monitor_new.xml
@@ -0,0 +1,172 @@
+
+
+
+
+
+
+
+
+ sd_login_monitor_new
+ systemd
+
+
+
+ Developer
+ Lennart
+ Poettering
+ lennart@poettering.net
+
+
+
+
+
+ sd_login_monitor_new
+ 3
+
+
+
+ sd_login_monitor_new
+ sd_login_monitor_unref
+ sd_login_monitor_flush
+ sd_login_monitor_get_fd
+ Monitor login sessions, seats and users
+
+
+
+
+ #include <systemd/sd-login.h>
+
+
+ int sd_login_monitor_new
+ const char* category
+ sd_login_monitor** ret
+
+
+
+ sd_login_monitor* sd_login_monitor_unref
+ sd_login_monitor* m
+
+
+
+ int sd_login_monitor_flush
+ sd_login_monitor* m
+
+
+
+ int sd_login_monitor_get_fd
+ sd_login_monitor* m
+
+
+
+
+
+
+ Description
+
+ sd_login_monitor_new() may
+ be used to monitor login session, users and seats. Via
+ a monitor object a file descriptor can be integrated
+ into an application defined event loop which is woken
+ up each time a user logs in, logs out or a seat is
+ added or removed, or a session, user, or seat changes
+ state otherwise. The first parameter takes a string
+ which can be either seat (to get
+ only notifications about seats being added, removed or
+ changed), session (to get only
+ notifications about sessions being created or removed
+ or changed) or uid (to get only
+ notifications when a user changes state in respect to
+ logins). If notifications shall be generated in all
+ these conditions, NULL may be passed. Note that in
+ future additional categories may be defined. The
+ second parameter returns a monitor object and needs to
+ be freed with the
+ sd_login_monitor_unref() call
+ after use.
+
+ sd_login_monitor_unref()
+ may be used to destroy a monitor object. Note that
+ this will invalidate any file descriptor returned by
+ sd_login_monitor_get_fd().
+
+ sd_login_monitor_flush()
+ may be used to reset the wakeup state of the monitor
+ object. Whenever an event causes the monitor to wake
+ up the event loop via the file descriptor this
+ function needs to be called to reset the wake-up
+ state. If this call is not invoked the file descriptor
+ will immediately wake up the event loop again.
+
+ sd_login_monitor_get_fd()
+ may be used to retrieve the file descriptor of the
+ monitor object that may be integrated in an
+ application defined event loop, based around
+ poll2
+ or a similar interface. The application should include
+ the returned file descriptor as wake up source for
+ POLLIN events. Whenever a wake-up is triggered the
+ file descriptor needs to be reset via
+ sd_login_monitor_flush(). An
+ application needs to reread the login state with a
+ function like
+ sd_get_seats3
+ or similar to determine what changed.
+
+
+
+ Return Value
+
+ On success
+ sd_login_monitor_new() and
+ sd_login_monitor_flush() return 0
+ or a positive integer. On success
+ sd_login_monitor_get_fd() returns
+ a Unix file descriptor. On failure, these calls return
+ a negative errno-style error code.
+
+ sd_login_monitor_unref()
+ always returns NULL.
+
+
+
+ Notes
+
+ The sd_login_monitor_new(),
+ sd_login_monitor_unref(), sd_login_monitor_flush() and
+ sd_login_monitor_get_fd() interfaces
+ are available as shared library, which can be compiled
+ and linked to with the
+ libsystemd-login
+ pkg-config1
+ file.
+
+
+
+ See Also
+
+
+ systemd1,
+ sd-login7,
+ sd_get_seats3,
+
+
+
+
diff --git a/man/sd_pid_get_session.xml b/man/sd_pid_get_session.xml
new file mode 100644
index 0000000000..9176433c3d
--- /dev/null
+++ b/man/sd_pid_get_session.xml
@@ -0,0 +1,136 @@
+
+
+
+
+
+
+
+
+ sd_pid_get_session
+ systemd
+
+
+
+ Developer
+ Lennart
+ Poettering
+ lennart@poettering.net
+
+
+
+
+
+ sd_pid_get_session
+ 3
+
+
+
+ sd_pid_get_session
+ sd_pid_get_owner_uid
+ Determine session or owner of a session of a specific PID
+
+
+
+
+ #include <systemd/sd-login.h>
+
+
+ int sd_pid_get_session
+ pid_t pid
+ char** session
+
+
+
+ int sd_pid_get_owner_uid
+ pid_t pid
+ uid_t* uid
+
+
+
+
+
+ Description
+
+ sd_pid_get_session() may be
+ used to determine the login session identifier of a
+ process identified by the specified process identifier. The session
+ identifier is a short string (up to 64 characters),
+ consisting only of the characters a-zA-Z0-9 as well as
+ '-' and '_'. It is suitable for usage in file system
+ paths. Note that not all processes are part of a login
+ session (e.g. system service processes and user
+ processes that are shared between multiple sessions of
+ the same user). For processes not being part of a
+ login session this function will fail. The returned
+ string needs to be freed with the libc
+ free3
+ call after use.
+
+ sd_pid_get_owner_uid() 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
+ sd_pid_get_session() will
+ fail. For processes not being part of a login session
+ and not being a shared process of a user this function
+ will fail.
+
+
+
+ Return Value
+
+ On success these calls return 0 or a positive
+ integer. On failure, these calls return a negative
+ errno-style error code.
+
+
+
+ Notes
+
+ The sd_pid_get_session()
+ and sd_pid_get_owner_uid()
+ interfaces are available as shared library, which can
+ be compiled and linked to with the
+ libsystemd-login
+ pkg-config1
+ file.
+
+ Note that the login session identifier as
+ returned by sd_pid_get_session()
+ is completely unrelated to the process session
+ identifier as returned by
+ getsid2.
+
+
+
+ See Also
+
+
+ systemd1,
+ sd-login7,
+ sd_session_is_active3,
+ getsid2
+
+
+
+
diff --git a/man/sd_seat_get_active.xml b/man/sd_seat_get_active.xml
new file mode 100644
index 0000000000..e729a653b7
--- /dev/null
+++ b/man/sd_seat_get_active.xml
@@ -0,0 +1,150 @@
+
+
+
+
+
+
+
+
+ sd_seat_get_active
+ systemd
+
+
+
+ Developer
+ Lennart
+ Poettering
+ lennart@poettering.net
+
+
+
+
+
+ sd_seat_get_active
+ 3
+
+
+
+ sd_seat_get_active
+ sd_seat_get_sessions
+ sd_seat_can_multi_session
+ Determine state of a specific seat
+
+
+
+
+ #include <systemd/sd-login.h>
+
+
+ int sd_seat_get_active
+ const char* seat
+ char** session
+ uid_t* uid
+
+
+
+ int sd_seat_get_sessions
+ const char* seat
+ char*** sessions
+ uid_t** uid
+ unsigned* n_uids
+
+
+
+ int sd_seat_can_multi_session
+ const char* session
+
+
+
+
+
+ Description
+
+ sd_seat_get_active() may be
+ used to determine which session is currently active on
+ a seat, if there is any. Returns the session
+ identifier and the user identifier of the Unix user
+ the session is belonging to. Either the session or the
+ user identifier parameter can be be passed NULL, in
+ case only one of the parameters shall be queried. The
+ returned string needs to be freed with the libc
+ free3
+ call after use.
+
+ sd_seat_get_sessions() may
+ be used to determine all sessions on the specified
+ seat. Returns two arrays, one (NULL terminated) with
+ the session identifiers of the sessions and one with
+ the user identifiers of the Unix users the sessions
+ belong to. An additional parameter may be used to
+ return the number of entries in the latter array. The
+ two arrays and the latter parameter may be passed as
+ NULL in case these values need not to be
+ determined. The arrays and the strings referenced by
+ them need to be freed with the libc
+ free3
+ call after use.
+
+ sd_seat_can_multi_session()
+ may be used to determine whether a specific seat is
+ capable of multi-session, i.e. allows multiple login
+ sessions in parallel (whith only one being active at a
+ time).
+
+
+
+ Return Value
+
+ On success
+ sd_seat_get_active() return
+ return 0 or a positive integer. On success
+ sd_seat_get_sessions() returns
+ the number of entries in the session identifier
+ array. If the test succeeds
+ sd_seat_can_multi_session returns
+ a positive integer, if it fails 0. On failure, these
+ calls return a negative errno-style error code.
+
+
+
+ Notes
+
+ The sd_seat_get_active(),
+ sd_seat_get_sessions(), and
+ sd_seat_can_multi_session() interfaces
+ are available as shared library, which can be compiled
+ and linked to with the
+ libsystemd-login
+ pkg-config1
+ file.
+
+
+
+ See Also
+
+
+ systemd1,
+ sd-login7,
+ sd_session_get_seat3,
+
+
+
+
diff --git a/man/sd_session_is_active.xml b/man/sd_session_is_active.xml
new file mode 100644
index 0000000000..82919f84fb
--- /dev/null
+++ b/man/sd_session_is_active.xml
@@ -0,0 +1,134 @@
+
+
+
+
+
+
+
+
+ sd_session_is_active
+ systemd
+
+
+
+ Developer
+ Lennart
+ Poettering
+ lennart@poettering.net
+
+
+
+
+
+ sd_session_is_active
+ 3
+
+
+
+ sd_session_is_active
+ sd_session_get_uid
+ sd_session_get_seat
+ Determine state of a specific session
+
+
+
+
+ #include <systemd/sd-login.h>
+
+
+ int sd_session_is_active
+ const char* session
+
+
+
+ int sd_session_get_uid
+ const char* session
+ uid_t* uid
+
+
+
+ int sd_session_get_seat
+ const char* session
+ char** seat
+
+
+
+
+
+ Description
+
+ sd_session_is_active() may
+ be used to determine whether the session identified by
+ the specified session identifier is currently active
+ (i.e. currently in the foreground and available for
+ user input) or not.
+
+ sd_session_get_uid() may be
+ used to determine the user identifier of the Unix user the session
+ identified by the specified session identifier belongs
+ to.
+
+ sd_session_get_seat() may
+ be used to determine the seat identifier of the seat
+ the session identified by the specified session
+ identifier belongs to. Note that not all sessions are
+ attached to a seat, this call will fail for them. The
+ returned string needs to be freed with the libc
+ free3
+ call after use.
+
+
+
+ Return Value
+
+ If the test succeeds
+ sd_session_is_active() returns a
+ positive integer, if it fails 0. On success
+ sd_session_get_uid() and
+ sd_session_get_seat() return 0 or
+ a positive integer. On failure, these calls return a
+ negative errno-style error code.
+
+
+
+ Notes
+
+ The sd_session_is_active(),
+ sd_session_get_uid(), and
+ sd_session_get_seat() interfaces
+ are available as shared library, which can be compiled
+ and linked to with the
+ libsystemd-login
+ pkg-config1
+ file.
+
+
+
+ See Also
+
+
+ systemd1,
+ sd-login7,
+ sd_pid_get_session3,
+
+
+
+
diff --git a/man/sd_uid_get_state.xml b/man/sd_uid_get_state.xml
new file mode 100644
index 0000000000..a4e9e73087
--- /dev/null
+++ b/man/sd_uid_get_state.xml
@@ -0,0 +1,182 @@
+
+
+
+
+
+
+
+
+ sd_uid_get_state
+ systemd
+
+
+
+ Developer
+ Lennart
+ Poettering
+ lennart@poettering.net
+
+
+
+
+
+ sd_uid_get_state
+ 3
+
+
+
+ sd_uid_get_state
+ sd_uid_is_on_seat
+ sd_uid_get_sessions
+ sd_uid_get_seats
+ Determine login state of a specific Unix user ID
+
+
+
+
+ #include <systemd/sd-login.h>
+
+
+ int sd_uid_get_state
+ uid_t pid
+ char** state
+
+
+
+ int sd_uid_is_on_seat
+ uid_t pid
+ int require_active
+ const char* seat
+
+
+
+ int sd_uid_get_sessions
+ uid_t pid
+ int require_active
+ char*** sessions
+
+
+
+ int sd_uid_get_seats
+ uid_t pid
+ int require_active
+ char*** seats
+
+
+
+
+
+ Description
+
+ sd_uid_get_state() may be
+ used to determine the login state of a specific Unix
+ user identifier. The following states are currently
+ known: offline (user not logged in
+ at all), lingering (user not logged
+ in, but some user services running),
+ online (user logged in, but not
+ active), active (user logged in on
+ an active seat). In the future additional states might
+ be defined, client code should be written to be robust
+ in regards to additional state strings being
+ returned. The returned string needs to be freed with
+ the libc
+ free3
+ call after use.
+
+ sd_uid_is_on_seat() may be
+ used to determine whether a specific user is logged in
+ or active on a specific seat. Accepts a Unix user
+ identifier and a seat identifier string as
+ parameters. The require_active
+ parameter is a boolean. If non-zero (true) this
+ function will test if the user is active (i.e. has a
+ session that is in the foreground and accepting user
+ input) on the specified seat, otherwise (false) only
+ if the user is logged in (and possibly inactive) on
+ the specified seat.
+
+ sd_uid_get_sessions() may
+ be used to determine the current sessions of the
+ specified user. Acceptes a Unix user identifier as
+ parameter. The require_active
+ boolean parameter controls whether the returned list
+ shall consist of only those sessions where the user is
+ currently active (true) or where the user is currently
+ logged in at all, possibly inactive (false). The call
+ returns a NULL terminated string array of session
+ identifiers in sessions which
+ needs to be freed by the caller with the libc
+ free3
+ call after use, including all the strings referenced. If
+ the string array parameter is passed as NULL the array
+ will not be filled in, but the return code still
+ indicates the number of current sessions.
+
+ Similar, sd_uid_get_seats()
+ may be used to determine the list of seats on which
+ the user currently has sessions. Similar semantics
+ apply, however note that the user may have
+ multiple sessions on the same seat as well as sessions
+ with no attached seat and hence the number of entries
+ in the returned array may differ from the one returned
+ by sd_uid_get_sessions().
+
+
+
+ Return Value
+
+ On success
+ sd_uid_get_state() returns 0 or a
+ positive integer. If the test succeeds
+ sd_uid_is_on_seat() returns a
+ positive integer, if it fails
+ 0. sd_uid_get_sessions() and
+ sd_uid_get_seats() return the
+ number of entries in the returned arrays. On failure,
+ these calls return a negative errno-style error
+ code.
+
+
+
+ Notes
+
+ The sd_uid_get_state(),
+ sd_uid_is_on_seat(),
+ sd_uid_get_sessions(), and
+ sd_uid_get_seats() interfaces are
+ available as shared library, which can be compiled and
+ linked to with the libsystemd-login
+ pkg-config1
+ file.
+
+
+
+ See Also
+
+
+ systemd1,
+ sd-login7,
+ sd_pid_get_owner_uid3,
+
+
+
+