From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <bernard.iremonger@intel.com>
Received: from mga14.intel.com (mga14.intel.com [192.55.52.115])
 by dpdk.org (Postfix) with ESMTP id D3BCF5677
 for <dev@dpdk.org>; Thu, 19 Mar 2015 17:04:38 +0100 (CET)
Received: from orsmga002.jf.intel.com ([10.7.209.21])
 by fmsmga103.fm.intel.com with ESMTP; 19 Mar 2015 09:04:37 -0700
X-ExtLoop1: 1
X-IronPort-AV: E=Sophos;i="5.11,430,1422950400"; d="scan'208";a="701109974"
Received: from irsmsx103.ger.corp.intel.com ([163.33.3.157])
 by orsmga002.jf.intel.com with ESMTP; 19 Mar 2015 09:04:37 -0700
Received: from irsmsx108.ger.corp.intel.com ([169.254.11.218]) by
 IRSMSX103.ger.corp.intel.com ([169.254.3.247]) with mapi id 14.03.0195.001;
 Thu, 19 Mar 2015 16:04:32 +0000
From: "Iremonger, Bernard" <bernard.iremonger@intel.com>
To: Tetsuya Mukawa <mukawa@igel.co.jp>, "dev@dpdk.org" <dev@dpdk.org>
Thread-Topic: [PATCH 2/6] eal: Close file descriptor of uio configuration
Thread-Index: AQHQYJUjTiBLbSAI/Eyb7RGBUTVZWp0j+v9w
Date: Thu, 19 Mar 2015 16:04:32 +0000
Message-ID: <8CEF83825BEC744B83065625E567D7C2049F3B56@IRSMSX108.ger.corp.intel.com>
References: <1426155474-1596-4-git-send-email-mukawa@igel.co.jp>
 <1426584645-28828-1-git-send-email-mukawa@igel.co.jp>
 <1426584645-28828-3-git-send-email-mukawa@igel.co.jp>
In-Reply-To: <1426584645-28828-3-git-send-email-mukawa@igel.co.jp>
Accept-Language: en-GB, en-US
Content-Language: en-US
X-MS-Has-Attach: 
X-MS-TNEF-Correlator: 
x-originating-ip: [163.33.239.181]
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: quoted-printable
MIME-Version: 1.0
Subject: Re: [dpdk-dev] [PATCH 2/6] eal: Close file descriptor of uio
	configuration
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: patches and discussions about DPDK <dev.dpdk.org>
List-Unsubscribe: <http://dpdk.org/ml/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://dpdk.org/ml/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <http://dpdk.org/ml/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
X-List-Received-Date: Thu, 19 Mar 2015 16:04:39 -0000


> -----Original Message-----
> From: Tetsuya Mukawa [mailto:mukawa@igel.co.jp]
> Sent: Tuesday, March 17, 2015 9:31 AM
> To: dev@dpdk.org
> Cc: Iremonger, Bernard; Richardson, Bruce; Tetsuya Mukawa
> Subject: [PATCH 2/6] eal: Close file descriptor of uio configuration
>=20
> When pci_uio_unmap_resource() is called, a file descriptor that is used f=
or uio configuration should be
> closed.
>=20
> Signed-off-by: Tetsuya Mukawa <mukawa@igel.co.jp>
> ---
>  lib/librte_eal/linuxapp/eal/eal_pci_uio.c | 8 +++++++-
>  1 file changed, 7 insertions(+), 1 deletion(-)
>=20
> diff --git a/lib/librte_eal/linuxapp/eal/eal_pci_uio.c b/lib/librte_eal/l=
inuxapp/eal/eal_pci_uio.c
> index 9cdf24f..b971ec9 100644
> --- a/lib/librte_eal/linuxapp/eal/eal_pci_uio.c
> +++ b/lib/librte_eal/linuxapp/eal/eal_pci_uio.c
> @@ -459,8 +459,14 @@ pci_uio_unmap_resource(struct rte_pci_device *dev)
>=20
>  	/* close fd if in primary process */
Hi Tetsuya,

Should there be a check for the primary process before closing both of the =
these files?

Regards,

Bernard.

>  	close(dev->intr_handle.fd);
> -
>  	dev->intr_handle.fd =3D -1;
> +
> +	/* close cfg_fd if in primary process */
> +	if (dev->intr_handle.uio_cfg_fd >=3D 0) {
> +		close(dev->intr_handle.uio_cfg_fd);
> +		dev->intr_handle.uio_cfg_fd =3D -1;
> +	}
> +
>  	dev->intr_handle.type =3D RTE_INTR_HANDLE_UNKNOWN;  }  #endif /*
> RTE_LIBRTE_EAL_HOTPLUG */
> --
> 1.9.1