From e7176abbe818c75c6acd90227a7a84c3e05fee31 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Tue, 3 Dec 2013 18:01:26 +0100 Subject: bus: make sd_bus_request_name() and sd_bus_release_name() behave more like other calls Instead of returning an enum of return codes, make them return error codes like kdbus does internally. Also, document this behaviour so that clients can stick to it. (Also rework bus-control.c to always have to functions for dbus1 vs. kernel implementation of the various calls.) --- man/sd_bus_request_name.xml | 213 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 213 insertions(+) create mode 100644 man/sd_bus_request_name.xml (limited to 'man/sd_bus_request_name.xml') diff --git a/man/sd_bus_request_name.xml b/man/sd_bus_request_name.xml new file mode 100644 index 000000000..6e61a8873 --- /dev/null +++ b/man/sd_bus_request_name.xml @@ -0,0 +1,213 @@ + + + + + + + + + sd_bus_request_name + systemd + + + + Developer + Lennart + Poettering + lennart@poettering.net + + + + + + sd_bus_request_name + 3 + + + + sd_bus_request_name + sd_bus_release_name + Request or release a well-known name on a bus + + + + + #include <systemd/sd-bus.h> + + + int sd_bus_request_name + sd_bus* bus + const char *name + unsigned flags + + + + int sd_bus_release_name + sd_bus* bus + const char *name + + + + + + + + Description + + sd_bus_request_name() requests + a well-known name on a bus. It takes a bus connection, + a valid bus name and a flags parameter. The flags + parameter is a combination of the following + flags: + + + + SD_BUS_NAME_ALLOW_REPLACEMENT + + After acquiring the + name successuflly, permit other peers + to take over the name when they try to + acquire it with the + SD_BUS_NAME_REPLACE_EXISTING + flag set. If + SD_BUS_NAME_ALLOW_REPLACEMENT + is not set on the original request + such a request by other peers will be + denied. + + + + SD_BUS_NAME_REPLACE_EXISTING + + Take over a the name + if it is already acquired by a another + peer, and that other peer permitted + taking it over by setting + SD_BUS_NAME_ALLOW_REPLACEMENT + while acquiring it. + + + + SD_BUS_NAME_DO_NOT_QUEUE + + Do not queue name + acquisition when the name is already + taken. + + + + sd_bus_release_name() releases + an acquired well-known name. It takes a bus connection + and a valid bus name as parameters. + + + + Return Value + + On success, these calls return 0 or a positive + integer. On failure, these calls return a negative + errno-style error code. + + sd_bus_request_name() will + return 0 when the name is already taken by another + peer and the client has been added to the queue for + the name, unless + SD_BUS_NAME_DO_NOT_QUEUE has been + set. The caller can subscribe to + NameOwnerChanged signals to be + notified when the name is successfully + acquired. sd_bus_request_name() returns + > 0 when the name has been + acquired successfully. + + + + Errors + + Returned errors may indicate the following problems: + + + + -EALREADY + + The caller already is + the owner of the specified + name. + + + + -EEXIST + + The name has already + been acquired by a different peer, and + SD_BUS_NAME_REPLACE_EXISTING was not + specified or the other peer did not + specify SD_BUS_NAME_ALLOW_REPLACEMENT + while acquiring the + name. + + + + -EINVAL + + A specified parameter + is invalid. + + + + -ENOTCONN + + The bus connection has + been disconnected. + + + + -ECHILD + + The bus connection has + been created in a different process + than the current. + + + + + + Notes + + The sd_bus_acquire_name() + and sd_bus_release_bame() + interfaces are available as shared library, which can + be compiled and linked to with the + libsystemd-bus pkg-config1 + file. + + + + See Also + + + systemd1, + sd-bus3, + sd_bus_new3 + + + + -- cgit v1.2.3