1
<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><title>sd_seat_get_active</title><meta name="generator" content="DocBook XSL Stylesheets V1.77.1"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><a href="index.html">Index </a>·
2
<a href="systemd.directives.html">Directives </a>·
3
<a href="../python-systemd/index.html">Python </a>·
4
<a href="../libudev/index.html">libudev </a>·
5
<a href="../libudev/index.html">gudev </a><span style="float:right">systemd 202</span><hr><div class="refentry"><a name="sd_seat_get_active"></a><div class="titlepage"></div><div class="refnamediv"><h2>Name</h2><p>sd_seat_get_active, sd_seat_get_sessions, sd_seat_can_multi_session — Determine state of a specific seat</p></div><div class="refsynopsisdiv"><h2>Synopsis</h2><div class="funcsynopsis"><pre class="funcsynopsisinfo">#include <systemd/sd-login.h></pre><table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"><tr><td><code class="funcdef">int <b class="fsfunc">sd_seat_get_active</b>(</code></td><td>const char* <var class="pdparam">seat</var>, </td></tr><tr><td> </td><td>char** <var class="pdparam">session</var>, </td></tr><tr><td> </td><td>uid_t* <var class="pdparam">uid</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer"> </div><table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"><tr><td><code class="funcdef">int <b class="fsfunc">sd_seat_get_sessions</b>(</code></td><td>const char* <var class="pdparam">seat</var>, </td></tr><tr><td> </td><td>char*** <var class="pdparam">sessions</var>, </td></tr><tr><td> </td><td>uid_t** <var class="pdparam">uid</var>, </td></tr><tr><td> </td><td>unsigned* <var class="pdparam">n_uids</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer"> </div><table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"><tr><td><code class="funcdef">int <b class="fsfunc">sd_seat_can_multi_session</b>(</code></td><td>const char* <var class="pdparam">seat</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer"> </div><table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"><tr><td><code class="funcdef">int <b class="fsfunc">sd_seat_can_tty</b>(</code></td><td>const char* <var class="pdparam">seat</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer"> </div><table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"><tr><td><code class="funcdef">int <b class="fsfunc">sd_seat_can_graphical</b>(</code></td><td>const char* <var class="pdparam">seat</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer"> </div></div></div><div class="refsect1"><a name="idp26160"></a><h2>Description</h2><p><code class="function">sd_seat_get_active()</code> may be
6
used to determine which session is currently active on
7
a seat, if there is any. Returns the session
8
identifier and the user identifier of the Unix user
9
the session is belonging to. Either the session or the
10
user identifier parameter can be passed NULL, in
11
case only one of the parameters shall be queried. The
12
returned string needs to be freed with the libc
13
<a href="free.html"><span class="citerefentry"><span class="refentrytitle">free</span>(3)</span></a>
14
call after use.</p><p><code class="function">sd_seat_get_sessions()</code> may
15
be used to determine all sessions on the specified
16
seat. Returns two arrays, one (NULL terminated) with
17
the session identifiers of the sessions and one with
18
the user identifiers of the Unix users the sessions
19
belong to. An additional parameter may be used to
20
return the number of entries in the latter array. The
21
two arrays and the latter parameter may be passed as
22
NULL in case these values need not to be
23
determined. The arrays and the strings referenced by
24
them need to be freed with the libc
25
<a href="free.html"><span class="citerefentry"><span class="refentrytitle">free</span>(3)</span></a>
26
call after use. Note that instead of an empty array
27
NULL may be returned and should be considered
28
equivalent to an empty array.</p><p><code class="function">sd_seat_can_multi_session()</code>
29
may be used to determine whether a specific seat is
30
capable of multi-session, i.e. allows multiple login
31
sessions in parallel (with only one being active at a
32
time).</p><p><code class="function">sd_seat_can_tty()</code> may be
33
used to determine whether a specific seat provides TTY
34
functionality, i.e. is useful as a text console.</p><p><code class="function">sd_seat_can_graphical()</code> may
35
be used to determine whether a specific seat provides
36
graphics functionality, i.e. is useful as a graphics
37
display.</p><p>If the <code class="literal">seat</code> parameter of any
38
of these functions is passed as NULL the operation is
39
executed for the seat of the session of the calling
40
process, if there is any.</p></div><div class="refsect1"><a name="idp36592"></a><h2>Return Value</h2><p> On success
41
<code class="function">sd_seat_get_active()</code>
42
returns 0 or a positive integer. On success
43
<code class="function">sd_seat_get_sessions()</code> returns
44
the number of entries in the session identifier
45
array. If the test succeeds
46
<code class="function">sd_seat_can_multi_session</code>,
47
<code class="function">sd_seat_can_tty</code> and
48
<code class="function">sd_seat_can_graphical</code> return a
49
positive integer, if it fails 0. On failure, these
50
calls return a negative errno-style error code.</p></div><div class="refsect1"><a name="idp49008"></a><h2>Notes</h2><p>The <code class="function">sd_seat_get_active()</code>,
51
<code class="function">sd_seat_get_sessions()</code>,
52
<code class="function">sd_seat_can_multi_session()</code>,
53
<code class="function">sd_seat_can_tty()</code> and
54
<code class="function">sd_seat_can_grapical()</code> interfaces
55
are available as shared library, which can be compiled
56
and linked to with the
57
<code class="literal">libsystemd-login</code>
58
<a href="pkg-config.html"><span class="citerefentry"><span class="refentrytitle">pkg-config</span>(1)</span></a>
59
file.</p></div><div class="refsect1"><a name="idp55488"></a><h2>See Also</h2><p>
60
<a href="systemd.html"><span class="citerefentry"><span class="refentrytitle">systemd</span>(1)</span></a>,
61
<a href="sd-login.html"><span class="citerefentry"><span class="refentrytitle">sd-login</span>(3)</span></a>,
62
<a href="sd_session_get_seat.html"><span class="citerefentry"><span class="refentrytitle">sd_session_get_seat</span>(3)</span></a>
63
</p></div></div></body></html>