]> git.ipfire.org Git - thirdparty/systemd.git/blame - man/sd_bus_creds_get_pid.xml
tree-wide: beautify remaining copyright statements
[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<!--
572eb058
ZJS
6 SPDX-License-Identifier: LGPL-2.1+
7
96b2fb93 8 Copyright © 2014 Zbigniew Jędrzejewski-Szmek
cd6d5e1c
ZJS
9-->
10
7d6b2723 11<refentry id="sd_bus_creds_get_pid" xmlns:xi="http://www.w3.org/2001/XInclude">
cd6d5e1c
ZJS
12
13 <refentryinfo>
14 <title>sd_bus_creds_get_pid</title>
15 <productname>systemd</productname>
16
17 <authorgroup>
18 <author>
19 <contrib>A monkey with a typewriter</contrib>
20 <firstname>Zbigniew</firstname>
21 <surname>Jędrzejewski-Szmek</surname>
22 <email>zbyszek@in.waw.pl</email>
23 </author>
24 </authorgroup>
25 </refentryinfo>
26
27 <refmeta>
28 <refentrytitle>sd_bus_creds_get_pid</refentrytitle>
29 <manvolnum>3</manvolnum>
30 </refmeta>
31
32 <refnamediv>
33 <refname>sd_bus_creds_get_pid</refname>
52d7c4dc 34 <refname>sd_bus_creds_get_ppid</refname>
cd6d5e1c
ZJS
35 <refname>sd_bus_creds_get_tid</refname>
36 <refname>sd_bus_creds_get_uid</refname>
52d7c4dc
LP
37 <refname>sd_bus_creds_get_euid</refname>
38 <refname>sd_bus_creds_get_suid</refname>
39 <refname>sd_bus_creds_get_fsuid</refname>
cd6d5e1c 40 <refname>sd_bus_creds_get_gid</refname>
52d7c4dc
LP
41 <refname>sd_bus_creds_get_egid</refname>
42 <refname>sd_bus_creds_get_sgid</refname>
43 <refname>sd_bus_creds_get_fsgid</refname>
44 <refname>sd_bus_creds_get_supplementary_gids</refname>
cd6d5e1c
ZJS
45 <refname>sd_bus_creds_get_comm</refname>
46 <refname>sd_bus_creds_get_tid_comm</refname>
47 <refname>sd_bus_creds_get_exe</refname>
48 <refname>sd_bus_creds_get_cmdline</refname>
49 <refname>sd_bus_creds_get_cgroup</refname>
50 <refname>sd_bus_creds_get_unit</refname>
cd6d5e1c 51 <refname>sd_bus_creds_get_slice</refname>
f6f7a984
LP
52 <refname>sd_bus_creds_get_user_unit</refname>
53 <refname>sd_bus_creds_get_user_slice</refname>
cd6d5e1c
ZJS
54 <refname>sd_bus_creds_get_session</refname>
55 <refname>sd_bus_creds_get_owner_uid</refname>
56 <refname>sd_bus_creds_has_effective_cap</refname>
57 <refname>sd_bus_creds_has_permitted_cap</refname>
58 <refname>sd_bus_creds_has_inheritable_cap</refname>
59 <refname>sd_bus_creds_has_bounding_cap</refname>
60 <refname>sd_bus_creds_get_selinux_context</refname>
61 <refname>sd_bus_creds_get_audit_session_id</refname>
62 <refname>sd_bus_creds_get_audit_login_uid</refname>
52d7c4dc 63 <refname>sd_bus_creds_get_tty</refname>
cd6d5e1c
ZJS
64 <refname>sd_bus_creds_get_unique_name</refname>
65 <refname>sd_bus_creds_get_well_known_names</refname>
52d7c4dc 66 <refname>sd_bus_creds_get_description</refname>
cd6d5e1c
ZJS
67
68 <refpurpose>Retrieve fields from a credentials object</refpurpose>
69 </refnamediv>
70
71 <refsynopsisdiv>
72 <funcsynopsis>
73 <funcsynopsisinfo>#include &lt;systemd/sd-bus.h&gt;</funcsynopsisinfo>
74
75 <funcprototype>
76 <funcdef>int <function>sd_bus_creds_get_pid</function></funcdef>
8dc385e7 77 <paramdef>sd_bus_creds *<parameter>c</parameter></paramdef>
cd6d5e1c
ZJS
78 <paramdef>pid_t *<parameter>pid</parameter></paramdef>
79 </funcprototype>
80
52d7c4dc
LP
81 <funcprototype>
82 <funcdef>int <function>sd_bus_creds_get_ppid</function></funcdef>
83 <paramdef>sd_bus_creds *<parameter>c</parameter></paramdef>
84 <paramdef>pid_t *<parameter>ppid</parameter></paramdef>
85 </funcprototype>
86
cd6d5e1c
ZJS
87 <funcprototype>
88 <funcdef>int <function>sd_bus_creds_get_tid</function></funcdef>
8dc385e7 89 <paramdef>sd_bus_creds *<parameter>c</parameter></paramdef>
cd6d5e1c
ZJS
90 <paramdef>pid_t *<parameter>tid</parameter></paramdef>
91 </funcprototype>
92
93 <funcprototype>
52d7c4dc
LP
94 <funcdef>int <function>sd_bus_creds_get_uid</function></funcdef>
95 <paramdef>sd_bus_creds *<parameter>c</parameter></paramdef>
96 <paramdef>uid_t *<parameter>uid</parameter></paramdef>
97 </funcprototype>
98
99 <funcprototype>
100 <funcdef>int <function>sd_bus_creds_get_euid</function></funcdef>
101 <paramdef>sd_bus_creds *<parameter>c</parameter></paramdef>
102 <paramdef>uid_t *<parameter>uid</parameter></paramdef>
103 </funcprototype>
104
105 <funcprototype>
106 <funcdef>int <function>sd_bus_creds_get_suid</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_fsuid</function></funcdef>
8dc385e7 113 <paramdef>sd_bus_creds *<parameter>c</parameter></paramdef>
cd6d5e1c
ZJS
114 <paramdef>uid_t *<parameter>uid</parameter></paramdef>
115 </funcprototype>
116
117 <funcprototype>
118 <funcdef>int <function>sd_bus_creds_get_gid</function></funcdef>
8dc385e7 119 <paramdef>sd_bus_creds *<parameter>c</parameter></paramdef>
cd6d5e1c
ZJS
120 <paramdef>gid_t *<parameter>gid</parameter></paramdef>
121 </funcprototype>
122
52d7c4dc
LP
123 <funcprototype>
124 <funcdef>int <function>sd_bus_creds_get_egid</function></funcdef>
125 <paramdef>sd_bus_creds *<parameter>c</parameter></paramdef>
126 <paramdef>gid_t *<parameter>gid</parameter></paramdef>
127 </funcprototype>
128
129 <funcprototype>
130 <funcdef>int <function>sd_bus_creds_get_sgid</function></funcdef>
131 <paramdef>sd_bus_creds *<parameter>c</parameter></paramdef>
132 <paramdef>gid_t *<parameter>gid</parameter></paramdef>
133 </funcprototype>
134
135 <funcprototype>
136 <funcdef>int <function>sd_bus_creds_get_fsgid</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_supplementary_gids</function></funcdef>
143 <paramdef>sd_bus_creds *<parameter>c</parameter></paramdef>
144 <paramdef>const gid_t **<parameter>gids</parameter></paramdef>
145 </funcprototype>
146
cd6d5e1c
ZJS
147 <funcprototype>
148 <funcdef>int <function>sd_bus_creds_get_comm</function></funcdef>
8dc385e7 149 <paramdef>sd_bus_creds *<parameter>c</parameter></paramdef>
cd6d5e1c
ZJS
150 <paramdef>const char **<parameter>comm</parameter></paramdef>
151 </funcprototype>
152
153 <funcprototype>
154 <funcdef>int <function>sd_bus_creds_get_tid_comm</function></funcdef>
8dc385e7 155 <paramdef>sd_bus_creds *<parameter>c</parameter></paramdef>
cd6d5e1c
ZJS
156 <paramdef>const char **<parameter>comm</parameter></paramdef>
157 </funcprototype>
158
159 <funcprototype>
160 <funcdef>int <function>sd_bus_creds_get_exe</function></funcdef>
8dc385e7 161 <paramdef>sd_bus_creds *<parameter>c</parameter></paramdef>
cd6d5e1c
ZJS
162 <paramdef>const char **<parameter>exe</parameter></paramdef>
163 </funcprototype>
164
165 <funcprototype>
166 <funcdef>int <function>sd_bus_creds_get_cmdline</function></funcdef>
8dc385e7 167 <paramdef>sd_bus_creds *<parameter>c</parameter></paramdef>
cd6d5e1c
ZJS
168 <paramdef>char ***<parameter>cmdline</parameter></paramdef>
169 </funcprototype>
170
171 <funcprototype>
172 <funcdef>int <function>sd_bus_creds_get_cgroup</function></funcdef>
8dc385e7 173 <paramdef>sd_bus_creds *<parameter>c</parameter></paramdef>
cd6d5e1c
ZJS
174 <paramdef>const char **<parameter>cgroup</parameter></paramdef>
175 </funcprototype>
176
177 <funcprototype>
178 <funcdef>int <function>sd_bus_creds_get_unit</function></funcdef>
8dc385e7 179 <paramdef>sd_bus_creds *<parameter>c</parameter></paramdef>
cd6d5e1c
ZJS
180 <paramdef>const char **<parameter>unit</parameter></paramdef>
181 </funcprototype>
182
f6f7a984
LP
183 <funcprototype>
184 <funcdef>int <function>sd_bus_creds_get_slice</function></funcdef>
185 <paramdef>sd_bus_creds *<parameter>c</parameter></paramdef>
186 <paramdef>const char **<parameter>slice</parameter></paramdef>
187 </funcprototype>
188
cd6d5e1c
ZJS
189 <funcprototype>
190 <funcdef>int <function>sd_bus_creds_get_user_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>
f6f7a984 196 <funcdef>int <function>sd_bus_creds_get_user_slice</function></funcdef>
8dc385e7 197 <paramdef>sd_bus_creds *<parameter>c</parameter></paramdef>
cd6d5e1c
ZJS
198 <paramdef>const char **<parameter>slice</parameter></paramdef>
199 </funcprototype>
200
201 <funcprototype>
202 <funcdef>int <function>sd_bus_creds_get_session</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_owner_uid</function></funcdef>
8dc385e7 209 <paramdef>sd_bus_creds *<parameter>c</parameter></paramdef>
cd6d5e1c
ZJS
210 <paramdef>uid_t *<parameter>uid</parameter></paramdef>
211 </funcprototype>
212
213 <funcprototype>
214 <funcdef>int <function>sd_bus_creds_has_effective_cap</function></funcdef>
8dc385e7 215 <paramdef>sd_bus_creds *<parameter>c</parameter></paramdef>
cd6d5e1c
ZJS
216 <paramdef>int <parameter>capability</parameter></paramdef>
217 </funcprototype>
218
219 <funcprototype>
220 <funcdef>int <function>sd_bus_creds_has_permitted_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_inheritable_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_bounding_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_get_selinux_context</function></funcdef>
8dc385e7 239 <paramdef>sd_bus_creds *<parameter>c</parameter></paramdef>
cd6d5e1c
ZJS
240 <paramdef>const char **<parameter>context</parameter></paramdef>
241 </funcprototype>
242
243 <funcprototype>
244 <funcdef>int <function>sd_bus_creds_get_audit_session_id</function></funcdef>
8dc385e7 245 <paramdef>sd_bus_creds *<parameter>c</parameter></paramdef>
cd6d5e1c
ZJS
246 <paramdef>uint32_t *<parameter>sessionid</parameter></paramdef>
247 </funcprototype>
248
249 <funcprototype>
250 <funcdef>int <function>sd_bus_creds_get_audit_login_uid</function></funcdef>
8dc385e7 251 <paramdef>sd_bus_creds *<parameter>c</parameter></paramdef>
cd6d5e1c
ZJS
252 <paramdef>uid_t *<parameter>loginuid</parameter></paramdef>
253 </funcprototype>
254
52d7c4dc
LP
255 <funcprototype>
256 <funcdef>int <function>sd_bus_creds_get_tty</function></funcdef>
257 <paramdef>sd_bus_creds *<parameter>c</parameter></paramdef>
258 <paramdef>const char **<parameter>tty</parameter></paramdef>
259 </funcprototype>
260
cd6d5e1c
ZJS
261 <funcprototype>
262 <funcdef>int <function>sd_bus_creds_get_unique_name</function></funcdef>
8dc385e7 263 <paramdef>sd_bus_creds *<parameter>c</parameter></paramdef>
cd6d5e1c
ZJS
264 <paramdef>const char **<parameter>name</parameter></paramdef>
265 </funcprototype>
266
267 <funcprototype>
268 <funcdef>int <function>sd_bus_creds_get_well_known_names</function></funcdef>
8dc385e7 269 <paramdef>sd_bus_creds *<parameter>c</parameter></paramdef>
cd6d5e1c
ZJS
270 <paramdef>char ***<parameter>name</parameter></paramdef>
271 </funcprototype>
272
5c20a8bc 273 <funcprototype>
52d7c4dc 274 <funcdef>int <function>sd_bus_creds_get_description</function></funcdef>
5c20a8bc
LP
275 <paramdef>sd_bus_creds *<parameter>c</parameter></paramdef>
276 <paramdef>const char **<parameter>name</parameter></paramdef>
277 </funcprototype>
278
cd6d5e1c
ZJS
279 </funcsynopsis>
280 </refsynopsisdiv>
281
282 <refsect1>
283 <title>Description</title>
284
f6f7a984
LP
285 <para>These functions return credential information from an
286 <parameter>sd_bus_creds</parameter> object. Credential objects may
287 be created with
cd6d5e1c 288 <citerefentry><refentrytitle>sd_bus_creds_new_from_pid</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
52d7c4dc
LP
289 in which case they describe the credentials of the process
290 identified by the specified PID, with
291 <citerefentry><refentrytitle>sd_bus_get_name_creds</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
292 in which case they describe the credentials of a bus peer
b655a028 293 identified by the specified bus name, with
056f95d0 294 <citerefentry><refentrytitle>sd_bus_get_owner_creds</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
52d7c4dc 295 in which case they describe the credentials of the creator of a
b655a028
UTL
296 bus, or with
297 <citerefentry><refentrytitle>sd_bus_message_get_creds</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
f6f7a984
LP
298 in which case they describe the credentials of the sender of the
299 message.</para>
300
301 <para>Not all credential fields are part of every
302 <literal>sd_bus_creds</literal> object. Use
303 <citerefentry><refentrytitle>sd_bus_creds_get_mask</refentrytitle><manvolnum>3</manvolnum></citerefentry>
304 to determine the mask of fields available.</para>
cd6d5e1c 305
52d7c4dc 306 <para><function>sd_bus_creds_get_pid()</function> will retrieve
a8eaaee7 307 the PID (process identifier). Similarly,
52d7c4dc
LP
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 315 <para><function>sd_bus_creds_get_uid()</function> will retrieve
a8eaaee7 316 the numeric UID (user identifier). Similarly,
52d7c4dc
LP
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
a8eaaee7 323 numeric GID (group identifier). Similarly,
52d7c4dc
LP
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>
a8eaaee7 345 link, but with the <literal> (deleted)</literal> suffix removed). Note
52d7c4dc
LP
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
c7458f93 356 the control group path. See <ulink
3c887f97 357 url="https://www.kernel.org/doc/Documentation/cgroup-v1/cgroups.txt">cgroups.txt</ulink>.
cd6d5e1c
ZJS
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
a8eaaee7 362 process is a part of. See
52d7c4dc 363 <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>. For
b938cb90 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 368 retrieve the systemd unit name (in the user instance of systemd)
a8eaaee7 369 that the process is a part of. See
52d7c4dc 370 <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>. For
b938cb90 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 375 the systemd slice (a unit in the system instance of systemd) that
a8eaaee7
JE
376 the process is a part of. See
377 <citerefentry><refentrytitle>systemd.slice</refentrytitle><manvolnum>5</manvolnum></citerefentry>. Similarly,
f6f7a984
LP
378 <function>sd_bus_creds_get_user_slice()</function> retrieves the
379 systemd slice of the process, in the user instance of systemd.
cd6d5e1c
ZJS
380 </para>
381
52d7c4dc 382 <para><function>sd_bus_creds_get_session()</function> will
f6f7a984 383 retrieve the identifier of the login session that the process is
1c97e2eb
AJ
384 a part of. Please note the login session may be limited to a stub
385 process or two. User processes may instead be started from their
386 systemd user manager, e.g. GUI applications started using DBus
387 activation, as well as service processes which are shared between
388 multiple logins of the same user. For processes that are not part
389 of a session, returns -ENXIO.</para>
cd6d5e1c 390
52d7c4dc
LP
391 <para><function>sd_bus_creds_get_owner_uid()</function> will
392 retrieve the numeric UID (user identifier) of the user who owns
1c97e2eb 393 the user unit or login session that the process is a part of. See
f6f7a984 394 <citerefentry><refentrytitle>systemd-logind.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>.
1c97e2eb
AJ
395 For processes that are not part of a user unit or session, returns
396 -ENXIO.
cd6d5e1c
ZJS
397 </para>
398
479050b3
LP
399 <para><function>sd_bus_creds_has_effective_cap()</function> will check whether the capability specified by
400 <parameter>capability</parameter> was set in the effective capabilities mask. A positive return value means that it
401 was set, zero means that it was not set, and a negative return value indicates an error. See <citerefentry
402 project='man-pages'><refentrytitle>capabilities</refentrytitle><manvolnum>7</manvolnum></citerefentry> and the
403 <varname>AmbientCapabilities=</varname> and <varname>CapabilityBoundingSet=</varname> settings in
cd6d5e1c
ZJS
404 <citerefentry><refentrytitle>systemd.exec</refentrytitle><manvolnum>5</manvolnum></citerefentry>.
405 </para>
406
b7ea3f3e
LP
407 <para><function>sd_bus_creds_has_permitted_cap()</function> is
408 similar to <function>sd_bus_creds_has_effective_cap()</function>,
cd6d5e1c
ZJS
409 but will check the permitted capabilities mask.</para>
410
b7ea3f3e
LP
411 <para><function>sd_bus_creds_has_inheritable_cap()</function> is
412 similar to <function>sd_bus_creds_has_effective_cap()</function>,
cd6d5e1c
ZJS
413 but will check the inheritable capabilities mask.</para>
414
b7ea3f3e
LP
415 <para><function>sd_bus_creds_has_bounding_cap()</function> is
416 similar to <function>sd_bus_creds_has_effective_cap()</function>,
cd6d5e1c
ZJS
417 but will check the bounding capabilities mask.</para>
418
b7ea3f3e 419 <para><function>sd_bus_creds_get_selinux_context()</function> will
82adf6af 420 retrieve the SELinux security context (label) of the process.</para>
cd6d5e1c 421
52d7c4dc
LP
422 <para><function>sd_bus_creds_get_audit_session_id()</function>
423 will retrieve the audit session identifier of the process. Returns
424 -ENXIO for processes that are not part of an audit session.</para>
cd6d5e1c 425
b7ea3f3e 426 <para><function>sd_bus_creds_get_audit_login_uid()</function> will
cd6d5e1c 427 retrieve the audit user login identifier (the identifier of the
52d7c4dc
LP
428 user who is "responsible" for the session). Returns -ENXIO for
429 processes that are not part of an audit session.</para>
430
431 <para><function>sd_bus_creds_get_tty()</function> will retrieve
f6f7a984
LP
432 the controlling TTY, without the prefixing "/dev/". Returns -ENXIO
433 for processes that have no controlling TTY.</para>
cd6d5e1c 434
b7ea3f3e 435 <para><function>sd_bus_creds_get_unique_name()</function> will
cd6d5e1c
ZJS
436 retrieve the D-Bus unique name. See <ulink
437 url="http://dbus.freedesktop.org/doc/dbus-specification.html#message-protocol-names-bus">The
438 D-Bus specification</ulink>.</para>
439
b7ea3f3e 440 <para><function>sd_bus_creds_get_well_known_names()</function> will
cd6d5e1c
ZJS
441 retrieve the set of D-Bus well-known names. See <ulink
442 url="http://dbus.freedesktop.org/doc/dbus-specification.html#message-protocol-names-bus">The
443 D-Bus specification</ulink>.</para>
444
52d7c4dc 445 <para><function>sd_bus_creds_get_description()</function> will
5c20a8bc
LP
446 retrieve a descriptive name of the bus connection of the
447 peer. This name is useful to discern multiple bus connections by
448 the same peer, and may be altered by the peer with the
52d7c4dc 449 <citerefentry><refentrytitle>sd_bus_set_description</refentrytitle><manvolnum>3</manvolnum></citerefentry>
5c20a8bc
LP
450 call.</para>
451
cd6d5e1c
ZJS
452 <para>All functions that take a <parameter>const
453 char**</parameter> parameter will store the answer there as an
454 address of a NUL-terminated string. It will be valid as long as
455 <parameter>c</parameter> remains valid, and should not be freed or
456 modified by the caller.</para>
457
458 <para>All functions that take a <parameter>char***</parameter>
7f3fdb7f 459 parameter will store the answer there as an address of an array
ff9b60f3 460 of strings. Each individual string is NUL-terminated, and the
cd6d5e1c
ZJS
461 array is NULL-terminated as a whole. It will be valid as long as
462 <parameter>c</parameter> remains valid, and should not be freed or
463 modified by the caller.</para>
464 </refsect1>
465
466 <refsect1>
467 <title>Return Value</title>
468
469 <para>On success, these calls return 0 or a positive integer. On
470 failure, these calls return a negative errno-style error code.
471 </para>
472 </refsect1>
473
474 <refsect1>
475 <title>Errors</title>
476
477 <para>Returned errors may indicate the following problems:</para>
478
479 <variablelist>
480 <varlistentry>
8474b70c 481 <term><constant>-ENODATA</constant></term>
cd6d5e1c 482
a8eaaee7 483 <listitem><para>The given field is not available in the
52d7c4dc 484 credentials object <parameter>c</parameter>.</para>
b200a92c 485 </listitem>
cd6d5e1c
ZJS
486 </varlistentry>
487
488 <varlistentry>
52d7c4dc 489 <term><constant>-ENXIO</constant></term>
cd6d5e1c 490
a8eaaee7 491 <listitem><para>The given field is not specified for the described
52d7c4dc 492 process or peer. This will be returned by
fc47bea6
AJ
493 <function>sd_bus_creds_get_unit()</function>,
494 <function>sd_bus_creds_get_slice()</function>,
495 <function>sd_bus_creds_get_user_unit()</function>,
496 <function>sd_bus_creds_get_user_slice()</function>, and
497 <function>sd_bus_creds_get_session()</function> if the process is
52d7c4dc 498 not part of a systemd system unit, systemd user unit, systemd
1c97e2eb
AJ
499 slice, or logind session. It will be returned by
500 <function>sd_bus_creds_get_owner_uid()</function> if the process is
501 not part of a systemd user unit or logind session. It will also be
502 returned by <function>sd_bus_creds_get_exe()</function> and
52d7c4dc 503 <function>sd_bus_creds_get_cmdline()</function> for kernel
a8eaaee7
JE
504 threads (since these are not started from an executable binary,
505 nor have a command line), and by
52d7c4dc
LP
506 <function>sd_bus_creds_get_audit_session_id()</function> and
507 <function>sd_bus_creds_get_audit_login_uid()</function> when
508 the process is not part of an audit session, and
509 <function>sd_bus_creds_get_tty()</function> if the process has
510 no controlling TTY.
511 </para>
b200a92c 512 </listitem>
cd6d5e1c
ZJS
513 </varlistentry>
514
515 <varlistentry>
8474b70c 516 <term><constant>-EINVAL</constant></term>
cd6d5e1c
ZJS
517
518 <listitem><para>Specified pointer parameter is <constant>NULL</constant>.
519 </para></listitem>
520 </varlistentry>
521
522 <varlistentry>
8474b70c 523 <term><constant>-ENOMEM</constant></term>
cd6d5e1c
ZJS
524
525 <listitem><para>Memory allocation failed.</para></listitem>
526 </varlistentry>
527 </variablelist>
528 </refsect1>
529
7d6b2723 530 <xi:include href="libsystemd-pkgconfig.xml" />
cd6d5e1c
ZJS
531
532 <refsect1>
533 <title>See Also</title>
534
535 <para>
536 <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
537 <citerefentry><refentrytitle>sd-bus</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
f6f7a984
LP
538 <citerefentry><refentrytitle>sd_bus_creds_new_from_pid</refentrytitle><manvolnum>2</manvolnum></citerefentry>,
539 <citerefentry project='man-pages'><refentrytitle>fork</refentrytitle><manvolnum>2</manvolnum></citerefentry>,
540 <citerefentry project='man-pages'><refentrytitle>execve</refentrytitle><manvolnum>2</manvolnum></citerefentry>,
5aded369
ZJS
541 <citerefentry project='man-pages'><refentrytitle>credentials</refentrytitle><manvolnum>7</manvolnum></citerefentry>,
542 <citerefentry project='man-pages'><refentrytitle>free</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
543 <citerefentry project='man-pages'><refentrytitle>proc</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
e530ed5e 544 <citerefentry><refentrytitle>systemd.journal-fields</refentrytitle><manvolnum>7</manvolnum></citerefentry>
cd6d5e1c
ZJS
545 </para>
546 </refsect1>
547
548</refentry>