summaryrefslogtreecommitdiffstats
path: root/upstream/fedora-rawhide/man3/sd_bus_negotiate_fds.3
blob: 3c94330bfdcd3788f770f14c8166acc334d00872 (plain)
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
'\" t
.TH "SD_BUS_NEGOTIATE_FDS" "3" "" "systemd 256~rc3" "sd_bus_negotiate_fds"
.\" -----------------------------------------------------------------
.\" * Define some portability stuff
.\" -----------------------------------------------------------------
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.\" http://bugs.debian.org/507673
.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.ie \n(.g .ds Aq \(aq
.el       .ds Aq '
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
.\" disable hyphenation
.nh
.\" disable justification (adjust text to left margin only)
.ad l
.\" -----------------------------------------------------------------
.\" * MAIN CONTENT STARTS HERE *
.\" -----------------------------------------------------------------
.SH "NAME"
sd_bus_negotiate_fds, sd_bus_negotiate_timestamp, sd_bus_negotiate_creds, sd_bus_get_creds_mask \- Control feature negotiation on bus connections
.SH "SYNOPSIS"
.sp
.ft B
.nf
#include <systemd/sd\-bus\&.h>
.fi
.ft
.HP \w'int\ sd_bus_negotiate_fds('u
.BI "int sd_bus_negotiate_fds(sd_bus\ *" "bus" ", int\ " "b" ");"
.HP \w'int\ sd_bus_negotiate_timestamp('u
.BI "int sd_bus_negotiate_timestamp(sd_bus\ *" "bus" ", int\ " "b" ");"
.HP \w'int\ sd_bus_negotiate_creds('u
.BI "int sd_bus_negotiate_creds(sd_bus\ *" "bus" ", int\ " "b" ", uint64_t\ " "mask" ");"
.HP \w'int\ sd_bus_get_creds_mask('u
.BI "int sd_bus_get_creds_mask(sd_bus\ *" "bus" ", uint64_t\ *" "mask" ");"
.SH "DESCRIPTION"
.PP
\fBsd_bus_negotiate_fds()\fR
controls whether file descriptor passing shall be negotiated for the specified bus connection\&. It takes a bus object and a boolean, which, when true, enables file descriptor passing, and, when false, disables it\&. Note that not all transports and servers support file descriptor passing\&. In particular, networked transports generally do not support file descriptor passing\&. To find out whether file descriptor passing is available after negotiation, use
\fBsd_bus_can_send\fR(3)
and pass
\fBSD_BUS_TYPE_UNIX_FD\fR\&. Note that file descriptor passing is always enabled for both sending and receiving or for neither, but never only in one direction\&. By default, file descriptor passing is negotiated for all connections\&.
.PP
\fBsd_bus_negotiate_timestamp()\fR
controls whether implicit sender timestamps shall be attached automatically to all incoming messages\&. Takes a bus object and a boolean, which, when true, enables timestamping, and, when false, disables it\&. Use
\fBsd_bus_message_get_monotonic_usec\fR(3),
\fBsd_bus_message_get_realtime_usec\fR(3),
\fBsd_bus_message_get_seqnum\fR(3)
to query the timestamps of incoming messages\&. If negotiation is disabled or not supported, these calls will fail with
\fB\-ENODATA\fR\&. Note that currently no transports support timestamping of messages\&. By default, message timestamping is not negotiated for connections\&.
.PP
\fBsd_bus_negotiate_creds()\fR
controls whether and which implicit sender credentials shall be attached automatically to all incoming messages\&. Takes a bus object and a boolean indicating whether to enable or disable the credential parts encoded in the bit mask value argument\&. Note that not all transports support attaching sender credentials to messages, or do not support all types of sender credential parameters, or might suppress them under certain circumstances for individual messages\&. Specifically, dbus1 only supports
\fBSD_BUS_CREDS_UNIQUE_NAME\fR\&. The sender credentials are suitable for authorization decisions\&. By default, only
\fBSD_BUS_CREDS_WELL_KNOWN_NAMES\fR
and
\fBSD_BUS_CREDS_UNIQUE_NAME\fR
are enabled\&. In fact, these two credential fields are always sent along and cannot be turned off\&.
.PP
\fBsd_bus_get_creds_mask()\fR
returns the set of sender credentials that was negotiated to be attached to all incoming messages in
\fImask\fR\&. This value is an upper boundary only\&. Hence, always make sure to explicitly check which credentials are attached to a specific message before using it\&.
.PP
The
\fBsd_bus_negotiate_fds()\fR
function may be called only before the connection has been started with
\fBsd_bus_start\fR(3)\&. Both
\fBsd_bus_negotiate_timestamp()\fR
and
\fBsd_bus_negotiate_creds()\fR
may also be called after a connection has been set up\&. Note that, when operating on a connection that is shared between multiple components of the same program (for example via
\fBsd_bus_default\fR(3)), it is highly recommended to only enable additional per message metadata fields, but never disable them again, in order not to disable functionality needed by other components\&.
.SH "RETURN VALUE"
.PP
On success, these functions return a non\-negative integer\&. On failure, they return a negative errno\-style error code\&.
.SS "Errors"
.PP
Returned errors may indicate the following problems:
.PP
\fB\-EPERM\fR
.RS 4
The bus connection has already been started\&.
.RE
.PP
\fB\-EINVAL\fR
.RS 4
An argument is invalid\&.
.sp
Added in version 246\&.
.RE
.PP
\fB\-ENOPKG\fR
.RS 4
The bus cannot be resolved\&.
.sp
Added in version 246\&.
.RE
.PP
\fB\-ECHILD\fR
.RS 4
The bus was created in a different process, library or module instance\&.
.sp
Added in version 246\&.
.RE
.SH "NOTES"
.PP
Functions described here are available as a shared library, which can be compiled against and linked to with the
\fBlibsystemd\fR\ \&\fBpkg-config\fR(1)
file\&.
.PP
The code described here uses
\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
\fBsetenv\fR(3)
from a parallel thread\&. It is recommended to only do calls to
\fBsetenv()\fR
from an early phase of the program when no other threads have been started\&.
.SH "HISTORY"
.PP
\fBsd_bus_negotiate_fds()\fR,
\fBsd_bus_negotiate_timestamp()\fR, and
\fBsd_bus_negotiate_creds()\fR
were added in version 212\&.
.PP
\fBsd_bus_get_creds_mask()\fR
was added in version 246\&.
.SH "SEE ALSO"
.PP
\fBsystemd\fR(1), \fBsd-bus\fR(3), \fBsd_bus_start\fR(3), \fBsd_bus_can_send\fR(3), \fBsd_bus_message_get_monotonic_usec\fR(3), \fBsd_bus_message_get_realtime_usec\fR(3), \fBsd_bus_message_get_seqnum\fR(3), \fBsd_bus_message_get_creds\fR(3)