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