mirror of
https://git.proxmox.com/git/systemd
synced 2025-06-03 06:25:40 +00:00
74 lines
7.9 KiB
HTML
74 lines
7.9 KiB
HTML
<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>
|
||
a.headerlink {
|
||
color: #c60f0f;
|
||
font-size: 0.8em;
|
||
padding: 0 4px 0 4px;
|
||
text-decoration: none;
|
||
visibility: hidden;
|
||
}
|
||
|
||
a.headerlink:hover {
|
||
background-color: #c60f0f;
|
||
color: white;
|
||
}
|
||
|
||
h1:hover > a.headerlink, h2:hover > a.headerlink, h3:hover > a.headerlink, dt:hover > a.headerlink {
|
||
visibility: visible;
|
||
}
|
||
</style><a href="index.html">Index </a>·
|
||
<a href="systemd.directives.html">Directives </a>·
|
||
<a href="../python-systemd/index.html">Python </a>·
|
||
<a href="../libudev/index.html">libudev </a>·
|
||
<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
|
||
determine which session is currently active on a seat, if there is
|
||
any. Returns the session identifier and the user identifier of the
|
||
Unix user the session is belonging to. Either the session or the
|
||
user identifier parameter can be passed <code class="constant">NULL</code>,
|
||
in case only one of the parameters shall be queried. The returned
|
||
string needs to be freed with the libc
|
||
<a href="http://man7.org/linux/man-pages/man3/free.3.html"><span class="citerefentry"><span class="refentrytitle">free</span>(3)</span></a>
|
||
call after use.</p><p><code class="function">sd_seat_get_sessions()</code> may be used to
|
||
determine all sessions on the specified seat. Returns two arrays,
|
||
one (<code class="constant">NULL</code> terminated) with the session
|
||
identifiers of the sessions and one with the user identifiers of
|
||
the Unix users the sessions belong to. An additional parameter may
|
||
be used to return the number of entries in the latter array. The
|
||
two arrays and the latter parameter may be passed as
|
||
<code class="constant">NULL</code> in case these values need not to be
|
||
determined. The arrays and the strings referenced by them need to
|
||
be freed with the libc
|
||
<a href="http://man7.org/linux/man-pages/man3/free.3.html"><span class="citerefentry"><span class="refentrytitle">free</span>(3)</span></a>
|
||
call after use. Note that instead of an empty array
|
||
<code class="constant">NULL</code> may be returned and should be considered
|
||
equivalent to an empty array.</p><p><code class="function">sd_seat_can_multi_session()</code> may be used
|
||
to determine whether a specific seat is capable of multi-session,
|
||
i.e. allows multiple login sessions in parallel (with only one
|
||
being active at a time).</p><p><code class="function">sd_seat_can_tty()</code> may be used to
|
||
determine whether a specific seat provides TTY functionality, i.e.
|
||
is useful as a text console.</p><p><code class="function">sd_seat_can_graphical()</code> may be used to
|
||
determine whether a specific seat provides graphics functionality,
|
||
i.e. is useful as a graphics display.</p><p>If the <code class="varname">seat</code> parameter of any of these
|
||
functions is passed as <code class="constant">NULL</code>, the operation is
|
||
executed for the seat of the session of the calling process, if
|
||
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>
|
||
returns 0 or a positive integer. On success,
|
||
<code class="function">sd_seat_get_sessions()</code> returns the number of
|
||
entries in the session identifier array. If the test succeeds,
|
||
<code class="function">sd_seat_can_multi_session</code>,
|
||
<code class="function">sd_seat_can_tty</code> and
|
||
<code class="function">sd_seat_can_graphical</code> return a positive
|
||
integer, if it fails 0. On failure, these calls return a negative
|
||
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>,
|
||
<code class="function">sd_seat_get_sessions()</code>,
|
||
<code class="function">sd_seat_can_multi_session()</code>,
|
||
<code class="function">sd_seat_can_tty()</code> and
|
||
<code class="function">sd_seat_can_grapical()</code> interfaces are
|
||
available as a shared library, which can be compiled and linked to
|
||
with the
|
||
<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>
|
||
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>
|
||
<a href="systemd.html"><span class="citerefentry"><span class="refentrytitle">systemd</span>(1)</span></a>,
|
||
<a href="sd-login.html"><span class="citerefentry"><span class="refentrytitle">sd-login</span>(3)</span></a>,
|
||
<a href="sd_session_get_seat.html"><span class="citerefentry"><span class="refentrytitle">sd_session_get_seat</span>(3)</span></a>
|
||
</p></div></div></body></html>
|