How does dbus-daemon handle multiple services with same Name?

Lennart Poettering mzqohf at 0pointer.de
Sun Jun 21 11:42:24 PDT 2015


On Sun, 21.06.15 13:02, Armin K. (krejzi at email.com) wrote:

> Hi,
> 
> While trying kdbus with systemd, I have ran across a problem.
> Apparently it doesn't yet properly handle multiple D-Bus services
> with same name.
> 
> I'm interested in how does D-Bus daemon handle this? Which one
> gets loaded and how it decides which one to load?
> 
> An example:
> 
> I have two services with Name=org.freedesktop.FileManager1
> 
> One is GNOME's Nautilus, other is MATE's Caja File Manager.
> Which one would get loaded and why?

Only one service can own a name at a time. If one already owns a name,
and another one tries to take possession of it as well, then one of
three things can happen:

      a) the request to own the name is queued, and dbus-daemon passes
      it on automatically and atomically as soon as the old owner
      voluntarily gives it up.

      b) the operation to request the name will simply fail (this mode
      of operation you get by passing DBUS_NAME_FLAG_DO_NOT_QUEUE when
      acquiring the name)

      c) the name will be taken away forcible from the old owner (only
      if the new owner indicated DBUS_NAME_FLAG_REPLACE_EXISTING, and
      the old one DBUS_NAME_FLAG_ALLOW_REPLACEMENT).

Either way, and no times there are two owners of a name at the same
time, neither in kdbus, nor in dbus-daemon.

Lennart

-- 
Lennart Poettering, Red Hat


More information about the dbus mailing list