1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
|
<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><title>sd_get_seats</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>·
<span style="float:right">systemd 221</span><hr><div class="refentry"><a name="sd_get_seats"></a><div class="titlepage"></div><div class="refnamediv"><h2>Name</h2><p>sd_get_seats, sd_get_sessions, sd_get_uids, sd_get_machine_names — Determine available seats, sessions, logged in users and virtual machines/containers</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_get_seats</b>(</code></td><td>char ***<var class="pdparam">seats</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_get_sessions</b>(</code></td><td>char ***<var class="pdparam">sessions</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_get_uids</b>(</code></td><td>uid_t **<var class="pdparam">users</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_get_machine_names</b>(</code></td><td>char ***<var class="pdparam">machines</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer"> </div></div></div><div class="refsect1"><a name="idm47823373665088"></a><h2 id="Description">Description<a class="headerlink" title="Permalink to this headline" href="#Description">¶</a></h2><p><code class="function">sd_get_seats()</code> may be used to determine
all currently available local seats. Returns a
<code class="constant">NULL</code> terminated array of seat identifiers.
The returned array and all strings it references 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>Similarly, <code class="function">sd_get_sessions()</code> may be
used to determine all current login sessions.</p><p>Similarly, <code class="function">sd_get_uids()</code> may be used to
determine all Unix users who currently have login sessions.</p><p>Similarly, <code class="function">sd_get_machine_names()</code> may
be used to determine all current virtual machines and containers
on the system.</p><p>Note that the returned lists are not sorted and in an
undefined order.</p></div><div class="refsect1"><a name="idm47823373657712"></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_get_seats()</code>,
<code class="function">sd_get_sessions()</code>,
<code class="function">sd_get_uids()</code> and
<code class="function">sd_get_machine_names()</code> return the number of
entries in the arrays. On failure, these calls return a negative
errno-style error code.</p></div><div class="refsect1"><a name="idm47823373653936"></a><h2 id="Notes">Notes<a class="headerlink" title="Permalink to this headline" href="#Notes">¶</a></h2><p>The <code class="function">sd_get_seats()</code>,
<code class="function">sd_get_sessions()</code>,
<code class="function">sd_get_uids()</code> and
<code class="function">sd_get_machine_names()</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="idm47823373648768"></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>
|