From patchwork Mon Oct 2 14:59:25 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Monjalon X-Patchwork-Id: 29483 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 A7FB91B24A; Mon, 2 Oct 2017 16:59:30 +0200 (CEST) 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 compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.nyi.internal (Postfix) with ESMTP id 852F422A27; Mon, 2 Oct 2017 10:59:29 -0400 (EDT) Received: from frontend2 ([10.202.2.161]) by compute1.internal (MEProxy); Mon, 02 Oct 2017 10:59:29 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=monjalon.net; h= date:from:message-id:subject:to:x-me-sender:x-me-sender :x-sasl-enc:x-sasl-enc; s=mesmtp; bh=1Hcw9C0mCLHYzRhG+dXmJsUHOiC ND2GKuquuYwc23ho=; b=JNY0SyeQ6FLx3sE6X8i7qTwptjb0LjoyzkqC+w5605m ASFTfgJlaglLfrdzl1AlfNdQI3v5iT8PR2HrPIzjQpybr9Fzk3aSy/xvZs85efU7 59L8sqCXvbi6zo/38pqwclExbewDE6wJvu1uZkqTunauycplIZX00/zvN6lFf4lI = DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=date:from:message-id:subject:to :x-me-sender:x-me-sender:x-sasl-enc:x-sasl-enc; s=fm1; bh=1Hcw9C 0mCLHYzRhG+dXmJsUHOiCND2GKuquuYwc23ho=; b=kUYqRKpx+DXgdVkz1s8aSR SpRsNFQslvdJ+BqFm/EqZrayVJKUTY/7sTDKREBmSJr6Jmoztne39crcAppcq0t1 r0wT8hgQTHyeGAMsaEFSfSKZ7t2LA96/RohQBvpiyVktSeZkLSsBHipNpucsOUkV ssmrIvgGezVF7D6D4hdGlXapDnOgNRvU2a3KOLc8YaoZo4Mo5yQy6Cu9UeB6MHb9 2Xg4p1bULeCd7sTOsktM70mmZnNfUX0CWWSbNBbnFjnZyiBIGIFEzYaBg6Q0KbiQ Wr8Vcrp7nD8/bC1cZvlBIC4IOl6cGAFgsoOv2L/6vDJd3+TXxdZbE8a39dMbL6Vg == X-ME-Sender: X-Sasl-enc: MJG+yzn7erG6hZqk+GJ/viktcqsz7qKzY7NZdK6nuDkL 1506956369 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) From: Thomas Monjalon To: dev@dpdk.org Date: Mon, 2 Oct 2017 16:59:25 +0200 Message-Id: <20171002145925.4462-1-thomas@monjalon.net> X-Mailer: git-send-email 2.14.1 Subject: [dpdk-dev] [PATCH] eal: add doc for constructor 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" It is a reminder that the constructors without priority get the lowest priority. Signed-off-by: Thomas Monjalon Reviewed-by: Ferruh Yigit Acked-by: John McNamara --- 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)