dbus server sans callbacks

Havoc Pennington hp at redhat.com
Fri Mar 9 11:35:38 PST 2007


Simon Burton wrote:
> I'm writing a dbus server, but without using the callback mechanism.
> (The app has it's own select loop).
> 
> So, I'm thinking I can create a DBusServer and extract its fd for the select loop,

I don't quite understand what you mean... the DBusWatch etc. is intended 
to integrate with an existing main loop, see for example the docs on 
dbus_connection_set_watch_functions():

http://dbus.freedesktop.org/doc/dbus/api/html/group__DBusConnection.html#g71e9a01114fcffe86b450d9b521a4540

You will also need to use set_timeout_functions()

Just getting the file descriptor probably is not enough, because you 
also need to know dbus_watch_get_enabled() (which covers whether to 
select for writing or not at any given time, for example), and need to 
support timeouts.

> or do my own listen and build a DBusConnection from a fd.
> 
> Any ideas on where best to cut into the (private) API to do either of these ?

Note that the private API is not exported (at least on platforms such as 
Linux that support hiding it). Solaris and Windows at least 
theoretically support hiding it and we'll hide it there eventually if 
not already. That is, you can't cheat and use the private API; the 
shared library effectively does not have a private API.

If you're statically linking or building your own dbus, you can use it 
of course, though of course the private API may change over time.

I don't think the private API will help you however because just having 
the fd is not enough as I mentioned.

Havoc



More information about the dbus mailing list