]> git.ipfire.org Git - thirdparty/systemd.git/blob - man/sd_get_seats.xml
Merge pull request #12002 from keszybz/man-headers
[thirdparty/systemd.git] / man / sd_get_seats.xml
1 <?xml version='1.0'?> <!--*-nxml-*-->
2 <!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
3 "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
4 <!-- SPDX-License-Identifier: LGPL-2.1+ -->
5
6 <refentry id="sd_get_seats" conditional='HAVE_PAM'
7 xmlns:xi="http://www.w3.org/2001/XInclude">
8
9 <refentryinfo>
10 <title>sd_get_seats</title>
11 <productname>systemd</productname>
12 </refentryinfo>
13
14 <refmeta>
15 <refentrytitle>sd_get_seats</refentrytitle>
16 <manvolnum>3</manvolnum>
17 </refmeta>
18
19 <refnamediv>
20 <refname>sd_get_seats</refname>
21 <refname>sd_get_sessions</refname>
22 <refname>sd_get_uids</refname>
23 <refname>sd_get_machine_names</refname>
24 <refpurpose>Determine available seats, sessions, logged in users and virtual machines/containers</refpurpose>
25 </refnamediv>
26
27 <refsynopsisdiv>
28 <funcsynopsis>
29 <funcsynopsisinfo>#include &lt;systemd/sd-login.h&gt;</funcsynopsisinfo>
30
31 <funcprototype>
32 <funcdef>int <function>sd_get_seats</function></funcdef>
33 <paramdef>char ***<parameter>seats</parameter></paramdef>
34 </funcprototype>
35
36 <funcprototype>
37 <funcdef>int <function>sd_get_sessions</function></funcdef>
38 <paramdef>char ***<parameter>sessions</parameter></paramdef>
39 </funcprototype>
40
41 <funcprototype>
42 <funcdef>int <function>sd_get_uids</function></funcdef>
43 <paramdef>uid_t **<parameter>users</parameter></paramdef>
44 </funcprototype>
45
46 <funcprototype>
47 <funcdef>int <function>sd_get_machine_names</function></funcdef>
48 <paramdef>char ***<parameter>machines</parameter></paramdef>
49 </funcprototype>
50
51 </funcsynopsis>
52 </refsynopsisdiv>
53
54 <refsect1>
55 <title>Description</title>
56
57 <para><function>sd_get_seats()</function> may be used to determine
58 all currently available local seats. Returns the number of seat
59 identifiers and if the input pointer is non-NULL, a
60 <constant>NULL</constant>-terminated array of seat identifiers
61 is stored at the address.
62 The returned array and all strings it references need to be freed
63 with the libc
64 <citerefentry project='man-pages'><refentrytitle>free</refentrytitle><manvolnum>3</manvolnum></citerefentry>
65 call after use. Note that instead of an empty array
66 <constant>NULL</constant> may be returned and should be considered
67 equivalent to an empty array.</para>
68
69 <para>Similarly, <function>sd_get_sessions()</function> may be
70 used to determine all current login sessions.</para>
71
72 <para>Similarly, <function>sd_get_uids()</function> may be used to
73 determine all Unix users who currently have login sessions.</para>
74
75 <para>Similarly, <function>sd_get_machine_names()</function> may
76 be used to determine all current virtual machines and containers
77 on the system.</para>
78
79 <para>Note that the returned lists are not sorted and in an
80 undefined order.</para>
81 </refsect1>
82
83 <refsect1>
84 <title>Return Value</title>
85
86 <para>On success, <function>sd_get_seats()</function>,
87 <function>sd_get_sessions()</function>,
88 <function>sd_get_uids()</function> and
89 <function>sd_get_machine_names()</function> return the number of
90 entries in the arrays. On failure, these calls return a negative
91 errno-style error code.</para>
92 </refsect1>
93
94 <refsect1>
95 <title>Errors</title>
96
97 <para>Returned errors may indicate the following problems:</para>
98
99 <variablelist>
100
101 <varlistentry>
102 <term><constant>-ENOMEM</constant></term>
103
104 <listitem><para>Memory allocation failed.</para></listitem>
105 </varlistentry>
106 </variablelist>
107 </refsect1>
108
109 <xi:include href="libsystemd-pkgconfig.xml" />
110
111 <refsect1>
112 <title>See Also</title>
113
114 <para>
115 <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
116 <citerefentry><refentrytitle>sd-login</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
117 <citerefentry><refentrytitle>sd_session_get_seat</refentrytitle><manvolnum>3</manvolnum></citerefentry>
118 </para>
119 </refsect1>
120
121 </refentry>