]> git.ipfire.org Git - thirdparty/systemd.git/blob - man/sd_get_seats.xml
tree-wide: drop 'This file is part of systemd' blurb
[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 Copyright 2010 Lennart Poettering
9 -->
10
11 <refentry id="sd_get_seats" conditional='HAVE_PAM'
12 xmlns:xi="http://www.w3.org/2001/XInclude">
13
14 <refentryinfo>
15 <title>sd_get_seats</title>
16 <productname>systemd</productname>
17
18 <authorgroup>
19 <author>
20 <contrib>Developer</contrib>
21 <firstname>Lennart</firstname>
22 <surname>Poettering</surname>
23 <email>lennart@poettering.net</email>
24 </author>
25 </authorgroup>
26 </refentryinfo>
27
28 <refmeta>
29 <refentrytitle>sd_get_seats</refentrytitle>
30 <manvolnum>3</manvolnum>
31 </refmeta>
32
33 <refnamediv>
34 <refname>sd_get_seats</refname>
35 <refname>sd_get_sessions</refname>
36 <refname>sd_get_uids</refname>
37 <refname>sd_get_machine_names</refname>
38 <refpurpose>Determine available seats, sessions, logged in users and virtual machines/containers</refpurpose>
39 </refnamediv>
40
41 <refsynopsisdiv>
42 <funcsynopsis>
43 <funcsynopsisinfo>#include &lt;systemd/sd-login.h&gt;</funcsynopsisinfo>
44
45 <funcprototype>
46 <funcdef>int <function>sd_get_seats</function></funcdef>
47 <paramdef>char ***<parameter>seats</parameter></paramdef>
48 </funcprototype>
49
50 <funcprototype>
51 <funcdef>int <function>sd_get_sessions</function></funcdef>
52 <paramdef>char ***<parameter>sessions</parameter></paramdef>
53 </funcprototype>
54
55 <funcprototype>
56 <funcdef>int <function>sd_get_uids</function></funcdef>
57 <paramdef>uid_t **<parameter>users</parameter></paramdef>
58 </funcprototype>
59
60 <funcprototype>
61 <funcdef>int <function>sd_get_machine_names</function></funcdef>
62 <paramdef>char ***<parameter>machines</parameter></paramdef>
63 </funcprototype>
64
65 </funcsynopsis>
66 </refsynopsisdiv>
67
68 <refsect1>
69 <title>Description</title>
70
71 <para><function>sd_get_seats()</function> may be used to determine
72 all currently available local seats. Returns the number of seat
73 identifiers and if the input pointer is non-NULL, a
74 <constant>NULL</constant>-terminated array of seat identifiers
75 is stored at the address.
76 The returned array and all strings it references need to be freed
77 with the libc
78 <citerefentry project='man-pages'><refentrytitle>free</refentrytitle><manvolnum>3</manvolnum></citerefentry>
79 call after use. Note that instead of an empty array
80 <constant>NULL</constant> may be returned and should be considered
81 equivalent to an empty array.</para>
82
83 <para>Similarly, <function>sd_get_sessions()</function> may be
84 used to determine all current login sessions.</para>
85
86 <para>Similarly, <function>sd_get_uids()</function> may be used to
87 determine all Unix users who currently have login sessions.</para>
88
89 <para>Similarly, <function>sd_get_machine_names()</function> may
90 be used to determine all current virtual machines and containers
91 on the system.</para>
92
93 <para>Note that the returned lists are not sorted and in an
94 undefined order.</para>
95 </refsect1>
96
97 <refsect1>
98 <title>Return Value</title>
99
100 <para>On success, <function>sd_get_seats()</function>,
101 <function>sd_get_sessions()</function>,
102 <function>sd_get_uids()</function> and
103 <function>sd_get_machine_names()</function> return the number of
104 entries in the arrays. On failure, these calls return a negative
105 errno-style error code.</para>
106 </refsect1>
107
108 <refsect1>
109 <title>Errors</title>
110
111 <para>Returned errors may indicate the following problems:</para>
112
113 <variablelist>
114
115 <varlistentry>
116 <term><constant>-ENOMEM</constant></term>
117
118 <listitem><para>Memory allocation failed.</para></listitem>
119 </varlistentry>
120 </variablelist>
121 </refsect1>
122
123 <xi:include href="libsystemd-pkgconfig.xml" />
124
125 <refsect1>
126 <title>See Also</title>
127
128 <para>
129 <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
130 <citerefentry><refentrytitle>sd-login</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
131 <citerefentry><refentrytitle>sd_session_get_seat</refentrytitle><manvolnum>3</manvolnum></citerefentry>
132 </para>
133 </refsect1>
134
135 </refentry>