Messages in this thread Patch in this message | | | From | Mikko Rapeli <> | Subject | [PATCH v05 67/72] uapi uio.h: glibc sys/uio.h header file compatibility fixes | Date | Mon, 22 Aug 2016 20:33:24 +0200 |
| |
Fixes this userspace compile error when glibc sys/uio.h is included before linux/uio.h:
linux/uio.h:16:8: error: redefinition of ‘struct iovec’
Signed-off-by: Mikko Rapeli <mikko.rapeli@iki.fi> --- include/uapi/linux/libc-compat.h | 10 ++++++++++ include/uapi/linux/uio.h | 4 +++- 2 files changed, 13 insertions(+), 1 deletion(-)
diff --git a/include/uapi/linux/libc-compat.h b/include/uapi/linux/libc-compat.h index 8a5a7cc..f793b09 100644 --- a/include/uapi/linux/libc-compat.h +++ b/include/uapi/linux/libc-compat.h @@ -180,6 +180,13 @@ #endif /* defined(__NETIPX_IPX_H) */ +/* Definitions for sys/uio.h */ +#if defined(_SYS_UIO_H) +#define __UAPI_DEF_IOVEC 0 +#else /* defined(_SYS_UIO_H) */ +#define __UAPI_DEF_IOVEC 1 +#endif /* defined(_SYS_UIO_H) */ + /* Definitions for xattr.h */ #if defined(_SYS_XATTR_H) #define __UAPI_DEF_XATTR 0 @@ -235,6 +242,9 @@ #define __UAPI_DEF_IPX_CONFIG_DATA 1 #define __UAPI_DEF_IPX_ROUTE_DEF 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..cba4819 100644 --- a/include/uapi/linux/uio.h +++ b/include/uapi/linux/uio.h @@ -9,15 +9,17 @@ #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) -- 2.8.1
| |