diff --git a/examples/apps/cli/main.c b/examples/apps/cli/main.c index 461d987c1..62f7e3f1b 100644 --- a/examples/apps/cli/main.c +++ b/examples/apps/cli/main.c @@ -27,6 +27,11 @@ */ #include +#ifdef __linux__ +#include +#include +#endif + #include #include @@ -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 diff --git a/examples/apps/ncp/main.c b/examples/apps/ncp/main.c index 0f3889511..ec3f8dc96 100644 --- a/examples/apps/ncp/main.c +++ b/examples/apps/ncp/main.c @@ -27,6 +27,11 @@ */ #include +#ifdef __linux__ +#include +#include +#endif + #include #include @@ -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; diff --git a/src/posix/main.c b/src/posix/main.c index db1dd7380..026c6c6eb 100644 --- a/src/posix/main.c +++ b/src/posix/main.c @@ -34,7 +34,6 @@ #include #include #include -#include #include #include #include