DBus in the kernel?

Thiago Macieira thiago at kde.org
Thu Jan 7 06:58:46 PST 2010


Em Quinta-feira 07 Janeiro 2010, às 11:17:16, Ian Molton escreveu:
> Thiago Macieira wrote:
> > Em Quarta-feira 06 Janeiro 2010, às 13:00:19, Ian Molton escreveu:
> >> Lennart Poettering wrote:
> >>> That is certainly doable, and is in fact done by some projects
> >>> (i.e. bluez passes BT audio via such a side-channel). However it kinda
> >>> sucks that as soon as you want to pass more than boring control data
> >>> you cannot use dbus anymore and need to invent your own protocol.
> >> 
> >> well, you either need to use data than dbus can marshall efficiently or
> >> not... OTOH, I'd have thought a byte stream could be marshalled with
> >> damn near zero overhead. (other than dbus' current two context switch
> >> overhead)
> > 
> > Not exactly.
> > 
> > First of all, it cannot be done without memcpy, which also means the
> > library must allocate a chunk of memory that matches your byte array
> > size.
> 
> srsly? theres no way a byte array an be marshalled 'in place' ?
> 
> if so thats a pretty big FAIL. I cant see anything in the wire protocol
> that prevents in place marshalling of byte arrays though.

The protocol allows for that, but the API doesn't.

It requires knowing that the byte array remains valid throughout the lifetime 
of the DBusMessage object.

If you do:
  DBusMessage *msg = dbus_message_new_something ();
  dbus_message_fictitious_append_bytearray_nocopy (msg, array, len);
  dbus_connection_send (conn, msg);
  dbus_message_unref (msg);

The message may still not be sent by the time dbus_connection_send returns (if 
the socket cannot be written to, for example). The event loop will be 
responsible for sending it later, when the socket can accept data.

We don't know how long later that will be. And there's no way of notifying 
that the data has been sent, so can be erased.

-- 
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
  Senior Product Manager - Nokia, Qt Development Frameworks
      PGP/GPG: 0x6EF45358; fingerprint:
      E067 918B B660 DBD1 105C  966C 33F5 F005 6EF4 5358
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 190 bytes
Desc: This is a digitally signed message part.
Url : http://lists.freedesktop.org/archives/dbus/attachments/20100107/e86ca0a6/attachment.pgp 


More information about the dbus mailing list