From patchwork Fri Nov 25 14:39:33 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe Milard X-Patchwork-Id: 84130 Delivered-To: patch@linaro.org Received: by 10.182.1.168 with SMTP id 8csp159141obn; Fri, 25 Nov 2016 05:40:16 -0800 (PST) X-Received: by 10.237.33.156 with SMTP id l28mr7694118qtc.111.1480081216301; Fri, 25 Nov 2016 05:40:16 -0800 (PST) Return-Path: Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id p86si25376883qki.104.2016.11.25.05.40.15; Fri, 25 Nov 2016 05:40:16 -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 74E7362E9C; Fri, 25 Nov 2016 13:40:15 +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=-2.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_LOW, 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 87DD760BF3; Fri, 25 Nov 2016 13:40:07 +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 53D9760C10; Fri, 25 Nov 2016 13:40:03 +0000 (UTC) Received: from mail-lf0-f54.google.com (mail-lf0-f54.google.com [209.85.215.54]) by lists.linaro.org (Postfix) with ESMTPS id 5613760BF1 for ; Fri, 25 Nov 2016 13:39:59 +0000 (UTC) Received: by mail-lf0-f54.google.com with SMTP id t196so51058644lff.3 for ; Fri, 25 Nov 2016 05:39:59 -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=Nn4mmYF1hp+dM2NR0pYUHeSHMLc5H6eQW1cQmAsNDEMO7jNJt4m/JYpW04c4EEBh1Z S3tWL9S8HtY6HAAJsl5W3YWP6UNb4/+IrviNk64/EIsM6DhdakD1Z80MUduD6S70Qkhu k2ER7Iw6JQNRkUKxsz1X5jEKCexXFPQaj3anu+LHisJSo978ohMRyTpO35/JQMp8jOV9 cJbBi9GDpM8wBpYaW+AebyiQt/maHQg7628aNZQxmv5FPxlzkiARUrXwPZRamlKd8IeT KGTvOqfI9/ryRYUdqOwgQdLa6hR0cetDJPlhJstZyx9QRsoX3HOTB4ha+LU950fbtwAN GhmQ== X-Gm-Message-State: AKaTC01I1J1oyIaFiQ78qs7H02sILHwUrTZASlLn7X1wr2O0fzflzYhOzbuvWjUQZnuGsl/QIW0= X-Received: by 10.25.135.130 with SMTP id j124mr3457986lfd.88.1480081198139; Fri, 25 Nov 2016 05:39:58 -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 m129sm9300400lfe.6.2016.11.25.05.39.57 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 25 Nov 2016 05:39:57 -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:39:33 +0100 Message-Id: <1480084773-17817-1-git-send-email-christophe.milard@linaro.org> X-Mailer: git-send-email 2.7.4 Subject: [lng-odp] [API-NEXT 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) {