From mboxrd@z Thu Jan 1 00:00:00 1970 From: Anatoly Burakov Subject: [PATCH v3 5/5] eal: don't hardcode socket filter value in IPC Date: Tue, 27 Feb 2018 14:35:41 +0000 Message-ID: <2f9a4da56e7f31f141db8cb2bb34d3c7fef97691.1519740527.git.anatoly.burakov@intel.com> References: <3f4fab71b0d17fb9d0b15e3634f4fe7d12dd3e92.1519740527.git.anatoly.burakov@intel.com> Cc: jianfeng.tan@intel.com To: dev@dpdk.org Return-path: Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by dpdk.org (Postfix) with ESMTP id 240864CB3 for ; Tue, 27 Feb 2018 15:35:44 +0100 (CET) In-Reply-To: <3f4fab71b0d17fb9d0b15e3634f4fe7d12dd3e92.1519740527.git.anatoly.burakov@intel.com> In-Reply-To: <31f6d9ef676fb1eb0a664c06d62d66f32876dcb6.1519672713.git.anatoly.burakov@intel.com> References: <31f6d9ef676fb1eb0a664c06d62d66f32876dcb6.1519672713.git.anatoly.burakov@intel.com> 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: v3: no changes v2: no changes 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 7856a7b..4cf3aa6 100644 --- a/lib/librte_eal/common/eal_common_proc.c +++ b/lib/librte_eal/common/eal_common_proc.c @@ -506,16 +506,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); -- 2.7.4