[PATCH v1] libcamera: ipc_unixsocket: Share stdin and stdout with IPA proxy

Paul Elder paul.elder at ideasonboard.com
Mon Dec 9 12:33:39 CET 2024


On Wed, Nov 06, 2024 at 04:43:06PM +0100, Julien Vuillaumier wrote:
> When IPA is running in isolated mode, at IPA process creation time
> all the inherited file descriptors are closed in the new process
> after the fork, with the exception of the file descriptor relevant
> to the IPC peer Unix socket.
> 
> In order to enable the IPA logging in the console, add stdout and
> stderr to the list of file descriptors to be shared with the
> isolated process.
> 
> Signed-off-by: Julien Vuillaumier <julien.vuillaumier at nxp.com>

Reviewed-by: Paul Elder <paul.elder at ideasonboard.com>

> ---
>  src/libcamera/ipc_pipe_unixsocket.cpp | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/src/libcamera/ipc_pipe_unixsocket.cpp b/src/libcamera/ipc_pipe_unixsocket.cpp
> index 668ec73b..9ca219dc 100644
> --- a/src/libcamera/ipc_pipe_unixsocket.cpp
> +++ b/src/libcamera/ipc_pipe_unixsocket.cpp
> @@ -7,6 +7,7 @@
>  
>  #include "libcamera/internal/ipc_pipe_unixsocket.h"
>  
> +#include <unistd.h>
>  #include <vector>
>  
>  #include <libcamera/base/event_dispatcher.h>
> @@ -42,6 +43,10 @@ IPCPipeUnixSocket::IPCPipeUnixSocket(const char *ipaModulePath,
>  	args.push_back(std::to_string(fd.get()));
>  	fds.push_back(fd.get());
>  
> +	/* Share stdout and stderr with the proxy for logging purpose */
> +	fds.push_back(STDOUT_FILENO);
> +	fds.push_back(STDERR_FILENO);
> +
>  	proc_ = std::make_unique<Process>();
>  	int ret = proc_->start(ipaProxyWorkerPath, args, fds);
>  	if (ret) {
> -- 
> 2.34.1
> 


More information about the libcamera-devel mailing list