Debian Codegraph @

upstream/debian-unstable/man3/sd_bus_negotiate_fds.3

raw
1 '\" t
2 .TH "SD_BUS_NEGOTIATE_FDS" "3" "" "systemd 261~rc3" "sd_bus_negotiate_fds"
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_negotiate_fds, sd_bus_negotiate_timestamp, sd_bus_negotiate_creds, sd_bus_get_creds_mask \- Control feature negotiation on bus connections
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_negotiate_fds('u
32 .BI "int sd_bus_negotiate_fds(sd_bus\ *" "bus" ", int\ " "b" ");"
33 .HP \w'int\ sd_bus_negotiate_timestamp('u
34 .BI "int sd_bus_negotiate_timestamp(sd_bus\ *" "bus" ", int\ " "b" ");"
35 .HP \w'int\ sd_bus_negotiate_creds('u
36 .BI "int sd_bus_negotiate_creds(sd_bus\ *" "bus" ", int\ " "b" ", uint64_t\ " "mask" ");"
37 .HP \w'int\ sd_bus_get_creds_mask('u
38 .BI "int sd_bus_get_creds_mask(sd_bus\ *" "bus" ", uint64_t\ *" "mask" ");"
39 .SH "DESCRIPTION"
40 .PP
41 \fBsd_bus_negotiate_fds()\fR
42 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
43 \fBsd_bus_can_send\fR(3)
44 and pass
45 \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\&.
46 .PP
47 \fBsd_bus_negotiate_timestamp()\fR
48 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
49 \fBsd_bus_message_get_monotonic_usec\fR(3),
50 \fBsd_bus_message_get_realtime_usec\fR(3),
51 \fBsd_bus_message_get_seqnum\fR(3)
52 to query the timestamps of incoming messages\&. If negotiation is disabled or not supported, these calls will fail with
53 \fB\-ENODATA\fR\&. Note that currently no transports support timestamping of messages\&. By default, message timestamping is not negotiated for connections\&.
54 .PP
55 \fBsd_bus_negotiate_creds()\fR
56 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
57 \fBSD_BUS_CREDS_UNIQUE_NAME\fR\&. The sender credentials are suitable for authorization decisions\&. By default, only
58 \fBSD_BUS_CREDS_WELL_KNOWN_NAMES\fR
59 and
60 \fBSD_BUS_CREDS_UNIQUE_NAME\fR
61 are enabled\&. In fact, these two credential fields are always sent along and cannot be turned off\&.
62 .PP
63 \fBsd_bus_get_creds_mask()\fR
64 returns the set of sender credentials that was negotiated to be attached to all incoming messages in
65 \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\&.
66 .PP
67 The
68 \fBsd_bus_negotiate_fds()\fR
69 function may be called only before the connection has been started with
70 \fBsd_bus_start\fR(3)\&. Both
71 \fBsd_bus_negotiate_timestamp()\fR
72 and
73 \fBsd_bus_negotiate_creds()\fR
74 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
75 \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\&.
76 .SH "RETURN VALUE"
77 .PP
78 On success, these functions return a non\-negative integer\&. On failure, they return a negative errno\-style error code\&.
79 .SS "Errors"
80 .PP
81 Returned errors may indicate the following problems:
82 .PP
83 \fB\-EPERM\fR
84 .RS 4
85 The bus connection has already been started\&.
86 .RE
87 .PP
88 \fB\-EINVAL\fR
89 .RS 4
90 An argument is invalid\&.
91 .sp
92 Added in version 246\&.
93 .RE
94 .PP
95 \fB\-ENOPKG\fR
96 .RS 4
97 The bus cannot be resolved\&.
98 .sp
99 Added in version 246\&.
100 .RE
101 .PP
102 \fB\-ECHILD\fR
103 .RS 4
104 The bus was created in a different process, library or module instance\&.
105 .sp
106 Added in version 246\&.
107 .RE
108 .SH "NOTES"
109 .PP
110 Functions described here are available as a shared library, which can be compiled against and linked to with the
111 \fBlibsystemd\fR\ \&\fBpkg-config\fR(1)
112 file\&.
113 .PP
114 The code described here uses
115 \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
116 \fBsetenv\fR(3)
117 from a parallel thread\&. It is recommended to only do calls to
118 \fBsetenv()\fR
119 from an early phase of the program when no other threads have been started\&.
120 .SH "HISTORY"
121 .PP
122 \fBsd_bus_negotiate_fds()\fR,
123 \fBsd_bus_negotiate_timestamp()\fR, and
124 \fBsd_bus_negotiate_creds()\fR
125 were added in version 212\&.
126 .PP
127 \fBsd_bus_get_creds_mask()\fR
128 was added in version 246\&.
129 .SH "SEE ALSO"
130 .PP
131 \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)