libcamera: process: Remove ProcessManager singleton

The `ProcessManager` is a singleton class to handle `SIGCHLD` signals
and report the exit status to the particular `Process` instance.

However, having a singleton in a library is not favourable and it is
even less favourable if it installs a signal handler.

Using pidfd it is possible to avoid the need for the signal handler;
and the `Process` objects can watch their pidfd themselves, eliminating
the need for the `ProcessManager` class altogether.

`P_PIDFD` for `waitid()` was introduced in Linux 5.4, so this change
raises the minimum supported kernel version. `clone3()`, `CLONE_PIDFD`,
`pidfd_send_signal()` were all introduced earlier.

Furthermore, the call to the `unshare()` system call can be removed
as those options can be passed to `clone3()` directly.

Signed-off-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
This commit is contained in:
Barnabás Pőcze
2025-01-11 12:26:26 +01:00
parent 4db96b6e66
commit b37e69d434
7 changed files with 61 additions and 228 deletions
-2
View File
@@ -209,8 +209,6 @@ protected:
}
private:
ProcessManager processManager_;
unique_ptr<IPCPipeUnixSocket> ipc_;
};
-2
View File
@@ -137,8 +137,6 @@ private:
exitCode_ = exitCode;
}
ProcessManager processManager_;
Process proc_;
Process::ExitStatus exitStatus_ = Process::NotExited;
string logPath_;
-2
View File
@@ -86,8 +86,6 @@ private:
exitCode_ = exitCode;
}
ProcessManager processManager_;
Process proc_;
enum Process::ExitStatus exitStatus_;
int exitCode_;