Unix FD Passing
mzqohf at 0pointer.de
Wed May 20 13:39:09 PDT 2009
On Wed, 20.05.09 16:24, Havoc Pennington (hp at pobox.com) wrote:
> > I don't really think this would help much anyway. Because unix fd
> > arrays would have to be handled by clients more like string arrays
> > than the other fixed arrays, since I'd need to allocate memory for
> > them because I need to translate the array of indexes stored in the
> > message to the actual array of file descriptors. Which means file
> > descriptors *need* to be handled different from the other fixed types
> > anyway. (because the array returned would need to be freed)
> The concern here is generic marshaling code where if it sees
> dbus_type_is_fixed() in an array, it just goes ahead and uses the
> fixed array marshaling stuff.
> Can that happen?
I am not sure I fully understood your question, but I think generic
demarshalling code like that wouldn't make sense anyway. Because in
contrast to other fixed data types unix fds are special: you need to
close() them after use.
It might be an idea to redefine a bit what a "fixed" type is: say that
even though unix fds are of fixed size in memory dbus_type_is_fixed()
returns FALSE for them. When I first wrote the code I was considering
to do just that but then came to the conclusion that it would suck
even more than making it return TRUE and then handle them
specially. But I don't really remember the reasons for that right now
I must admit.
> refresh my memory - the issue here is that manually doing an array of
> fds works, but get_fixed_array() does not?
Lennart Poettering Red Hat, Inc.
lennart [at] poettering [dot] net
http://0pointer.net/lennart/ GnuPG 0x1A015CC4
More information about the dbus