]>
Commit | Line | Data |
---|---|---|
663996b3 MS |
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.78.1"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><style> |
2 | a.headerlink { | |
3 | color: #c60f0f; | |
4 | font-size: 0.8em; | |
5 | padding: 0 4px 0 4px; | |
6 | text-decoration: none; | |
7 | visibility: hidden; | |
8 | } | |
9 | ||
10 | a.headerlink:hover { | |
11 | background-color: #c60f0f; | |
12 | color: white; | |
13 | } | |
14 | ||
15 | h1:hover > a.headerlink, h2:hover > a.headerlink, h3:hover > a.headerlink, dt:hover > a.headerlink { | |
16 | visibility: visible; | |
17 | } | |
18 | </style><a href="index.html">Index </a>· | |
19 | <a href="systemd.directives.html">Directives </a>· | |
20 | <a href="../python-systemd/index.html">Python </a>· | |
21 | <a href="../libudev/index.html">libudev </a>· | |
e735f4d4 MP |
22 | <a href="../libudev/index.html">gudev </a><span style="float:right">systemd 219</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, sd_seat_can_tty, sd_seat_can_graphical — 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 int *<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="idm139769649157632"></a><h2 id="Description">Description<a class="headerlink" title="Permalink to this headline" href="#Description">¶</a></h2><p><code class="function">sd_seat_get_active()</code> may be used to |
23 | determine which session is currently active on a seat, if there is | |
24 | any. Returns the session identifier and the user identifier of the | |
25 | Unix user the session is belonging to. Either the session or the | |
26 | user identifier parameter can be passed <code class="constant">NULL</code>, | |
27 | in case only one of the parameters shall be queried. The returned | |
28 | string needs to be freed with the libc | |
29 | <a href="http://man7.org/linux/man-pages/man3/free.3.html"><span class="citerefentry"><span class="refentrytitle">free</span>(3)</span></a> | |
30 | call after use.</p><p><code class="function">sd_seat_get_sessions()</code> may be used to | |
31 | determine all sessions on the specified seat. Returns two arrays, | |
32 | one (<code class="constant">NULL</code> terminated) with the session | |
33 | identifiers of the sessions and one with the user identifiers of | |
34 | the Unix users the sessions belong to. An additional parameter may | |
35 | be used to return the number of entries in the latter array. The | |
36 | two arrays and the latter parameter may be passed as | |
37 | <code class="constant">NULL</code> in case these values need not to be | |
38 | determined. The arrays and the strings referenced by them need to | |
39 | be freed with the libc | |
40 | <a href="http://man7.org/linux/man-pages/man3/free.3.html"><span class="citerefentry"><span class="refentrytitle">free</span>(3)</span></a> | |
41 | call after use. Note that instead of an empty array | |
42 | <code class="constant">NULL</code> may be returned and should be considered | |
43 | equivalent to an empty array.</p><p><code class="function">sd_seat_can_multi_session()</code> may be used | |
44 | to determine whether a specific seat is capable of multi-session, | |
45 | i.e. allows multiple login sessions in parallel (with only one | |
46 | being active at a time).</p><p><code class="function">sd_seat_can_tty()</code> may be used to | |
47 | determine whether a specific seat provides TTY functionality, i.e. | |
48 | is useful as a text console.</p><p><code class="function">sd_seat_can_graphical()</code> may be used to | |
49 | determine whether a specific seat provides graphics functionality, | |
50 | i.e. is useful as a graphics display.</p><p>If the <code class="varname">seat</code> parameter of any of these | |
51 | functions is passed as <code class="constant">NULL</code>, the operation is | |
52 | executed for the seat of the session of the calling process, if | |
53 | there is any.</p></div><div class="refsect1"><a name="idm139769649145360"></a><h2 id="Return Value">Return Value<a class="headerlink" title="Permalink to this headline" href="#Return%20Value">¶</a></h2><p> On success, <code class="function">sd_seat_get_active()</code> | |
54 | returns 0 or a positive integer. On success, | |
55 | <code class="function">sd_seat_get_sessions()</code> returns the number of | |
56 | entries in the session identifier array. If the test succeeds, | |
57 | <code class="function">sd_seat_can_multi_session</code>, | |
58 | <code class="function">sd_seat_can_tty</code> and | |
59 | <code class="function">sd_seat_can_graphical</code> return a positive | |
60 | integer, if it fails 0. On failure, these calls return a negative | |
61 | errno-style error code.</p></div><div class="refsect1"><a name="idm139769649133408"></a><h2 id="Notes">Notes<a class="headerlink" title="Permalink to this headline" href="#Notes">¶</a></h2><p>The <code class="function">sd_seat_get_active()</code>, | |
62 | <code class="function">sd_seat_get_sessions()</code>, | |
63 | <code class="function">sd_seat_can_multi_session()</code>, | |
64 | <code class="function">sd_seat_can_tty()</code> and | |
65 | <code class="function">sd_seat_can_grapical()</code> interfaces are | |
66 | available as a shared library, which can be compiled and linked to | |
67 | with the | |
68 | <code class="constant">libsystemd</code> <a href="http://linux.die.net/man/1/pkg-config"><span class="citerefentry"><span class="refentrytitle">pkg-config</span>(1)</span></a> | |
69 | file.</p></div><div class="refsect1"><a name="idm139769649126880"></a><h2 id="See Also">See Also<a class="headerlink" title="Permalink to this headline" href="#See%20Also">¶</a></h2><p> | |
70 | <a href="systemd.html"><span class="citerefentry"><span class="refentrytitle">systemd</span>(1)</span></a>, | |
71 | <a href="sd-login.html"><span class="citerefentry"><span class="refentrytitle">sd-login</span>(3)</span></a>, | |
72 | <a href="sd_session_get_seat.html"><span class="citerefentry"><span class="refentrytitle">sd_session_get_seat</span>(3)</span></a> | |
73 | </p></div></div></body></html> |