Other Alias
sd_bus_negotiate_fds, sd_bus_negotiate_credsSYNOPSIS
#include <systemd/sd-bus.h>
-
int sd_bus_negotiate_fds(sd_bus *bus, int b);
- int sd_bus_negotiate_timestamp(sd_bus *bus, int b);
- int sd_bus_negotiate_creds(sd_bus *bus, int b, uint64_t mask);
- int sd_bus_negotiate_timestamp(sd_bus *bus, int b);
DESCRIPTION
sd_bus_negotiate_fds()
Note that when bus activation is used, it is highly recommended to set the AcceptFileDescriptors= setting in the .busname unit file to the same setting as negotiated by the program ultimately activated. By default, file descriptor passing is enabled for both.
sd_bus_negotiate_timestamps() 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 sd_bus_message_get_monotonic_usec(3), sd_bus_message_get_realtime_usec(3), sd_bus_message_get_seqnum(3) to query the timestamps of incoming messages. If negotiation is disabled or not supported, these calls will fail with -ENODATA. Note that not all transports support timestamping of messages. Specifically, timestamping is only available on the kdbus transport, but not on dbus1. The timestamping is applied by the kernel and cannot be manipulated by userspace. By default, message timestamping is not negotiated for connections.
sd_bus_negotiate_creds() 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, implicit sender credentials on messages are only fully supported on kdbus transports, and dbus1 only supports SD_BUS_CREDS_UNIQUE_NAME. The sender credentials are attached by the kernel and cannot be manipulated by userspace, and are thus suitable for authorization decisions. By default, only SD_BUS_CREDS_WELL_KNOWN_NAMES and SD_BUS_CREDS_UNIQUE_NAME are enabled. In fact, these two credential fields are always sent along and cannot be turned off.
The sd_bus_negotiate_fds() function may be called only before the connection has been started with sd_bus_start(3). Both sd_bus_negotiate_timestamp() and sd_bus_negotiate_creds() 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 sd_bus_default(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.
RETURN VALUE
On success, these functions return 0 or a positive integer. On failure, they return a negative errno-style error code.
ERRORS
Returned errors may indicate the following problems:
-EPERM
- The bus connection has already been started.
NOTES
sd_bus_negotiate_fds() and the other functions described here are available as a shared library, which can be compiled and linked to with the libsystemd pkg-config(1) file.