]> git.ipfire.org Git - thirdparty/systemd.git/blame - man/sd_bus_creds_get_pid.xml
man: revert dynamic paths for split-usr setups
[thirdparty/systemd.git] / man / sd_bus_creds_get_pid.xml
CommitLineData
3802a3d3 1<?xml version='1.0'?> <!--*- Mode: nxml; nxml-child-indent: 2; indent-tabs-mode: nil -*-->
cd6d5e1c 2<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
12b42c76 3"http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
cd6d5e1c
ZJS
4
5<!--
5de0ccff 6 This file is part of systemd.
cd6d5e1c 7
5de0ccff 8 Copyright 2014 Zbigniew Jędrzejewski-Szmek
cd6d5e1c 9
5de0ccff
ZJS
10 systemd is free software; you can redistribute it and/or modify it
11 under the terms of the GNU Lesser General Public License as published by
12 the Free Software Foundation; either version 2.1 of the License, or
13 (at your option) any later version.
cd6d5e1c 14
5de0ccff
ZJS
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 Lesser General Public License for more details.
cd6d5e1c 19
5de0ccff
ZJS
20 You should have received a copy of the GNU Lesser General Public License
21 along with systemd; If not, see <http://www.gnu.org/licenses/>.
cd6d5e1c
ZJS
22-->
23
48f69d8f 24<refentry id="sd_bus_creds_get_pid">
cd6d5e1c
ZJS
25
26 <refentryinfo>
27 <title>sd_bus_creds_get_pid</title>
28 <productname>systemd</productname>
29
30 <authorgroup>
31 <author>
32 <contrib>A monkey with a typewriter</contrib>
33 <firstname>Zbigniew</firstname>
34 <surname>Jędrzejewski-Szmek</surname>
35 <email>zbyszek@in.waw.pl</email>
36 </author>
37 </authorgroup>
38 </refentryinfo>
39
40 <refmeta>
41 <refentrytitle>sd_bus_creds_get_pid</refentrytitle>
42 <manvolnum>3</manvolnum>
43 </refmeta>
44
45 <refnamediv>
46 <refname>sd_bus_creds_get_pid</refname>
52d7c4dc 47 <refname>sd_bus_creds_get_ppid</refname>
cd6d5e1c
ZJS
48 <refname>sd_bus_creds_get_tid</refname>
49 <refname>sd_bus_creds_get_uid</refname>
52d7c4dc
LP
50 <refname>sd_bus_creds_get_euid</refname>
51 <refname>sd_bus_creds_get_suid</refname>
52 <refname>sd_bus_creds_get_fsuid</refname>
cd6d5e1c 53 <refname>sd_bus_creds_get_gid</refname>
52d7c4dc
LP
54 <refname>sd_bus_creds_get_egid</refname>
55 <refname>sd_bus_creds_get_sgid</refname>
56 <refname>sd_bus_creds_get_fsgid</refname>
57 <refname>sd_bus_creds_get_supplementary_gids</refname>
cd6d5e1c
ZJS
58 <refname>sd_bus_creds_get_comm</refname>
59 <refname>sd_bus_creds_get_tid_comm</refname>
60 <refname>sd_bus_creds_get_exe</refname>
61 <refname>sd_bus_creds_get_cmdline</refname>
62 <refname>sd_bus_creds_get_cgroup</refname>
63 <refname>sd_bus_creds_get_unit</refname>
64 <refname>sd_bus_creds_get_user_unit</refname>
65 <refname>sd_bus_creds_get_slice</refname>
66 <refname>sd_bus_creds_get_session</refname>
67 <refname>sd_bus_creds_get_owner_uid</refname>
68 <refname>sd_bus_creds_has_effective_cap</refname>
69 <refname>sd_bus_creds_has_permitted_cap</refname>
70 <refname>sd_bus_creds_has_inheritable_cap</refname>
71 <refname>sd_bus_creds_has_bounding_cap</refname>
72 <refname>sd_bus_creds_get_selinux_context</refname>
73 <refname>sd_bus_creds_get_audit_session_id</refname>
74 <refname>sd_bus_creds_get_audit_login_uid</refname>
52d7c4dc 75 <refname>sd_bus_creds_get_tty</refname>
cd6d5e1c
ZJS
76 <refname>sd_bus_creds_get_unique_name</refname>
77 <refname>sd_bus_creds_get_well_known_names</refname>
52d7c4dc 78 <refname>sd_bus_creds_get_description</refname>
cd6d5e1c
ZJS
79
80 <refpurpose>Retrieve fields from a credentials object</refpurpose>
81 </refnamediv>
82
83 <refsynopsisdiv>
84 <funcsynopsis>
85 <funcsynopsisinfo>#include &lt;systemd/sd-bus.h&gt;</funcsynopsisinfo>
86
87 <funcprototype>
88 <funcdef>int <function>sd_bus_creds_get_pid</function></funcdef>
8dc385e7 89 <paramdef>sd_bus_creds *<parameter>c</parameter></paramdef>
cd6d5e1c
ZJS
90 <paramdef>pid_t *<parameter>pid</parameter></paramdef>
91 </funcprototype>
92
52d7c4dc
LP
93 <funcprototype>
94 <funcdef>int <function>sd_bus_creds_get_ppid</function></funcdef>
95 <paramdef>sd_bus_creds *<parameter>c</parameter></paramdef>
96 <paramdef>pid_t *<parameter>ppid</parameter></paramdef>
97 </funcprototype>
98
cd6d5e1c
ZJS
99 <funcprototype>
100 <funcdef>int <function>sd_bus_creds_get_tid</function></funcdef>
8dc385e7 101 <paramdef>sd_bus_creds *<parameter>c</parameter></paramdef>
cd6d5e1c
ZJS
102 <paramdef>pid_t *<parameter>tid</parameter></paramdef>
103 </funcprototype>
104
105 <funcprototype>
52d7c4dc
LP
106 <funcdef>int <function>sd_bus_creds_get_uid</function></funcdef>
107 <paramdef>sd_bus_creds *<parameter>c</parameter></paramdef>
108 <paramdef>uid_t *<parameter>uid</parameter></paramdef>
109 </funcprototype>
110
111 <funcprototype>
112 <funcdef>int <function>sd_bus_creds_get_euid</function></funcdef>
113 <paramdef>sd_bus_creds *<parameter>c</parameter></paramdef>
114 <paramdef>uid_t *<parameter>uid</parameter></paramdef>
115 </funcprototype>
116
117 <funcprototype>
118 <funcdef>int <function>sd_bus_creds_get_suid</function></funcdef>
119 <paramdef>sd_bus_creds *<parameter>c</parameter></paramdef>
120 <paramdef>uid_t *<parameter>uid</parameter></paramdef>
121 </funcprototype>
122
123 <funcprototype>
124 <funcdef>int <function>sd_bus_creds_get_fsuid</function></funcdef>
8dc385e7 125 <paramdef>sd_bus_creds *<parameter>c</parameter></paramdef>
cd6d5e1c
ZJS
126 <paramdef>uid_t *<parameter>uid</parameter></paramdef>
127 </funcprototype>
128
129 <funcprototype>
130 <funcdef>int <function>sd_bus_creds_get_gid</function></funcdef>
8dc385e7 131 <paramdef>sd_bus_creds *<parameter>c</parameter></paramdef>
cd6d5e1c
ZJS
132 <paramdef>gid_t *<parameter>gid</parameter></paramdef>
133 </funcprototype>
134
52d7c4dc
LP
135 <funcprototype>
136 <funcdef>int <function>sd_bus_creds_get_egid</function></funcdef>
137 <paramdef>sd_bus_creds *<parameter>c</parameter></paramdef>
138 <paramdef>gid_t *<parameter>gid</parameter></paramdef>
139 </funcprototype>
140
141 <funcprototype>
142 <funcdef>int <function>sd_bus_creds_get_sgid</function></funcdef>
143 <paramdef>sd_bus_creds *<parameter>c</parameter></paramdef>
144 <paramdef>gid_t *<parameter>gid</parameter></paramdef>
145 </funcprototype>
146
147 <funcprototype>
148 <funcdef>int <function>sd_bus_creds_get_fsgid</function></funcdef>
149 <paramdef>sd_bus_creds *<parameter>c</parameter></paramdef>
150 <paramdef>gid_t *<parameter>gid</parameter></paramdef>
151 </funcprototype>
152
153 <funcprototype>
154 <funcdef>int <function>sd_bus_creds_get_supplementary_gids</function></funcdef>
155 <paramdef>sd_bus_creds *<parameter>c</parameter></paramdef>
156 <paramdef>const gid_t **<parameter>gids</parameter></paramdef>
157 </funcprototype>
158
cd6d5e1c
ZJS
159 <funcprototype>
160 <funcdef>int <function>sd_bus_creds_get_comm</function></funcdef>
8dc385e7 161 <paramdef>sd_bus_creds *<parameter>c</parameter></paramdef>
cd6d5e1c
ZJS
162 <paramdef>const char **<parameter>comm</parameter></paramdef>
163 </funcprototype>
164
165 <funcprototype>
166 <funcdef>int <function>sd_bus_creds_get_tid_comm</function></funcdef>
8dc385e7 167 <paramdef>sd_bus_creds *<parameter>c</parameter></paramdef>
cd6d5e1c
ZJS
168 <paramdef>const char **<parameter>comm</parameter></paramdef>
169 </funcprototype>
170
171 <funcprototype>
172 <funcdef>int <function>sd_bus_creds_get_exe</function></funcdef>
8dc385e7 173 <paramdef>sd_bus_creds *<parameter>c</parameter></paramdef>
cd6d5e1c
ZJS
174 <paramdef>const char **<parameter>exe</parameter></paramdef>
175 </funcprototype>
176
177 <funcprototype>
178 <funcdef>int <function>sd_bus_creds_get_cmdline</function></funcdef>
8dc385e7 179 <paramdef>sd_bus_creds *<parameter>c</parameter></paramdef>
cd6d5e1c
ZJS
180 <paramdef>char ***<parameter>cmdline</parameter></paramdef>
181 </funcprototype>
182
183 <funcprototype>
184 <funcdef>int <function>sd_bus_creds_get_cgroup</function></funcdef>
8dc385e7 185 <paramdef>sd_bus_creds *<parameter>c</parameter></paramdef>
cd6d5e1c
ZJS
186 <paramdef>const char **<parameter>cgroup</parameter></paramdef>
187 </funcprototype>
188
189 <funcprototype>
190 <funcdef>int <function>sd_bus_creds_get_unit</function></funcdef>
8dc385e7 191 <paramdef>sd_bus_creds *<parameter>c</parameter></paramdef>
cd6d5e1c
ZJS
192 <paramdef>const char **<parameter>unit</parameter></paramdef>
193 </funcprototype>
194
195 <funcprototype>
196 <funcdef>int <function>sd_bus_creds_get_user_unit</function></funcdef>
8dc385e7 197 <paramdef>sd_bus_creds *<parameter>c</parameter></paramdef>
cd6d5e1c
ZJS
198 <paramdef>const char **<parameter>unit</parameter></paramdef>
199 </funcprototype>
200
201 <funcprototype>
202 <funcdef>int <function>sd_bus_creds_get_slice</function></funcdef>
8dc385e7 203 <paramdef>sd_bus_creds *<parameter>c</parameter></paramdef>
cd6d5e1c
ZJS
204 <paramdef>const char **<parameter>slice</parameter></paramdef>
205 </funcprototype>
206
207 <funcprototype>
208 <funcdef>int <function>sd_bus_creds_get_session</function></funcdef>
8dc385e7 209 <paramdef>sd_bus_creds *<parameter>c</parameter></paramdef>
cd6d5e1c
ZJS
210 <paramdef>const char **<parameter>slice</parameter></paramdef>
211 </funcprototype>
212
213 <funcprototype>
214 <funcdef>int <function>sd_bus_creds_get_owner_uid</function></funcdef>
8dc385e7 215 <paramdef>sd_bus_creds *<parameter>c</parameter></paramdef>
cd6d5e1c
ZJS
216 <paramdef>uid_t *<parameter>uid</parameter></paramdef>
217 </funcprototype>
218
219 <funcprototype>
220 <funcdef>int <function>sd_bus_creds_has_effective_cap</function></funcdef>
8dc385e7 221 <paramdef>sd_bus_creds *<parameter>c</parameter></paramdef>
cd6d5e1c
ZJS
222 <paramdef>int <parameter>capability</parameter></paramdef>
223 </funcprototype>
224
225 <funcprototype>
226 <funcdef>int <function>sd_bus_creds_has_permitted_cap</function></funcdef>
8dc385e7 227 <paramdef>sd_bus_creds *<parameter>c</parameter></paramdef>
cd6d5e1c
ZJS
228 <paramdef>int <parameter>capability</parameter></paramdef>
229 </funcprototype>
230
231 <funcprototype>
232 <funcdef>int <function>sd_bus_creds_has_inheritable_cap</function></funcdef>
8dc385e7 233 <paramdef>sd_bus_creds *<parameter>c</parameter></paramdef>
cd6d5e1c
ZJS
234 <paramdef>int <parameter>capability</parameter></paramdef>
235 </funcprototype>
236
237 <funcprototype>
238 <funcdef>int <function>sd_bus_creds_has_bounding_cap</function></funcdef>
8dc385e7 239 <paramdef>sd_bus_creds *<parameter>c</parameter></paramdef>
cd6d5e1c
ZJS
240 <paramdef>int <parameter>capability</parameter></paramdef>
241 </funcprototype>
242
243 <funcprototype>
244 <funcdef>int <function>sd_bus_creds_get_selinux_context</function></funcdef>
8dc385e7 245 <paramdef>sd_bus_creds *<parameter>c</parameter></paramdef>
cd6d5e1c
ZJS
246 <paramdef>const char **<parameter>context</parameter></paramdef>
247 </funcprototype>
248
249 <funcprototype>
250 <funcdef>int <function>sd_bus_creds_get_audit_session_id</function></funcdef>
8dc385e7 251 <paramdef>sd_bus_creds *<parameter>c</parameter></paramdef>
cd6d5e1c
ZJS
252 <paramdef>uint32_t *<parameter>sessionid</parameter></paramdef>
253 </funcprototype>
254
255 <funcprototype>
256 <funcdef>int <function>sd_bus_creds_get_audit_login_uid</function></funcdef>
8dc385e7 257 <paramdef>sd_bus_creds *<parameter>c</parameter></paramdef>
cd6d5e1c
ZJS
258 <paramdef>uid_t *<parameter>loginuid</parameter></paramdef>
259 </funcprototype>
260
52d7c4dc
LP
261 <funcprototype>
262 <funcdef>int <function>sd_bus_creds_get_tty</function></funcdef>
263 <paramdef>sd_bus_creds *<parameter>c</parameter></paramdef>
264 <paramdef>const char **<parameter>tty</parameter></paramdef>
265 </funcprototype>
266
cd6d5e1c
ZJS
267 <funcprototype>
268 <funcdef>int <function>sd_bus_creds_get_unique_name</function></funcdef>
8dc385e7 269 <paramdef>sd_bus_creds *<parameter>c</parameter></paramdef>
cd6d5e1c
ZJS
270 <paramdef>const char **<parameter>name</parameter></paramdef>
271 </funcprototype>
272
273 <funcprototype>
274 <funcdef>int <function>sd_bus_creds_get_well_known_names</function></funcdef>
8dc385e7 275 <paramdef>sd_bus_creds *<parameter>c</parameter></paramdef>
cd6d5e1c
ZJS
276 <paramdef>char ***<parameter>name</parameter></paramdef>
277 </funcprototype>
278
5c20a8bc 279 <funcprototype>
52d7c4dc 280 <funcdef>int <function>sd_bus_creds_get_description</function></funcdef>
5c20a8bc
LP
281 <paramdef>sd_bus_creds *<parameter>c</parameter></paramdef>
282 <paramdef>const char **<parameter>name</parameter></paramdef>
283 </funcprototype>
284
cd6d5e1c
ZJS
285 </funcsynopsis>
286 </refsynopsisdiv>
287
288 <refsect1>
289 <title>Description</title>
290
66f756d4 291 <para>These functions return information from an
52d7c4dc
LP
292 <parameter>sd_bus_creds</parameter> credential object. Credential
293 objects may be created with
cd6d5e1c 294 <citerefentry><refentrytitle>sd_bus_creds_new_from_pid</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
52d7c4dc
LP
295 in which case they describe the credentials of the process
296 identified by the specified PID, with
297 <citerefentry><refentrytitle>sd_bus_get_name_creds</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
298 in which case they describe the credentials of a bus peer
b655a028 299 identified by the specified bus name, with
056f95d0 300 <citerefentry><refentrytitle>sd_bus_get_owner_creds</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
52d7c4dc 301 in which case they describe the credentials of the creator of a
b655a028
UTL
302 bus, or with
303 <citerefentry><refentrytitle>sd_bus_message_get_creds</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
304 in which case they describe the credentials of the sender of the message.</para>
cd6d5e1c 305
52d7c4dc
LP
306 <para><function>sd_bus_creds_get_pid()</function> will retrieve
307 the PID (process identifier). Similar,
308 <function>sd_bus_creds_get_ppid()</function> will retrieve the
309 parent PID. Note that PID 1 has no parent process, in which case
310 -ENXIO is returned.</para>
cd6d5e1c 311
b7ea3f3e 312 <para><function>sd_bus_creds_get_tid()</function> will retrieve the
cd6d5e1c
ZJS
313 TID (thread identifier).</para>
314
52d7c4dc
LP
315 <para><function>sd_bus_creds_get_uid()</function> will retrieve
316 the numeric UID (user identifier). Similar,
317 <function>sd_bus_creds_get_euid()</function> returns the effective
318 UID, <function>sd_bus_creds_get_suid()</function> the saved UID
319 and <function>sd_bus_creds_get_fsuid()</function> the file system
320 UID.</para>
cd6d5e1c 321
b7ea3f3e 322 <para><function>sd_bus_creds_get_gid()</function> will retrieve the
52d7c4dc
LP
323 numeric GID (group identifier). Similar,
324 <function>sd_bus_creds_get_egid()</function> returns the effective
325 GID, <function>sd_bus_creds_get_sgid()</function> the saved GID
326 and <function>sd_bus_creds_get_fsgid()</function> the file system
327 GID.</para>
328
329 <para><function>sd_bus_creds_get_supplementary_gids()</function>
330 will retrieve the supplementary GIDs list.</para>
cd6d5e1c 331
b7ea3f3e 332 <para><function>sd_bus_creds_get_comm()</function> will retrieve the
dc968941 333 comm field (truncated name of the executable, as stored in
cd6d5e1c
ZJS
334 <filename>/proc/<replaceable>pid</replaceable>/comm</filename>).
335 </para>
336
b7ea3f3e 337 <para><function>sd_bus_creds_get_tid_comm()</function> will retrieve
cd6d5e1c
ZJS
338 the comm field of the thread (as stored in
339 <filename>/proc/<replaceable>pid</replaceable>/task/<replaceable>tid</replaceable>/comm</filename>).
340 </para>
341
52d7c4dc
LP
342 <para><function>sd_bus_creds_get_exe()</function> will retrieve
343 the path to the program executable (as stored in the
cd6d5e1c 344 <filename>/proc/<replaceable>pid</replaceable>/exe</filename>
52d7c4dc
LP
345 link, but with <literal> (deleted)</literal> suffix removed). Note
346 that kernel threads do not have an executable path, in which case
347 -ENXIO is returned.</para>
cd6d5e1c 348
52d7c4dc
LP
349 <para><function>sd_bus_creds_get_cmdline()</function> will
350 retrieve an array of command line arguments (as stored in
351 <filename>/proc/<replaceable>pid</replaceable>/cmdline</filename>). Note
352 that kernel threads do not have a command line, in which case
353 -ENXIO is returned.</para>
cd6d5e1c 354
b7ea3f3e 355 <para><function>sd_bus_creds_get_cgroup()</function> will retrieve
cd6d5e1c
ZJS
356 the cgroup path. See <ulink
357 url="https://www.kernel.org/doc/Documentation/cgroups/cgroups.txt">cgroups.txt</ulink>.
358 </para>
359
52d7c4dc
LP
360 <para><function>sd_bus_creds_get_unit()</function> will retrieve
361 the systemd unit name (in the system instance of systemd) that the
cd6d5e1c 362 process is part of. See
52d7c4dc
LP
363 <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>. For
364 processes that are not part of a unit returns -ENXIO.
cd6d5e1c
ZJS
365 </para>
366
b7ea3f3e 367 <para><function>sd_bus_creds_get_user_unit()</function> will
cd6d5e1c
ZJS
368 retrieve the systemd unit name (in the user instance of systemd)
369 that the process is part of. See
52d7c4dc
LP
370 <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>. For
371 processes that are not part of a user unit returns -ENXIO.
cd6d5e1c
ZJS
372 </para>
373
b7ea3f3e 374 <para><function>sd_bus_creds_get_slice()</function> will retrieve
cd6d5e1c
ZJS
375 the systemd slice (a unit in the system instance of systemd) that
376 the process is part of. See
377 <citerefentry><refentrytitle>systemd.slice</refentrytitle><manvolnum>5</manvolnum></citerefentry>.
378 </para>
379
52d7c4dc
LP
380 <para><function>sd_bus_creds_get_session()</function> will
381 retrieve the logind session that the process is part of. See
382 <citerefentry><refentrytitle>systemd-logind.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>. For
383 processes that are not part of a session returns -ENXIO.
cd6d5e1c
ZJS
384 </para>
385
52d7c4dc
LP
386 <para><function>sd_bus_creds_get_owner_uid()</function> will
387 retrieve the numeric UID (user identifier) of the user who owns
388 the session that the process is part of. See
cd6d5e1c 389 <citerefentry><refentrytitle>systemd.slice</refentrytitle><manvolnum>5</manvolnum></citerefentry>
52d7c4dc 390 For processes that are not part of a session returns -ENXIO.
cd6d5e1c
ZJS
391 </para>
392
b7ea3f3e 393 <para><function>sd_bus_creds_has_effective_cap()</function> will
5485de1e
ZJS
394 check whether the capability specified by
395 <parameter>capability</parameter> was set in the effective
66f756d4 396 capabilities mask. A positive return value means that is was
5485de1e 397 set, zero means that it was not set, and a negative return
cd6d5e1c 398 value signifies an error. See
5aded369 399 <citerefentry project='man-pages'><refentrytitle>capabilities</refentrytitle><manvolnum>7</manvolnum></citerefentry>
cd6d5e1c
ZJS
400 and <varname>Capabilities=</varname> and
401 <varname>CapabilityBoundingSet=</varname> settings in
402 <citerefentry><refentrytitle>systemd.exec</refentrytitle><manvolnum>5</manvolnum></citerefentry>.
403 </para>
404
b7ea3f3e
LP
405 <para><function>sd_bus_creds_has_permitted_cap()</function> is
406 similar to <function>sd_bus_creds_has_effective_cap()</function>,
cd6d5e1c
ZJS
407 but will check the permitted capabilities mask.</para>
408
b7ea3f3e
LP
409 <para><function>sd_bus_creds_has_inheritable_cap()</function> is
410 similar to <function>sd_bus_creds_has_effective_cap()</function>,
cd6d5e1c
ZJS
411 but will check the inheritable capabilities mask.</para>
412
b7ea3f3e
LP
413 <para><function>sd_bus_creds_has_bounding_cap()</function> is
414 similar to <function>sd_bus_creds_has_effective_cap()</function>,
cd6d5e1c
ZJS
415 but will check the bounding capabilities mask.</para>
416
b7ea3f3e 417 <para><function>sd_bus_creds_get_selinux_context()</function> will
82adf6af 418 retrieve the SELinux security context (label) of the process.</para>
cd6d5e1c 419
52d7c4dc
LP
420 <para><function>sd_bus_creds_get_audit_session_id()</function>
421 will retrieve the audit session identifier of the process. Returns
422 -ENXIO for processes that are not part of an audit session.</para>
cd6d5e1c 423
b7ea3f3e 424 <para><function>sd_bus_creds_get_audit_login_uid()</function> will
cd6d5e1c 425 retrieve the audit user login identifier (the identifier of the
52d7c4dc
LP
426 user who is "responsible" for the session). Returns -ENXIO for
427 processes that are not part of an audit session.</para>
428
429 <para><function>sd_bus_creds_get_tty()</function> will retrieve
430 the controlling TTY. Returns -ENXIO for processes that have no
431 controlling TTY.</para>
cd6d5e1c 432
b7ea3f3e 433 <para><function>sd_bus_creds_get_unique_name()</function> will
cd6d5e1c
ZJS
434 retrieve the D-Bus unique name. See <ulink
435 url="http://dbus.freedesktop.org/doc/dbus-specification.html#message-protocol-names-bus">The
436 D-Bus specification</ulink>.</para>
437
b7ea3f3e 438 <para><function>sd_bus_creds_get_well_known_names()</function> will
cd6d5e1c
ZJS
439 retrieve the set of D-Bus well-known names. See <ulink
440 url="http://dbus.freedesktop.org/doc/dbus-specification.html#message-protocol-names-bus">The
441 D-Bus specification</ulink>.</para>
442
52d7c4dc 443 <para><function>sd_bus_creds_get_description()</function> will
5c20a8bc
LP
444 retrieve a descriptive name of the bus connection of the
445 peer. This name is useful to discern multiple bus connections by
446 the same peer, and may be altered by the peer with the
52d7c4dc 447 <citerefentry><refentrytitle>sd_bus_set_description</refentrytitle><manvolnum>3</manvolnum></citerefentry>
5c20a8bc
LP
448 call.</para>
449
cd6d5e1c
ZJS
450 <para>All functions that take a <parameter>const
451 char**</parameter> parameter will store the answer there as an
452 address of a NUL-terminated string. It will be valid as long as
453 <parameter>c</parameter> remains valid, and should not be freed or
454 modified by the caller.</para>
455
456 <para>All functions that take a <parameter>char***</parameter>
457 parameter will store the answer there as an address of a an array
ff9b60f3 458 of strings. Each individual string is NUL-terminated, and the
cd6d5e1c
ZJS
459 array is NULL-terminated as a whole. It will be valid as long as
460 <parameter>c</parameter> remains valid, and should not be freed or
461 modified by the caller.</para>
462 </refsect1>
463
464 <refsect1>
465 <title>Return Value</title>
466
467 <para>On success, these calls return 0 or a positive integer. On
468 failure, these calls return a negative errno-style error code.
469 </para>
470 </refsect1>
471
472 <refsect1>
473 <title>Errors</title>
474
475 <para>Returned errors may indicate the following problems:</para>
476
477 <variablelist>
478 <varlistentry>
8474b70c 479 <term><constant>-ENODATA</constant></term>
cd6d5e1c 480
52d7c4dc
LP
481 <listitem><para>Given field is not available in the
482 credentials object <parameter>c</parameter>.</para>
b200a92c 483 </listitem>
cd6d5e1c
ZJS
484 </varlistentry>
485
486 <varlistentry>
52d7c4dc 487 <term><constant>-ENXIO</constant></term>
cd6d5e1c 488
52d7c4dc
LP
489 <listitem><para>Given field is not specified for the described
490 process or peer. This will be returned by
491 <function>sd_bus_get_unit()</function>,
b7ea3f3e
LP
492 <function>sd_bus_get_user_unit()</function>,
493 <function>sd_bus_get_slice()</function>,
494 <function>sd_bus_get_session()</function>, and
52d7c4dc
LP
495 <function>sd_bus_get_owner_uid()</function> if the process is
496 not part of a systemd system unit, systemd user unit, systemd
497 slice, or logind session. It will also be returned by
498 <function>sd_bus_creds_get_exe()</function> and
499 <function>sd_bus_creds_get_cmdline()</function> for kernel
500 threads (since these aren't started from an executable binary
501 or have a command line),
502 <function>sd_bus_creds_get_audit_session_id()</function> and
503 <function>sd_bus_creds_get_audit_login_uid()</function> when
504 the process is not part of an audit session, and
505 <function>sd_bus_creds_get_tty()</function> if the process has
506 no controlling TTY.
507 </para>
b200a92c 508 </listitem>
cd6d5e1c
ZJS
509 </varlistentry>
510
511 <varlistentry>
8474b70c 512 <term><constant>-EINVAL</constant></term>
cd6d5e1c
ZJS
513
514 <listitem><para>Specified pointer parameter is <constant>NULL</constant>.
515 </para></listitem>
516 </varlistentry>
517
518 <varlistentry>
8474b70c 519 <term><constant>-ENOMEM</constant></term>
cd6d5e1c
ZJS
520
521 <listitem><para>Memory allocation failed.</para></listitem>
522 </varlistentry>
523 </variablelist>
524 </refsect1>
525
526 <refsect1>
527 <title>Notes</title>
528
529 <para><function>sd_bus_open_user()</function> and other functions
530 described here are available as a shared library, which can be
531 compiled and linked to with the
5aded369 532 <constant>libsystemd</constant> <citerefentry project='die-net'><refentrytitle>pkg-config</refentrytitle><manvolnum>1</manvolnum></citerefentry>
cd6d5e1c
ZJS
533 file.</para>
534 </refsect1>
535
536 <refsect1>
537 <title>See Also</title>
538
539 <para>
540 <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
541 <citerefentry><refentrytitle>sd-bus</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
cd6d5e1c
ZJS
542 <citerefentry><refentrytitle>fork</refentrytitle><manvolnum>2</manvolnum></citerefentry>,
543 <citerefentry><refentrytitle>execve</refentrytitle><manvolnum>2</manvolnum></citerefentry>,
5aded369
ZJS
544 <citerefentry project='man-pages'><refentrytitle>credentials</refentrytitle><manvolnum>7</manvolnum></citerefentry>,
545 <citerefentry project='man-pages'><refentrytitle>free</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
546 <citerefentry project='man-pages'><refentrytitle>proc</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
e530ed5e 547 <citerefentry><refentrytitle>systemd.journal-fields</refentrytitle><manvolnum>7</manvolnum></citerefentry>
cd6d5e1c
ZJS
548 </para>
549 </refsect1>
550
551</refentry>