From mboxrd@z Thu Jan 1 00:00:00 1970 From: Thomas Monjalon Subject: [PATCH] eal: add doc for constructor macros Date: Mon, 2 Oct 2017 16:59:25 +0200 Message-ID: <20171002145925.4462-1-thomas@monjalon.net> To: dev@dpdk.org Return-path: Received: from out1-smtp.messagingengine.com (out1-smtp.messagingengine.com [66.111.4.25]) by dpdk.org (Postfix) with ESMTP id 0DF001B249 for ; Mon, 2 Oct 2017 16:59:29 +0200 (CEST) Received: from xps.monjalon.net (184.203.134.77.rev.sfr.net [77.134.203.184]) by mail.messagingengine.com (Postfix) with ESMTPA id 0DE9324772 for ; Mon, 2 Oct 2017 10:59:28 -0400 (EDT) List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" It is a reminder that the constructors without priority get the lowest priority. Signed-off-by: Thomas Monjalon --- lib/librte_eal/common/include/rte_eal.h | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/lib/librte_eal/common/include/rte_eal.h b/lib/librte_eal/common/include/rte_eal.h index 0e7363d77..559d2308e 100644 --- a/lib/librte_eal/common/include/rte_eal.h +++ b/lib/librte_eal/common/include/rte_eal.h @@ -287,9 +287,26 @@ static inline int rte_gettid(void) return RTE_PER_LCORE(_thread_id); } +/** + * Run function before main() with low priority. + * + * The constructor will be run after prioritized constructors. + * + * @param func + * Constructor function. + */ #define RTE_INIT(func) \ static void __attribute__((constructor, used)) func(void) +/** + * Run function before main() with high priority. + * + * @param func + * Constructor function. + * @param prio + * Priority number must be above 100. + * Lowest number is the first to run. + */ #define RTE_INIT_PRIO(func, prio) \ static void __attribute__((constructor(prio), used)) func(void) -- 2.14.1