if you use D-Bus on non-Linux Unix, please try new DBusSocket code

Simon McVittie simon.mcvittie at collabora.co.uk
Tue Mar 31 05:35:40 PDT 2015


On <https://bugs.freedesktop.org/show_bug.cgi?id=89444> we've been
working on fixing the distinction between file descriptors and sockets,
which are the same thing on Unix, but unfortunately not on Windows
(where a SOCKET is basically a uintptr_t, if done correctly).

The solution we're trying is to introduce an internal DBusSocket struct
containing an int (on Unix) or a SOCKET (on Windows), to force APIs to
distinguish between the native thing and the abstraction.

If you use D-Bus on non-Linux Unix platforms (*BSD, Solaris, etc.) it's
possible that this will cause compilation failures, if I missed code
paths that are not compiled on Linux. So, please try compiling, and
preferably testing, this branch on your favourite Unix platform:

    git clone -b dbussocket git://people.freedesktop.org/~smcv/dbus
    web: http://cgit.freedesktop.org/~smcv/dbus/log/?h=dbussocket

and report any problems on #89444, ideally with patches. The fix for any
compilation errors will probably be something quite simple, like
replacing "getsomesocketthing (s)" with "getsomesocketthing (s.fd)".

The intention is:

* non-Unix-specific code consistently uses DBusSocket (if the thing
  is definitely a socket) or DBusPollable (if it's an arbitrary
  pollable thing, i.e. a socket on Windows but any fd on Unix),
  and does not assume that either of those is an integer

* Unix-specific socket handling (dbus-sysdeps-*unix.c etc.) passes s.fd,
  which is an int, to platform APIs

* Unix-specific pollable handling may rely on the fact that DBusPollable
  is really an int

* for the moment, public APIs are still in terms of int, although
  we should probably add dbus_watch_get_windows_socket() eventually

-- 
Simon McVittie
Collabora Ltd. <http://www.collabora.com/>


More information about the dbus mailing list