From 53d266ac7bb147d4a174d3c7d1b594d571cb3961 Mon Sep 17 00:00:00 2001 From: Thomas Monjalon Date: Mon, 2 Oct 2017 15:57:15 +0200 Subject: [PATCH] eal: add doc for constructor macros It is a reminder that the constructors without priority get the lowest priority. Signed-off-by: Thomas Monjalon Reviewed-by: Ferruh Yigit --- 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 0e7363d770..559d2308eb 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.20.1