[libcamera-devel,RFC,0/2] libcamera: ipc: unix: Add a IPC mechanism based on Unix sockets
mbox series

Message ID 20190621041519.29689-1-niklas.soderlund@ragnatech.se
Headers show
Series
  • libcamera: ipc: unix: Add a IPC mechanism based on Unix sockets
Related show

Message

Niklas Söderlund June 21, 2019, 4:15 a.m. UTC
Hello,

This is an RFC for how IPC could be implemented using Unix Sockets. It 
supports transferring data and multiple file descriptors in both 
directions and in the same message.

As this is an RFC I'm mostly interested to check if my idea of IPC 
matches that of Laurent and Paul who are dealing with the IPA API and 
process manager. For this reason I have not tried profile the code as it 
will be in our hot-path or written much (any) Doxygen documentation.

I'm not super happy with the interface towards the user having to resize 
the vector and then memcpy() to the buffer. Maybe I can think of a more 
neat way to do that. On the whole it feels a bit wrong to use the vector 
as I do, but it provides a nice memory safe way to deal with the 
problem. Once we start to use this and profile it maybe we could improve 
it if needed. Or if anyone have a neat idea on how to make this nicer 
I'm all ears!

Niklas Söderlund (2):
  libcamera: ipc: unix: Add a IPC mechanism based on Unix sockets
  test: ipc: unix: Add test for IPCUnixSocket

 src/libcamera/include/ipc_unixsocket.h |  58 +++++
 src/libcamera/ipc_unixsocket.cpp       | 330 +++++++++++++++++++++++++
 src/libcamera/meson.build              |   2 +
 test/ipc/meson.build                   |  20 ++
 test/ipc/unixsocket-slave.cpp          |  92 +++++++
 test/ipc/unixsocket.cpp                | 200 +++++++++++++++
 test/ipc/unixsocket.h                  |  27 ++
 test/meson.build                       |   1 +
 8 files changed, 730 insertions(+)
 create mode 100644 src/libcamera/include/ipc_unixsocket.h
 create mode 100644 src/libcamera/ipc_unixsocket.cpp
 create mode 100644 test/ipc/meson.build
 create mode 100644 test/ipc/unixsocket-slave.cpp
 create mode 100644 test/ipc/unixsocket.cpp
 create mode 100644 test/ipc/unixsocket.h