From patchwork Sun Sep 24 20:23:00 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Samuel Thibault X-Patchwork-Id: 817986 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=sourceware.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=libc-alpha-return-84899-incoming=patchwork.ozlabs.org@sourceware.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.b="Ur0xDyfO"; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3y0dvQ60tRz9t3R for ; Mon, 25 Sep 2017 06:23:14 +1000 (AEST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:cc:subject:date:message-id; q=dns; s= default; b=l0LSveKfpiBONiEy5KJhMCXDICBNVowLPioJJcoBDX4IWyCnYnpSM rZADuW8xYBNbP19cgzx7yC4SOBENQoN/GoizBQ9mvr+qWSMgdOlhNVNtpsh/xK3e CTz/uT70zZV0kNerTmGr+pyQ3IyVWzG7ivTe8AdbmAFC0wLIXp3w9w= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:cc:subject:date:message-id; s=default; bh=Bv/bDr9dFSuLCM/FQEWXBWbMKAs=; b=Ur0xDyfO55Ao4nGKRh27o+77YQC2 g75ZPPgLVWOCxxfvOTqqjtSBHgXV6A5vF3O9uxpvf15eLH+qtcVml+jHEKDjvqmq BnXsJcqUb3wLrdCW9Xy4RFnbUd4MoU/Epsx8XvRzEALCzBER7zJXJW4lkP4rbB7W Up1/CxgILyAyPGY= Received: (qmail 90374 invoked by alias); 24 Sep 2017 20:23:08 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 90362 invoked by uid 89); 24 Sep 2017 20:23:07 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-26.1 required=5.0 tests=BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, SPF_HELO_PASS, SPF_NEUTRAL, URIBL_RED autolearn=ham version=3.3.2 spammy=setsockopt, manipulate, Protocol X-HELO: hera.aquilenet.fr From: Samuel Thibault To: libc-alpha@sourceware.org Cc: Samuel Thibault Subject: [hurd,commited] hurd: Fix bits/socket.h conformity Date: Sun, 24 Sep 2017 22:23:00 +0200 Message-Id: <20170924202300.31052-1-samuel.thibault@ens-lyon.org> * sysdeps/mach/hurd/bits/socket.h: Include instead of (__need_NULL): Do not define. (__ss_aligntype): Use __WORDSIZE instead of ULONG_MAX to determine alignment. [!__USE_MISC] (pseudo_AF_XTP, pseudo_AF_RTIP, pseudo_AF_PIP, CMGROUP_MAX, cmsgcred): Do not define. (CMSG_FIRSTHDR, __cmsg_nxthdr): Use (struct cmsghdr *) 0 instead of NULL. * bits/socket.h: Likewise. --- ChangeLog | 10 ++++++++++ bits/socket.h | 25 ++++++++++++++++--------- sysdeps/mach/hurd/bits/socket.h | 25 ++++++++++++++++--------- 3 files changed, 42 insertions(+), 18 deletions(-) diff --git a/ChangeLog b/ChangeLog index 7336c52c1b..1c44a53c75 100644 --- a/ChangeLog +++ b/ChangeLog @@ -5,6 +5,16 @@ __mmap, __fxstat64, __xstat64, __access, __access_noerrno, __getpid, __getcwd, __sbrk, __strtoul_internal, _exit, abort): Use check_no_hidden to make sure that these symbols are defined. + * sysdeps/mach/hurd/bits/socket.h: Include instead + of + (__need_NULL): Do not define. + (__ss_aligntype): Use __WORDSIZE instead of ULONG_MAX to determine + alignment. + [!__USE_MISC] (pseudo_AF_XTP, pseudo_AF_RTIP, pseudo_AF_PIP, + CMGROUP_MAX, cmsgcred): Do not define. + (CMSG_FIRSTHDR, __cmsg_nxthdr): Use (struct cmsghdr *) 0 instead of + NULL. + * bits/socket.h: Likewise. 2017-09-22 Joseph Myers diff --git a/bits/socket.h b/bits/socket.h index b527f9c129..d70fb6d753 100644 --- a/bits/socket.h +++ b/bits/socket.h @@ -24,10 +24,9 @@ #endif #define __need_size_t -#define __need_NULL #include -#include /* XXX Is this allowed? */ +#include #include /* Type for length arguments in socket calls. */ @@ -127,13 +126,19 @@ enum __socket_type #define AF_APPLETALK PF_APPLETALK #define AF_ROUTE PF_ROUTE #define AF_LINK PF_LINK -#define pseudo_AF_XTP PF_XTP +#ifdef __USE_MISC +# define pseudo_AF_XTP PF_XTP +#endif #define AF_COIP PF_COIP #define AF_CNT PF_CNT -#define pseudo_AF_RTIP PF_RTIP +#ifdef __USE_MISC +# define pseudo_AF_RTIP PF_RTIP +#endif #define AF_IPX PF_IPX #define AF_SIP PF_SIP -#define pseudo_AF_PIP PF_PIP +#ifdef __USE_MISC +# define pseudo_AF_PIP PF_PIP +#endif #define AF_INET6 PF_INET6 #define AF_MAX PF_MAX @@ -153,7 +158,7 @@ struct sockaddr /* Structure large enough to hold any socket address (with the historical exception of AF_UNIX). */ -#if ULONG_MAX > 0xffffffff +#if __WORDSIZE == 64 # define __ss_aligntype __uint64_t #else # define __ss_aligntype __uint32_t @@ -232,7 +237,7 @@ struct cmsghdr #define CMSG_FIRSTHDR(mhdr) \ ((size_t) (mhdr)->msg_controllen >= sizeof (struct cmsghdr) \ - ? (struct cmsghdr *) (mhdr)->msg_control : (struct cmsghdr *) NULL) + ? (struct cmsghdr *) (mhdr)->msg_control : (struct cmsghdr *) 0) #define CMSG_ALIGN(len) (((len) + sizeof (size_t) - 1) \ & (size_t) ~(sizeof (size_t) - 1)) @@ -251,7 +256,7 @@ __NTH (__cmsg_nxthdr (struct msghdr *__mhdr, struct cmsghdr *__cmsg)) { if ((size_t) __cmsg->cmsg_len < sizeof (struct cmsghdr)) /* The kernel header does this so there may be a reason. */ - return NULL; + return (struct cmsghdr *) 0; __cmsg = (struct cmsghdr *) ((unsigned char *) __cmsg + CMSG_ALIGN (__cmsg->cmsg_len)); @@ -260,7 +265,7 @@ __NTH (__cmsg_nxthdr (struct msghdr *__mhdr, struct cmsghdr *__cmsg)) || ((unsigned char *) __cmsg + CMSG_ALIGN (__cmsg->cmsg_len) > ((unsigned char *) __mhdr->msg_control + __mhdr->msg_controllen))) /* No more entries. */ - return NULL; + return (struct cmsghdr *) 0; return __cmsg; } #endif /* Use `extern inline'. */ @@ -276,6 +281,7 @@ enum #define SCM_CREDS SCM_CREDS }; +#ifdef __USE_MISC /* Unfortunately, BSD practice dictates this structure be of fixed size. If there are more than CMGROUP_MAX groups, the list is truncated. (On GNU systems, the `cmcred_euid' field is just the first in the @@ -296,6 +302,7 @@ struct cmsgcred int cmcred_ngroups; __gid_t cmcred_groups[CMGROUP_MAX]; }; +#endif /* Protocol number used to manipulate socket-level options with `getsockopt' and `setsockopt'. */ diff --git a/sysdeps/mach/hurd/bits/socket.h b/sysdeps/mach/hurd/bits/socket.h index 9a412f0833..bac77f54f2 100644 --- a/sysdeps/mach/hurd/bits/socket.h +++ b/sysdeps/mach/hurd/bits/socket.h @@ -25,10 +25,9 @@ #endif #define __need_size_t -#define __need_NULL #include -#include /* XXX Is this allowed? */ +#include #include /* Type for length arguments in socket calls. */ @@ -131,13 +130,19 @@ enum __socket_type #define AF_APPLETALK PF_APPLETALK #define AF_ROUTE PF_ROUTE #define AF_LINK PF_LINK -#define pseudo_AF_XTP PF_XTP +#ifdef __USE_MISC +# define pseudo_AF_XTP PF_XTP +#endif #define AF_COIP PF_COIP #define AF_CNT PF_CNT -#define pseudo_AF_RTIP PF_RTIP +#ifdef __USE_MISC +# define pseudo_AF_RTIP PF_RTIP +#endif #define AF_IPX PF_IPX #define AF_SIP PF_SIP -#define pseudo_AF_PIP PF_PIP +#ifdef __USE_MISC +# define pseudo_AF_PIP PF_PIP +#endif #define AF_INET6 PF_INET6 #define AF_MAX PF_MAX @@ -157,7 +162,7 @@ struct sockaddr /* Structure large enough to hold any socket address (with the historical exception of AF_UNIX). */ -#if ULONG_MAX > 0xffffffff +#if __WORDSIZE == 64 # define __ss_aligntype __uint64_t #else # define __ss_aligntype __uint32_t @@ -236,7 +241,7 @@ struct cmsghdr #define CMSG_FIRSTHDR(mhdr) \ ((size_t) (mhdr)->msg_controllen >= sizeof (struct cmsghdr) \ - ? (struct cmsghdr *) (mhdr)->msg_control : (struct cmsghdr *) NULL) + ? (struct cmsghdr *) (mhdr)->msg_control : (struct cmsghdr *) 0) #define CMSG_ALIGN(len) (((len) + sizeof (size_t) - 1) \ & (size_t) ~(sizeof (size_t) - 1)) @@ -255,7 +260,7 @@ __NTH (__cmsg_nxthdr (struct msghdr *__mhdr, struct cmsghdr *__cmsg)) { if ((size_t) __cmsg->cmsg_len < sizeof (struct cmsghdr)) /* The kernel header does this so there may be a reason. */ - return NULL; + return (struct cmsghdr *) 0; __cmsg = (struct cmsghdr *) ((unsigned char *) __cmsg + CMSG_ALIGN (__cmsg->cmsg_len)); @@ -264,7 +269,7 @@ __NTH (__cmsg_nxthdr (struct msghdr *__mhdr, struct cmsghdr *__cmsg)) || ((unsigned char *) __cmsg + CMSG_ALIGN (__cmsg->cmsg_len) > ((unsigned char *) __mhdr->msg_control + __mhdr->msg_controllen))) /* No more entries. */ - return NULL; + return (struct cmsghdr *) 0; return __cmsg; } #endif /* Use `extern inline'. */ @@ -280,6 +285,7 @@ enum #define SCM_CREDS SCM_CREDS }; +#ifdef __USE_MISC /* Unfortunately, BSD practice dictates this structure be of fixed size. If there are more than CMGROUP_MAX groups, the list is truncated. (On GNU systems, the `cmcred_euid' field is just the first in the @@ -300,6 +306,7 @@ struct cmsgcred int cmcred_ngroups; __gid_t cmcred_groups[CMGROUP_MAX]; }; +#endif /* Protocol number used to manipulate socket-level options with `getsockopt' and `setsockopt'. */