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