Patch Detail
Show a patch.
GET /api/patches/23018/?format=api
{ "id": 23018, "url": "https://patchwork.libcamera.org/api/patches/23018/?format=api", "web_url": "https://patchwork.libcamera.org/patch/23018/", "project": { "id": 1, "url": "https://patchwork.libcamera.org/api/projects/1/?format=api", "name": "libcamera", "link_name": "libcamera", "list_id": "libcamera_core", "list_email": "libcamera-devel@lists.libcamera.org", "web_url": "", "scm_url": "", "webscm_url": "" }, "msgid": "<20250325180821.1456154-7-barnabas.pocze@ideasonboard.com>", "date": "2025-03-25T18:08:18", "name": "[RFC,v3,6/9] libcamera: process: Use span instead of vector", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": false, "hash": "2ecf2986be6120fe33f24485067642b69b636658", "submitter": { "id": 216, "url": "https://patchwork.libcamera.org/api/people/216/?format=api", "name": "Barnabás Pőcze", "email": "barnabas.pocze@ideasonboard.com" }, "delegate": null, "mbox": "https://patchwork.libcamera.org/patch/23018/mbox/", "series": [ { "id": 5079, "url": "https://patchwork.libcamera.org/api/series/5079/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=5079", "date": "2025-03-25T18:08:12", "name": "libcamera: process: Remove `ProcessManager` singleton", "version": 3, "mbox": "https://patchwork.libcamera.org/series/5079/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/23018/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/23018/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 B9456C3321\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 25 Mar 2025 18:09:00 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 152636895E;\n\tTue, 25 Mar 2025 19:08:59 +0100 (CET)", "from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id D72A268955\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 25 Mar 2025 19:08:46 +0100 (CET)", "from pb-laptop.local (185.221.143.221.nat.pool.zt.hu\n\t[185.221.143.221])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 506B4E45\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 25 Mar 2025 19:06:59 +0100 (CET)" ], "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"ahIwsZE5\"; dkim-atps=neutral", "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1742926019;\n\tbh=ajDtbhAdnXEqGMrXZuYQpcnu6FTcvIe3UMYT5AkuaHs=;\n\th=From:To:Subject:Date:In-Reply-To:References:From;\n\tb=ahIwsZE5TJ7q9ZGVjTr/z6lk2JzmgDB4HQ1QQM6ZpkiFVclzlfZYtKaWDNeKbPxtF\n\tKPSmAA+Hw6bwNuXFKgxaZwrJKvtM21GbBN4ryHJ9SouNYL/wj0j62YEPrXCB0gAa9m\n\t1TdUuINnfyoTBfGIHQmUVIFx6EjS+qqIdjTQlpw4=", "From": "=?utf-8?q?Barnab=C3=A1s_P=C5=91cze?= <barnabas.pocze@ideasonboard.com>", "To": "libcamera-devel@lists.libcamera.org", "Subject": "[RFC PATCH v3 6/9] libcamera: process: Use span instead of vector", "Date": "Tue, 25 Mar 2025 19:08:18 +0100", "Message-ID": "<20250325180821.1456154-7-barnabas.pocze@ideasonboard.com>", "X-Mailer": "git-send-email 2.49.0", "In-Reply-To": "<20250325180821.1456154-1-barnabas.pocze@ideasonboard.com>", "References": "<20250325180821.1456154-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 `libcamera::Span` whenever applicable.\n\nSigned-off-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>\n---\n include/libcamera/internal/process.h | 8 ++++----\n src/libcamera/ipc_pipe_unixsocket.cpp | 9 +++------\n src/libcamera/process.cpp | 8 ++++----\n test/process/process_test.cpp | 5 ++---\n 4 files changed, 13 insertions(+), 17 deletions(-)", "diff": "diff --git a/include/libcamera/internal/process.h b/include/libcamera/internal/process.h\nindex 030a1e66e..e4f5bb979 100644\n--- a/include/libcamera/internal/process.h\n+++ b/include/libcamera/internal/process.h\n@@ -9,9 +9,9 @@\n \n #include <signal.h>\n #include <string>\n-#include <vector>\n \n #include <libcamera/base/signal.h>\n+#include <libcamera/base/span.h>\n #include <libcamera/base/unique_fd.h>\n \n namespace libcamera {\n@@ -31,8 +31,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_; }\n@@ -44,7 +44,7 @@ public:\n private:\n \tLIBCAMERA_DISABLE_COPY_AND_MOVE(Process)\n \n-\tvoid closeAllFdsExcept(const std::vector<int> &fds);\n+\tvoid closeAllFdsExcept(Span<const int> fds);\n \tint isolate();\n \tvoid died(int wstatus);\n \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 62e63255b..5603dc903 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@@ -282,9 +282,9 @@ int Process::start(const std::string &path,\n \t}\n }\n \n-void Process::closeAllFdsExcept(const std::vector<int> &fds)\n+void Process::closeAllFdsExcept(Span<const int> fds)\n {\n-\tstd::vector<int> v(fds);\n+\tstd::vector<int> v(fds.begin(), fds.end());\n \tsort(v.begin(), v.end());\n \n \tASSERT(v.empty() || v.front() >= 0);\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": [ "RFC", "v3", "6/9" ] }