]>
Commit | Line | Data |
---|---|---|
0b3b020a LP |
1 | <?xml version='1.0'?> <!--*-nxml-*--> |
2 | <!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN" | |
12b42c76 | 3 | "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd"> |
0b3b020a LP |
4 | |
5 | <!-- | |
572eb058 | 6 | SPDX-License-Identifier: LGPL-2.1+ |
0b3b020a LP |
7 | --> |
8 | ||
7d6b2723 ZJS |
9 | <refentry id="sd_get_seats" conditional='HAVE_PAM' |
10 | xmlns:xi="http://www.w3.org/2001/XInclude"> | |
0b3b020a | 11 | |
798d3a52 ZJS |
12 | <refentryinfo> |
13 | <title>sd_get_seats</title> | |
14 | <productname>systemd</productname> | |
798d3a52 ZJS |
15 | </refentryinfo> |
16 | ||
17 | <refmeta> | |
18 | <refentrytitle>sd_get_seats</refentrytitle> | |
19 | <manvolnum>3</manvolnum> | |
20 | </refmeta> | |
21 | ||
22 | <refnamediv> | |
23 | <refname>sd_get_seats</refname> | |
24 | <refname>sd_get_sessions</refname> | |
25 | <refname>sd_get_uids</refname> | |
26 | <refname>sd_get_machine_names</refname> | |
27 | <refpurpose>Determine available seats, sessions, logged in users and virtual machines/containers</refpurpose> | |
28 | </refnamediv> | |
29 | ||
30 | <refsynopsisdiv> | |
31 | <funcsynopsis> | |
32 | <funcsynopsisinfo>#include <systemd/sd-login.h></funcsynopsisinfo> | |
33 | ||
34 | <funcprototype> | |
35 | <funcdef>int <function>sd_get_seats</function></funcdef> | |
36 | <paramdef>char ***<parameter>seats</parameter></paramdef> | |
37 | </funcprototype> | |
38 | ||
39 | <funcprototype> | |
40 | <funcdef>int <function>sd_get_sessions</function></funcdef> | |
41 | <paramdef>char ***<parameter>sessions</parameter></paramdef> | |
42 | </funcprototype> | |
43 | ||
44 | <funcprototype> | |
45 | <funcdef>int <function>sd_get_uids</function></funcdef> | |
46 | <paramdef>uid_t **<parameter>users</parameter></paramdef> | |
47 | </funcprototype> | |
48 | ||
49 | <funcprototype> | |
50 | <funcdef>int <function>sd_get_machine_names</function></funcdef> | |
51 | <paramdef>char ***<parameter>machines</parameter></paramdef> | |
52 | </funcprototype> | |
53 | ||
54 | </funcsynopsis> | |
55 | </refsynopsisdiv> | |
56 | ||
57 | <refsect1> | |
58 | <title>Description</title> | |
59 | ||
60 | <para><function>sd_get_seats()</function> may be used to determine | |
ff5d2cd0 YW |
61 | all currently available local seats. Returns the number of seat |
62 | identifiers and if the input pointer is non-NULL, a | |
63 | <constant>NULL</constant>-terminated array of seat identifiers | |
64 | is stored at the address. | |
798d3a52 ZJS |
65 | The returned array and all strings it references need to be freed |
66 | with the libc | |
67 | <citerefentry project='man-pages'><refentrytitle>free</refentrytitle><manvolnum>3</manvolnum></citerefentry> | |
68 | call after use. Note that instead of an empty array | |
69 | <constant>NULL</constant> may be returned and should be considered | |
70 | equivalent to an empty array.</para> | |
71 | ||
72 | <para>Similarly, <function>sd_get_sessions()</function> may be | |
73 | used to determine all current login sessions.</para> | |
74 | ||
75 | <para>Similarly, <function>sd_get_uids()</function> may be used to | |
76 | determine all Unix users who currently have login sessions.</para> | |
77 | ||
78 | <para>Similarly, <function>sd_get_machine_names()</function> may | |
79 | be used to determine all current virtual machines and containers | |
80 | on the system.</para> | |
81 | ||
82 | <para>Note that the returned lists are not sorted and in an | |
83 | undefined order.</para> | |
84 | </refsect1> | |
85 | ||
86 | <refsect1> | |
87 | <title>Return Value</title> | |
88 | ||
89 | <para>On success, <function>sd_get_seats()</function>, | |
90 | <function>sd_get_sessions()</function>, | |
91 | <function>sd_get_uids()</function> and | |
92 | <function>sd_get_machine_names()</function> return the number of | |
93 | entries in the arrays. On failure, these calls return a negative | |
94 | errno-style error code.</para> | |
95 | </refsect1> | |
96 | ||
707b66c6 LP |
97 | <refsect1> |
98 | <title>Errors</title> | |
99 | ||
100 | <para>Returned errors may indicate the following problems:</para> | |
101 | ||
102 | <variablelist> | |
103 | ||
707b66c6 LP |
104 | <varlistentry> |
105 | <term><constant>-ENOMEM</constant></term> | |
106 | ||
107 | <listitem><para>Memory allocation failed.</para></listitem> | |
108 | </varlistentry> | |
109 | </variablelist> | |
110 | </refsect1> | |
111 | ||
7d6b2723 | 112 | <xi:include href="libsystemd-pkgconfig.xml" /> |
798d3a52 ZJS |
113 | |
114 | <refsect1> | |
115 | <title>See Also</title> | |
116 | ||
117 | <para> | |
118 | <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>, | |
119 | <citerefentry><refentrytitle>sd-login</refentrytitle><manvolnum>3</manvolnum></citerefentry>, | |
120 | <citerefentry><refentrytitle>sd_session_get_seat</refentrytitle><manvolnum>3</manvolnum></citerefentry> | |
121 | </para> | |
122 | </refsect1> | |
0b3b020a LP |
123 | |
124 | </refentry> |