From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754110AbdBVC34 (ORCPT ); Tue, 21 Feb 2017 21:29:56 -0500 Received: from vmicros1.altlinux.org ([194.107.17.57]:46516 "EHLO vmicros1.altlinux.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753329AbdBVC3t (ORCPT ); Tue, 21 Feb 2017 21:29:49 -0500 Date: Wed, 22 Feb 2017 05:29:47 +0300 From: "Dmitry V. Levin" To: David Miller Cc: "Carlos O'Donell" , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 2/2] uapi: add a compatibility layer between linux/uio.h and glibc Message-ID: <20170222022946.GC32359@altlinux.org> References: <20170220115841.GA6846@altlinux.org> <20170221.121022.676021611021776681.davem@davemloft.net> <20170221201914.GA28360@altlinux.org> <20170222022259.GA32359@altlinux.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20170222022259.GA32359@altlinux.org> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Do not define struct iovec in linux/uio.h when or is already included and provides these definitions. This fixes the following compilation error when or is included before : /usr/include/linux/uio.h:16:8: error: redefinition of 'struct iovec' Signed-off-by: Dmitry V. Levin --- 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 #include #include +#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