From patchwork Tue Feb 27 13:23:26 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anatoly Burakov X-Patchwork-Id: 35473 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 39FC95F2F; Tue, 27 Feb 2018 14:23:34 +0100 (CET) Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by dpdk.org (Postfix) with ESMTP id E2C485B30 for ; Tue, 27 Feb 2018 14:23:30 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 27 Feb 2018 05:23:29 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.47,401,1515484800"; d="scan'208";a="23567455" Received: from irvmail001.ir.intel.com ([163.33.26.43]) by fmsmga002.fm.intel.com with ESMTP; 27 Feb 2018 05:23:29 -0800 Received: from sivswdev01.ir.intel.com (sivswdev01.ir.intel.com [10.237.217.45]) by irvmail001.ir.intel.com (8.14.3/8.13.6/MailSET/Hub) with ESMTP id w1RDNSJn023821; Tue, 27 Feb 2018 13:23:28 GMT Received: from sivswdev01.ir.intel.com (localhost [127.0.0.1]) by sivswdev01.ir.intel.com with ESMTP id w1RDNSiA016080; Tue, 27 Feb 2018 13:23:28 GMT Received: (from aburakov@localhost) by sivswdev01.ir.intel.com with LOCAL id w1RDNR5c016015; Tue, 27 Feb 2018 13:23:27 GMT From: Anatoly Burakov To: dev@dpdk.org Cc: jianfeng.tan@intel.com Date: Tue, 27 Feb 2018 13:23:26 +0000 Message-Id: <64b3f5748e9f99b141da323a837e151983f5cf5b.1519672713.git.anatoly.burakov@intel.com> X-Mailer: git-send-email 1.7.0.7 In-Reply-To: <31f6d9ef676fb1eb0a664c06d62d66f32876dcb6.1519672713.git.anatoly.burakov@intel.com> References: <31f6d9ef676fb1eb0a664c06d62d66f32876dcb6.1519672713.git.anatoly.burakov@intel.com> In-Reply-To: <31f6d9ef676fb1eb0a664c06d62d66f32876dcb6.1519322682.git.anatoly.burakov@intel.com> References: <31f6d9ef676fb1eb0a664c06d62d66f32876dcb6.1519322682.git.anatoly.burakov@intel.com> Subject: [dpdk-dev] [PATCH v2 5/5] eal: don't hardcode socket filter value in IPC 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" Currently, filter value is hardcoded and disconnected from actual value returned by eal_mp_socket_path(). Fix this to generate filter value by deriving it from eal_mp_socket_path() instead. Signed-off-by: Anatoly Burakov --- Notes: v2: added this patch lib/librte_eal/common/eal_common_proc.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/lib/librte_eal/common/eal_common_proc.c b/lib/librte_eal/common/eal_common_proc.c index 82ea4a7..bdea6d6 100644 --- a/lib/librte_eal/common/eal_common_proc.c +++ b/lib/librte_eal/common/eal_common_proc.c @@ -504,16 +504,17 @@ int rte_mp_channel_init(void) { char thread_name[RTE_MAX_THREAD_NAME_LEN]; - char *path; + char path[PATH_MAX]; int dir_fd; pthread_t tid; - snprintf(mp_filter, PATH_MAX, ".%s_unix_*", - internal_config.hugefile_prefix); + /* create filter path */ + create_socket_path("*", path, sizeof(path)); + snprintf(mp_filter, sizeof(mp_filter), "%s", basename(path)); - path = strdup(eal_mp_socket_path()); - snprintf(mp_dir_path, PATH_MAX, "%s", dirname(path)); - free(path); + /* path may have been modified, so recreate it */ + create_socket_path("*", path, sizeof(path)); + snprintf(mp_dir_path, sizeof(mp_dir_path), "%s", dirname(path)); /* lock the directory */ dir_fd = open(mp_dir_path, O_RDONLY);