From 850df10ac10aedbc2140bcd1152d6e86fdad9b48 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Fri, 19 Jun 2015 22:18:36 +0200 Subject: man: various documentation improvements for sd-bus --- man/sd_bus_default.xml | 47 ++++++++++++++++++++++++++++-------------- man/sd_bus_negotiate_fds.xml | 49 ++++++++++++++++++++++++++++---------------- man/sd_bus_new.xml | 22 ++++++++++++++++---- 3 files changed, 81 insertions(+), 37 deletions(-) (limited to 'man') diff --git a/man/sd_bus_default.xml b/man/sd_bus_default.xml index fbf10d019f..9b4c71b677 100644 --- a/man/sd_bus_default.xml +++ b/man/sd_bus_default.xml @@ -109,26 +109,30 @@ Description sd_bus_default() acquires a bus - connection object to the user bus when invoked in user context or + connection object to the user bus when invoked in user context, or to the system bus otherwise. The connection object is associated to the calling thread. Each time the function is invoked from the same thread the same object is returned, but its reference count - increased by one, as long as at least one reference is kept. When - the last reference to the connection is dropped (using the - sd_bus_unref() call), the connection is - terminated. Note that the connection is not automatically - terminated when the associated thread ends. It is important to - drop the last reference to the bus connection explicitly before - the thread ends or otherwise the connection will be leaked. + is increased by one, as long as at least one reference is + kept. When the last reference to the connection is dropped (using + the + sd_bus_unref3 + call), the connection is terminated. Note that the connection is + not automatically terminated when the associated thread ends. It + is important to drop the last reference to the bus connection + explicitly before the thread ends or otherwise the connection will + be leaked. sd_bus_default_user() returns a user bus connection object associated to the calling thread. sd_bus_default_system() is similar, but - connects to the system bus. + connects to the system bus. Note that + sd_bus_default() is identical to these two + calls, depending on the execution context. sd_bus_open() creates a new, independent bus connection to the user bus when invoked in user - context or the system bus + context, or the system bus otherwise. sd_bus_open_user() is similar, but connects only to the user bus. sd_bus_open_system() does the same, but @@ -162,8 +166,10 @@ sd_bus_open_system_remote() connects to the system bus on the specified host using - SSH. host consists of an optional user name - followed by the @ symbol, and the hostname. + ssh1. host + consists of an optional user name followed by the + @ symbol, and the hostname. sd_bus_open_system_container() connects @@ -171,7 +177,18 @@ where machine is the name of a local container. See machinectl1 - for more information about "machines". + for more information about the "machine" concept. Note that + connections into local containers are only available to privileged + processes at this time. + + These calls allocate a bus connection object and initiate + the connection ot a well-known bus of some form. An alternative to + using these high-level calls is to create an unconnected bus + object with + sd_bus_new3 + and to connect it with + sd_bus_start3. + @@ -185,8 +202,8 @@ Reference ownership - The functions sd_bus_open_user(), - sd_bus_open(), + The functions sd_bus_open(), + sd_bus_open_user(), sd_bus_open_system(), sd_bus_open_system_remote(), and sd_bus_open_system_machine() return a new diff --git a/man/sd_bus_negotiate_fds.xml b/man/sd_bus_negotiate_fds.xml index f988acf41a..04042f2136 100644 --- a/man/sd_bus_negotiate_fds.xml +++ b/man/sd_bus_negotiate_fds.xml @@ -70,7 +70,7 @@ int sd_bus_negotiate_creds sd_bus *bus int b - uint64_t flags + uint64_t mask @@ -81,10 +81,11 @@ sd_bus_negotiate_fds() 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. To find out whether file descriptor passing is available - after negotiation, use + 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 sd_bus_can_send3 and pass SD_BUS_TYPE_UNIX_FD. Note that file descriptor passing is always enabled for both sending and @@ -101,34 +102,44 @@ 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. If - this is disabled, + when true, enables timestamping, and, when false, disables it. + Use sd_bus_message_get_monotonic_usec3, sd_bus_message_get_realtime_usec3, sd_bus_message_get_seqnum3 - fail with -ENODATA on incoming messages. Note - that not all transports support timestamping of messages. On local - transports, the timestamping is applied by the kernel and cannot - be manipulated by userspace. By default, message timestamping is - not negotiated for all connections. + 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 implicit sender credentials shall be attached + whether and which implicit sender credentials shall be attached automatically to all incoming messages. Takes a bus object, 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. On local transports, the sender credentials are attached - by the kernel and cannot be manipulated by userspace. By default, - no sender credentials are attached. + 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_start3. Both sd_bus_negotiate_timestamp() and - sd_bus_negotiate_creds() also may be called + 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 @@ -163,7 +174,7 @@ Notes - sd_bus_negotiate_fs() and the other + 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-config1 @@ -179,6 +190,8 @@ sd_bus_start3, sd_bus_message_can_send3, sd_bus_message_get_monotonic_usec3, + sd_bus_message_get_realtime_usec3, + sd_bus_message_get_seqnum3, sd_bus_message_get_creds3, systemd.busname5 diff --git a/man/sd_bus_new.xml b/man/sd_bus_new.xml index 5c65b9a2fe..44744a0029 100644 --- a/man/sd_bus_new.xml +++ b/man/sd_bus_new.xml @@ -77,7 +77,21 @@ sd_bus_new() creates a new bus object. This object is reference-counted, and will be destroyed when all references are gone. Initially, the caller of this - function owns the sole reference. + function owns the sole reference. The bus object will not be + connected to any bus initially. To connect it to a bus, make sure + to set an address with + sd_bus_set_address3 + or a related call, and then start the connection with + sd_bus_start3. + + In most cases it's a better idea to invoke + sd_bus_default_user3, + sd_bus_default_system3 + or related calls instead of the more low-level + sd_bus_new() and + sd_bus_start(). The higher-level calls not + only allocate a bus object but also start the connection to a + well-known bus in a single function invocation. sd_bus_ref() creates a new reference to bus. This bus object will not be destroyed @@ -135,10 +149,10 @@ systemd1, sd-bus3, - sd_bus_open_user3, - sd_bus_open_system3, sd_bus_default_user3, - sd_bus_default_system3 + sd_bus_default_system3, + sd_bus_open_user3, + sd_bus_open_system3 -- cgit v1.2.3-54-g00ecf