From: "Dmitry V. Levin" <ldv@altlinux.org>
To: David Miller <davem@davemloft.net>
Cc: "Carlos O'Donell" <carlos@redhat.com>,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH 2/2] uapi: add a compatibility layer between linux/uio.h and glibc
Date: Wed, 22 Feb 2017 05:29:47 +0300 [thread overview]
Message-ID: <20170222022946.GC32359@altlinux.org> (raw)
In-Reply-To: <20170222022259.GA32359@altlinux.org>
Do not define struct iovec in linux/uio.h when <sys/uio.h> or <fcntl.h>
is already included and provides these definitions.
This fixes the following compilation error when <sys/uio.h> or <fcntl.h>
is included before <linux/uio.h>:
/usr/include/linux/uio.h:16:8: error: redefinition of 'struct iovec'
Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
---
include/uapi/linux/libc-compat.h | 10 ++++++++++
include/uapi/linux/uio.h | 3 +++
2 files changed, 13 insertions(+)
diff --git a/include/uapi/linux/libc-compat.h b/include/uapi/linux/libc-compat.h
index 481e3b1..9b88586 100644
--- a/include/uapi/linux/libc-compat.h
+++ b/include/uapi/linux/libc-compat.h
@@ -205,6 +205,13 @@
#define __UAPI_DEF_TIMEZONE 1
#endif
+/* Coordinate with glibc bits/uio.h header. */
+#if defined(_SYS_UIO_H) || defined(_FCNTL_H)
+#define __UAPI_DEF_IOVEC 0
+#else
+#define __UAPI_DEF_IOVEC 1
+#endif
+
/* Definitions for xattr.h */
#if defined(_SYS_XATTR_H)
#define __UAPI_DEF_XATTR 0
@@ -261,6 +268,9 @@
#define __UAPI_DEF_TIMEVAL 1
#define __UAPI_DEF_TIMEZONE 1
+/* Definitions for uio.h */
+#define __UAPI_DEF_IOVEC 1
+
/* Definitions for xattr.h */
#define __UAPI_DEF_XATTR 1
diff --git a/include/uapi/linux/uio.h b/include/uapi/linux/uio.h
index 2731d56..e6e12cf 100644
--- a/include/uapi/linux/uio.h
+++ b/include/uapi/linux/uio.h
@@ -9,15 +9,18 @@
#ifndef _UAPI__LINUX_UIO_H
#define _UAPI__LINUX_UIO_H
+#include <linux/libc-compat.h>
#include <linux/compiler.h>
#include <linux/types.h>
+#if __UAPI_DEF_IOVEC
struct iovec
{
void __user *iov_base; /* BSD uses caddr_t (1003.1g requires void *) */
__kernel_size_t iov_len; /* Must be size_t (1003.1g) */
};
+#endif /* __UAPI_DEF_IOVEC */
/*
* UIO_MAXIOV shall be at least 16 1003.1g (5.4.1.1)
--
ldv
next prev parent reply other threads:[~2017-02-22 2:29 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-02-20 11:58 [PATCH] uapi: fix linux/if.h userspace compilation errors Dmitry V. Levin
2017-02-21 17:10 ` David Miller
2017-02-21 20:19 ` Dmitry V. Levin
2017-02-22 2:22 ` Dmitry V. Levin
2017-02-22 2:29 ` [PATCH 1/2] uapi: add a compatibility layer between linux/time.h and glibc Dmitry V. Levin
2017-02-22 2:29 ` Dmitry V. Levin [this message]
2017-02-22 21:09 ` [PATCH] uapi: fix linux/if.h userspace compilation errors David Miller
2017-09-27 16:46 ` [PATCH 2/2] uapi: add a compatibility layer between linux/uio.h and glibc Lee Duncan
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170222022946.GC32359@altlinux.org \
--to=ldv@altlinux.org \
--cc=carlos@redhat.com \
--cc=davem@davemloft.net \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.