sd_seat_get_sessions.html 8.5 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
<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>·
Michael Biebl's avatar
Michael Biebl committed
22
  <a href="../libudev/index.html">gudev </a><span style="float:right">systemd 215</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 &lt;systemd/sd-login.h&gt;</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="idm214195794128"></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
23 24 25 26
                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
Michael Biebl's avatar
Michael Biebl committed
27 28 29 30
                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
31 32 33
                <a href="free.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
Michael Biebl's avatar
Michael Biebl committed
34
                seat. Returns two arrays, one (<code class="constant">NULL</code> terminated) with
35 36 37 38 39
                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
Michael Biebl's avatar
Michael Biebl committed
40
                <code class="constant">NULL</code> in case these values need not to be
41 42 43 44
                determined. The arrays and the strings referenced by
                them need to be freed with the libc
                <a href="free.html"><span class="citerefentry"><span class="refentrytitle">free</span>(3)</span></a>
                call after use. Note that instead of an empty array
Michael Biebl's avatar
Michael Biebl committed
45
                <code class="constant">NULL</code> may be returned and should be considered
46 47 48 49 50 51 52 53 54
                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
Michael Biebl's avatar
Michael Biebl committed
55 56 57 58
                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
Michael Biebl's avatar
Michael Biebl committed
59
                there is any.</p></div><div class="refsect1"><a name="idm214195782032"></a><h2 id="Return Value">Return Value<a class="headerlink" title="Permalink to this headline" href="#Return%20Value"></a></h2><p> On success,
60
                <code class="function">sd_seat_get_active()</code>
61
                returns 0 or a positive integer. On success,
62 63
                <code class="function">sd_seat_get_sessions()</code> returns
                the number of entries in the session identifier
Michael Biebl's avatar
Michael Biebl committed
64
                array. If the test succeeds,
65 66 67 68
                <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
Michael Biebl's avatar
Michael Biebl committed
69
                calls return a negative errno-style error code.</p></div><div class="refsect1"><a name="idm214195769616"></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>,
70 71 72 73
                <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
74
                are available as a shared library, which can be compiled
75
                and linked to with the
76
                <code class="constant">libsystemd</code> <a href="pkg-config.html"><span class="citerefentry"><span class="refentrytitle">pkg-config</span>(1)</span></a>
Michael Biebl's avatar
Michael Biebl committed
77
                file.</p></div><div class="refsect1"><a name="idm214195763328"></a><h2 id="See Also">See Also<a class="headerlink" title="Permalink to this headline" href="#See%20Also"></a></h2><p>
78 79 80 81
                        <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>