dbus questions

David Zeuthen david@fubar.dk
Tue, 9 Dec 2003 03:08:23 +0100


I have two questions about D-BUS

1. Primary/secondary owners

I have just submitted a patch to udev to send out a D-BUS signal when a 
node is created / destroyed. As multiple copies of udev may run 
simultaneously, and
frequently do (normally when hot-plugging, say, usb-storage both sda 
and sda1 is
created), they race to become the owner of the service org.kernel.udev 
from where
I want to emit the signal. My understanding in this situation is that 
one of the
copies is the primary owner while the other copy becomes the secondary 

It turns out that when intercepting the signal from the secondary owner 
(I guess)
then the owner of the service emitting it is reported to be a base 
service, e.g.
:xyz instead of the service that it is secondary owner of, e.g. 

This is a problem because then clients listening for these signals 
cannot filter
on which service the signal originated from. This is a potential 
security issue.

Is this a bug or a feature?

2. Message dependencies

I have an situation where I know that I will receive several messages, 
but one of
the early messages need to wait for a later message to have been 
before the early message itself can be processed (possibly with some 

How is this easiest achieved? I suppose the only answer is go 
multithreaded (even
though I really want to avoid this); Is D-BUS designed to do this? I 
can't seem to
find anything useful about this in the docs..

(it's actually for the hal project where I want hotplug events to be 
into D-BUS messages. Now, linux 2.6 is known to give hotplug events out 
of order,
for instance the USB interfaces are added quite a bit earlier that the 
USB devices
they belong to. Today it's not a problem as I run a separate copy of 
the same
program to process each hotplug event and each of these processes can 
sleep until
the desired situation has occurred.)