[simulation] SIGHUP when parent dies (#9624)

This commit is contained in:
Yakun Xu
2023-11-20 17:48:17 -08:00
committed by GitHub
parent 34dd612008
commit 9165bc62d7
3 changed files with 22 additions and 1 deletions
+11
View File
@@ -27,6 +27,11 @@
*/
#include <assert.h>
#ifdef __linux__
#include <signal.h>
#include <sys/prctl.h>
#endif
#include <openthread-core-config.h>
#include <openthread/config.h>
@@ -97,6 +102,12 @@ int main(int argc, char *argv[])
{
otInstance *instance;
#ifdef __linux__
// Ensure we terminate this process if the
// parent process dies.
prctl(PR_SET_PDEATHSIG, SIGHUP);
#endif
OT_SETUP_RESET_JUMP(argv);
#if OPENTHREAD_CONFIG_MULTIPLE_INSTANCE_ENABLE