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+
9 <refentry id="sd_get_seats" conditional='HAVE_PAM'
10 xmlns:xi="http://www.w3.org/2001/XInclude">
13 <title>sd_get_seats</title>
14 <productname>elogind</productname>
18 <contrib>Developer</contrib>
19 <firstname>Lennart</firstname>
20 <surname>Poettering</surname>
21 <email>lennart@poettering.net</email>
27 <refentrytitle>sd_get_seats</refentrytitle>
28 <manvolnum>3</manvolnum>
32 <refname>sd_get_seats</refname>
33 <refname>sd_get_sessions</refname>
34 <refname>sd_get_uids</refname>
35 <refname>sd_get_machine_names</refname>
36 <refpurpose>Determine available seats, sessions, logged in users and virtual machines/containers</refpurpose>
41 <funcsynopsisinfo>#include <elogind/sd-login.h></funcsynopsisinfo>
44 <funcdef>int <function>sd_get_seats</function></funcdef>
45 <paramdef>char ***<parameter>seats</parameter></paramdef>
49 <funcdef>int <function>sd_get_sessions</function></funcdef>
50 <paramdef>char ***<parameter>sessions</parameter></paramdef>
54 <funcdef>int <function>sd_get_uids</function></funcdef>
55 <paramdef>uid_t **<parameter>users</parameter></paramdef>
59 <funcdef>int <function>sd_get_machine_names</function></funcdef>
60 <paramdef>char ***<parameter>machines</parameter></paramdef>
67 <title>Description</title>
69 <para><function>sd_get_seats()</function> may be used to determine
70 all currently available local seats. Returns the number of seat
71 identifiers and if the input pointer is non-NULL, a
72 <constant>NULL</constant>-terminated array of seat identifiers
73 is stored at the address.
74 The returned array and all strings it references need to be freed
76 <citerefentry project='man-pages'><refentrytitle>free</refentrytitle><manvolnum>3</manvolnum></citerefentry>
77 call after use. Note that instead of an empty array
78 <constant>NULL</constant> may be returned and should be considered
79 equivalent to an empty array.</para>
81 <para>Similarly, <function>sd_get_sessions()</function> may be
82 used to determine all current login sessions.</para>
84 <para>Similarly, <function>sd_get_uids()</function> may be used to
85 determine all Unix users who currently have login sessions.</para>
87 <para>Similarly, <function>sd_get_machine_names()</function> may
88 be used to determine all current virtual machines and containers
91 <para>Note that the returned lists are not sorted and in an
92 undefined order.</para>
96 <title>Return Value</title>
98 <para>On success, <function>sd_get_seats()</function>,
99 <function>sd_get_sessions()</function>,
100 <function>sd_get_uids()</function> and
101 <function>sd_get_machine_names()</function> return the number of
102 entries in the arrays. On failure, these calls return a negative
103 errno-style error code.</para>
107 <title>Errors</title>
109 <para>Returned errors may indicate the following problems:</para>
114 <term><constant>-ENOMEM</constant></term>
116 <listitem><para>Memory allocation failed.</para></listitem>
121 <xi:include href="libelogind-pkgconfig.xml" />
124 <title>See Also</title>
127 <!-- 0 /// elogind is in section 8
128 <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
130 <citerefentry><refentrytitle>elogind</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
132 <citerefentry><refentrytitle>sd-login</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
133 <citerefentry><refentrytitle>sd_session_get_seat</refentrytitle><manvolnum>3</manvolnum></citerefentry>