win32 patch dbus_watch_get_handle patch

Havoc Pennington hp at
Sat Jun 16 07:29:15 PDT 2007


Ralf Habacker wrote:
> Any problems with this patch ?

I had a bunch of comments in that Peter mentioned, 
those all remain it looks like.

- there should not be any dbus-specific fd-thingy, only sockets or
- internal functions should be in internal headers and
   underscore-prefixed, not in public headers with #ifdef
- dbus_watch_get_fd() should probably return -1 on Windows
   (i.e. the DBusWatch API should work like connection_get_unix_fd
    and connection_get_socket, watch_get_fd does not have
    unix in the name for historical reasons but should work like
    it did)

Once the API is correct, I think you'll find that dbus-mainloop.c breaks 
on Windows, because in there we are relying on the broken unix emulation 
hack of an internal "file descriptor" object. dbus-mainloop.c is really 
a part of the bus daemon, not libdbus, and thus can't use weird internal 
fake descriptors.

The solution to this is to change the abstraction boundary in 
dbus-mainloop.c so it does not have to deal with the socket/handle/fd 
directly but can delegate doing so to the sysdeps-win.c and 
sysdeps-unix.c files. One way to think of this is that _dbus_poll should 
probably be in sysdeps-unix.h instead of pretending to be a 
cross-platform API.


More information about the dbus mailing list