libcamera
v0.3.1+12-19bbca3c
Supporting cameras in Linux since 2019
|
Public Types | |
enum | ExitStatus { NotExited, NormalExit, SignalExit } |
Exit status of process. More... | |
Public Member Functions | |
int | start (const std::string &path, const std::vector< std::string > &args=std::vector< std::string >(), const std::vector< int > &fds=std::vector< int >()) |
Fork and exec a process, and close fds. More... | |
ExitStatus | exitStatus () const |
Retrieve the exit status of the process. More... | |
int | exitCode () const |
Retrieve the exit code of the process. More... | |
void | kill () |
Kill the process. More... | |
Public Attributes | |
Signal< enum ExitStatus, int > | finished |
Friends | |
class | ProcessManager |
Process object.
The Process class models a process, and simplifies spawning new processes and monitoring the exiting of a process.
|
inline |
Retrieve the exit code of the process.
This function is only valid if exitStatus() returned NormalExit.
|
inline |
Retrieve the exit status of the process.
Return the exit status of the process, that is, whether the process has exited via exit() or returning from main, or if the process was terminated by a signal.
void libcamera::Process::kill | ( | ) |
Kill the process.
Sends SIGKILL to the process.
int libcamera::Process::start | ( | const std::string & | path, |
const std::vector< std::string > & | args = std::vector<std::string>() , |
||
const std::vector< int > & | fds = std::vector<int>() |
||
) |
Fork and exec a process, and close fds.
[in] | path | Path to executable |
[in] | args | Arguments to pass to executable (optional) |
[in] | fds | Vector of file descriptors to keep open (optional) |
Fork a process, and exec the executable specified by path. Prior to exec'ing, but after forking, all file descriptors except for those specified in fds will be closed.
All indexes of args will be incremented by 1 before being fed to exec(), so args[0] should not need to be equal to path.
libcamera::Process::finished |
Signal that is emitted when the process is confirmed to have terminated.