From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wr1-f51.google.com (mail-wr1-f51.google.com [209.85.221.51]) by dpdk.org (Postfix) with ESMTP id C155C1B539 for ; Wed, 11 Jul 2018 23:45:45 +0200 (CEST) Received: by mail-wr1-f51.google.com with SMTP id c4-v6so6928684wrs.12 for ; Wed, 11 Jul 2018 14:45:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=6wind-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=3VDu06LFQ4J/b75N3K8Nn5QtaSeL/9dR5LnuAlbsMmA=; b=0WDhuBMDbhgjnoFi8Qoi2S+DaDvDhA9gveVqZ7YuNme7usaQ/NABwS0D2vqocftiwb wut8Cu8lepPzpU6VJhQcV3l1/cf8FuDlpXATB6UqHqByhMxuvim75e2jbA5BE2duZ6fW KszqVqMvStsLmPI4WeU2VOLgJhslmjBMXqe0EbTqrsRu3KDSe8naOPDVl8yLnXTkr+/X 39niUb8TylBuBsn0zZRrXq172qQVaqHYcfIg12+uHbB7ZI5qsa3fdPHB3q3Jtj1sTrbW MCpr7iPMAcQB1tAHtTh5kxR/wlDintzEsT63Bwob6Qs4XE+GUCx+x4yHOL90fChpAgZL 6wuQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=3VDu06LFQ4J/b75N3K8Nn5QtaSeL/9dR5LnuAlbsMmA=; b=bR0ZkcYe/X5+3WkcukBj/trUz0lg2jXkpZXPp9CuDWh1/8RqoQAGWspi0JFeD9N7VQ JmKTbuQuI2qcQ8OyZviANvNIls+c9zenUCesCAxnpXO3XyLvuT7kkftj7B5hDR3IgU9C Hz8WZL3kX2s3oUUaZTMuNzGiJ/6t8DrnD3au+gmS9+UgMxPBII92w9r0bF7/pQ2/+riq H9nkBgikklOX8v39PZUiuGRqtoLO2A/BWCVgGGjSBTYoCMm56kDKcGQIPYg8tyvmf3xC WNEVY+ua7f2sJujt7nXneIzWa0c4wgax/hdck3Le29+TWFBu3U3d0jNlCqVVFkmv23Hp BA8A== X-Gm-Message-State: AOUpUlHVqCYOLliHfQAs0prZBjGHSzX2sEQd3uyoB8Ppx2E4+4/2Ztz1 4EYrivokNT8FyGQD3dXM+T9WtpTs X-Google-Smtp-Source: AAOMgpeL9qnrSvLmUh42rb5iJ5lXeOTQ/HVbLtQlF7UeciqeMy4ItbuVRxluu5OYocRzyU7E3cc3ow== X-Received: by 2002:adf:e78d:: with SMTP id n13-v6mr219281wrm.136.1531345545021; Wed, 11 Jul 2018 14:45:45 -0700 (PDT) Received: from bidouze.dev.6wind.com. (host.78.145.23.62.rev.coltfrance.com. [62.23.145.78]) by smtp.gmail.com with ESMTPSA id h5-v6sm10550936wrr.19.2018.07.11.14.45.43 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 11 Jul 2018 14:45:43 -0700 (PDT) From: Gaetan Rivet To: dev@dpdk.org Cc: Gaetan Rivet Date: Wed, 11 Jul 2018 23:44:56 +0200 Message-Id: <0d2e618f68d5d7f5028a26681ca67cdcdcf3b0e6.1531345404.git.gaetan.rivet@6wind.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: References: Subject: [dpdk-dev] [PATCH v11 06/25] eal: introduce dtor macros X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 11 Jul 2018 21:45:46 -0000 This macro adds symbols to the .fini section using the global RTE priorities, to ensure consistency. Signed-off-by: Gaetan Rivet Acked-by: Shreyansh Jain --- lib/librte_eal/common/include/rte_common.h | 23 ++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/lib/librte_eal/common/include/rte_common.h b/lib/librte_eal/common/include/rte_common.h index 434adfd45..0dd832728 100644 --- a/lib/librte_eal/common/include/rte_common.h +++ b/lib/librte_eal/common/include/rte_common.h @@ -111,6 +111,29 @@ static void __attribute__((constructor(RTE_PRIO(prio)), used)) func(void) #define RTE_INIT(func) \ RTE_INIT_PRIO(func, LAST) +/** + * Run after main() with low priority. + * + * @param func + * Destructor function name. + * @param prio + * Priority number must be above 100. + * Lowest number is the last to run. + */ +#define RTE_FINI_PRIO(func, prio) \ +static void __attribute__((destructor(RTE_PRIO(prio)), used)) func(void) + +/** + * Run after main() with high priority. + * + * The destructor will be run *before* prioritized destructors. + * + * @param func + * Destructor function name. + */ +#define RTE_FINI(func) \ + RTE_FINI_PRIO(func, LAST) + /** * Force a function to be inlined */ -- 2.18.0