libcamera v0.7.2+1-7a25b42d-nvm
Supporting cameras in Linux since 2019
Loading...
Searching...
No Matches
process.h
Go to the documentation of this file.
1/* SPDX-License-Identifier: LGPL-2.1-or-later */
2/*
3 * Copyright (C) 2019, Google Inc.
4 *
5 * Process object
6 */
7
8#pragma once
9
10#include <span>
11#include <string>
12#include <sys/types.h>
13
17
18namespace libcamera {
19
20class EventNotifier;
21
22class Process final
23{
24public:
30
31 Process();
32 ~Process();
33
34 int start(const std::string &path,
35 std::span<const std::string> args = {},
36 std::span<const int> fds = {});
37
38 ExitStatus exitStatus() const { return exitStatus_; }
39 int exitCode() const { return exitCode_; }
40
41 void kill();
42
44
45private:
47
48 void onPidfdNotify();
49
50 pid_t pid_;
51 enum ExitStatus exitStatus_;
52 int exitCode_;
53
54 UniqueFD pidfd_;
55 std::unique_ptr<EventNotifier> pidfdNotify_;
56};
57
58} /* namespace libcamera */
Utilities to help constructing class interfaces.
#define LIBCAMERA_DISABLE_COPY_AND_MOVE(klass)
Disable copy and move construction and assignment of the klass.
Definition class.h:29
Process object.
Definition process.h:23
void kill()
Kill the process.
Definition process.cpp:281
int exitCode() const
Retrieve the exit code of the process.
Definition process.h:39
ExitStatus
Exit status of process.
Definition process.h:25
@ NormalExit
Definition process.h:27
@ NotExited
Definition process.h:26
@ SignalExit
Definition process.h:28
Signal< enum ExitStatus, int > finished
Definition process.h:43
int start(const std::string &path, std::span< const std::string > args={}, std::span< const int > fds={})
Fork and exec a process, and close fds.
Definition process.cpp:141
ExitStatus exitStatus() const
Retrieve the exit status of the process.
Definition process.h:38
Generic signal and slot communication mechanism.
Definition signal.h:39
unique_ptr-like wrapper for a file descriptor
Definition unique_fd.h:17
Top-level libcamera namespace.
Definition backtrace.h:17
Signal & slot implementation.
File descriptor wrapper that owns a file descriptor.