{"id":23993,"url":"https://patchwork.libcamera.org/api/1.1/patches/23993/?format=json","web_url":"https://patchwork.libcamera.org/patch/23993/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/1.1/projects/1/?format=json","name":"libcamera","link_name":"libcamera","list_id":"libcamera_core","list_email":"libcamera-devel@lists.libcamera.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<20250728113641.238256-3-barnabas.pocze@ideasonboard.com>","date":"2025-07-28T11:36:37","name":"[v6,2/6] libcamera: process: start(): Use span instead of vector","commit_ref":null,"pull_url":null,"state":"accepted","archived":false,"hash":"d35c9fbf307f536b667e2ec9955610f5f6bee9f7","submitter":{"id":216,"url":"https://patchwork.libcamera.org/api/1.1/people/216/?format=json","name":"Barnabás Pőcze","email":"barnabas.pocze@ideasonboard.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/23993/mbox/","series":[{"id":5342,"url":"https://patchwork.libcamera.org/api/1.1/series/5342/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=5342","date":"2025-07-28T11:36:35","name":"libcamera: process: Remove `ProcessManager` singleton","version":6,"mbox":"https://patchwork.libcamera.org/series/5342/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/23993/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/23993/checks/","tags":{},"headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id A7C58C332A\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 28 Jul 2025 11:36:58 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id F323A6916F;\n\tMon, 28 Jul 2025 13:36:54 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 858136904C\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 28 Jul 2025 13:36:46 +0200 (CEST)","from pb-laptop.local (185.221.140.39.nat.pool.zt.hu\n\t[185.221.140.39])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 1B51E928;\n\tMon, 28 Jul 2025 13:36:04 +0200 (CEST)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"eCHginpo\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1753702564;\n\tbh=oeuWLwy6WcxkXKfyfTY6/CUeuECx5MywK/VsX7tn5R4=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=eCHginpofMQp/gqASZghFia7is279CQCDr6s+SeUFIJfe6jOLAJXBGfPXhQ6SJQRI\n\tEomdOB0WqY8sn2z9MPmfU4ynLBDu2GkcY5DWu9Y8vy54tpP+Dpvp0FdeOC2cHU6i53\n\tH4JhKI36/FrSqayFZYiSKs7H+elViSlLCe95lHNw=","From":"=?utf-8?q?Barnab=C3=A1s_P=C5=91cze?= <barnabas.pocze@ideasonboard.com>","To":"libcamera-devel@lists.libcamera.org","Cc":"Kieran Bingham <kieran.bingham@ideasonboard.com>,\n\tLaurent Pinchart <laurent.pinchart@ideasonboard.com>","Subject":"[PATCH v6 2/6] libcamera: process: start(): Use span instead of\n\tvector","Date":"Mon, 28 Jul 2025 13:36:37 +0200","Message-ID":"<20250728113641.238256-3-barnabas.pocze@ideasonboard.com>","X-Mailer":"git-send-email 2.50.1","In-Reply-To":"<20250728113641.238256-1-barnabas.pocze@ideasonboard.com>","References":"<20250728113641.238256-1-barnabas.pocze@ideasonboard.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=UTF-8","Content-Transfer-Encoding":"8bit","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"},"content":"Use a span instead of a const reference to a vector, this does not\nchange the behaviour and allows e.g. arrays to be used to hold\narguments/file descriptors.\n\nSigned-off-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>\nReviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n---\n include/libcamera/internal/process.h  | 6 +++---\n src/libcamera/ipc_pipe_unixsocket.cpp | 9 +++------\n src/libcamera/process.cpp             | 6 +++---\n test/process/process_test.cpp         | 5 ++---\n 4 files changed, 11 insertions(+), 15 deletions(-)","diff":"diff --git a/include/libcamera/internal/process.h b/include/libcamera/internal/process.h\nindex 891e78947..307c809f7 100644\n--- a/include/libcamera/internal/process.h\n+++ b/include/libcamera/internal/process.h\n@@ -9,10 +9,10 @@\n \n #include <signal.h>\n #include <string>\n-#include <vector>\n \n #include <libcamera/base/class.h>\n #include <libcamera/base/signal.h>\n+#include <libcamera/base/span.h>\n #include <libcamera/base/unique_fd.h>\n \n namespace libcamera {\n@@ -32,8 +32,8 @@ public:\n \t~Process();\n \n \tint start(const std::string &path,\n-\t\t  const std::vector<std::string> &args = std::vector<std::string>(),\n-\t\t  const std::vector<int> &fds = std::vector<int>());\n+\t\t  Span<const std::string> args = {},\n+\t\t  Span<const int> fds = {});\n \n \tExitStatus exitStatus() const { return exitStatus_; }\n \tint exitCode() const { return exitCode_; }\ndiff --git a/src/libcamera/ipc_pipe_unixsocket.cpp b/src/libcamera/ipc_pipe_unixsocket.cpp\nindex 668ec73b9..7ee7cac79 100644\n--- a/src/libcamera/ipc_pipe_unixsocket.cpp\n+++ b/src/libcamera/ipc_pipe_unixsocket.cpp\n@@ -28,10 +28,6 @@ IPCPipeUnixSocket::IPCPipeUnixSocket(const char *ipaModulePath,\n \t\t\t\t     const char *ipaProxyWorkerPath)\n \t: IPCPipe()\n {\n-\tstd::vector<int> fds;\n-\tstd::vector<std::string> args;\n-\targs.push_back(ipaModulePath);\n-\n \tsocket_ = std::make_unique<IPCUnixSocket>();\n \tUniqueFD fd = socket_->create();\n \tif (!fd.isValid()) {\n@@ -39,8 +35,9 @@ IPCPipeUnixSocket::IPCPipeUnixSocket(const char *ipaModulePath,\n \t\treturn;\n \t}\n \tsocket_->readyRead.connect(this, &IPCPipeUnixSocket::readyRead);\n-\targs.push_back(std::to_string(fd.get()));\n-\tfds.push_back(fd.get());\n+\n+\tstd::array args{ std::string(ipaModulePath), std::to_string(fd.get()) };\n+\tstd::array fds{ fd.get() };\n \n \tproc_ = std::make_unique<Process>();\n \tint ret = proc_->start(ipaProxyWorkerPath, args, fds);\ndiff --git a/src/libcamera/process.cpp b/src/libcamera/process.cpp\nindex a7add0b17..479163e83 100644\n--- a/src/libcamera/process.cpp\n+++ b/src/libcamera/process.cpp\n@@ -235,8 +235,8 @@ Process::~Process()\n  * or a negative error code otherwise\n  */\n int Process::start(const std::string &path,\n-\t\t   const std::vector<std::string> &args,\n-\t\t   const std::vector<int> &fds)\n+\t\t   Span<const std::string> args,\n+\t\t   Span<const int> fds)\n {\n \tint ret;\n \n@@ -262,7 +262,7 @@ int Process::start(const std::string &path,\n \t\tif (isolate())\n \t\t\t_exit(EXIT_FAILURE);\n \n-\t\tstd::vector<int> v(fds);\n+\t\tstd::vector<int> v(fds.begin(), fds.end());\n \t\tv.push_back(STDERR_FILENO);\n \t\tcloseAllFdsExcept(v);\n \ndiff --git a/test/process/process_test.cpp b/test/process/process_test.cpp\nindex e9f5e7e9b..a88d8fef1 100644\n--- a/test/process/process_test.cpp\n+++ b/test/process/process_test.cpp\n@@ -5,9 +5,9 @@\n  * Process test\n  */\n \n+#include <array>\n #include <iostream>\n #include <unistd.h>\n-#include <vector>\n \n #include <libcamera/base/event_dispatcher.h>\n #include <libcamera/base/thread.h>\n@@ -48,8 +48,7 @@ protected:\n \t\tTimer timeout;\n \n \t\tint exitCode = 42;\n-\t\tvector<std::string> args;\n-\t\targs.push_back(to_string(exitCode));\n+\t\tstd::array args{ to_string(exitCode) };\n \t\tproc_.finished.connect(this, &ProcessTest::procFinished);\n \n \t\t/* Test that kill() on an unstarted process is safe. */\n","prefixes":["v6","2/6"]}