What calls bus_registry_ensure?

Simon McVittie smcv at collabora.com
Wed Feb 27 11:12:06 UTC 2019


On Tue, 26 Feb 2019 at 21:20:46 -0500, Fabián Orccón wrote:
> something calls [1]bus_registry_ensure, before executing [2]
> bus_driver_handle_list_services. I cannot figure out what is calling [3]
> bus_registry_ensure and why. 

Each connection to the bus needs a unique bus name (":1.42" or similar).
This includes dbus-send, which owns a unique name for the duration of its
(usually brief) connection to the bus.

The usual analogy is that if well-known bus names like
com.example.MyService are like Internet hostnames, then unique names
are like IP addresses. Not every connection has a well-known name, and
some have more than one, but every connection has exactly one unique name.

The BusRegistry object is responsible for ownership of both well-known
and unique bus names.

> Using grep this function is just called on `bus_driver_handle_hello`

dbus-send has to send a Hello message to finish connecting to the bus
before it will be allowed to send the message you originally asked for.
Every message that is relayed by the bus has to have a valid sender,
so connections are not allowed to send any messages (except for the
special Hello method call) until they have obtained their unique name
by calling the Hello method.

For more details, please see the D-Bus Specification
<https://dbus.freedesktop.org/doc/dbus-specification.html>, or monitor
the bus with dbus-monitor while you use dbus-send. In dbus-monitor output
you'll see the dbus-send process calling the Hello method and receiving
its unique name as a reply, and a NameOwnerChanged broadcast from the
dbus-daemon announcing that the name has a new owner; you'll also see a
NameOwnerChanged broadcast when dbus-send exits, announcing that it no
longer owns the name.

Regards,
    smcv


More information about the dbus mailing list