From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 92268 invoked by alias); 18 Mar 2017 00:31:57 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Received: (qmail 92237 invoked by uid 89); 18 Mar 2017 00:31:56 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-24.4 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,RCVD_IN_DNSWL_NONE,SPF_PASS,URIBL_RED autolearn=ham version=3.3.2 spammy=informations X-HELO: relay1.mentorg.com Date: Sat, 18 Mar 2017 00:31:00 -0000 From: Joseph Myers To: Subject: Fix bits/socket.h IOC* namespace issues (bug 21267) Message-ID: User-Agent: Alpine 2.20 (DEB 67 2015-01-07) MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" X-ClientProxiedBy: svr-ies-mbx-01.mgc.mentorg.com (139.181.222.1) To svr-ies-mbx-01.mgc.mentorg.com (139.181.222.1) X-SW-Source: 2017-03/txt/msg00400.txt.bz2 sysdeps/unix/sysv/linux/bits/socket.h includes asm/socket.h. That includes asm/sockios.h, which on MIPS includes asm/ioctl.h, resulting in namespace violations from IOC* macros. bits/socket.h already has code to handle asm/socket.h unconditionally defining macros that are only wanted for __USE_MISC. This patch extends it to handle the IOC* macros as well (always undefining them if not defined when bits/socket.h was included, as I don't think they are part of the intended API even for __USE_MISC). It's possible there should also be a kernel fix - it's not clear to me that IOC* belong in the uapi headers, and even if they do they might best be split out into another header to avoid getting defined by this particular path. But since glibc needs to deal with existing kernel headers, it also seems appropriate to extend the existing workaround to these macros. Tested (compilation only) with build-many-glibcs.py. 2017-03-18 Joseph Myers [BZ #21267] * sysdeps/unix/sysv/linux/bits/socket.h (IOCSIZE_MASK): Undefine if defined by and not previously defined. (IOCSIZE_SHIFT): Likewise. (IOC_IN): Likewise. (IOC_INOUT): Likewise. (IOC_OUT): Likewise. diff --git a/sysdeps/unix/sysv/linux/bits/socket.h b/sysdeps/unix/sysv/linux/bits/socket.h index 0f1b786..6d6d56e 100644 --- a/sysdeps/unix/sysv/linux/bits/socket.h +++ b/sysdeps/unix/sysv/linux/bits/socket.h @@ -365,6 +365,21 @@ struct ucred # define __SYS_SOCKET_H_undef_SIOCSPGRP # endif #endif +#ifndef IOCSIZE_MASK +# define __SYS_SOCKET_H_undef_IOCSIZE_MASK +#endif +#ifndef IOCSIZE_SHIFT +# define __SYS_SOCKET_H_undef_IOCSIZE_SHIFT +#endif +#ifndef IOC_IN +# define __SYS_SOCKET_H_undef_IOC_IN +#endif +#ifndef IOC_INOUT +# define __SYS_SOCKET_H_undef_IOC_INOUT +#endif +#ifndef IOC_OUT +# define __SYS_SOCKET_H_undef_IOC_OUT +#endif /* Get socket manipulation related informations from kernel headers. */ #include @@ -399,6 +414,26 @@ struct ucred # undef SIOCSPGRP # endif #endif +#ifdef __SYS_SOCKET_H_undef_IOCSIZE_MASK +# undef __SYS_SOCKET_H_undef_IOCSIZE_MASK +# undef IOCSIZE_MASK +#endif +#ifdef __SYS_SOCKET_H_undef_IOCSIZE_SHIFT +# undef __SYS_SOCKET_H_undef_IOCSIZE_SHIFT +# undef IOCSIZE_SHIFT +#endif +#ifdef __SYS_SOCKET_H_undef_IOC_IN +# undef __SYS_SOCKET_H_undef_IOC_IN +# undef IOC_IN +#endif +#ifdef __SYS_SOCKET_H_undef_IOC_INOUT +# undef __SYS_SOCKET_H_undef_IOC_INOUT +# undef IOC_INOUT +#endif +#ifdef __SYS_SOCKET_H_undef_IOC_OUT +# undef __SYS_SOCKET_H_undef_IOC_OUT +# undef IOC_OUT +#endif /* Structure used to manipulate the SO_LINGER option. */ struct linger -- Joseph S. Myers joseph@codesourcery.com