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 This file is part of elogind.
7 SPDX-License-Identifier: LGPL-2.1+
10 Copyright 2010 Lennart Poettering
13 <refentry id="sd_get_seats" conditional='HAVE_PAM'
14 xmlns:xi="http://www.w3.org/2001/XInclude">
17 <title>sd_get_seats</title>
18 <productname>elogind</productname>
22 <contrib>Developer</contrib>
23 <firstname>Lennart</firstname>
24 <surname>Poettering</surname>
25 <email>lennart@poettering.net</email>
31 <refentrytitle>sd_get_seats</refentrytitle>
32 <manvolnum>3</manvolnum>
36 <refname>sd_get_seats</refname>
37 <refname>sd_get_sessions</refname>
38 <refname>sd_get_uids</refname>
39 <refname>sd_get_machine_names</refname>
40 <refpurpose>Determine available seats, sessions, logged in users and virtual machines/containers</refpurpose>
45 <funcsynopsisinfo>#include <elogind/sd-login.h></funcsynopsisinfo>
48 <funcdef>int <function>sd_get_seats</function></funcdef>
49 <paramdef>char ***<parameter>seats</parameter></paramdef>
53 <funcdef>int <function>sd_get_sessions</function></funcdef>
54 <paramdef>char ***<parameter>sessions</parameter></paramdef>
58 <funcdef>int <function>sd_get_uids</function></funcdef>
59 <paramdef>uid_t **<parameter>users</parameter></paramdef>
63 <funcdef>int <function>sd_get_machine_names</function></funcdef>
64 <paramdef>char ***<parameter>machines</parameter></paramdef>
71 <title>Description</title>
73 <para><function>sd_get_seats()</function> may be used to determine
74 all currently available local seats. Returns the number of seat
75 identifiers and if the input pointer is non-NULL, a
76 <constant>NULL</constant>-terminated array of seat identifiers
77 is stored at the address.
78 The returned array and all strings it references need to be freed
80 <citerefentry project='man-pages'><refentrytitle>free</refentrytitle><manvolnum>3</manvolnum></citerefentry>
81 call after use. Note that instead of an empty array
82 <constant>NULL</constant> may be returned and should be considered
83 equivalent to an empty array.</para>
85 <para>Similarly, <function>sd_get_sessions()</function> may be
86 used to determine all current login sessions.</para>
88 <para>Similarly, <function>sd_get_uids()</function> may be used to
89 determine all Unix users who currently have login sessions.</para>
91 <para>Similarly, <function>sd_get_machine_names()</function> may
92 be used to determine all current virtual machines and containers
95 <para>Note that the returned lists are not sorted and in an
96 undefined order.</para>
100 <title>Return Value</title>
102 <para>On success, <function>sd_get_seats()</function>,
103 <function>sd_get_sessions()</function>,
104 <function>sd_get_uids()</function> and
105 <function>sd_get_machine_names()</function> return the number of
106 entries in the arrays. On failure, these calls return a negative
107 errno-style error code.</para>
111 <title>Errors</title>
113 <para>Returned errors may indicate the following problems:</para>
118 <term><constant>-ENOMEM</constant></term>
120 <listitem><para>Memory allocation failed.</para></listitem>
125 <xi:include href="libelogind-pkgconfig.xml" />
128 <title>See Also</title>
131 <!-- 0 /// elogind is in section 8
132 <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
134 <citerefentry><refentrytitle>elogind</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
136 <citerefentry><refentrytitle>sd-login</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
137 <citerefentry><refentrytitle>sd_session_get_seat</refentrytitle><manvolnum>3</manvolnum></citerefentry>