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