Message ID | 1466948986-12255-1-git-send-email-jianfeng.tan@intel.com (mailing list archive) |
---|---|
State | Superseded, archived |
Delegated to: | Yuanhan Liu |
Headers |
Return-Path: <dev-bounces@dpdk.org> X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [IPv6:::1]) by dpdk.org (Postfix) with ESMTP id 6445D5AA7; Sun, 26 Jun 2016 15:50:09 +0200 (CEST) Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by dpdk.org (Postfix) with ESMTP id 1BC9C5AA6 for <dev@dpdk.org>; Sun, 26 Jun 2016 15:50:07 +0200 (CEST) Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga102.fm.intel.com with ESMTP; 26 Jun 2016 06:50:09 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos; i="5.26,531,1459839600"; d="scan'208"; a="1005436049" Received: from dpdk06.sh.intel.com ([10.239.128.225]) by orsmga002.jf.intel.com with ESMTP; 26 Jun 2016 06:50:07 -0700 From: Jianfeng Tan <jianfeng.tan@intel.com> To: dev@dpdk.org Cc: yuanhan.liu@linux.intel.com, huawei.xie@intel.com, Jianfeng Tan <jianfeng.tan@intel.com> Date: Sun, 26 Jun 2016 13:49:46 +0000 Message-Id: <1466948986-12255-1-git-send-email-jianfeng.tan@intel.com> X-Mailer: git-send-email 2.1.4 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH] net/virtio-user: fix O_CLOEXEC undeclared error 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> Errors-To: dev-bounces@dpdk.org Sender: "dev" <dev-bounces@dpdk.org> |
Commit Message
Jianfeng Tan
June 26, 2016, 1:49 p.m. UTC
On some older systems, such as SUSE 11, the compiling error shows
as:
.../dpdk/drivers/net/virtio/virtio_user/virtio_user_dev.c:67:22:
error: ‘O_CLOEXEC’ undeclared (first use in this function)
The fix is to declare _GNU_SOURCE macro before include fcntl.h.
Fixes: 37a7eb2ae816 ("net/virtio-user: add device emulation layer")
Signed-off-by: Jianfeng Tan <jianfeng.tan@intel.com>
---
drivers/net/virtio/virtio_user/virtio_user_dev.c | 1 +
1 file changed, 1 insertion(+)
Comments
On Sun, Jun 26, 2016 at 01:49:46PM +0000, Jianfeng Tan wrote: > On some older systems, such as SUSE 11, the compiling error shows > as: > .../dpdk/drivers/net/virtio/virtio_user/virtio_user_dev.c:67:22: > error: ‘O_CLOEXEC’ undeclared (first use in this function) > > The fix is to declare _GNU_SOURCE macro before include fcntl.h. I think you need give a reason how that error comes and why this would fix the error. And if you look at the git history, you might want to define this macro in Makefile. See commit e49680a87e06 ("mk: compilation fixes"). Last, don't forgot to run ./scripts/check-git-log.sh against your patch. --yliu
On 6/26/2016 2:49 PM, Jianfeng Tan wrote: > On some older systems, such as SUSE 11, the compiling error shows > as: > .../dpdk/drivers/net/virtio/virtio_user/virtio_user_dev.c:67:22: > error: ‘O_CLOEXEC’ undeclared (first use in this function) > > The fix is to declare _GNU_SOURCE macro before include fcntl.h. > > Fixes: 37a7eb2ae816 ("net/virtio-user: add device emulation layer") > > Signed-off-by: Jianfeng Tan <jianfeng.tan@intel.com> > --- > drivers/net/virtio/virtio_user/virtio_user_dev.c | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/drivers/net/virtio/virtio_user/virtio_user_dev.c b/drivers/net/virtio/virtio_user/virtio_user_dev.c > index 3d12a32..180f824 100644 > --- a/drivers/net/virtio/virtio_user/virtio_user_dev.c > +++ b/drivers/net/virtio/virtio_user/virtio_user_dev.c > @@ -31,6 +31,7 @@ > * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. > */ > > +#define _GNU_SOURCE This flag enables glibc extensions, and kind of problem on code portability. How big problem is it? Is there any platform that DPDK runs on which uses a libc that isn't compatible with what this flag provides? And it seems this flag already used in DPDK, including libraries. If we are agree on using glibc extensions, does it make sense to move this flag into a single common location (like mk/exec-env/) ? > #include <stdint.h> > #include <stdio.h> > #include <fcntl.h> >
On Tue, Jun 28, 2016 at 10:41:24AM +0100, Ferruh Yigit wrote: > On 6/26/2016 2:49 PM, Jianfeng Tan wrote: > > On some older systems, such as SUSE 11, the compiling error shows > > as: > > .../dpdk/drivers/net/virtio/virtio_user/virtio_user_dev.c:67:22: > > error: ‘O_CLOEXEC’ undeclared (first use in this function) > > > > The fix is to declare _GNU_SOURCE macro before include fcntl.h. > > > > Fixes: 37a7eb2ae816 ("net/virtio-user: add device emulation layer") > > > > Signed-off-by: Jianfeng Tan <jianfeng.tan@intel.com> > > --- > > drivers/net/virtio/virtio_user/virtio_user_dev.c | 1 + > > 1 file changed, 1 insertion(+) > > > > diff --git a/drivers/net/virtio/virtio_user/virtio_user_dev.c b/drivers/net/virtio/virtio_user/virtio_user_dev.c > > index 3d12a32..180f824 100644 > > --- a/drivers/net/virtio/virtio_user/virtio_user_dev.c > > +++ b/drivers/net/virtio/virtio_user/virtio_user_dev.c > > @@ -31,6 +31,7 @@ > > * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. > > */ > > > > +#define _GNU_SOURCE > This flag enables glibc extensions, and kind of problem on code > portability. How big problem is it? Honestly, I don't know. But I was also thinking that define _GNU_SOURCE here is an overkill to me. For this issue, we may simply fix it by reference the O_CLOEXEC flag only when it's defined. > Is there any platform that DPDK runs on which uses a libc that isn't > compatible with what this flag provides? > > And it seems this flag already used in DPDK, including libraries. Yes, "git grep _GNU_SOURCE" shows a lot of such usage. --yliu > If we > are agree on using glibc extensions, does it make sense to move this > flag into a single common location (like mk/exec-env/) ? > > > #include <stdint.h> > > #include <stdio.h> > > #include <fcntl.h> > >
diff --git a/drivers/net/virtio/virtio_user/virtio_user_dev.c b/drivers/net/virtio/virtio_user/virtio_user_dev.c index 3d12a32..180f824 100644 --- a/drivers/net/virtio/virtio_user/virtio_user_dev.c +++ b/drivers/net/virtio/virtio_user/virtio_user_dev.c @@ -31,6 +31,7 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +#define _GNU_SOURCE #include <stdint.h> #include <stdio.h> #include <fcntl.h>