From patchwork Tue Jul 3 22:14:48 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Ga=C3=ABtan_Rivet?= X-Patchwork-Id: 42174 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id E1B091BE6A; Wed, 4 Jul 2018 00:15:44 +0200 (CEST) Received: from mail-wr0-f169.google.com (mail-wr0-f169.google.com [209.85.128.169]) by dpdk.org (Postfix) with ESMTP id B4B711B4C1 for ; Wed, 4 Jul 2018 00:15:40 +0200 (CEST) Received: by mail-wr0-f169.google.com with SMTP id q10-v6so3379615wrd.4 for ; Tue, 03 Jul 2018 15:15:40 -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 :in-reply-to:references; bh=kjK0X93uJ8qR12GsXLADuXLvB/fMaIlBtKWcJvWWVLY=; b=VD9zsi+0FaQ4heNT1tnpBlP/SLFgMwJpl9A0IB2pGUmXDy1Ag16IAVGt4MPvSk5FL8 vwSaDIxHYz4ExYwElpX69TyuBXwJqeS6WgTXj4/reEjRPbtB35ThlwEHbf7MugOl9gl+ QrCA+12B+vL44PCzRWtaiZa5t3tHVg6MCzthaSpkxrVeShuODu0gRIr8Ksl0DMs6kQA/ vvJX5pfocVOXRH53AI/b4ispy4JG55S4AAqB7/Cz3rGU2uPQLQyylsaXBii8hhYiwjWV mIAjk/5R1qNNB572LS4mAy+75nPoZdHMs51iMJP4q32qy2kF+t7ZLDAStciYko3rEqte Wfvg== 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:in-reply-to:references; bh=kjK0X93uJ8qR12GsXLADuXLvB/fMaIlBtKWcJvWWVLY=; b=G329vrfV+4OLJXCYg6b6HleN1oV26vIeyU0dGj3XN4ra8ITaG57KebWbwzS+54B8Ul 6tWxTMPeKJxXPYkRHlkR9r/B+wDNwHUm6ceosM2sfGKdn6f9q8QjsrFvEgPSBqFkO1HV VSOUkHGKskvE/S/f6kiX1xgyJZohI+HCWGqvCuTONCzMkxmJGtp8RMINXoClogamYMcu fdydXHgqFwqYhnGrCn4HP/h/iU3zBCVKbb4NS6rWwDk4v5GM4nMbE9jNqZzotzUOHbXu 7D5hr8SenYYiI5ObHHeRbSYpduNJMRDGb9Ac0EXS2eE3TvvWpBcvgmN/hSDgp1rT3byv ULhg== X-Gm-Message-State: APt69E1M2RVaBbZ98xbWL/4TGcdPuI5fwjJKwg4tS2CeUKfviPdxYZV5 aBuPO8ljFKnFRlxrAN64AwNPVGo/ X-Google-Smtp-Source: AAOMgpcVd8ncVlRBa+ueTF8edzJWdUchWQKKVw+xrh2oUa3BCaitAabZHGDjc0bZRst5IvJT5qdNJA== X-Received: by 2002:adf:8b01:: with SMTP id n1-v6mr24690402wra.282.1530656140133; Tue, 03 Jul 2018 15:15:40 -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 i190-v6sm3771084wmd.33.2018.07.03.15.15.38 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 03 Jul 2018 15:15:39 -0700 (PDT) From: Gaetan Rivet To: dev@dpdk.org Cc: Gaetan Rivet Date: Wed, 4 Jul 2018 00:14:48 +0200 Message-Id: <1ec567e6991c4959491b9517bce926f32d03ccc8.1530655929.git.gaetan.rivet@6wind.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: References: In-Reply-To: References: Subject: [dpdk-dev] [PATCH v9 05/27] 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Signed-off-by: Gaetan Rivet --- 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 @@ -112,6 +112,29 @@ static void __attribute__((constructor(RTE_PRIO(prio)), used)) func(void) 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 */ #define __rte_always_inline inline __attribute__((always_inline))