]> git.ipfire.org Git - thirdparty/systemd.git/commit
Add support for SD_BUS_DEFAULT* 7939/head
authorNathaniel McCallum <npmccallum@redhat.com>
Mon, 22 Jan 2018 21:26:44 +0000 (16:26 -0500)
committerNathaniel McCallum <npmccallum@redhat.com>
Tue, 23 Jan 2018 14:40:25 +0000 (09:40 -0500)
commit45b1f410ba699990e4033805fe64cc369b835f10
treeea5d3e2ca768625aac6fa17816ca1bcf95bc667c
parentb937d761085c484cc1708171c01b9aac37537d4e
Add support for SD_BUS_DEFAULT*

Currently, sd-bus supports the ability to have thread-local default busses.
However, this is less useful than it can be since all functions which
require an sd_bus* as input require the caller to pass it. This patch adds
a new macro which allows the developer to pass a constant SD_BUS_DEFAULT,
SD_BUS_DEFAULT_USER or SD_BUS_DEFAULT_SYSTEM instead. This reduces work for
the caller.

For example:

    r = sd_bus_default(&bus);
    r = sd_bus_call_method(bus, ...);
    sd_bus_unref(bus);

Becomes:

    r = sd_bus_call_method(SD_BUS_DEFAULT, ...);

If the specified thread-local default bus does not exist, the function
calls will return -ENOPKG. No bus will ever be implicitly created.
src/libsystemd/sd-bus/bus-control.c
src/libsystemd/sd-bus/bus-convenience.c
src/libsystemd/sd-bus/bus-internal.h
src/libsystemd/sd-bus/bus-objects.c
src/libsystemd/sd-bus/bus-track.c
src/libsystemd/sd-bus/sd-bus.c
src/systemd/sd-bus.h