5 ms·
In Binder's case, it makes RPC between different languages significantly easier. You can't pass file descriptors over sockets. You can't do RPC over pipes. Ano
by ndesaulniers 10y ago
In Binder's case, it makes RPC between different languages significantly easier.
You can't pass file descriptors over sockets.
You can't do RPC over pipes.
Anonymous sockets can only be shared with children.
Named sockets require write permission and a filesystem.
SysV is prone to resource leaks.
Binder has authentication, shared memory, reference counting, weak references, dead object notifications.
The descriptors and authentication part is key, as it allows Android's trusted system_server to open a device or socket for an untrusted process such as an App if it has user permissions. The receiver of a binder request can check the requester's PID/GID and with confidence from the kernel.
Most importantly, I don't think it's healthy to think of POSIX as being done. Some experimentation and discovery of better APIs and better systems should be encouraged.
gah, I'm driving myself crazy; I swear I saw somewhere a diagram of the Taxonomy of Unix IPC Mechanisms, with most of them crossed out and replaced simply with binder, please help me find it!
- dozzie 10y ago> You can't pass file descriptors over sockets. Good that my code doesn't know this. It would stop working. > The descriptors and authentication part is key, [...] If by "authentication" you mean "checking PID/UID/GID", we already have both in unix sockets.
- CJefferson 10y agoHow do you pass a file descriptor through a socket? They just take bytes? If you mean "I send some bytes that describes the file to open, and keep my processes in sync manually", of course you can do that, but true passing would allow a number of cool things.
- ahoka 10y ago> You can't pass file descriptors over sockets. You can: http://man7.org/tlpi/code/online/dist/sockets/scm_rights_send.c.html http://man7.org/tlpi/code/online/dist/sockets/scm_rights_sen...
- justin66 10y agoNice. I've used that book and recommend it to people but I've never seen that before. I don't know how I would find it, either, since it doesn't appear to be indexed anywhere.
- Nursie 10y agoYou absolutely can do RPC over pipes. I've seen that done several times, with defined request and response message formats.