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