From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp.tuxdriver.com (charlotte.tuxdriver.com [70.61.120.58]) by dpdk.org (Postfix) with ESMTP id 612441BB4D for ; Thu, 12 Apr 2018 13:17:37 +0200 (CEST) Received: from cpe-2606-a000-111b-40b7-640c-26a-4e16-9225.dyn6.twc.com ([2606:a000:111b:40b7:640c:26a:4e16:9225] helo=hmswarspite.think-freely.org) by smtp.tuxdriver.com with esmtpsa (TLSv1:AES256-SHA:256) (Exim 4.63) (envelope-from ) id 1f6aEF-000743-FG; Thu, 12 Apr 2018 07:17:32 -0400 Received: from hmswarspite.think-freely.org (localhost [127.0.0.1]) by hmswarspite.think-freely.org (8.15.2/8.15.2) with ESMTP id w3CBGnwf009024; Thu, 12 Apr 2018 07:16:49 -0400 Received: (from nhorman@localhost) by hmswarspite.think-freely.org (8.15.2/8.15.2/Submit) id w3CBGmAQ009023; Thu, 12 Apr 2018 07:16:48 -0400 From: Neil Horman To: dev@dpdk.org Cc: Neil Horman , Thomas Monjalon , Ferruh Yigit Date: Thu, 12 Apr 2018 07:16:40 -0400 Message-Id: <20180412111640.8977-1-nhorman@tuxdriver.com> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180402120619.30404-1-nhorman@tuxdriver.com> References: <20180402120619.30404-1-nhorman@tuxdriver.com> X-Spam-Score: -2.9 (--) X-Spam-Status: No Subject: [dpdk-dev] [PATCHv2] linuxapp eal: set fd to -1 for MAP_ANONYMOUS cases 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: , X-List-Received-Date: Thu, 12 Apr 2018 11:17:39 -0000 https://dpdk.org/tracker/show_bug.cgi?id=18 Indicated that several mmap call sites in the [linux|bsd]app eal code set fd that was not -1 in their calls while using MAP_ANONYMOUS. While probably not a huge deal, the man page does say the fd should be -1 for portability, as some implementations don't ignore fd as they should for MAP_ANONYMOUS. Signed-off-by: Neil Horman CC: Thomas Monjalon CC: Ferruh Yigit --- Change notes v2) Rebased to HEAD again to adjust for patches that landed ahead of this --- lib/librte_eal/bsdapp/eal/eal_memory.c | 2 +- lib/librte_eal/linuxapp/eal/eal_memory.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/librte_eal/bsdapp/eal/eal_memory.c b/lib/librte_eal/bsdapp/eal/eal_memory.c index b27262c7e..a5e034789 100644 --- a/lib/librte_eal/bsdapp/eal/eal_memory.c +++ b/lib/librte_eal/bsdapp/eal/eal_memory.c @@ -70,7 +70,7 @@ rte_eal_hugepage_init(void) addr = mmap(NULL, internal_config.memory, PROT_READ | PROT_WRITE, - MAP_PRIVATE | MAP_ANONYMOUS, 0, 0); + MAP_PRIVATE | MAP_ANONYMOUS, -1, 0); if (addr == MAP_FAILED) { RTE_LOG(ERR, EAL, "%s: mmap() failed: %s\n", __func__, strerror(errno)); diff --git a/lib/librte_eal/linuxapp/eal/eal_memory.c b/lib/librte_eal/linuxapp/eal/eal_memory.c index 7cdd3048e..b7a2e951d 100644 --- a/lib/librte_eal/linuxapp/eal/eal_memory.c +++ b/lib/librte_eal/linuxapp/eal/eal_memory.c @@ -1329,7 +1329,7 @@ eal_legacy_hugepage_init(void) } addr = mmap(NULL, internal_config.memory, PROT_READ | PROT_WRITE, - MAP_PRIVATE | MAP_ANONYMOUS, 0, 0); + MAP_PRIVATE | MAP_ANONYMOUS, -1, 0); if (addr == MAP_FAILED) { RTE_LOG(ERR, EAL, "%s: mmap() failed: %s\n", __func__, strerror(errno)); -- 2.14.3