From patchwork Fri Nov 25 14:01:44 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe Milard X-Patchwork-Id: 84126 Delivered-To: patch@linaro.org Received: by 10.140.20.101 with SMTP id 92csp110053qgi; Fri, 25 Nov 2016 05:02:34 -0800 (PST) X-Received: by 10.55.12.2 with SMTP id 2mr6592757qkm.68.1480078954562; Fri, 25 Nov 2016 05:02:34 -0800 (PST) Return-Path: Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id w37si17883761qtw.45.2016.11.25.05.02.34; Fri, 25 Nov 2016 05:02:34 -0800 (PST) Received-SPF: pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) client-ip=54.225.227.206; Authentication-Results: mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org; dmarc=pass (p=NONE dis=NONE) header.from=linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id E5EDA62EB6; Fri, 25 Nov 2016 13:02:33 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on ip-10-142-244-252 X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL autolearn=disabled version=3.4.0 Received: from [127.0.0.1] (localhost [127.0.0.1]) by lists.linaro.org (Postfix) with ESMTP id D6FC560C5F; Fri, 25 Nov 2016 13:02:20 +0000 (UTC) X-Original-To: lng-odp@lists.linaro.org Delivered-To: lng-odp@lists.linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id D9B7060CA1; Fri, 25 Nov 2016 13:02:15 +0000 (UTC) Received: from mail-lf0-f42.google.com (mail-lf0-f42.google.com [209.85.215.42]) by lists.linaro.org (Postfix) with ESMTPS id D4F8A60C17 for ; Fri, 25 Nov 2016 13:02:11 +0000 (UTC) Received: by mail-lf0-f42.google.com with SMTP id c13so50157961lfg.0 for ; Fri, 25 Nov 2016 05:02:11 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=u60TM1tTCqp+xWH5wTXNBXQlMr8yk5BAWeyGptWwv3I=; b=lFGhS1JB+D+YTQWRhmU5WAS0I+A0abeVZXPE+Oy+SFC4kBwlzYOLEGWzmPsPY7BfNW liXU7Q1eEuh4lMUh51aSIjhe62Q23/NtXqdBr8lWeoYLiZ03+zFXNTU+C7WRD1QdOQ0o JbB35PPrboGsU8hRPb+M76uAZGNi0VJgGZqu14+zSdqyxzm1G7Shg4abHXPQ8WBRcHAy F9kNPmkP6UrqNzORYv6nrK2Gje7Kw2RXBr4Oj2vohL10+gZdvd709bqQjFRI2ualYWWg z0e/dfZj7x5tt1tDK9X+Z5MAzr94PJBz310jqrJUvIXMwJBw/4X78JqyVsXvHfradqFP Xzgw== X-Gm-Message-State: AKaTC01DlLN8MXpuadoy7SdBfLPmbMGrIGHVv0Fsz+4t/K5xohA70qyKimLyQYDVYuGSJBuf5QY= X-Received: by 10.25.213.7 with SMTP id m7mr3152998lfg.36.1480078930634; Fri, 25 Nov 2016 05:02:10 -0800 (PST) Received: from erachmi-ericsson.ki.sw.ericsson.se (c-83-233-76-66.cust.bredband2.com. [83.233.76.66]) by smtp.gmail.com with ESMTPSA id n124sm9289444lfb.33.2016.11.25.05.02.09 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 25 Nov 2016 05:02:10 -0800 (PST) From: Christophe Milard To: maxim.uvarov@linaro.com, mike.holmes@linaro.org, bill.fischofer@linaro.org, lng-odp@lists.linaro.org Date: Fri, 25 Nov 2016 15:01:44 +0100 Message-Id: <1480082504-16506-1-git-send-email-christophe.milard@linaro.org> X-Mailer: git-send-email 2.7.4 Subject: [lng-odp] [PATCH] linux-gen: _fdserver: request sigterm if parent dies X-BeenThere: lng-odp@lists.linaro.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: "The OpenDataPlane \(ODP\) List" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: lng-odp-bounces@lists.linaro.org Sender: "lng-odp" _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 --- platform/linux-generic/_fdserver.c | 6 ++++++ 1 file changed, 6 insertions(+) -- 2.7.4 Reviewed-by: Mike Holmes 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 #include #include <_fdserver_internal.h> +#include +#include #include #include @@ -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) {