[libcamera-devel] [PATCH] utils: ipc: Assign a new gid to proxy worker
Umang Jain
umang.jain at ideasonboard.com
Mon Jul 26 12:31:26 CEST 2021
Doing so, handles the situation where the proxy worker
has been shutdown by SIGINT/SIGTERM preemptively, before
the pipeline handler got a chance to cleanup nicely.
Bug: https://bugs.libcamera.org/show_bug.cgi?id=60
Signed-off-by: Umang Jain <umang.jain at ideasonboard.com>
---
.../module_ipa_proxy_worker.cpp.tmpl | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/utils/ipc/generators/libcamera_templates/module_ipa_proxy_worker.cpp.tmpl b/utils/ipc/generators/libcamera_templates/module_ipa_proxy_worker.cpp.tmpl
index d993e39e..32ac3869 100644
--- a/utils/ipc/generators/libcamera_templates/module_ipa_proxy_worker.cpp.tmpl
+++ b/utils/ipc/generators/libcamera_templates/module_ipa_proxy_worker.cpp.tmpl
@@ -207,6 +207,16 @@ int main(int argc, char **argv)
return EXIT_FAILURE;
}
+ /*
+ * Shutdown of proxy worker can be preemptive by events like
+ * SIGINT/SIGTERM, even before the pipeline handler can request
+ * shutdown. Hence, assign a new gid to handle these situations.
+ */
+ if (setpgid(0, 0) < -1) {
+ LOG({{proxy_worker_name}}, Warning)
+ << "Failed to set new gid: " << strerror(errno);
+ }
+
{{proxy_worker_name}} proxyWorker;
int ret = proxyWorker.init(ipam, fd);
if (ret < 0) {
--
2.31.1
More information about the libcamera-devel
mailing list