]> git.ipfire.org Git - thirdparty/systemd.git/blob - man/sd_get_seats.xml
final v236 update (#7649)
[thirdparty/systemd.git] / man / sd_get_seats.xml
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">
4
5 <!--
6 SPDX-License-Identifier: LGPL-2.1+
7
8 This file is part of systemd.
9
10 Copyright 2010 Lennart Poettering
11
12 systemd is free software; you can redistribute it and/or modify it
13 under the terms of the GNU Lesser General Public License as published by
14 the Free Software Foundation; either version 2.1 of the License, or
15 (at your option) any later version.
16
17 systemd is distributed in the hope that it will be useful, but
18 WITHOUT ANY WARRANTY; without even the implied warranty of
19 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20 Lesser General Public License for more details.
21
22 You should have received a copy of the GNU Lesser General Public License
23 along with systemd; If not, see <http://www.gnu.org/licenses/>.
24 -->
25
26 <refentry id="sd_get_seats" conditional='HAVE_PAM'>
27
28 <refentryinfo>
29 <title>sd_get_seats</title>
30 <productname>systemd</productname>
31
32 <authorgroup>
33 <author>
34 <contrib>Developer</contrib>
35 <firstname>Lennart</firstname>
36 <surname>Poettering</surname>
37 <email>lennart@poettering.net</email>
38 </author>
39 </authorgroup>
40 </refentryinfo>
41
42 <refmeta>
43 <refentrytitle>sd_get_seats</refentrytitle>
44 <manvolnum>3</manvolnum>
45 </refmeta>
46
47 <refnamediv>
48 <refname>sd_get_seats</refname>
49 <refname>sd_get_sessions</refname>
50 <refname>sd_get_uids</refname>
51 <refname>sd_get_machine_names</refname>
52 <refpurpose>Determine available seats, sessions, logged in users and virtual machines/containers</refpurpose>
53 </refnamediv>
54
55 <refsynopsisdiv>
56 <funcsynopsis>
57 <funcsynopsisinfo>#include &lt;systemd/sd-login.h&gt;</funcsynopsisinfo>
58
59 <funcprototype>
60 <funcdef>int <function>sd_get_seats</function></funcdef>
61 <paramdef>char ***<parameter>seats</parameter></paramdef>
62 </funcprototype>
63
64 <funcprototype>
65 <funcdef>int <function>sd_get_sessions</function></funcdef>
66 <paramdef>char ***<parameter>sessions</parameter></paramdef>
67 </funcprototype>
68
69 <funcprototype>
70 <funcdef>int <function>sd_get_uids</function></funcdef>
71 <paramdef>uid_t **<parameter>users</parameter></paramdef>
72 </funcprototype>
73
74 <funcprototype>
75 <funcdef>int <function>sd_get_machine_names</function></funcdef>
76 <paramdef>char ***<parameter>machines</parameter></paramdef>
77 </funcprototype>
78
79 </funcsynopsis>
80 </refsynopsisdiv>
81
82 <refsect1>
83 <title>Description</title>
84
85 <para><function>sd_get_seats()</function> may be used to determine
86 all currently available local seats. Returns the number of seat
87 identifiers and if the input pointer is non-NULL, a
88 <constant>NULL</constant>-terminated array of seat identifiers
89 is stored at the address.
90 The returned array and all strings it references need to be freed
91 with the libc
92 <citerefentry project='man-pages'><refentrytitle>free</refentrytitle><manvolnum>3</manvolnum></citerefentry>
93 call after use. Note that instead of an empty array
94 <constant>NULL</constant> may be returned and should be considered
95 equivalent to an empty array.</para>
96
97 <para>Similarly, <function>sd_get_sessions()</function> may be
98 used to determine all current login sessions.</para>
99
100 <para>Similarly, <function>sd_get_uids()</function> may be used to
101 determine all Unix users who currently have login sessions.</para>
102
103 <para>Similarly, <function>sd_get_machine_names()</function> may
104 be used to determine all current virtual machines and containers
105 on the system.</para>
106
107 <para>Note that the returned lists are not sorted and in an
108 undefined order.</para>
109 </refsect1>
110
111 <refsect1>
112 <title>Return Value</title>
113
114 <para>On success, <function>sd_get_seats()</function>,
115 <function>sd_get_sessions()</function>,
116 <function>sd_get_uids()</function> and
117 <function>sd_get_machine_names()</function> return the number of
118 entries in the arrays. On failure, these calls return a negative
119 errno-style error code.</para>
120 </refsect1>
121
122
123 <refsect1>
124 <title>Errors</title>
125
126 <para>Returned errors may indicate the following problems:</para>
127
128 <variablelist>
129
130 <varlistentry>
131 <term><constant>-ENOMEM</constant></term>
132
133 <listitem><para>Memory allocation failed.</para></listitem>
134 </varlistentry>
135 </variablelist>
136 </refsect1>
137
138 <refsect1>
139 <title>Notes</title>
140
141 <para>The <function>sd_get_seats()</function>,
142 <function>sd_get_sessions()</function>,
143 <function>sd_get_uids()</function> and
144 <function>sd_get_machine_names()</function> interfaces are
145 available as a shared library, which can be compiled and linked to
146 with the
147 <constant>libsystemd</constant> <citerefentry project='die-net'><refentrytitle>pkg-config</refentrytitle><manvolnum>1</manvolnum></citerefentry>
148 file.</para>
149 </refsect1>
150
151 <refsect1>
152 <title>See Also</title>
153
154 <para>
155 <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
156 <citerefentry><refentrytitle>sd-login</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
157 <citerefentry><refentrytitle>sd_session_get_seat</refentrytitle><manvolnum>3</manvolnum></citerefentry>
158 </para>
159 </refsect1>
160
161 </refentry>