{"id":23992,"url":"https://patchwork.libcamera.org/api/patches/23992/?format=json","web_url":"https://patchwork.libcamera.org/patch/23992/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/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-4-barnabas.pocze@ideasonboard.com>","date":"2025-07-28T11:36:38","name":"[v6,3/6] libcamera: process: closeAllFdsExcept(): Take vector by value","commit_ref":null,"pull_url":null,"state":"accepted","archived":false,"hash":"e376897bd550f78f216eed6f20aa2ac0522e2a1c","submitter":{"id":216,"url":"https://patchwork.libcamera.org/api/people/216/?format=json","name":"Barnabás Pőcze","email":"barnabas.pocze@ideasonboard.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/23992/mbox/","series":[{"id":5342,"url":"https://patchwork.libcamera.org/api/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/23992/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/23992/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 A6BE5C3323\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 28 Jul 2025 11:36:56 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 07EC469153;\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 571A769158\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 6E4404A4\n\tfor <libcamera-devel@lists.libcamera.org>;\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=\"GlcZmVFi\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1753702564;\n\tbh=6amt1pfSCZMrGeT/snXCoeIbXZlm0bIT7dtXjOLqdwU=;\n\th=From:To:Subject:Date:In-Reply-To:References:From;\n\tb=GlcZmVFi8/Yhl/NP38CEnQZ5tB4kDy9D9PTvXboJmvb8KT6bkRdkTe/9iaZ1NDOa6\n\tm3BHQkMoqzhMKAZEYRbIGCYr4otMHje3ZF//Ry++4VP+zZFC69EeYlFJ6fU3r8GzZu\n\tlK85pYd6HNgvymmE9E9lGs9buDbOVNNt3rQQPZbc=","From":"=?utf-8?q?Barnab=C3=A1s_P=C5=91cze?= <barnabas.pocze@ideasonboard.com>","To":"libcamera-devel@lists.libcamera.org","Subject":"[PATCH v6 3/6] libcamera: process: closeAllFdsExcept(): Take vector\n\tby value","Date":"Mon, 28 Jul 2025 13:36:38 +0200","Message-ID":"<20250728113641.238256-4-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":"Instead of creating a new vector, take the vector by value to make it\npossible for the caller to use move construction when calling the function.\n\nSigned-off-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>\n---\n include/libcamera/internal/process.h | 2 +-\n src/libcamera/process.cpp            | 5 ++---\n 2 files changed, 3 insertions(+), 4 deletions(-)","diff":"diff --git a/include/libcamera/internal/process.h b/include/libcamera/internal/process.h\nindex 307c809f7..4ab846b24 100644\n--- a/include/libcamera/internal/process.h\n+++ b/include/libcamera/internal/process.h\n@@ -45,7 +45,7 @@ public:\n private:\n \tLIBCAMERA_DISABLE_COPY_AND_MOVE(Process)\n \n-\tvoid closeAllFdsExcept(const std::vector<int> &fds);\n+\tvoid closeAllFdsExcept(std::vector<int> v);\n \tint isolate();\n \tvoid died(int wstatus);\n \ndiff --git a/src/libcamera/process.cpp b/src/libcamera/process.cpp\nindex 479163e83..5193386ce 100644\n--- a/src/libcamera/process.cpp\n+++ b/src/libcamera/process.cpp\n@@ -264,7 +264,7 @@ int Process::start(const std::string &path,\n \n \t\tstd::vector<int> v(fds.begin(), fds.end());\n \t\tv.push_back(STDERR_FILENO);\n-\t\tcloseAllFdsExcept(v);\n+\t\tcloseAllFdsExcept(std::move(v));\n \n \t\tconst auto tryDevNullLowestFd = [](int expected, int oflag) {\n \t\t\tint fd = open(\"/dev/null\", oflag);\n@@ -296,9 +296,8 @@ int Process::start(const std::string &path,\n \t}\n }\n \n-void Process::closeAllFdsExcept(const std::vector<int> &fds)\n+void Process::closeAllFdsExcept(std::vector<int> v)\n {\n-\tstd::vector<int> v(fds);\n \tsort(v.begin(), v.end());\n \n \tASSERT(v.empty() || v.front() >= 0);\n","prefixes":["v6","3/6"]}