]> git.ipfire.org Git - thirdparty/systemd.git/blob - man/sd_get_seats.xml
travis: add more ASan options
[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>, <function>sd_get_sessions()</function>,
87 <function>sd_get_uids()</function> and <function>sd_get_machine_names()</function> return the number of
88 entries in the arrays. On failure, these calls return a negative errno-style error code.</para>
89
90 <refsect2>
91 <title>Errors</title>
92
93 <para>Returned errors may indicate the following problems:</para>
94
95 <variablelist>
96
97 <varlistentry>
98 <term><constant>-ENOMEM</constant></term>
99
100 <listitem><para>Memory allocation failed.</para></listitem>
101 </varlistentry>
102 </variablelist>
103 </refsect2>
104 </refsect1>
105
106 <xi:include href="libsystemd-pkgconfig.xml" />
107
108 <refsect1>
109 <title>See Also</title>
110
111 <para>
112 <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
113 <citerefentry><refentrytitle>sd-login</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
114 <citerefentry><refentrytitle>sd_session_get_seat</refentrytitle><manvolnum>3</manvolnum></citerefentry>
115 </para>
116 </refsect1>
117
118 </refentry>