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