From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by dpdk.org (Postfix) with ESMTP id 19AE447D2 for ; Tue, 4 Feb 2014 12:22:29 +0100 (CET) Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga101.jf.intel.com with ESMTP; 04 Feb 2014 03:23:50 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.95,779,1384329600"; d="scan'208";a="449483647" Received: from irsmsx102.ger.corp.intel.com ([163.33.3.155]) by orsmga001.jf.intel.com with ESMTP; 04 Feb 2014 03:23:49 -0800 Received: from irsmsx153.ger.corp.intel.com (163.33.192.75) by IRSMSX102.ger.corp.intel.com (163.33.3.155) with Microsoft SMTP Server (TLS) id 14.3.123.3; Tue, 4 Feb 2014 11:23:47 +0000 Received: from irsmsx101.ger.corp.intel.com ([169.254.1.67]) by IRSMSX153.ger.corp.intel.com ([169.254.9.196]) with mapi id 14.03.0123.003; Tue, 4 Feb 2014 11:23:47 +0000 From: "Burakov, Anatoly" To: "dev@dpdk.org" Thread-Topic: [dpdk-dev] couple of minor compilation errors in DPDK 1.6 (/lib/librte_eal/linuxapp/eal/eal_ivshmem.c) Thread-Index: AQHPIVndPaS9vptkqUWvFnxoZF8715qk8rLwgAABmTA= Date: Tue, 4 Feb 2014 11:23:46 +0000 Message-ID: References: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [163.33.239.182] Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Subject: [dpdk-dev] FW: couple of minor compilation errors in DPDK 1.6 (/lib/librte_eal/linuxapp/eal/eal_ivshmem.c) X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 04 Feb 2014 11:22:30 -0000 > -----Original Message----- > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Jyotiswarup = > Raiturkar > Sent: Tuesday, February 04, 2014 3:33 AM > To: dev@dpdk.org > Cc: Jyotiswarup Raiturkar > Subject: [dpdk-dev] couple of minor compilation errors in DPDK 1.6 > (/lib/librte_eal/linuxapp/eal/eal_ivshmem.c) > = > Hi > = > I downloaded DPDK 1.6 from the Intel website and ran into couple of = > compilation errors with /lib/librte_eal/linuxapp/eal/eal_ivshmem.c. = > The following changes seem to fix it. Have other people seen these? > = > Thanks > Jyoti > = > = > @@ -472,7 +472,7 @@ > rte_snprintf(path, sizeof(path), IVSHMEM_CONFIG_PATH, > internal_config.hugefile_prefix); > = > - fd =3D open(path, O_CREAT | O_RDWR); > + fd =3D open(path, O_CREAT | O_RDWR, S_IRWXU | S_IRWXG | S_IRWXO ); > = > if (fd < 0) { > RTE_LOG(ERR, EAL, "Could not open %s: %s\n", path, strerror(errno)); = > @@ - > 486,7 +486,8 @@ > return -1; > } > = > - ftruncate(fd, sizeof(struct ivshmem_shared_config)); > + if (ftruncate(fd, sizeof(struct ivshmem_shared_config))) { > + close(fd); return -1; > + } > = > ivshmem_config =3D mmap(NULL, sizeof(struct ivshmem_shared_config), > PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0); Hi I don't think assigning 0777 to a newly created file is a good idea, I woul= d prefer 0666. Other than that, there is also another place where a call to= close() should be added, so the correct patch would be: @@ -443,7 +443,7 @@ create_shared_config(void) rte_snprintf(path, sizeof(path), IVSHMEM_CONFIG_PATH, internal_config.hugefile_prefix); - fd =3D open(path, O_CREAT | O_RDWR); + fd =3D open(path, O_CREAT | O_RDWR, 0666); if (fd < 0) { RTE_LOG(ERR, EAL, "Could not open %s: %s\n", path, strerror= (errno)); @@ -462,14 +462,17 @@ create_shared_config(void) ivshmem_config =3D mmap(NULL, sizeof(struct ivshmem_shared_config), PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0); - if (ivshmem_config =3D=3D MAP_FAILED) + if (ivshmem_config =3D=3D MAP_FAILED) { + close(fd); return -1; + } memset(ivshmem_config, 0, sizeof(struct ivshmem_shared_config)); /* change the exclusive lock we got earlier to a shared lock */ if (flock(fd, LOCK_SH | LOCK_NB) =3D=3D -1) { RTE_LOG(ERR, EAL, "Locking %s failed: %s \n", path, strerro= r(errno)); + close(fd); return -1; } Best regards, Anatoly Burakov DPDK SW Engineer -------------------------------------------------------------- Intel Shannon Limited Registered in Ireland Registered Office: Collinstown Industrial Park, Leixlip, County Kildare Registered Number: 308263 Business address: Dromore House, East Park, Shannon, Co. Clare This e-mail and any attachments may contain confidential material for the s= ole use of the intended recipient(s). Any review or distribution by others = is strictly prohibited. If you are not the intended recipient, please conta= ct the sender and delete all copies.