1 <?xml version='1.0'?> <!--*-nxml-*-->
2 <!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
3 "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
6 SPDX-License-Identifier: LGPL-2.1+
8 Copyright 2010 Lennart Poettering
11 <refentry id="sd_get_seats" conditional='HAVE_PAM'
12 xmlns:xi="http://www.w3.org/2001/XInclude">
15 <title>sd_get_seats</title>
16 <productname>elogind</productname>
20 <contrib>Developer</contrib>
21 <firstname>Lennart</firstname>
22 <surname>Poettering</surname>
23 <email>lennart@poettering.net</email>
29 <refentrytitle>sd_get_seats</refentrytitle>
30 <manvolnum>3</manvolnum>
34 <refname>sd_get_seats</refname>
35 <refname>sd_get_sessions</refname>
36 <refname>sd_get_uids</refname>
37 <refname>sd_get_machine_names</refname>
38 <refpurpose>Determine available seats, sessions, logged in users and virtual machines/containers</refpurpose>
43 <funcsynopsisinfo>#include <elogind/sd-login.h></funcsynopsisinfo>
46 <funcdef>int <function>sd_get_seats</function></funcdef>
47 <paramdef>char ***<parameter>seats</parameter></paramdef>
51 <funcdef>int <function>sd_get_sessions</function></funcdef>
52 <paramdef>char ***<parameter>sessions</parameter></paramdef>
56 <funcdef>int <function>sd_get_uids</function></funcdef>
57 <paramdef>uid_t **<parameter>users</parameter></paramdef>
61 <funcdef>int <function>sd_get_machine_names</function></funcdef>
62 <paramdef>char ***<parameter>machines</parameter></paramdef>
69 <title>Description</title>
71 <para><function>sd_get_seats()</function> may be used to determine
72 all currently available local seats. Returns the number of seat
73 identifiers and if the input pointer is non-NULL, a
74 <constant>NULL</constant>-terminated array of seat identifiers
75 is stored at the address.
76 The returned array and all strings it references need to be freed
78 <citerefentry project='man-pages'><refentrytitle>free</refentrytitle><manvolnum>3</manvolnum></citerefentry>
79 call after use. Note that instead of an empty array
80 <constant>NULL</constant> may be returned and should be considered
81 equivalent to an empty array.</para>
83 <para>Similarly, <function>sd_get_sessions()</function> may be
84 used to determine all current login sessions.</para>
86 <para>Similarly, <function>sd_get_uids()</function> may be used to
87 determine all Unix users who currently have login sessions.</para>
89 <para>Similarly, <function>sd_get_machine_names()</function> may
90 be used to determine all current virtual machines and containers
93 <para>Note that the returned lists are not sorted and in an
94 undefined order.</para>
98 <title>Return Value</title>
100 <para>On success, <function>sd_get_seats()</function>,
101 <function>sd_get_sessions()</function>,
102 <function>sd_get_uids()</function> and
103 <function>sd_get_machine_names()</function> return the number of
104 entries in the arrays. On failure, these calls return a negative
105 errno-style error code.</para>
109 <title>Errors</title>
111 <para>Returned errors may indicate the following problems:</para>
116 <term><constant>-ENOMEM</constant></term>
118 <listitem><para>Memory allocation failed.</para></listitem>
123 <xi:include href="libelogind-pkgconfig.xml" />
126 <title>See Also</title>
129 <!-- 0 /// elogind is in section 8
130 <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
132 <citerefentry><refentrytitle>elogind</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
134 <citerefentry><refentrytitle>sd-login</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
135 <citerefentry><refentrytitle>sd_session_get_seat</refentrytitle><manvolnum>3</manvolnum></citerefentry>