From patchwork Thu Jul 5 11:48:12 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: 42340 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 E65001BEFC; Thu, 5 Jul 2018 13:49:17 +0200 (CEST) Received: from mail-wm0-f48.google.com (mail-wm0-f48.google.com [74.125.82.48]) by dpdk.org (Postfix) with ESMTP id 200CB1BECA for ; Thu, 5 Jul 2018 13:49:04 +0200 (CEST) Received: by mail-wm0-f48.google.com with SMTP id 69-v6so10305352wmf.3 for ; Thu, 05 Jul 2018 04:49:04 -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=ZtfNPlBkZCCYph80cHi2zc7zewiEPP0tLPgIMEpMWxE=; b=xe2zOcO8ZoYuKf5DYw2mOUs0Rr0zQYW8g92H2YfMlsQS5o4zovEbj+eznfWo8pg4q/ Tv9hLtEqF+p+9YMJoU6WY0eQtuwwyRLXcCF7sYYuB+TdfX5DQ9WyV+1srqu8l/X3OPHF 78ObfM2/SHuE6CduJ7V6j5Jlw6VQA1daZkC1546RBlSNuMxSlWvAeFGGjAlprhZYyvcG fgP2Tb61/hhqLm5X6asptnZXtM8SVUKGsIgGErh0fE/SWMu4vPD16uU9eEDjQ24SEsOg VjBlrMoHp1WlPExdJQPi+VFsOftl8pBPFxUibGk7WIiMThJ809YFWHWlW9sdH/0wY9lS o21Q== 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=ZtfNPlBkZCCYph80cHi2zc7zewiEPP0tLPgIMEpMWxE=; b=tgjB3bA4SvZxFtmQ50V6jkDE+29uhlgfqWKO/vXpvpDBZQFqJOfpakJCqsCf9t8Qnd CYZtjpB/SFRsFb3l/heJ905TfVaxHBxZvtoIr7xJjQgbu6W7maIt0F9SCF19ZbTyXjKB ozRQNNbBrPma+HXy/0zVFfXGeywyJLvmVHVqNJyMRAlnNeG/0vO0behyO+owzXMfxFay rzjfbsWooqEDI+GDzuni6/jzuD2ljMzL2RhLi2t4D24sCtcPkPkQdt26/ZbvC3tNCF+l IuAlCpu8gd78tfOisOKoEX+5u1LAOhL4wzX4HjkMceX7P6D7VH+g0bL+4O2hFvNwFMXb cH1Q== X-Gm-Message-State: APt69E0LkvigU3dKE3YEDAVJGYF5jAeA6F2dwWa2PN4f3FTTD4qx8wLu M6RjtcnBoB6spah8UMGFEucTHauu X-Google-Smtp-Source: AAOMgpdhtRTxQCGizUpJfwLSgDWmER0GesIwbyqDiyoLoREF1K6Tud0Rdk7kf/aZpVNtJ+sZmPQ+cw== X-Received: by 2002:a1c:acc1:: with SMTP id v184-v6mr4333312wme.114.1530791343475; Thu, 05 Jul 2018 04:49:03 -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 o42-v6sm15809183wrc.50.2018.07.05.04.49.01 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 05 Jul 2018 04:49:02 -0700 (PDT) From: Gaetan Rivet To: dev@dpdk.org Cc: Gaetan Rivet Date: Thu, 5 Jul 2018 13:48:12 +0200 Message-Id: <42037d90036505fc764572b8a4c8b25a529c4ec7.1530791217.git.gaetan.rivet@6wind.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: References: Subject: [dpdk-dev] [PATCH v10 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 Acked-by: Shreyansh Jain Acked-by: Thomas Monjalon --- 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 */