how to do large-ish IPC transfers

Brad Bishop bradleyb at fuzziesquirrel.com
Sat Sep 14 04:40:44 AEST 2019


at 3:42 AM, Alexander Amelkin <a.amelkin at yadro.com> wrote:

> 12.09.2019 16:24, Brad Bishop wrote:
>>> What is a 'file descriptor' you're referring to here? The Linux file  
>>> descriptor
>>> (the integer you get from open()) is process-specific and doesn't keep  
>>> its
>>> meaning in another process' context.
>>
>> On Linux you can pass file descriptors (the ones returned by open) over  
>> unix
>> sockets.  The implementation of the ‘h’ DBus type relies on that.
>
> Oh, great! Didn't know about that. Thanks.
>
> Anyway, I think I'd just use message queues or sockets (directly). What's  
> the
> profit of using a file whose descriptor is sent over a socket instead of  
> just
> using the socket for communication?

I feel like you might be trolling me a tiny bit on our usage of DBus but  
I’ll answer just in case you aren’t…

In this particular case we already have a socket established and are  
passing other data over it, using an existing protocol (DBus).  Obviously  
we can’t stuff this file data onto that socket without breaking the  
protocol and all the code that implements it.  We could open yet another  
socket for this but it seems simpler to me to just pass the fd over the  
existing one…especially when the DBus protocol has allowances for that.

-brad


More information about the openbmc mailing list