From patchwork Fri Jun 21 04:15:17 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Niklas_S=C3=B6derlund?= X-Patchwork-Id: 1490 Return-Path: Received: from bin-mail-out-05.binero.net (bin-mail-out-05.binero.net [195.74.38.228]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 7601B61583 for ; Fri, 21 Jun 2019 06:16:22 +0200 (CEST) X-Halon-ID: 26e61097-93db-11e9-8601-0050569116f7 Authorized-sender: niklas@soderlund.pp.se Received: from bismarck.berto.se (unknown [145.14.112.32]) by bin-vsp-out-03.atm.binero.net (Halon) with ESMTPA id 26e61097-93db-11e9-8601-0050569116f7; Fri, 21 Jun 2019 06:15:16 +0200 (CEST) From: =?utf-8?q?Niklas_S=C3=B6derlund?= To: libcamera-devel@lists.libcamera.org Date: Fri, 21 Jun 2019 06:15:17 +0200 Message-Id: <20190621041519.29689-1-niklas.soderlund@ragnatech.se> X-Mailer: git-send-email 2.21.0 MIME-Version: 1.0 Subject: [libcamera-devel] [RFC 0/2] libcamera: ipc: unix: Add a IPC mechanism based on Unix sockets X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 21 Jun 2019 04:16:22 -0000 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