[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
+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>
@@ -59,6 +64,12 @@ int main(int argc, char *argv[])
OT_SETUP_RESET_JUMP(argv);
#ifdef __linux__
// Ensure we terminate this process if the
// parent process dies.
prctl(PR_SET_PDEATHSIG, SIGHUP);
#endif
#if OPENTHREAD_CONFIG_MULTIPLE_INSTANCE_ENABLE
size_t otInstanceBufferLength = 0;
uint8_t *otInstanceBuffer = NULL;
-1
View File
@@ -34,7 +34,6 @@
#include <errno.h>
#include <getopt.h>
#include <libgen.h>
#include <setjmp.h>
#include <signal.h>
#include <stdio.h>
#include <stdlib.h>