chiark / gitweb /
logind: move logind into its own subdirectory
[elogind.git] / man / sd_session_is_active.xml
1 <?xml version='1.0'?> <!--*-nxml-*-->
2 <!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
3         "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
4
5 <!--
6   This file is part of systemd.
7
8   Copyright 2010 Lennart Poettering
9
10   systemd is free software; you can redistribute it and/or modify it
11   under the terms of the GNU General Public License as published by
12   the Free Software Foundation; either version 2 of the License, or
13   (at your option) any later version.
14
15   systemd is distributed in the hope that it will be useful, but
16   WITHOUT ANY WARRANTY; without even the implied warranty of
17   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18   General Public License for more details.
19
20   You should have received a copy of the GNU General Public License
21   along with systemd; If not, see <http://www.gnu.org/licenses/>.
22 -->
23
24 <refentry id="sd_session_is_active">
25
26         <refentryinfo>
27                 <title>sd_session_is_active</title>
28                 <productname>systemd</productname>
29
30                 <authorgroup>
31                         <author>
32                                 <contrib>Developer</contrib>
33                                 <firstname>Lennart</firstname>
34                                 <surname>Poettering</surname>
35                                 <email>lennart@poettering.net</email>
36                         </author>
37                 </authorgroup>
38         </refentryinfo>
39
40         <refmeta>
41                 <refentrytitle>sd_session_is_active</refentrytitle>
42                 <manvolnum>3</manvolnum>
43         </refmeta>
44
45         <refnamediv>
46                 <refname>sd_session_is_active</refname>
47                 <refname>sd_session_get_uid</refname>
48                 <refname>sd_session_get_seat</refname>
49                 <refpurpose>Determine state of a specific session</refpurpose>
50         </refnamediv>
51
52         <refsynopsisdiv>
53                 <funcsynopsis>
54                         <funcsynopsisinfo>#include &lt;systemd/sd-login.h&gt;</funcsynopsisinfo>
55
56                         <funcprototype>
57                                 <funcdef>int <function>sd_session_is_active</function></funcdef>
58                                 <paramdef>const char* <parameter>session</parameter></paramdef>
59                         </funcprototype>
60
61                         <funcprototype>
62                                 <funcdef>int <function>sd_session_get_uid</function></funcdef>
63                                 <paramdef>const char* <parameter>session</parameter></paramdef>
64                                 <paramdef>uid_t* <parameter>uid</parameter></paramdef>
65                         </funcprototype>
66
67                         <funcprototype>
68                                 <funcdef>int <function>sd_session_get_seat</function></funcdef>
69                                 <paramdef>const char* <parameter>session</parameter></paramdef>
70                                 <paramdef>char** <parameter>seat</parameter></paramdef>
71                         </funcprototype>
72                 </funcsynopsis>
73         </refsynopsisdiv>
74
75         <refsect1>
76                 <title>Description</title>
77
78                 <para><function>sd_session_is_active()</function> may
79                 be used to determine whether the session identified by
80                 the specified session identifier is currently active
81                 (i.e. currently in the foreground and available for
82                 user input) or not.</para>
83
84                 <para><function>sd_session_get_uid()</function> may be
85                 used to determine the user identifier of the Unix user the session
86                 identified by the specified session identifier belongs
87                 to.</para>
88
89                 <para><function>sd_session_get_seat()</function> may
90                 be used to determine the seat identifier of the seat
91                 the session identified by the specified session
92                 identifier belongs to. Note that not all sessions are
93                 attached to a seat, this call will fail for them. The
94                 returned string needs to be freed with the libc
95                 <citerefentry><refentrytitle>free</refentrytitle><manvolnum>3</manvolnum></citerefentry>
96                 call after use.</para>
97         </refsect1>
98
99         <refsect1>
100                 <title>Return Value</title>
101
102                 <para>If the test succeeds
103                 <function>sd_session_is_active()</function> returns a
104                 positive integer, if it fails 0.  On success
105                 <function>sd_session_get_uid()</function> and
106                 <function>sd_session_get_seat()</function> return 0 or
107                 a positive integer. On failure, these calls return a
108                 negative errno-style error code.</para>
109         </refsect1>
110
111         <refsect1>
112                 <title>Notes</title>
113
114                 <para>The <function>sd_session_is_active()</function>,
115                 <function>sd_session_get_uid()</function>, and
116                 <function>sd_session_get_seat()</function> interfaces
117                 are available as shared library, which can be compiled
118                 and linked to with the
119                 <literal>libsystemd-login</literal>
120                 <citerefentry><refentrytitle>pkg-config</refentrytitle><manvolnum>1</manvolnum></citerefentry>
121                 file.</para>
122         </refsect1>
123
124         <refsect1>
125                 <title>See Also</title>
126
127                 <para>
128                         <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
129                         <citerefentry><refentrytitle>sd-login</refentrytitle><manvolnum>7</manvolnum></citerefentry>,
130                         <citerefentry><refentrytitle>sd_pid_get_session</refentrytitle><manvolnum>3</manvolnum></citerefentry>
131                 </para>
132         </refsect1>
133
134 </refentry>