From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id D8F2CA0487 for ; Fri, 5 Jul 2019 10:53:56 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id E51B11BDE1; Fri, 5 Jul 2019 10:53:54 +0200 (CEST) Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by dpdk.org (Postfix) with ESMTP id E1DC71B9BD; Fri, 5 Jul 2019 10:53:52 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 05 Jul 2019 01:53:52 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.63,454,1557212400"; d="scan'208";a="167007185" Received: from aburakov-mobl1.ger.corp.intel.com (HELO [10.251.95.203]) ([10.251.95.203]) by orsmga003.jf.intel.com with ESMTP; 05 Jul 2019 01:53:50 -0700 To: ogawa.yasufumi@lab.ntt.co.jp Cc: dev@dpdk.org, stable@dpdk.org References: <1555379952-23517-1-git-send-email-ogawa.yasufumi@lab.ntt.co.jp> <1555386203-23776-1-git-send-email-ogawa.yasufumi@lab.ntt.co.jp> <1555386203-23776-2-git-send-email-ogawa.yasufumi@lab.ntt.co.jp> From: "Burakov, Anatoly" Message-ID: Date: Fri, 5 Jul 2019 09:53:50 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.7.2 MIME-Version: 1.0 In-Reply-To: <1555386203-23776-2-git-send-email-ogawa.yasufumi@lab.ntt.co.jp> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Subject: Re: [dpdk-dev] [PATCH v2 1/1] fbarray: get fbarrays from containerized secondary 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" On 16-Apr-19 4:43 AM, ogawa.yasufumi@lab.ntt.co.jp wrote: > From: Yasufumi Ogawa > > In secondary_msl_create_walk(), it creates a file for fbarrays with its > PID for reserving unique name among secondary processes. However, it > does not work if secondary is run as app container because each of > containerized secondary has PID 1. To reserve unique name, use hostname > instead of PID if the value is 1. > > Cc: stable@dpdk.org > > Signed-off-by: Yasufumi Ogawa > --- I'm not too well versed in containers - is this hostname 1) always set, and 2) always unique? > + if (getpid() == 1) { > + FILE *hn_fp; > + hn_fp = fopen("/etc/hostname", "r"); > + if (hn_fp == NULL) { > + RTE_LOG(ERR, EAL, > + "Cannot open '/etc/hostname' for secondary\n"); > + return -1; > + } > + > + /* with docker, /etc/hostname just has one entry of hostname */ > + if (fscanf(hn_fp, "%s", proc_id) == EOF) > + return -1; Wouldn't an error in fscanf() leak the file handle? I think you need to fclose() before checking the result. > + fclose(hn_fp); > + } else > + sprintf(proc_id, "%d", (int)getpid()); > + > + snprintf(name, RTE_FBARRAY_NAME_LEN, "%s_%s", > + primary_msl->memseg_arr.name, proc_id); > > ret = rte_fbarray_init(&local_msl->memseg_arr, name, > primary_msl->memseg_arr.len, > -- Thanks, Anatoly