patch monado to respect terminate signals
Although it doesn't terminate properly with this it seems to make `systemctl --user restart monado` work
This commit is contained in:
68
0001-ipc-shutdown-ipc-server-on-SIGTERM.patch
Normal file
68
0001-ipc-shutdown-ipc-server-on-SIGTERM.patch
Normal file
@ -0,0 +1,68 @@
|
||||
From 8d75be68315bec605a95b50edf7d2a6c56772b7f Mon Sep 17 00:00:00 2001
|
||||
From: Sapphire <imsapphire0@gmail.com>
|
||||
Date: Tue, 25 Nov 2025 23:20:46 -0600
|
||||
Subject: [PATCH] ipc: shutdown ipc server on SIGTERM
|
||||
|
||||
---
|
||||
src/xrt/ipc/server/ipc_server_process.c | 24 ++++++++++++++++++++++++
|
||||
1 file changed, 24 insertions(+)
|
||||
|
||||
diff --git a/src/xrt/ipc/server/ipc_server_process.c b/src/xrt/ipc/server/ipc_server_process.c
|
||||
index 92c232904..47a4a70bc 100644
|
||||
--- a/src/xrt/ipc/server/ipc_server_process.c
|
||||
+++ b/src/xrt/ipc/server/ipc_server_process.c
|
||||
@@ -50,6 +50,10 @@
|
||||
#include <timeapi.h>
|
||||
#endif
|
||||
|
||||
+#if defined(XRT_OS_UNIX)
|
||||
+#include <signal.h>
|
||||
+#endif
|
||||
+
|
||||
|
||||
/*
|
||||
*
|
||||
@@ -1062,6 +1066,16 @@ ipc_server_get_system_properties(struct ipc_server *vs, struct xrt_system_proper
|
||||
return XRT_SUCCESS;
|
||||
}
|
||||
|
||||
+#ifdef XRT_OS_UNIX
|
||||
+struct ipc_server *g_server;
|
||||
+static void handle_signal(int signal)
|
||||
+{
|
||||
+ if (g_server && signal == SIGTERM) {
|
||||
+ ipc_server_handle_shutdown_signal(g_server);
|
||||
+ }
|
||||
+}
|
||||
+#endif
|
||||
+
|
||||
int
|
||||
ipc_server_main_common(const struct ipc_server_main_info *ismi,
|
||||
const struct ipc_server_callbacks *callbacks,
|
||||
@@ -1086,6 +1100,11 @@ ipc_server_main_common(const struct ipc_server_main_info *ismi,
|
||||
timeBeginPeriod(1);
|
||||
#endif
|
||||
|
||||
+#ifdef XRT_OS_UNIX
|
||||
+ g_server = s;
|
||||
+ signal(SIGTERM, handle_signal);
|
||||
+#endif
|
||||
+
|
||||
/*
|
||||
* Need to create early before any vars are added. Not created in
|
||||
* init_all since that function is shared with Android and the debug
|
||||
@@ -1127,6 +1146,11 @@ ipc_server_main_common(const struct ipc_server_main_info *ismi,
|
||||
// Stop the UI before tearing everything down.
|
||||
u_debug_gui_stop(&s->debug_gui);
|
||||
|
||||
+#ifdef XRT_OS_UNIX
|
||||
+ signal(SIGTERM, NULL);
|
||||
+ g_server = NULL;
|
||||
+#endif
|
||||
+
|
||||
// Done after UI stopped.
|
||||
teardown_all(s);
|
||||
free(s);
|
||||
--
|
||||
2.52.0
|
||||
|
||||
@ -25,7 +25,9 @@
|
||||
rev = "2ebbca83e896e0802185277ce0a0a463db7a7892";
|
||||
hash = "sha256-JjlKHXd1SD9M8OpgFERZCvAhM0eMxjME96YU38DlKNw=";
|
||||
};
|
||||
patches = [];
|
||||
patches = [
|
||||
./0001-ipc-shutdown-ipc-server-on-SIGTERM.patch
|
||||
];
|
||||
});
|
||||
})
|
||||
];
|
||||
|
||||
Reference in New Issue
Block a user