On 25 November 2016 at 09:01, Christophe Milard <
christophe.mil...@linaro.org> wrote:

> _fdserver now request SIGTERM if parent process (ODP instantiation
> process) dies, hence avoiding it to become orphan and reattached to the
> init process.
>
> Signed-off-by: Christophe Milard <christophe.mil...@linaro.org>
>

Reviewed-by: Mike Holmes <mike.holmes@linaro.,org>


> ---
>  platform/linux-generic/_fdserver.c | 6 ++++++
>  1 file changed, 6 insertions(+)
>
> diff --git a/platform/linux-generic/_fdserver.c b/platform/linux-generic/_
> fdserver.c
> index 41a630b..9aed7a9 100644
> --- a/platform/linux-generic/_fdserver.c
> +++ b/platform/linux-generic/_fdserver.c
> @@ -41,6 +41,8 @@
>  #include <odp_internal.h>
>  #include <odp_debug_internal.h>
>  #include <_fdserver_internal.h>
> +#include <sys/prctl.h>
> +#include <signal.h>
>
>  #include <stdio.h>
>  #include <stdlib.h>
> @@ -622,6 +624,10 @@ int _odp_fdserver_init_global(void)
>                 /* TODO: pin the server on appropriate service cpu mask */
>                 /* when (if) we can agree on the usage of service mask  */
>
> +               /* request to be killed if parent dies, hence avoiding  */
> +               /* orphans being "adopted" by the init process...       */
> +               prctl(PR_SET_PDEATHSIG, SIGTERM);
> +
>                 /* allocate the space for the file descriptor<->key table:
> */
>                 fd_table = malloc(FDSERVER_MAX_ENTRIES *
> sizeof(fdentry_t));
>                 if (!fd_table) {
> --
> 2.7.4
>
>


-- 
Mike Holmes
Program Manager - Linaro Networking Group
Linaro.org <http://www.linaro.org/> *│ *Open source software for ARM SoCs
"Work should be fun and collaborative, the rest follows"

Reply via email to