From patchwork Fri Jul 12 08:29:08 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Elder X-Patchwork-Id: 1669 Return-Path: Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id A5CB760E40 for ; Fri, 12 Jul 2019 10:29:21 +0200 (CEST) Received: from neptunite.amanokami.net (softbank126209254147.bbtec.net [126.209.254.147]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id D6B102B2; Fri, 12 Jul 2019 10:29:16 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1562920158; bh=ZO6MdzW7MdK1g2j91y70WinJ6ciA+Fkk4kC3JirdAHY=; h=From:To:Cc:Subject:Date:From; b=I4+1nPkCCBpwLknVL3d6jnLQRkgqBbyOFuqXQPwgeETqCjk/IfXZwF+hiJ1cqXXDB IvPC8t8EWu+weqE16O58erEFd4qu6NgL3n46NBswArIrb6w+10NnYDD0+H5aNqot4j o4+EJVAQLEqcUuAcPN6omtslRmuwvCLTmf8ir7xk= From: Paul Elder To: libcamera-devel@lists.libcamera.org Date: Fri, 12 Jul 2019 17:29:08 +0900 Message-Id: <20190712082909.3811-1-paul.elder@ideasonboard.com> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH 1/2] libcamera: process: fix compilation on Chromium OS 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, 12 Jul 2019 08:29:22 -0000 Commit 3d20beca6616 ("libcamera: Add Process and ProcessManager classes") causes the build to fail in the Chromium OS build environment, because the return values of some system calls are ignored. Fix this. Signed-off-by: Paul Elder Reviewed-by: Laurent Pinchart --- src/libcamera/process.cpp | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/libcamera/process.cpp b/src/libcamera/process.cpp index 9d8829d..eccf1dd 100644 --- a/src/libcamera/process.cpp +++ b/src/libcamera/process.cpp @@ -69,7 +69,9 @@ namespace { void sigact(int signal, siginfo_t *info, void *ucontext) { char data = 0; - write(ProcessManager::instance()->writePipe(), &data, sizeof(data)); + /* We're in a signal handler so we can't log any message, + * and we need to continue anyway. */ + (void)write(ProcessManager::instance()->writePipe(), &data, sizeof(data)); const struct sigaction &oldsa = ProcessManager::instance()->oldsa(); if (oldsa.sa_flags & SA_SIGINFO) { @@ -85,7 +87,11 @@ void sigact(int signal, siginfo_t *info, void *ucontext) void ProcessManager::sighandler(EventNotifier *notifier) { char data; - read(pipe_[0], &data, sizeof(data)); + if (read(pipe_[0], &data, sizeof(data))) { + LOG(Process, Error) + << "failed to read byte from direct signal handler"; + return; + } for (auto it = processes_.begin(); it != processes_.end(); ) { Process *process = *it; @@ -128,7 +134,9 @@ ProcessManager::ProcessManager() sigaction(SIGCHLD, &sa, NULL); - pipe2(pipe_, O_CLOEXEC | O_DIRECT | O_NONBLOCK); + if (pipe2(pipe_, O_CLOEXEC | O_DIRECT | O_NONBLOCK)) + LOG(Process, Fatal) + << "Failed to initialize pipe for signal handling"; sigEvent_ = new EventNotifier(pipe_[0], EventNotifier::Read); sigEvent_->activated.connect(this, &ProcessManager::sighandler); } From patchwork Fri Jul 12 08:29:09 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Elder X-Patchwork-Id: 1670 Return-Path: Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id B30F86156A for ; Fri, 12 Jul 2019 10:29:21 +0200 (CEST) Received: from neptunite.amanokami.net (softbank126209254147.bbtec.net [126.209.254.147]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 1897852A; Fri, 12 Jul 2019 10:29:18 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1562920160; bh=tqrNVGUplzNOpm2wPT/uJe1gzjnNd+3EWdhGzwfJg9M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VR35x9mECQV71l+bLNthFFJzhHsp5o9vxCGKGUg8FR5fs74N3Wfjvds46c6b+DpnA wCjy80CBdm5tRgMdVAhFNL3PYcHAeLUBqpuFIVEMLxomoYiCvrrMk8l1rNDrm4Wn6/ yrpmH/orxx+UVOmtnOmRib/QCCIP3B/sBhlgjO3U= From: Paul Elder To: libcamera-devel@lists.libcamera.org Date: Fri, 12 Jul 2019 17:29:09 +0900 Message-Id: <20190712082909.3811-2-paul.elder@ideasonboard.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190712082909.3811-1-paul.elder@ideasonboard.com> References: <20190712082909.3811-1-paul.elder@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH 2/2] test: logging: fix compilation on Chromium OS 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, 12 Jul 2019 08:29:22 -0000 Commit a25c937f8afe ("test: add logging API test") causes the build to fail in the Chromium OS build environment, because the return value of a system call is ignored. Fix this. Signed-off-by: Paul Elder Reviewed-by: Laurent Pinchart --- test/log.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/test/log.cpp b/test/log.cpp index bc64325..89fb5ca 100644 --- a/test/log.cpp +++ b/test/log.cpp @@ -59,7 +59,10 @@ protected: char buf[1000]; memset(buf, 0, sizeof(buf)); lseek(fd, 0, SEEK_SET); - read(fd, buf, sizeof(buf)); + if (read(fd, buf, sizeof(buf)) < 0) { + cerr << "Failed to read tmp log file" << endl; + return TestFail; + } close(fd); std::list goodList = { 1, 3, 5 };