| 1 |
'\" t |
| 2 |
.TH "SD_BUS_GET_NAME_CREDS" "3" "" "systemd 261~rc3" "sd_bus_get_name_creds" |
| 3 |
.\" ----------------------------------------------------------------- |
| 4 |
.\" * Define some portability stuff |
| 5 |
.\" ----------------------------------------------------------------- |
| 6 |
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 7 |
.\" http://bugs.debian.org/507673 |
| 8 |
.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html |
| 9 |
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 10 |
.ie \n(.g .ds Aq \(aq |
| 11 |
.el .ds Aq ' |
| 12 |
.\" ----------------------------------------------------------------- |
| 13 |
.\" * set default formatting |
| 14 |
.\" ----------------------------------------------------------------- |
| 15 |
.\" disable hyphenation |
| 16 |
.nh |
| 17 |
.\" disable justification (adjust text to left margin only) |
| 18 |
.ad l |
| 19 |
.\" ----------------------------------------------------------------- |
| 20 |
.\" * MAIN CONTENT STARTS HERE * |
| 21 |
.\" ----------------------------------------------------------------- |
| 22 |
.SH "NAME" |
| 23 |
sd_bus_get_name_creds, sd_bus_get_owner_creds \- Query bus client credentials |
| 24 |
.SH "SYNOPSIS" |
| 25 |
.sp |
| 26 |
.ft B |
| 27 |
.nf |
| 28 |
#include <systemd/sd\-bus\&.h> |
| 29 |
.fi |
| 30 |
.ft |
| 31 |
.HP \w'int\ sd_bus_get_name_creds('u |
| 32 |
.BI "int sd_bus_get_name_creds(sd_bus\ *" "bus" ", const\ char\ *" "name" ", uint64_t\ " "mask" ", sd_bus_creds\ **" "creds" ");" |
| 33 |
.HP \w'int\ sd_bus_get_owner_creds('u |
| 34 |
.BI "int sd_bus_get_owner_creds(sd_bus\ *" "bus" ", uint64_t\ " "mask" ", sd_bus_creds\ **" "creds" ");" |
| 35 |
.SH "DESCRIPTION" |
| 36 |
.PP |
| 37 |
\fBsd_bus_get_name_creds()\fR |
| 38 |
queries the credentials of the bus client identified by |
| 39 |
\fIname\fR\&. The |
| 40 |
\fImask\fR |
| 41 |
parameter is a combo of |
| 42 |
\fBSD_BUS_CREDS_*\fR |
| 43 |
flags that indicate which credential info the caller is interested in\&. See |
| 44 |
\fBsd_bus_creds_new_from_pid\fR(3) |
| 45 |
for a list of possible flags\&. On success, |
| 46 |
\fIcreds\fR |
| 47 |
contains a new |
| 48 |
sd_bus_creds |
| 49 |
instance with the requested information\&. Ownership of this instance belongs to the caller and it should be freed once no longer needed by calling |
| 50 |
\fBsd_bus_creds_unref\fR(3)\&. |
| 51 |
.PP |
| 52 |
\fBsd_bus_get_owner_creds()\fR |
| 53 |
queries the credentials of the creator of the given bus\&. The |
| 54 |
\fImask\fR |
| 55 |
and |
| 56 |
\fIcreds\fR |
| 57 |
parameters behave the same as in |
| 58 |
\fBsd_bus_get_name_creds()\fR\&. |
| 59 |
.SH "RETURN VALUE" |
| 60 |
.PP |
| 61 |
On success, these functions return a non\-negative integer\&. On failure, they return a negative errno\-style error code\&. |
| 62 |
.SS "Errors" |
| 63 |
.PP |
| 64 |
Returned errors may indicate the following problems: |
| 65 |
.PP |
| 66 |
\fB\-EINVAL\fR |
| 67 |
.RS 4 |
| 68 |
An argument is invalid\&. |
| 69 |
.RE |
| 70 |
.PP |
| 71 |
\fB\-ENOPKG\fR |
| 72 |
.RS 4 |
| 73 |
The bus cannot be resolved\&. |
| 74 |
.RE |
| 75 |
.PP |
| 76 |
\fB\-EPERM\fR |
| 77 |
.RS 4 |
| 78 |
The bus has already been started\&. |
| 79 |
.RE |
| 80 |
.PP |
| 81 |
\fB\-ECHILD\fR |
| 82 |
.RS 4 |
| 83 |
The bus was created in a different process, library or module instance\&. |
| 84 |
.RE |
| 85 |
.PP |
| 86 |
\fB\-ENOMEM\fR |
| 87 |
.RS 4 |
| 88 |
Memory allocation failed\&. |
| 89 |
.RE |
| 90 |
.SH "NOTES" |
| 91 |
.PP |
| 92 |
Functions described here are available as a shared library, which can be compiled against and linked to with the |
| 93 |
\fBlibsystemd\fR\ \&\fBpkg-config\fR(1) |
| 94 |
file\&. |
| 95 |
.PP |
| 96 |
The code described here uses |
| 97 |
\fBgetenv\fR(3), which is declared to be not multi\-thread\-safe\&. This means that the code calling the functions described here must not call |
| 98 |
\fBsetenv\fR(3) |
| 99 |
from a parallel thread\&. It is recommended to only do calls to |
| 100 |
\fBsetenv()\fR |
| 101 |
from an early phase of the program when no other threads have been started\&. |
| 102 |
.SH "HISTORY" |
| 103 |
.PP |
| 104 |
\fBsd_bus_get_name_creds()\fR |
| 105 |
and |
| 106 |
\fBsd_bus_get_owner_creds()\fR |
| 107 |
were added in version 221\&. |
| 108 |
.SH "SEE ALSO" |
| 109 |
.PP |
| 110 |
\fBsystemd\fR(1), \fBsd-bus\fR(3), \fBsd_bus_creds_unref\fR(3) |