]>
Commit | Line | Data |
---|---|---|
0b3b020a LP |
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 systemd. | |
7 | ||
8 | Copyright 2010 Lennart Poettering | |
9 | ||
10 | systemd is free software; you can redistribute it and/or modify it | |
5430f7f2 LP |
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 | |
0b3b020a LP |
13 | (at your option) any later version. |
14 | ||
15 | systemd 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 | |
5430f7f2 | 18 | Lesser General Public License for more details. |
0b3b020a | 19 | |
5430f7f2 | 20 | You should have received a copy of the GNU Lesser General Public License |
0b3b020a LP |
21 | along with systemd; If not, see <http://www.gnu.org/licenses/>. |
22 | --> | |
23 | ||
56ba3c78 | 24 | <refentry id="sd_seat_get_active" conditional='HAVE_PAM'> |
0b3b020a LP |
25 | |
26 | <refentryinfo> | |
27 | <title>sd_seat_get_active</title> | |
28 | <productname>systemd</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_seat_get_active</refentrytitle> | |
42 | <manvolnum>3</manvolnum> | |
43 | </refmeta> | |
44 | ||
45 | <refnamediv> | |
46 | <refname>sd_seat_get_active</refname> | |
47 | <refname>sd_seat_get_sessions</refname> | |
48 | <refname>sd_seat_can_multi_session</refname> | |
fa57130d LP |
49 | <refname>sd_seat_can_tty</refname> |
50 | <refname>sd_seat_can_graphical</refname> | |
0b3b020a LP |
51 | <refpurpose>Determine state of a specific seat</refpurpose> |
52 | </refnamediv> | |
53 | ||
54 | <refsynopsisdiv> | |
55 | <funcsynopsis> | |
56 | <funcsynopsisinfo>#include <systemd/sd-login.h></funcsynopsisinfo> | |
57 | ||
58 | <funcprototype> | |
59 | <funcdef>int <function>sd_seat_get_active</function></funcdef> | |
3b3d7d06 JE |
60 | <paramdef>const char *<parameter>seat</parameter></paramdef> |
61 | <paramdef>char **<parameter>session</parameter></paramdef> | |
62 | <paramdef>uid_t *<parameter>uid</parameter></paramdef> | |
0b3b020a LP |
63 | </funcprototype> |
64 | ||
65 | <funcprototype> | |
66 | <funcdef>int <function>sd_seat_get_sessions</function></funcdef> | |
3b3d7d06 JE |
67 | <paramdef>const char *<parameter>seat</parameter></paramdef> |
68 | <paramdef>char ***<parameter>sessions</parameter></paramdef> | |
69 | <paramdef>uid_t **<parameter>uid</parameter></paramdef> | |
70 | <paramdef>unsigned int *<parameter>n_uids</parameter></paramdef> | |
0b3b020a LP |
71 | </funcprototype> |
72 | ||
73 | <funcprototype> | |
74 | <funcdef>int <function>sd_seat_can_multi_session</function></funcdef> | |
3b3d7d06 | 75 | <paramdef>const char *<parameter>seat</parameter></paramdef> |
0b3b020a | 76 | </funcprototype> |
20747498 LP |
77 | |
78 | <funcprototype> | |
79 | <funcdef>int <function>sd_seat_can_tty</function></funcdef> | |
3b3d7d06 | 80 | <paramdef>const char *<parameter>seat</parameter></paramdef> |
20747498 LP |
81 | </funcprototype> |
82 | ||
83 | <funcprototype> | |
84 | <funcdef>int <function>sd_seat_can_graphical</function></funcdef> | |
3b3d7d06 | 85 | <paramdef>const char *<parameter>seat</parameter></paramdef> |
20747498 | 86 | </funcprototype> |
0b3b020a LP |
87 | </funcsynopsis> |
88 | </refsynopsisdiv> | |
89 | ||
90 | <refsect1> | |
91 | <title>Description</title> | |
92 | ||
93 | <para><function>sd_seat_get_active()</function> may be | |
94 | used to determine which session is currently active on | |
95 | a seat, if there is any. Returns the session | |
96 | identifier and the user identifier of the Unix user | |
97 | the session is belonging to. Either the session or the | |
05cc7267 ZJS |
98 | user identifier parameter can be passed |
99 | <constant>NULL</constant>, in case only one of the | |
100 | parameters shall be queried. The returned string needs | |
101 | to be freed with the libc | |
5aded369 | 102 | <citerefentry project='man-pages'><refentrytitle>free</refentrytitle><manvolnum>3</manvolnum></citerefentry> |
0b3b020a LP |
103 | call after use.</para> |
104 | ||
105 | <para><function>sd_seat_get_sessions()</function> may | |
106 | be used to determine all sessions on the specified | |
74d00578 | 107 | seat. Returns two arrays, one (<constant>NULL</constant> terminated) with |
0b3b020a LP |
108 | the session identifiers of the sessions and one with |
109 | the user identifiers of the Unix users the sessions | |
110 | belong to. An additional parameter may be used to | |
111 | return the number of entries in the latter array. The | |
112 | two arrays and the latter parameter may be passed as | |
74d00578 | 113 | <constant>NULL</constant> in case these values need not to be |
0b3b020a LP |
114 | determined. The arrays and the strings referenced by |
115 | them need to be freed with the libc | |
5aded369 | 116 | <citerefentry project='man-pages'><refentrytitle>free</refentrytitle><manvolnum>3</manvolnum></citerefentry> |
595aae37 | 117 | call after use. Note that instead of an empty array |
74d00578 | 118 | <constant>NULL</constant> may be returned and should be considered |
595aae37 | 119 | equivalent to an empty array.</para> |
0b3b020a LP |
120 | |
121 | <para><function>sd_seat_can_multi_session()</function> | |
122 | may be used to determine whether a specific seat is | |
123 | capable of multi-session, i.e. allows multiple login | |
49f43d5f | 124 | sessions in parallel (with only one being active at a |
0b3b020a | 125 | time).</para> |
50b1678a | 126 | |
20747498 LP |
127 | <para><function>sd_seat_can_tty()</function> may be |
128 | used to determine whether a specific seat provides TTY | |
129 | functionality, i.e. is useful as a text console.</para> | |
130 | ||
131 | <para><function>sd_seat_can_graphical()</function> may | |
132 | be used to determine whether a specific seat provides | |
133 | graphics functionality, i.e. is useful as a graphics | |
134 | display.</para> | |
135 | ||
74d00578 ZJS |
136 | <para>If the <varname>seat</varname> parameter of any |
137 | of these functions is passed as | |
79640424 | 138 | <constant>NULL</constant>, the operation is executed |
74d00578 ZJS |
139 | for the seat of the session of the calling process, if |
140 | there is any.</para> | |
0b3b020a LP |
141 | </refsect1> |
142 | ||
143 | <refsect1> | |
144 | <title>Return Value</title> | |
145 | ||
b040723e | 146 | <para> On success, |
bb31a4ac | 147 | <function>sd_seat_get_active()</function> |
b040723e | 148 | returns 0 or a positive integer. On success, |
0b3b020a LP |
149 | <function>sd_seat_get_sessions()</function> returns |
150 | the number of entries in the session identifier | |
79640424 | 151 | array. If the test succeeds, |
20747498 LP |
152 | <function>sd_seat_can_multi_session</function>, |
153 | <function>sd_seat_can_tty</function> and | |
154 | <function>sd_seat_can_graphical</function> return a | |
155 | positive integer, if it fails 0. On failure, these | |
0b3b020a LP |
156 | calls return a negative errno-style error code.</para> |
157 | </refsect1> | |
158 | ||
159 | <refsect1> | |
160 | <title>Notes</title> | |
161 | ||
162 | <para>The <function>sd_seat_get_active()</function>, | |
20747498 LP |
163 | <function>sd_seat_get_sessions()</function>, |
164 | <function>sd_seat_can_multi_session()</function>, | |
165 | <function>sd_seat_can_tty()</function> and | |
166 | <function>sd_seat_can_grapical()</function> interfaces | |
494a6682 | 167 | are available as a shared library, which can be compiled |
0b3b020a | 168 | and linked to with the |
5aded369 | 169 | <constant>libsystemd</constant> <citerefentry project='die-net'><refentrytitle>pkg-config</refentrytitle><manvolnum>1</manvolnum></citerefentry> |
0b3b020a LP |
170 | file.</para> |
171 | </refsect1> | |
172 | ||
173 | <refsect1> | |
174 | <title>See Also</title> | |
175 | ||
176 | <para> | |
177 | <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>, | |
cb07866b | 178 | <citerefentry><refentrytitle>sd-login</refentrytitle><manvolnum>3</manvolnum></citerefentry>, |
595aae37 | 179 | <citerefentry><refentrytitle>sd_session_get_seat</refentrytitle><manvolnum>3</manvolnum></citerefentry> |
0b3b020a LP |
180 | </para> |
181 | </refsect1> | |
182 | ||
183 | </refentry> |