From patchwork Wed Jun 26 17:49:46 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zack Weinberg X-Patchwork-Id: 1122938 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-103162-incoming=patchwork.ozlabs.org@sourceware.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=panix.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.b="dJqkmbNx"; 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 45YrCL2W2Cz9s4V for ; Thu, 27 Jun 2019 03:50:06 +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:in-reply-to :references:mime-version:content-transfer-encoding; q=dns; s= default; b=pnL7a0cSz1REzAGv0m4w/YRl3lgmEXmj0Y+8ik4v5fgT3/y/JaPaE fyaavWiri4vboe5X27NTsNiTpOeas1TOtjFGOlxP/YcOJ9kDtHzbDpncbC33+edo WT+7iPX1XLMrp6OBqCn0fycXPalFebIH2PEtAkfCyBRqCpBRlSDdxg= 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:in-reply-to :references:mime-version:content-transfer-encoding; s=default; bh=zF6OcdVDyrLwVMaOogiwP0frXnM=; b=dJqkmbNxYsDgOmlJUCGcWvmK3Glg VxjnA0SSbLZIggvR+DRiYBFXRTpirVuQFP8JXIkl43r9PPsTFy/CR4Ps5EqXGPqs kXM2ojaSr2A/ppinzpyrvUSdH5N1vQPM6vl8FR83m1XwEa9geuo9p8JLfP/wPm4F DCjIHKikv5ouEjU= Received: (qmail 7363 invoked by alias); 26 Jun 2019 17:49:59 -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 7344 invoked by uid 89); 26 Jun 2019 17:49:59 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-15.6 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, SPF_PASS autolearn=ham version=3.3.1 spammy= X-HELO: mailbackend.panix.com From: Zack Weinberg To: libc-alpha@sourceware.org Cc: joseph@codesourcery.com, carlos@redhat.com Subject: [PATCH 01/25] Move most headers installed by top-level Makefile to misc/. Date: Wed, 26 Jun 2019 13:49:46 -0400 Message-Id: <20190626174954.8009-2-zackw@panix.com> In-Reply-To: <20190626174954.8009-1-zackw@panix.com> References: <20190626174954.8009-1-zackw@panix.com> MIME-Version: 1.0 The Makefile glue to run tests on installed headers is currently duplicated between the top-level Makefile and Rules, because the top-level Makefile doesn't read Rules but does install some headers. This patch moves most of the headers installed by the top-level Makefile to misc/ (chosen arbitrarily; I'm open to putting them somewhere else if reviewers feel it would be better) and removes the duplicated logic from the top-level Makefile. I believe this also means that none of the headers in include/ are installed headers anymore. gnu/lib-names*.h are still generated by code in Makerules and installed by the top-level Makefile. I tried to move them to misc/ as well, but that broke the generation process in a manner that didn't make any sense so I gave up. The tests performed on installed headers are not especially useful for gnu/lib-names*.h so I think we can live with this for now. * include/bits/xopen_lim.h * include/features.h * include/gnu-versions.h * include/gnu/libc-version.h * include/limits.h * include/stdc-predef.h * include/values.h: Move to misc/ and replace with a trivial wrapper. * Makefile (headers): Remove all headers moved to misc/. Don't set a vpath for %.h. (check-installed-headers-c.out, check-installed-headers-cxx.out) (check-wrapper-headers.out): Remove rules. * misc/Makefile (headers): Add all of the above headers and sort the list. * sysdeps/mach/hurd/bits/errno.h: Regenerate. --- Makefile | 38 +-- include/bits/xopen_lim.h | 149 +-------- include/features.h | 478 +-------------------------- include/gnu-versions.h | 53 +-- include/gnu/libc-version.h | 35 +- include/limits.h | 193 +---------- include/stdc-predef.h | 61 +--- include/values.h | 69 +--- misc/Makefile | 31 +- {include => misc}/bits/xopen_lim.h | 0 {include => misc}/features.h | 0 {include => misc}/gnu-versions.h | 0 {include => misc}/gnu/libc-version.h | 0 {include => misc}/limits.h | 0 {include => misc}/stdc-predef.h | 0 {include => misc}/values.h | 0 sysdeps/mach/hurd/bits/errno.h | 1 + 17 files changed, 26 insertions(+), 1082 deletions(-) rewrite include/bits/xopen_lim.h (100%) rewrite include/features.h (100%) rewrite include/gnu-versions.h (100%) rewrite include/gnu/libc-version.h (100%) rewrite include/limits.h (100%) rewrite include/stdc-predef.h (100%) rewrite include/values.h (100%) copy {include => misc}/bits/xopen_lim.h (100%) copy {include => misc}/features.h (100%) copy {include => misc}/gnu-versions.h (100%) copy {include => misc}/gnu/libc-version.h (100%) copy {include => misc}/limits.h (100%) copy {include => misc}/stdc-predef.h (100%) copy {include => misc}/values.h (100%) diff --git a/Makefile b/Makefile index dc5de7aa6b..d34aa8bc97 100644 --- a/Makefile +++ b/Makefile @@ -59,17 +59,11 @@ endif # $(AUTOCONF) = no subdir_objs subdir_stubs subdir_testclean \ $(addprefix install-, no-libc.a bin lib data headers others) -headers := limits.h values.h features.h gnu-versions.h \ - bits/xopen_lim.h gnu/libc-version.h stdc-predef.h \ - bits/libc-header-start.h +headers := echo-headers: subdir_echo-headers -# The headers are in the include directory. -subdir-dirs = include -vpath %.h $(subdir-dirs) - -# What to install. +# This header is created during the install process. See below. install-others = $(inst_includedir)/gnu/stubs.h install-bin-script = @@ -311,34 +305,6 @@ $(objpfx)check-local-headers.out: scripts/check-local-headers.sh "$(includedir)" "$(objpfx)" < /dev/null > $@; \ $(evaluate-test) -ifneq "$(headers)" "" -# Special test of all the installed headers in this directory. -tests-special += $(objpfx)check-installed-headers-c.out -libof-check-installed-headers-c := testsuite -$(objpfx)check-installed-headers-c.out: \ - scripts/check-installed-headers.sh $(headers) - $(SHELL) $(..)scripts/check-installed-headers.sh c \ - "$(CC) $(filter-out -std=%,$(CFLAGS)) -D_ISOMAC $(+includes)" \ - $(headers) > $@; \ - $(evaluate-test) - -ifneq "$(CXX)" "" -tests-special += $(objpfx)check-installed-headers-cxx.out -libof-check-installed-headers-cxx := testsuite -$(objpfx)check-installed-headers-cxx.out: \ - scripts/check-installed-headers.sh $(headers) - $(SHELL) $(..)scripts/check-installed-headers.sh c++ \ - "$(CXX) $(filter-out -std=%,$(CXXFLAGS)) -D_ISOMAC $(+includes)" \ - $(headers) > $@; \ - $(evaluate-test) -endif # $(CXX) - -tests-special += $(objpfx)check-wrapper-headers.out -$(objpfx)check-wrapper-headers.out: scripts/check-wrapper-headers.py $(headers) - $(PYTHON) $< --root=. --subdir=. $(headers) \ - --generated $(common-generated) > $@; $(evaluate-test) -endif # $(headers) - define summarize-tests @egrep -v '^(PASS|XFAIL):' $(objpfx)$1 || true @echo "Summary of test results$2:" diff --git a/include/bits/xopen_lim.h b/include/bits/xopen_lim.h dissimilarity index 100% index b76a94bd14..9c2c1ecf9b 100644 --- a/include/bits/xopen_lim.h +++ b/include/bits/xopen_lim.h @@ -?,? +1 @@ +#include diff --git a/include/features.h b/include/features.h dissimilarity index 100% index e016b3e5c7..504a6848bc 100644 --- a/include/features.h +++ b/include/features.h @@ -?,? +1 @@ +#include diff --git a/include/gnu-versions.h b/include/gnu-versions.h dissimilarity index 100% index 6db552a700..eafc8c842d 100644 --- a/include/gnu-versions.h +++ b/include/gnu-versions.h @@ -?,? +1 @@ +#include diff --git a/include/gnu/libc-version.h b/include/gnu/libc-version.h dissimilarity index 100% index 0e2e91b6e6..745fb5bbd2 100644 --- a/include/gnu/libc-version.h +++ b/include/gnu/libc-version.h @@ -?,? +1 @@ +#include diff --git a/include/limits.h b/include/limits.h dissimilarity index 100% index 08bb5248be..9eb278c69b 100644 --- a/include/limits.h +++ b/include/limits.h @@ -?,? +1 @@ +#include diff --git a/include/stdc-predef.h b/include/stdc-predef.h dissimilarity index 100% index 5cc5eef22f..0a8122ae37 100644 --- a/include/stdc-predef.h +++ b/include/stdc-predef.h @@ -?,? +1 @@ +#include diff --git a/include/values.h b/include/values.h dissimilarity index 100% index ae987a5675..56ad18e803 100644 --- a/include/values.h +++ b/include/values.h @@ -?,? +1 @@ +#include diff --git a/misc/Makefile b/misc/Makefile index 032f28fc38..e6c73896cd 100644 --- a/misc/Makefile +++ b/misc/Makefile @@ -23,21 +23,22 @@ subdir := misc include ../Makeconfig -headers := sys/uio.h bits/uio-ext.h bits/uio_lim.h \ - sys/ioctl.h bits/ioctls.h bits/ioctl-types.h \ - sys/ptrace.h sys/file.h sys/dir.h sys/cdefs.h \ - ar.h a.out.h libgen.h stab.h bits/stab.def sgtty.h \ - ttyent.h paths.h sys/reboot.h \ - sys/mman.h sys/param.h bits/param.h \ - fstab.h mntent.h search.h err.h error.h \ - sys/queue.h sysexits.h syscall.h sys/syscall.h sys/swap.h \ - sys/select.h sys/sysinfo.h \ - regexp.h bits/select.h bits/mman.h sys/xattr.h \ - syslog.h sys/syslog.h \ - bits/syslog.h bits/syslog-ldbl.h bits/syslog-path.h bits/error.h \ - bits/select2.h bits/hwcap.h sys/auxv.h \ - sys/sysmacros.h bits/sysmacros.h bits/types/struct_iovec.h \ - bits/err-ldbl.h bits/error-ldbl.h +headers := \ + a.out.h ar.h err.h error.h features.h fstab.h gnu-versions.h \ + libgen.h limits.h mntent.h paths.h regexp.h search.h sgtty.h \ + stab.h stdc-predef.h syscall.h sysexits.h syslog.h ttyent.h \ + values.h \ + bits/err-ldbl.h bits/error-ldbl.h bits/error.h bits/hwcap.h \ + bits/ioctl-types.h bits/ioctls.h bits/libc-header-start.h \ + bits/mman.h bits/param.h bits/select.h bits/select2.h \ + bits/stab.def bits/syslog-ldbl.h bits/syslog-path.h \ + bits/syslog.h bits/sysmacros.h bits/types/struct_iovec.h \ + bits/uio-ext.h bits/uio_lim.h bits/xopen_lim.h \ + gnu/libc-version.h \ + sys/auxv.h sys/cdefs.h sys/dir.h sys/file.h sys/ioctl.h \ + sys/mman.h sys/param.h sys/ptrace.h sys/queue.h sys/reboot.h \ + sys/select.h sys/swap.h sys/syscall.h sys/sysinfo.h \ + sys/syslog.h sys/sysmacros.h sys/uio.h sys/xattr.h routines := brk sbrk sstk ioctl \ readv writev preadv preadv64 pwritev pwritev64 \ diff --git a/include/bits/xopen_lim.h b/misc/bits/xopen_lim.h similarity index 100% copy from include/bits/xopen_lim.h copy to misc/bits/xopen_lim.h diff --git a/include/features.h b/misc/features.h similarity index 100% copy from include/features.h copy to misc/features.h diff --git a/include/gnu-versions.h b/misc/gnu-versions.h similarity index 100% copy from include/gnu-versions.h copy to misc/gnu-versions.h diff --git a/include/gnu/libc-version.h b/misc/gnu/libc-version.h similarity index 100% copy from include/gnu/libc-version.h copy to misc/gnu/libc-version.h diff --git a/include/limits.h b/misc/limits.h similarity index 100% copy from include/limits.h copy to misc/limits.h diff --git a/include/stdc-predef.h b/misc/stdc-predef.h similarity index 100% copy from include/stdc-predef.h copy to misc/stdc-predef.h diff --git a/include/values.h b/misc/values.h similarity index 100% copy from include/values.h copy to misc/values.h diff --git a/sysdeps/mach/hurd/bits/errno.h b/sysdeps/mach/hurd/bits/errno.h index 8f2fbfd80f..8e8d1cc468 100644 --- a/sysdeps/mach/hurd/bits/errno.h +++ b/sysdeps/mach/hurd/bits/errno.h @@ -1,6 +1,7 @@ /* This file generated by errnos.awk from errno.texi stdc-predef.h + ../misc/stdc-predef.h libc-symbols.h mach/message.h mach/kern_return.h From patchwork Wed Jun 26 17:49:47 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Zack Weinberg X-Patchwork-Id: 1122940 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-103164-incoming=patchwork.ozlabs.org@sourceware.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=panix.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.b="yxg9faLF"; 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 45YrCh5vRjz9s8m for ; Thu, 27 Jun 2019 03:50:24 +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:in-reply-to :references:mime-version:content-type:content-transfer-encoding; q=dns; s=default; b=Sfk0d16L1S8xZmKYcHIgv5/PoljlXvyy3r0E/qPqM+g 87c2qL842dMHGtyIZEkUJHXjzsQVW7pjR1hhcGIf5C/SMxPHsoiqeVDHBLWV68lT TmjMVr0fGuyuk/MHSngp3wALv0JX/TMcUYORFBhCMVTR2/yr03xixnMd8d+DmmoM = 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:in-reply-to :references:mime-version:content-type:content-transfer-encoding; s=default; bh=XuLMAQ/xO3BVgEnCTLpnx+7gtHY=; b=yxg9faLFmCBaVYVlb bLBuaImdDglOL7w2zIytzlH09psS1JvNVgvlAfirPL6Utu6kWnYu7wbCS0PIYrOq QhzMsv+RMg2KMDtucpoc1iJGqHmPHXBGHRPewYUEIqPdaP8z/PUhJYc5TbKkSFt0 9KIFute/tTY0eARbHsqvaRdmOs= Received: (qmail 7402 invoked by alias); 26 Jun 2019 17:49:59 -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 7343 invoked by uid 89); 26 Jun 2019 17:49:59 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-15.8 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, SPF_PASS autolearn=ham version=3.3.1 spammy=2011 X-HELO: mailbackend.panix.com From: Zack Weinberg To: libc-alpha@sourceware.org Cc: joseph@codesourcery.com, carlos@redhat.com Subject: [PATCH 02/25] Define register_t using bits/typesizes.h macros. Date: Wed, 26 Jun 2019 13:49:47 -0400 Message-Id: <20190626174954.8009-3-zackw@panix.com> In-Reply-To: <20190626174954.8009-1-zackw@panix.com> References: <20190626174954.8009-1-zackw@panix.com> MIME-Version: 1.0 Currently register_t is, unlike all other types in sys/types.h, defined using a GCC extension (__attribute__((mode(word)))), falling back to ‘int’ if the extension is unavailable. This is a potential ABI compatibility hazard for people using non-GNU compilers with glibc. It’s also unnecessary; the bits/typesizes.h mechanism can handle all of the existing variation in the definition. In most cases, defining __REGISTER_T_TYPE as __SWORD_TYPE is sufficient. Special handling is necessary for MIPS n32 and x86-64 x32, where __SWORD_TYPE is ‘int’ and the appropriate type for register_t is ‘long long’. Unfortunately, this means we need to create a new bits/typesizes.h variant for linux/mips. This variant is based on the top-level bits/typesizes.h, not linux/generic/bits/typesizes.h, to match the existing MIPS ABIs. Tested using build-many-glibcs. The c++-types test confirms that the physical type of register_t does not change on any supported platform. * posix/sys/types.h: Typedef register_t as __register_t. * posix/bits/types.h: Typedef __register_t using __REGISTER_T_TYPE. * bits/typesizes.h * sysdeps/mach/hurd/bits/typesizes.h * sysdeps/unix/sysv/linux/alpha/bits/typesizes.h * sysdeps/unix/sysv/linux/generic/bits/typesizes.h * sysdeps/unix/sysv/linux/s390/bits/typesizes.h * sysdeps/unix/sysv/linux/sparc/bits/typesizes.h: Define __REGISTER_T_TYPE as __SWORD_TYPE. * sysdeps/unix/sysv/linux/mips/bits/typesizes.h: New file (copied from bits/typesizes.h). Define __REGISTER_T_TYPE as __SWORD_TYPE for o32 and n64 ABIs. Define __REGISTER_T_TYPE as __SQUAD_TYPE for n32. * sysdeps/unix/sysv/linux/x86/bits/typesizes.h: Define __REGISTER_T_TYPE as __SWORD_TYPE for o32 and 64-bit ABIs. Define __REGISTER_T_TYPE as __SQUAD_TYPE for x32. --- bits/typesizes.h | 1 + posix/bits/types.h | 3 +++ posix/sys/types.h | 7 ++----- sysdeps/mach/hurd/bits/typesizes.h | 1 + sysdeps/unix/sysv/linux/alpha/bits/typesizes.h | 1 + sysdeps/unix/sysv/linux/generic/bits/typesizes.h | 1 + .../sysv/linux/{generic => mips}/bits/typesizes.h | 13 +++++++++---- sysdeps/unix/sysv/linux/s390/bits/typesizes.h | 1 + sysdeps/unix/sysv/linux/sparc/bits/typesizes.h | 1 + sysdeps/unix/sysv/linux/x86/bits/typesizes.h | 2 ++ 10 files changed, 22 insertions(+), 9 deletions(-) copy sysdeps/unix/sysv/linux/{generic => mips}/bits/typesizes.h (90%) diff --git a/bits/typesizes.h b/bits/typesizes.h index 41c8924336..4541013361 100644 --- a/bits/typesizes.h +++ b/bits/typesizes.h @@ -60,6 +60,7 @@ #define __SYSCALL_SLONG_TYPE __SLONGWORD_TYPE #define __SYSCALL_ULONG_TYPE __ULONGWORD_TYPE #define __CPU_MASK_TYPE __ULONGWORD_TYPE +#define __REGISTER_T_TYPE __SWORD_TYPE #ifdef __LP64__ /* Tell the libc code that off_t and off64_t are actually the same type diff --git a/posix/bits/types.h b/posix/bits/types.h index cb737caff0..70507ce4bd 100644 --- a/posix/bits/types.h +++ b/posix/bits/types.h @@ -222,6 +222,9 @@ typedef int __sig_atomic_t; __STD_TYPE __TIME64_T_TYPE __time64_t; #endif +/* BSD: Size of a general-purpose integer register. */ +__STD_TYPE __REGISTER_T_TYPE __register_t; + #undef __STD_TYPE #endif /* bits/types.h */ diff --git a/posix/sys/types.h b/posix/sys/types.h index 0e37b1ce6a..1bbd896ad4 100644 --- a/posix/sys/types.h +++ b/posix/sys/types.h @@ -160,11 +160,8 @@ typedef __uint16_t u_int16_t; typedef __uint32_t u_int32_t; typedef __uint64_t u_int64_t; -#if __GNUC_PREREQ (2, 7) -typedef int register_t __attribute__ ((__mode__ (__word__))); -#else -typedef int register_t; -#endif +/* Type of a general-purpose integer register (BSD). */ +typedef __register_t register_t; /* Some code from BIND tests this macro to see if the types above are defined. */ diff --git a/sysdeps/mach/hurd/bits/typesizes.h b/sysdeps/mach/hurd/bits/typesizes.h index 6bd9b43599..94b0afcdaf 100644 --- a/sysdeps/mach/hurd/bits/typesizes.h +++ b/sysdeps/mach/hurd/bits/typesizes.h @@ -60,6 +60,7 @@ #define __SYSCALL_SLONG_TYPE __SLONGWORD_TYPE #define __SYSCALL_ULONG_TYPE __ULONGWORD_TYPE #define __CPU_MASK_TYPE __ULONGWORD_TYPE +#define __REGISTER_T_TYPE __SWORD_TYPE /* Number of descriptors that can fit in an `fd_set'. */ #define __FD_SETSIZE 256 diff --git a/sysdeps/unix/sysv/linux/alpha/bits/typesizes.h b/sysdeps/unix/sysv/linux/alpha/bits/typesizes.h index cde275defd..0485dd1eb7 100644 --- a/sysdeps/unix/sysv/linux/alpha/bits/typesizes.h +++ b/sysdeps/unix/sysv/linux/alpha/bits/typesizes.h @@ -60,6 +60,7 @@ #define __SYSCALL_ULONG_TYPE __ULONGWORD_TYPE #define __CPU_MASK_TYPE __ULONGWORD_TYPE #define __FSWORD_T_TYPE __S32_TYPE +#define __REGISTER_T_TYPE __SWORD_TYPE /* Tell the libc code that off_t and off64_t are actually the same type for all ABI purposes, even if possibly expressed as different base types diff --git a/sysdeps/unix/sysv/linux/generic/bits/typesizes.h b/sysdeps/unix/sysv/linux/generic/bits/typesizes.h index 3ef1281c8a..c738ff50a5 100644 --- a/sysdeps/unix/sysv/linux/generic/bits/typesizes.h +++ b/sysdeps/unix/sysv/linux/generic/bits/typesizes.h @@ -61,6 +61,7 @@ #define __SYSCALL_SLONG_TYPE __SLONGWORD_TYPE #define __SYSCALL_ULONG_TYPE __ULONGWORD_TYPE #define __CPU_MASK_TYPE __ULONGWORD_TYPE +#define __REGISTER_T_TYPE __SWORD_TYPE #ifdef __LP64__ /* Tell the libc code that off_t and off64_t are actually the same type diff --git a/sysdeps/unix/sysv/linux/generic/bits/typesizes.h b/sysdeps/unix/sysv/linux/mips/bits/typesizes.h similarity index 90% copy from sysdeps/unix/sysv/linux/generic/bits/typesizes.h copy to sysdeps/unix/sysv/linux/mips/bits/typesizes.h index 3ef1281c8a..1132670b1c 100644 --- a/sysdeps/unix/sysv/linux/generic/bits/typesizes.h +++ b/sysdeps/unix/sysv/linux/mips/bits/typesizes.h @@ -1,7 +1,6 @@ -/* bits/typesizes.h -- underlying types for *_t. For the generic Linux ABI. +/* bits/typesizes.h -- underlying types for *_t. For the MIPS Linux ABI. Copyright (C) 2011-2019 Free Software Foundation, Inc. This file is part of the GNU C Library. - Contributed by Chris Metcalf , 2011. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public @@ -33,7 +32,7 @@ #define __INO_T_TYPE __ULONGWORD_TYPE #define __INO64_T_TYPE __UQUAD_TYPE #define __MODE_T_TYPE __U32_TYPE -#define __NLINK_T_TYPE __U32_TYPE +#define __NLINK_T_TYPE __UWORD_TYPE #define __OFF_T_TYPE __SLONGWORD_TYPE #define __OFF64_T_TYPE __SQUAD_TYPE #define __PID_T_TYPE __S32_TYPE @@ -55,13 +54,19 @@ #define __KEY_T_TYPE __S32_TYPE #define __CLOCKID_T_TYPE __S32_TYPE #define __TIMER_T_TYPE void * -#define __BLKSIZE_T_TYPE __S32_TYPE +#define __BLKSIZE_T_TYPE __SLONGWORD_TYPE #define __FSID_T_TYPE struct { int __val[2]; } #define __SSIZE_T_TYPE __SWORD_TYPE #define __SYSCALL_SLONG_TYPE __SLONGWORD_TYPE #define __SYSCALL_ULONG_TYPE __ULONGWORD_TYPE #define __CPU_MASK_TYPE __ULONGWORD_TYPE +#if defined _ABIN32 && _MIPS_SIM == _ABIN32 +#define __REGISTER_T_TYPE __SQUAD_TYPE +#else +#define __REGISTER_T_TYPE __SWORD_TYPE +#endif + #ifdef __LP64__ /* Tell the libc code that off_t and off64_t are actually the same type for all ABI purposes, even if possibly expressed as different base types diff --git a/sysdeps/unix/sysv/linux/s390/bits/typesizes.h b/sysdeps/unix/sysv/linux/s390/bits/typesizes.h index e42105700a..c578237817 100644 --- a/sysdeps/unix/sysv/linux/s390/bits/typesizes.h +++ b/sysdeps/unix/sysv/linux/s390/bits/typesizes.h @@ -66,6 +66,7 @@ #define __SYSCALL_SLONG_TYPE __SLONGWORD_TYPE #define __SYSCALL_ULONG_TYPE __ULONGWORD_TYPE #define __CPU_MASK_TYPE __ULONGWORD_TYPE +#define __REGISTER_T_TYPE __SWORD_TYPE #ifdef __s390x__ /* Tell the libc code that off_t and off64_t are actually the same type diff --git a/sysdeps/unix/sysv/linux/sparc/bits/typesizes.h b/sysdeps/unix/sysv/linux/sparc/bits/typesizes.h index 115cc1995b..0db18f4913 100644 --- a/sysdeps/unix/sysv/linux/sparc/bits/typesizes.h +++ b/sysdeps/unix/sysv/linux/sparc/bits/typesizes.h @@ -60,6 +60,7 @@ #define __SYSCALL_SLONG_TYPE __SLONGWORD_TYPE #define __SYSCALL_ULONG_TYPE __ULONGWORD_TYPE #define __CPU_MASK_TYPE __ULONGWORD_TYPE +#define __REGISTER_T_TYPE __SWORD_TYPE #if defined __arch64__ || defined __sparcv9 /* Tell the libc code that off_t and off64_t are actually the same type diff --git a/sysdeps/unix/sysv/linux/x86/bits/typesizes.h b/sysdeps/unix/sysv/linux/x86/bits/typesizes.h index 18d2c63b0a..0a71e30681 100644 --- a/sysdeps/unix/sysv/linux/x86/bits/typesizes.h +++ b/sysdeps/unix/sysv/linux/x86/bits/typesizes.h @@ -30,9 +30,11 @@ #if defined __x86_64__ && defined __ILP32__ # define __SYSCALL_SLONG_TYPE __SQUAD_TYPE # define __SYSCALL_ULONG_TYPE __UQUAD_TYPE +# define __REGISTER_T_TYPE __SQUAD_TYPE #else # define __SYSCALL_SLONG_TYPE __SLONGWORD_TYPE # define __SYSCALL_ULONG_TYPE __ULONGWORD_TYPE +# define __REGISTER_T_TYPE __SWORD_TYPE #endif #define __DEV_T_TYPE __UQUAD_TYPE From patchwork Wed Jun 26 17:49:48 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Zack Weinberg X-Patchwork-Id: 1122939 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-103163-incoming=patchwork.ozlabs.org@sourceware.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=panix.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.b="U/spRkPe"; 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 45YrCX0BXQz9s4V for ; Thu, 27 Jun 2019 03:50:15 +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:in-reply-to :references:mime-version:content-type:content-transfer-encoding; q=dns; s=default; b=AbncYs4WS4hxiCA+rPIqKKPmjl9uFwvR/SMODeC/AgW NU+Fdnjz+lCi0pEe+SuXSaAp17ev/MmYOcWR5CJ/mr93MJ/8FLszAiAAHBELtdIO mPf4NKJq+gEHI5Syi4IJbcOB97G+emHVz635yL9cXD4xw5FBRauVWknIYhCDjUWc = 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:in-reply-to :references:mime-version:content-type:content-transfer-encoding; s=default; bh=sqkeAUDGc1laJIZ2UO5MCj4eY24=; b=U/spRkPe+Qu/CcqYA u+vhab+67KkXtmDrOeCy+g2d8vL6QDJDCLcjdG88iksHDJ+r6rBmmxGLfJs9pO2T mu7QmbecxKHycyVXDE0edy+fAiC4zmq5u8dhbOydQWnmi+fZJ9msnwyZG9xPUUNM MB72ybx1Tn9KnI2Ya+2n4bauWs= Received: (qmail 7370 invoked by alias); 26 Jun 2019 17:49:59 -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 7342 invoked by uid 89); 26 Jun 2019 17:49:59 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-15.6 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, SPF_PASS autolearn=ham version=3.3.1 spammy=dozen, 14318, ushort X-HELO: mailbackend.panix.com From: Zack Weinberg To: libc-alpha@sourceware.org Cc: joseph@codesourcery.com, carlos@redhat.com Subject: [PATCH 03/25] =?utf-8?b?c3lzL3R5cGVzLmg6IERvbuKAmXQgZGVmaW5lIHVf?= =?utf-8?q?intN=5Ft_or_register=5Ft_unless_=5F=5FUSE=5FMISC=2E?= Date: Wed, 26 Jun 2019 13:49:48 -0400 Message-Id: <20190626174954.8009-4-zackw@panix.com> In-Reply-To: <20190626174954.8009-1-zackw@panix.com> References: <20190626174954.8009-1-zackw@panix.com> MIME-Version: 1.0 sys/types.h unconditionally defines u_int8_t, u_int16_t, u_int32_t, u_int64_t, and register_t. These are not part of any standard. The u_intXX_t types are superseded by C99’s uintXX_t types (defined in stdint.h). I’m not aware of a standardized exact equivalent of register_t, but also I’ve never seen anyone use it for anything. I could be persuaded to leave that one alone. sys/types.h also unconditionally defines int8_t, int16_t, int32_t, and int64_t, which are the same as the C99 exact-width signed types in stdint.h. POSIX doesn’t require these to appear in sys/types.h, so in principle they ought to be brought under __USE_MISC also. But, when I tried that it broke about two dozen files just in our own source tree, and POSIX doesn’t *forbid* sys/types.h to define these types, so I think we should leave them alone. * posix/sys/types.h (u_int8_t, u_int16_t, u_int32_t, u_int64_t) (register_t): Move under #ifdef __USE_MISC. Consolidate adjacent #ifdef __USE_MISC blocks. * scripts/check_obsolete_constructs.py: Add register_t to the set of obsolete typedefs that our headers should not use (but sys/types.h may still define). --- NEWS | 8 ++++++++ posix/sys/types.h | 16 ++++++++-------- scripts/check-obsolete-constructs.py | 1 + 3 files changed, 17 insertions(+), 8 deletions(-) diff --git a/NEWS b/NEWS index 8a2fecef47..edf7739293 100644 --- a/NEWS +++ b/NEWS @@ -45,6 +45,14 @@ Deprecated and removed features, and other changes affecting compatibility: * The obsolete and never-implemented XSI STREAMS header files and have been removed. +* The typedefs u_int8_t, u_int16_t, u_int32_t, u_int64_t, and register_t + are no longer defined by in strict conformance modes. + These types were historically provided by on BSD systems, + but are not part of the POSIX specification for that header. Applications + requiring fixed-width unsigned integer types should use the similarly + named uint8_t, uint16_t, etc. from . There is no standardized + replacement for register_t. + * Support for the "inet6" option in /etc/resolv.conf and the RES_USE_INET6 resolver flag (deprecated in glibc 2.25) have been removed. diff --git a/posix/sys/types.h b/posix/sys/types.h index 1bbd896ad4..7327904346 100644 --- a/posix/sys/types.h +++ b/posix/sys/types.h @@ -143,18 +143,20 @@ typedef __suseconds_t suseconds_t; #define __need_size_t #include +/* POSIX does not require intN_t to be defined in this header, so + technically this ought to be under __USE_MISC, but it doesn't + forbid them to be defined here either, and much existing code + expects them to be defined here. */ +#include + #ifdef __USE_MISC /* Old compatibility names for C types. */ typedef unsigned long int ulong; typedef unsigned short int ushort; typedef unsigned int uint; -#endif -/* These size-specific names are used by some of the inet code. */ - -#include - -/* These were defined by ISO C without the first `_'. */ +/* These size-specific names are used by some of the inet code. + They were defined by ISO C without the first `_'. */ typedef __uint8_t u_int8_t; typedef __uint16_t u_int16_t; typedef __uint32_t u_int32_t; @@ -167,8 +169,6 @@ typedef __register_t register_t; defined. */ #define __BIT_TYPES_DEFINED__ 1 - -#ifdef __USE_MISC /* In BSD is expected to define BYTE_ORDER. */ # include diff --git a/scripts/check-obsolete-constructs.py b/scripts/check-obsolete-constructs.py index 89d21dea6e..4dc52761c5 100755 --- a/scripts/check-obsolete-constructs.py +++ b/scripts/check-obsolete-constructs.py @@ -254,6 +254,7 @@ class NoCheck(ConstructChecker): OBSOLETE_TYPE_RE_ = re.compile(r"""\A (__)? ( quad_t + | register_t | u(?: short | int | long | _(?: char | short | int(?:[0-9]+_t)? | long | quad_t ))) \Z""", re.VERBOSE) From patchwork Wed Jun 26 17:49:49 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Zack Weinberg X-Patchwork-Id: 1122945 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-103169-incoming=patchwork.ozlabs.org@sourceware.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=panix.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.b="kydj9qi8"; 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 45YrDt72Y5z9sCJ for ; Thu, 27 Jun 2019 03:51:26 +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:in-reply-to :references:mime-version:content-type:content-transfer-encoding; q=dns; s=default; b=ZU7nPij19wJhCX5F8H3rQTZp93vg0VX8fH3B9n1CPpH piTz2DkwPAjjkAWDhIEqoqij9xTJMaWcofgGKpIF2JUMqr5mmXB4J0tY9BKrtULD 3uVBexk21sDkxzXtmktPD75nznR2q6y08Tg/1l0aXYuBsdor3CAIqcRr0UNsaytk = 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:in-reply-to :references:mime-version:content-type:content-transfer-encoding; s=default; bh=aFPjmdIFx6cDESIqcITCfIXkv90=; b=kydj9qi8KcsxLUrEx q7aeRJUhqXgnj18OC3SUflBTc3oCo5T4pS+UUU0/3uRao+7T9LfDzVsIaxMkR5L3 NnsCoMOFfSWALqZQmv0pAH4PVQUJoU9wsvYdTF+1W8bmSJBpjtOHjN9CnbWBw9jm o3hXX2V8FSrRVRP4pwfjGlQWo8= Received: (qmail 9656 invoked by alias); 26 Jun 2019 17:50:17 -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 9519 invoked by uid 89); 26 Jun 2019 17:50:16 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-16.1 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, SPF_HELO_PASS, SPF_PASS autolearn=ham version=3.3.1 spammy=catalog, transmit, REPLY, tape X-HELO: l2mail1.panix.com From: Zack Weinberg To: libc-alpha@sourceware.org Cc: joseph@codesourcery.com, carlos@redhat.com Subject: [PATCH 04/25] Add caddr_t, daddr_t, and loff_t to the set of obsolete typedefs. Date: Wed, 26 Jun 2019 13:49:49 -0400 Message-Id: <20190626174954.8009-5-zackw@panix.com> In-Reply-To: <20190626174954.8009-1-zackw@panix.com> References: <20190626174954.8009-1-zackw@panix.com> MIME-Version: 1.0 caddr_t is a BSD-derived alias for ‘char *’, obsoleted by the introduction of ‘void *’ in C89 (!) daddr_t is a “disk address,” but it’s always defined as ‘int’, making it too small for modern disks and tapes. loff_t is another name for off64_t, from early drafts of LFS. All three are already only exposed by sys/types.h under __USE_MISC. This patch adds them to the set of types that shall not be used in installed headers (enforced by check-obsolete-constructs.py) and expunges all remaining uses, internally as well as in installed headers. Since __DADDR_T_TYPE is always defined as __S32_TYPE, and daddr_t is obsolete so there’s no need to worry about future variation, the patch also removes __DADDR_T_TYPE from the set of macros that bits/typesizes.h is required to define. Instead bits/types.h always defines __daddr_t as __S32_TYPE, and the definition is moved to a more logical location within the file, next to __caddr_t. It’s always safe to change (__)loff_t to the matching (__)off64_t; in a few internal files, I removed an unnecessary __ prefix. daddr_t is only used for struct ustat, which is obsoleted by struct statvfs and we already don’t declare it in public headers, and for an ioctl parameter block in sys/mtio.h (which may or may not be obsolete, I can’t tell). In sys/mtio.h I replaced both uses with ‘int’ to match the use of bare ‘long int’ for most of the other fields of that structure. In misc/ustat.c, the definition of struct ustat is not actually necessary so I removed it entirely. In sysdeps/unix/sysv/linux/ustat.c a definition is necessary but only because INLINE_SYSCALL_CALL doesn’t work (on at least x86) when an argument is a pointer to an incomplete type, so I substituted a dummy definition. Most of the internal uses of caddr_t are in the sunrpc and nis directories, and since most of that code is obsolete, I mechanically replaced them with char * rather than consider whether void * might make more sense. Because “const caddr_t foo” is semantically different from “const char *foo” (in the first case ‘foo’ itself is const but the memory pointed to isn’t, in the second case the memory pointed to is const but ‘foo’ isn’t) this change exposed some const-correctness errors in sunrpc, which I fixed minimally. Outside of sunrpc and nis, I put a little more thought into whether uses of caddr_t should be void * instead. * scripts/check-obsolete-constructs.py: Add caddr_t, daddr_t, and loff_t to the set of obsolete types forbidden in public headers. * posix/bits/types.h: Unconditionally define __daddr_t as __S32_TYPE. Move definition of __daddr_t next to definition of __caddr_t. * bits/typesizes.h * sysdeps/mach/hurd/bits/typesizes.h * sysdeps/unix/sysv/linux/alpha/bits/typesizes.h * sysdeps/unix/sysv/linux/generic/bits/typesizes.h * sysdeps/unix/sysv/linux/mips/bits/typesizes.h * sysdeps/unix/sysv/linux/s390/bits/typesizes.h * sysdeps/unix/sysv/linux/sparc/bits/typesizes.h * sysdeps/unix/sysv/linux/x86/bits/typesizes.h: Don’t define __DADDR_T_TYPE. * sysdeps/gnu/sys/mtio.h (struct mtget): Change all uses of __daddr_t to int. * misc/ustat.c: Remove definition of struct ustat; only forward-declare it. * sysdeps/unix/sysv/linux/ustat.c: Replace fields of struct ustat with a size-preserving dummy field. * hurd/Makefile (migheaderpipe): Rewrite loff_t as __off64_t. * hurd/fd-read.c (_hurd_fd_read): Use off64_t instead of loff_t. * hurd/fd-write.c (hurd_fd_write): Use off64_t instead of loff_t. * hurd/hurd/fd.h (_hurd_fd_read, _hurd_fd_write): Declare using __off64_t instead of __loff_t. * support/xunistd.h (xcopy_file_range): Declare using off64_t instead of loff_t. * sysdeps/unix/sysv/linux/generic/wordsize-32/overflow.h * sysdeps/unix/sysv/linux/lseek.c * sysdeps/unix/sysv/linux/lseek64.c * sysdeps/unix/sysv/linux/splice.c Throughout, use off64_t instead of loff_t. * sysdeps/unix/sysv/linux/sys/quota.h (dqoff): Use __off64_t instead of __loff_t. (quotactl): Declare using char * instead of caddr_t. * sysdeps/unix/sysv/linux/test-errno-linux.c (do_test): Cast to char * instead of caddr_t when calling quotactl. * elf/dl-map-segments.h (_dl_map_segments): Cast to void * instead of caddr_t when calling __mprotect and __mmap. * elf/dl-minimal.c (malloc): Declare page as char *, not caddr_t. * elf/dl-reloc.c (_dl_relocate_object): Declare textrels.start as char *, not caddr_t. Cast to char *, not caddr_t, in pointer arithmetic. * intl/loadmsgcat.c: Remove two unnecessary casts to caddr_t when calling munmap. Change a third cast to target void * instead and add a comment explaining why this one is necessary. * locale/loadlocale.c (_nl_load_locale): Use NULL instead of `(caddr_t)0`, and remove an unnecessary cast to caddr_t when calling munmap. (_nl_unload_locale): Change casts when calling free and munmap to target char *, and add a comment explaining why they are necessary. * sysdeps/gnu/net/if.h (struct ifreq): Declare ifru_data as char *, not __caddr_t. (struct ifconf): Declare ifcu_buf as char *, not __caddr_t. * nis/nis_add.c * nis/nis_call.c * nis/nis_callback.c * nis/nis_checkpoint.c * nis/nis_findserv.c * nis/nis_intern.h * nis/nis_lookup.c * nis/nis_mkdir.c * nis/nis_modify.c * nis/nis_ping.c * nis/nis_remove.c * nis/nis_rmdir.c * nis/nis_server.c * nis/nis_table.c * nis/nis_util.c * nis/nss_nisplus/nisplus-grp.c * nis/nss_nisplus/nisplus-pwd.c * nis/rpcsvc/nis_callback.h * nis/rpcsvc/yp.h * nis/ypclnt.c * sunrpc/auth_des.c * sunrpc/auth_unix.c * sunrpc/authdes_prot.c * sunrpc/authuxprot.c * sunrpc/clnt_raw.c * sunrpc/clnt_tcp.c * sunrpc/clnt_udp.c * sunrpc/clnt_unix.c * sunrpc/key_call.c * sunrpc/pm_getmaps.c * sunrpc/pm_getport.c * sunrpc/pmap_clnt.c * sunrpc/pmap_prot2.c * sunrpc/pmap_rmt.c * sunrpc/proto.h * sunrpc/rpc/auth.h * sunrpc/rpc/clnt.h * sunrpc/rpc/pmap_clnt.h * sunrpc/rpc/pmap_rmt.h * sunrpc/rpc/rpc_msg.h * sunrpc/rpc/svc.h * sunrpc/rpc/xdr.h * sunrpc/rpc_clntout.c * sunrpc/rpc_cmsg.c * sunrpc/rpc_hout.c * sunrpc/rpc_prot.c * sunrpc/rpc_sample.c * sunrpc/rpc_svcout.c * sunrpc/svc.c * sunrpc/svc_authux.c * sunrpc/svc_raw.c * sunrpc/svc_tcp.c * sunrpc/svc_udp.c * sunrpc/svc_unix.c * sunrpc/xdr.c * sunrpc/xdr_array.c * sunrpc/xdr_mem.c * sunrpc/xdr_rec.c * sunrpc/xdr_ref.c * sunrpc/xdr_sizeof.c * sunrpc/xdr_stdio.c: Mechanically replace all uses of caddr_t with char *. * sunrpc/xdr_mem.c (xdrmem_create): Cast away const when setting xdrs->x_private and xdrs->x_base. * sunrpc/xdr_stdio.c (xdrstdio_getbytes): Correct argument types in definition to match prototype. --- bits/typesizes.h | 1 - elf/dl-map-segments.h | 15 +++--- elf/dl-minimal.c | 2 +- elf/dl-reloc.c | 4 +- hurd/Makefile | 2 +- hurd/fd-read.c | 2 +- hurd/fd-write.c | 2 +- hurd/hurd/fd.h | 6 ++- intl/loadmsgcat.c | 7 +-- locale/loadlocale.c | 11 +++-- misc/ustat.c | 8 +--- nis/nis_add.c | 4 +- nis/nis_call.c | 10 ++-- nis/nis_callback.c | 12 ++--- nis/nis_checkpoint.c | 4 +- nis/nis_findserv.c | 8 ++-- nis/nis_intern.h | 12 ++--- nis/nis_lookup.c | 4 +- nis/nis_mkdir.c | 8 ++-- nis/nis_modify.c | 4 +- nis/nis_ping.c | 4 +- nis/nis_remove.c | 4 +- nis/nis_rmdir.c | 4 +- nis/nis_server.c | 8 ++-- nis/nis_table.c | 28 +++++------ nis/nis_util.c | 4 +- nis/nss_nisplus/nisplus-grp.c | 8 ++-- nis/nss_nisplus/nisplus-pwd.c | 8 ++-- nis/rpcsvc/nis_callback.h | 2 +- nis/rpcsvc/yp.h | 6 +-- nis/ypclnt.c | 42 ++++++++--------- posix/bits/types.h | 4 +- scripts/check-obsolete-constructs.py | 7 ++- sunrpc/auth_des.c | 2 +- sunrpc/auth_unix.c | 4 +- sunrpc/authdes_prot.c | 10 ++-- sunrpc/authuxprot.c | 2 +- sunrpc/clnt_raw.c | 12 ++--- sunrpc/clnt_tcp.c | 28 +++++------ sunrpc/clnt_udp.c | 22 ++++----- sunrpc/clnt_unix.c | 26 +++++------ sunrpc/key_call.c | 2 +- sunrpc/pm_getmaps.c | 2 +- sunrpc/pm_getport.c | 4 +- sunrpc/pmap_clnt.c | 4 +- sunrpc/pmap_prot2.c | 2 +- sunrpc/pmap_rmt.c | 16 +++---- sunrpc/proto.h | 2 +- sunrpc/rpc/auth.h | 4 +- sunrpc/rpc/clnt.h | 16 +++---- sunrpc/rpc/pmap_clnt.h | 12 ++--- sunrpc/rpc/pmap_rmt.h | 4 +- sunrpc/rpc/rpc_msg.h | 2 +- sunrpc/rpc/svc.h | 14 +++--- sunrpc/rpc/xdr.h | 22 ++++----- sunrpc/rpc_clntout.c | 8 ++-- sunrpc/rpc_cmsg.c | 12 ++--- sunrpc/rpc_hout.c | 2 +- sunrpc/rpc_prot.c | 4 +- sunrpc/rpc_sample.c | 4 +- sunrpc/rpc_svcout.c | 6 +-- sunrpc/svc.c | 2 +- sunrpc/svc_authux.c | 2 +- sunrpc/svc_raw.c | 8 ++-- sunrpc/svc_tcp.c | 24 +++++----- sunrpc/svc_udp.c | 14 +++--- sunrpc/svc_unix.c | 28 +++++------ sunrpc/xdr.c | 4 +- sunrpc/xdr_array.c | 4 +- sunrpc/xdr_mem.c | 12 ++--- sunrpc/xdr_rec.c | 46 +++++++++---------- sunrpc/xdr_ref.c | 6 +-- sunrpc/xdr_sizeof.c | 8 ++-- sunrpc/xdr_stdio.c | 14 +++--- support/xunistd.h | 4 +- sysdeps/gnu/net/if.h | 4 +- sysdeps/gnu/sys/mtio.h | 4 +- sysdeps/mach/hurd/bits/typesizes.h | 1 - .../unix/sysv/linux/alpha/bits/typesizes.h | 1 - .../unix/sysv/linux/generic/bits/typesizes.h | 1 - .../sysv/linux/generic/wordsize-32/overflow.h | 2 +- sysdeps/unix/sysv/linux/lseek.c | 4 +- sysdeps/unix/sysv/linux/lseek64.c | 2 +- sysdeps/unix/sysv/linux/mips/bits/typesizes.h | 1 - sysdeps/unix/sysv/linux/s390/bits/typesizes.h | 1 - .../unix/sysv/linux/sparc/bits/typesizes.h | 1 - sysdeps/unix/sysv/linux/splice.c | 2 +- sysdeps/unix/sysv/linux/sys/quota.h | 4 +- sysdeps/unix/sysv/linux/test-errno-linux.c | 2 +- sysdeps/unix/sysv/linux/ustat.c | 9 ++-- sysdeps/unix/sysv/linux/x86/bits/typesizes.h | 1 - 91 files changed, 357 insertions(+), 362 deletions(-) diff --git a/bits/typesizes.h b/bits/typesizes.h index 4541013361..a7291465ca 100644 --- a/bits/typesizes.h +++ b/bits/typesizes.h @@ -50,7 +50,6 @@ #define __TIME_T_TYPE __SLONGWORD_TYPE #define __USECONDS_T_TYPE __U32_TYPE #define __SUSECONDS_T_TYPE __SLONGWORD_TYPE -#define __DADDR_T_TYPE __S32_TYPE #define __KEY_T_TYPE __S32_TYPE #define __CLOCKID_T_TYPE __S32_TYPE #define __TIMER_T_TYPE void * diff --git a/elf/dl-map-segments.h b/elf/dl-map-segments.h index a41f0667f0..c981e882f0 100644 --- a/elf/dl-map-segments.h +++ b/elf/dl-map-segments.h @@ -71,7 +71,7 @@ _dl_map_segments (struct link_map *l, int fd, handle the portion of the segment past the end of the file mapping. */ if (__glibc_unlikely - (__mprotect ((caddr_t) (l->l_addr + c->mapend), + (__mprotect ((void *) (l->l_addr + c->mapend), loadcmds[nloadcmds - 1].mapstart - c->mapend, PROT_NONE) < 0)) return DL_MAP_SEGMENTS_ERROR_MPROTECT; @@ -123,22 +123,21 @@ _dl_map_segments (struct link_map *l, int fd, if (__glibc_unlikely ((c->prot & PROT_WRITE) == 0)) { /* Dag nab it. */ - if (__mprotect ((caddr_t) (zero - & ~(GLRO(dl_pagesize) - 1)), - GLRO(dl_pagesize), c->prot|PROT_WRITE) < 0) - return DL_MAP_SEGMENTS_ERROR_MPROTECT; + if (__mprotect ((void *) (zero & ~(GLRO(dl_pagesize) - 1)), + GLRO(dl_pagesize), c->prot|PROT_WRITE) < 0) + return DL_MAP_SEGMENTS_ERROR_MPROTECT; } memset ((void *) zero, '\0', zeropage - zero); if (__glibc_unlikely ((c->prot & PROT_WRITE) == 0)) - __mprotect ((caddr_t) (zero & ~(GLRO(dl_pagesize) - 1)), + __mprotect ((void *) (zero & ~(GLRO(dl_pagesize) - 1)), GLRO(dl_pagesize), c->prot); } if (zeroend > zeropage) { /* Map the remaining zero pages in from the zero fill FD. */ - caddr_t mapat; - mapat = __mmap ((caddr_t) zeropage, zeroend - zeropage, + char *mapat; + mapat = __mmap ((void *) zeropage, zeroend - zeropage, c->prot, MAP_ANON|MAP_PRIVATE|MAP_FIXED, -1, 0); if (__glibc_unlikely (mapat == MAP_FAILED)) diff --git a/elf/dl-minimal.c b/elf/dl-minimal.c index fdb1341832..78d992180a 100644 --- a/elf/dl-minimal.c +++ b/elf/dl-minimal.c @@ -65,7 +65,7 @@ malloc (size_t n) { /* Insufficient space left; allocate another page plus one extra page to reduce number of mmap calls. */ - caddr_t page; + char *page; size_t nup = (n + GLRO(dl_pagesize) - 1) & ~(GLRO(dl_pagesize) - 1); if (__glibc_unlikely (nup == 0 && n != 0)) return NULL; diff --git a/elf/dl-reloc.c b/elf/dl-reloc.c index e7fb8da276..fb99599b09 100644 --- a/elf/dl-reloc.c +++ b/elf/dl-reloc.c @@ -148,7 +148,7 @@ _dl_relocate_object (struct link_map *l, struct r_scope_elem *scope[], { struct textrels { - caddr_t start; + char *start; size_t len; int prot; struct textrels *next; @@ -198,7 +198,7 @@ _dl_relocate_object (struct link_map *l, struct r_scope_elem *scope[], newp->len = ALIGN_UP (ph->p_vaddr + ph->p_memsz, GLRO(dl_pagesize)) - ALIGN_DOWN (ph->p_vaddr, GLRO(dl_pagesize)); newp->start = PTR_ALIGN_DOWN (ph->p_vaddr, GLRO(dl_pagesize)) - + (caddr_t) l->l_addr; + + (char *) l->l_addr; newp->prot = 0; if (ph->p_flags & PF_R) diff --git a/hurd/Makefile b/hurd/Makefile index 99d33f9562..686e154f71 100644 --- a/hurd/Makefile +++ b/hurd/Makefile @@ -89,7 +89,7 @@ CFLAGS-hurdstartup.o = $(no-stack-protector) CFLAGS-RPC_exec_startup_get_info.o = $(no-stack-protector) # Make generated headers compatible with all support standards -migheaderpipe := | sed -e 's/\/__ino64_t/' -e 's/\/__loff_t/' +migheaderpipe := | sed -e 's/\/__ino64_t/' -e 's/\/__off64_t/' include ../mach/Machrules include ../Rules diff --git a/hurd/fd-read.c b/hurd/fd-read.c index 594b14003b..f07814a775 100644 --- a/hurd/fd-read.c +++ b/hurd/fd-read.c @@ -22,7 +22,7 @@ #include error_t -_hurd_fd_read (struct hurd_fd *fd, void *buf, size_t *nbytes, loff_t offset) +_hurd_fd_read (struct hurd_fd *fd, void *buf, size_t *nbytes, off64_t offset) { error_t err; char *data; diff --git a/hurd/fd-write.c b/hurd/fd-write.c index b2589245b1..e485f69758 100644 --- a/hurd/fd-write.c +++ b/hurd/fd-write.c @@ -23,7 +23,7 @@ error_t _hurd_fd_write (struct hurd_fd *fd, - const void *buf, size_t *nbytes, loff_t offset) + const void *buf, size_t *nbytes, off64_t offset) { error_t err; mach_msg_type_number_t wrote; diff --git a/hurd/hurd/fd.h b/hurd/hurd/fd.h index 779ea4fc9d..1e324057aa 100644 --- a/hurd/hurd/fd.h +++ b/hurd/hurd/fd.h @@ -255,9 +255,11 @@ extern error_t _hurd_fd_close (struct hurd_fd *fd); If successful, stores the amount actually read or written in *NBYTES. */ extern error_t _hurd_fd_read (struct hurd_fd *fd, - void *buf, size_t *nbytes, __loff_t offset); + void *buf, size_t *nbytes, + __off64_t offset); extern error_t _hurd_fd_write (struct hurd_fd *fd, - const void *buf, size_t *nbytes, __loff_t offset); + const void *buf, size_t *nbytes, + __off64_t offset); /* Call *RPC on PORT and/or CTTY; if a call on CTTY returns EBACKGROUND, diff --git a/intl/loadmsgcat.c b/intl/loadmsgcat.c index 5f32290331..179a575065 100644 --- a/intl/loadmsgcat.c +++ b/intl/loadmsgcat.c @@ -871,7 +871,7 @@ _nl_load_domain (struct loaded_l10nfile *domain_file, /* The magic number is wrong: not a message catalog file. */ #ifdef HAVE_MMAP if (use_mmap) - munmap ((caddr_t) data, size); + munmap (data, size); else #endif free (data); @@ -1237,7 +1237,7 @@ _nl_load_domain (struct loaded_l10nfile *domain_file, free (domain->malloced); #ifdef HAVE_MMAP if (use_mmap) - munmap ((caddr_t) data, size); + munmap (data, size); else #endif free (data); @@ -1307,9 +1307,10 @@ _nl_unload_domain (struct loaded_domain *domain) free (domain->malloced); + /* Casts below are necessary because domain->data is const. */ # ifdef _POSIX_MAPPED_FILES if (domain->use_mmap) - munmap ((caddr_t) domain->data, domain->mmap_size); + munmap ((void *) domain->data, domain->mmap_size); else # endif /* _POSIX_MAPPED_FILES */ free ((void *) domain->data); diff --git a/locale/loadlocale.c b/locale/loadlocale.c index 571c94e1de..93b39d73ad 100644 --- a/locale/loadlocale.c +++ b/locale/loadlocale.c @@ -222,8 +222,7 @@ _nl_load_locale (struct loaded_l10nfile *file, int category) /* Some systems do not have this flag; it is superfluous. */ # define MAP_FILE 0 # endif - filedata = __mmap ((caddr_t) 0, st.st_size, - PROT_READ, MAP_FILE|MAP_COPY, fd, 0); + filedata = __mmap (NULL, st.st_size, PROT_READ, MAP_FILE|MAP_COPY, fd, 0); if (__glibc_unlikely (filedata == MAP_FAILED)) { filedata = NULL; @@ -271,7 +270,7 @@ _nl_load_locale (struct loaded_l10nfile *file, int category) { #ifdef _POSIX_MAPPED_FILES if (alloc == ld_mapped) - __munmap ((caddr_t) filedata, st.st_size); + __munmap (filedata, st.st_size); #endif return; } @@ -289,14 +288,16 @@ _nl_unload_locale (struct __locale_data *locale) if (locale->private.cleanup) (*locale->private.cleanup) (locale); + /* The casts below are necessary because locale->name and + locale->filedata are const. */ switch (__builtin_expect (locale->alloc, ld_mapped)) { case ld_malloced: - free ((void *) locale->filedata); + free ((char *) locale->filedata); break; case ld_mapped: #ifdef _POSIX_MAPPED_FILES - __munmap ((caddr_t) locale->filedata, locale->filesize); + __munmap ((char *) locale->filedata, locale->filesize); break; #endif case ld_archive: /* Nothing to do. */ diff --git a/misc/ustat.c b/misc/ustat.c index 7336ea9318..b22adb1184 100644 --- a/misc/ustat.c +++ b/misc/ustat.c @@ -24,13 +24,7 @@ # include # include -struct ustat - { - __daddr_t f_tfree; /* Number of free blocks. */ - __ino_t f_tinode; /* Number of free inodes. */ - char f_fname[6]; - char f_fpack[6]; -}; +struct ustat; int __old_ustat (dev_t dev, struct ustat *ust) diff --git a/nis/nis_add.c b/nis/nis_add.c index ad91ac1f79..15734d5bdd 100644 --- a/nis/nis_add.c +++ b/nis/nis_add.c @@ -63,8 +63,8 @@ nis_add (const_nis_name name, const nis_object *obj2) status = __do_niscall (req.ns_object.ns_object_val[0].zo_domain, NIS_ADD, (xdrproc_t) _xdr_ns_request, - (caddr_t) &req, (xdrproc_t) _xdr_nis_result, - (caddr_t) res, MASTER_ONLY, NULL); + (char *) &req, (xdrproc_t) _xdr_nis_result, + (char *) res, MASTER_ONLY, NULL); if (status != NIS_SUCCESS) NIS_RES_STATUS (res) = status; diff --git a/nis/nis_call.c b/nis/nis_call.c index a48ecc39a8..50c51255af 100644 --- a/nis/nis_call.c +++ b/nis/nis_call.c @@ -217,7 +217,7 @@ __nisbind_connect (dir_binding *dbp) if (dbp->clnt == NULL) return NIS_RPCERROR; - clnt_control (dbp->clnt, CLSET_TIMEOUT, (caddr_t) &RPCTIMEOUT); + clnt_control (dbp->clnt, CLSET_TIMEOUT, (char *) &RPCTIMEOUT); /* If the program exists, close the socket */ if (fcntl (dbp->socket, F_SETFD, 1) == -1) perror ("fcntl: F_SETFD"); @@ -296,8 +296,8 @@ libnsl_hidden_nolink_def (__nisbind_create, GLIBC_2_1) /* __nisbind_connect (dbp) must be run before calling this function ! So we could use the same binding twice */ nis_error -__do_niscall3 (dir_binding *dbp, u_long prog, xdrproc_t xargs, caddr_t req, - xdrproc_t xres, caddr_t resp, unsigned int flags, nis_cb *cb) +__do_niscall3 (dir_binding *dbp, u_long prog, xdrproc_t xargs, char *req, + xdrproc_t xres, char *resp, unsigned int flags, nis_cb *cb) { enum clnt_stat result; nis_error retcode; @@ -381,7 +381,7 @@ libnsl_hidden_nolink_def (__do_niscall3, GLIBC_PRIVATE) nis_error __do_niscall2 (const nis_server *server, u_int server_len, u_long prog, - xdrproc_t xargs, caddr_t req, xdrproc_t xres, caddr_t resp, + xdrproc_t xargs, char *req, xdrproc_t xres, char *resp, unsigned int flags, nis_cb *cb) { dir_binding dbp; @@ -823,7 +823,7 @@ libnsl_hidden_nolink_def (__prepare_niscall, GLIBC_PRIVATE) nis_error __do_niscall (const_nis_name name, u_long prog, xdrproc_t xargs, - caddr_t req, xdrproc_t xres, caddr_t resp, unsigned int flags, + char *req, xdrproc_t xres, char *resp, unsigned int flags, nis_cb *cb) { dir_binding bptr; diff --git a/nis/nis_callback.c b/nis/nis_callback.c index 0a78b1c41e..58afea804b 100644 --- a/nis/nis_callback.c +++ b/nis/nis_callback.c @@ -121,7 +121,7 @@ cb_prog_1 (struct svc_req *rqstp, SVCXPRT *transp) xdr_argument = (xdrproc_t) xdr_cback_data; xdr_result = (xdrproc_t) xdr_bool; memset (&argument, 0, sizeof (argument)); - if (!svc_getargs (transp, xdr_argument, (caddr_t) & argument)) + if (!svc_getargs (transp, xdr_argument, (char *) & argument)) { svcerr_decode (transp); return; @@ -153,7 +153,7 @@ cb_prog_1 (struct svc_req *rqstp, SVCXPRT *transp) xdr_argument = (xdrproc_t) xdr_void; xdr_result = (xdrproc_t) xdr_void; memset (&argument, 0, sizeof (argument)); - if (!svc_getargs (transp, xdr_argument, (caddr_t) & argument)) + if (!svc_getargs (transp, xdr_argument, (char *) & argument)) { svcerr_decode (transp); return; @@ -167,7 +167,7 @@ cb_prog_1 (struct svc_req *rqstp, SVCXPRT *transp) xdr_argument = (xdrproc_t) _xdr_nis_error; xdr_result = (xdrproc_t) xdr_void; memset (&argument, 0, sizeof (argument)); - if (!svc_getargs (transp, xdr_argument, (caddr_t) & argument)) + if (!svc_getargs (transp, xdr_argument, (char *) & argument)) { svcerr_decode (transp); return; @@ -183,7 +183,7 @@ cb_prog_1 (struct svc_req *rqstp, SVCXPRT *transp) } if (result != NULL && !svc_sendreply (transp, xdr_result, result)) svcerr_systemerr (transp); - if (!svc_freeargs (transp, xdr_argument, (caddr_t) & argument)) + if (!svc_freeargs (transp, xdr_argument, (char *) & argument)) { fputs (_ ("unable to free arguments"), stderr); exit (1); @@ -224,8 +224,8 @@ internal_nis_do_callback (struct dir_binding *bptr, netobj *cookie, /* See if callback 'thread' in the server is still alive. */ cb_is_running = FALSE; if (clnt_call (bptr->clnt, NIS_CALLBACK, (xdrproc_t) xdr_netobj, - (caddr_t) cookie, (xdrproc_t) xdr_bool, - (caddr_t) &cb_is_running, TIMEOUT) != RPC_SUCCESS) + (char *) cookie, (xdrproc_t) xdr_bool, + (char *) &cb_is_running, TIMEOUT) != RPC_SUCCESS) cb_is_running = FALSE; if (cb_is_running == FALSE) diff --git a/nis/nis_checkpoint.c b/nis/nis_checkpoint.c index 42e262b0c0..b03582fc00 100644 --- a/nis/nis_checkpoint.c +++ b/nis/nis_checkpoint.c @@ -60,8 +60,8 @@ nis_checkpoint (const_nis_name dirname) memset (&cpres, '\0', sizeof (cp_result)); if (__do_niscall2 (&NIS_RES_OBJECT(res2)->DI_data.do_servers.do_servers_val[i], 1, NIS_CHECKPOINT, (xdrproc_t) _xdr_nis_name, - (caddr_t) &dirname, (xdrproc_t) _xdr_cp_result, - (caddr_t) &cpres, 0, NULL) != NIS_SUCCESS) + (char *) &dirname, (xdrproc_t) _xdr_cp_result, + (char *) &cpres, 0, NULL) != NIS_SUCCESS) NIS_RES_STATUS (res) = NIS_RPCERROR; else { diff --git a/nis/nis_findserv.c b/nis/nis_findserv.c index d0ce3e8693..a87f9b34f4 100644 --- a/nis/nis_findserv.c +++ b/nis/nis_findserv.c @@ -163,15 +163,15 @@ __nis_findfastest_with_timeout (dir_binding *bind, sizeof (struct sockaddr_in)); /* Transmit to NULLPROC, return immediately. */ clnt_call (clnt, NULLPROC, - (xdrproc_t) xdr_void, (caddr_t) 0, - (xdrproc_t) xdr_void, (caddr_t) 0, TIMEOUT00); + (xdrproc_t) xdr_void, (char *) 0, + (xdrproc_t) xdr_void, (char *) 0, TIMEOUT00); } while (found == -1) { /* Receive reply from NULLPROC asynchronously. Note null inproc. */ int rc = clnt_call (clnt, NULLPROC, - (xdrproc_t) NULL, (caddr_t) 0, - (xdrproc_t) xdr_void, (caddr_t) 0, + (xdrproc_t) NULL, (char *) 0, + (xdrproc_t) xdr_void, (char *) 0, *timeout); if (RPC_SUCCESS == rc) { uint32_t val; diff --git a/nis/nis_intern.h b/nis/nis_intern.h index fcd60cb3a2..6c0e234c76 100644 --- a/nis/nis_intern.h +++ b/nis/nis_intern.h @@ -54,16 +54,16 @@ typedef struct nis_cb nis_cb; extern unsigned long int inetstr2int (const char *str); extern long int __nis_findfastest (dir_binding *bind); extern nis_error __do_niscall2 (const nis_server *serv, u_int serv_len, - u_long prog, xdrproc_t xargs, caddr_t req, - xdrproc_t xres, caddr_t resp, + u_long prog, xdrproc_t xargs, char *req, + xdrproc_t xres, char *resp, unsigned int flags, nis_cb *cb); extern nis_error __do_niscall (const_nis_name name, u_long prog, - xdrproc_t xargs, caddr_t req, - xdrproc_t xres, caddr_t resp, + xdrproc_t xargs, char *req, + xdrproc_t xres, char *resp, unsigned int flags, nis_cb *cb); extern nis_error __do_niscall3 (dir_binding *dbp, u_long prog, - xdrproc_t xargs, caddr_t req, - xdrproc_t xres, caddr_t resp, + xdrproc_t xargs, char *req, + xdrproc_t xres, char *resp, unsigned int flags, nis_cb *cb); libnsl_hidden_proto (__do_niscall3) diff --git a/nis/nis_lookup.c b/nis/nis_lookup.c index de5eb193ef..8871be7362 100644 --- a/nis/nis_lookup.c +++ b/nis/nis_lookup.c @@ -78,8 +78,8 @@ nis_lookup (const_nis_name name, const unsigned int flags) again: result = clnt_call (bptr.clnt, NIS_LOOKUP, (xdrproc_t) _xdr_ns_request, - (caddr_t) &req, (xdrproc_t) _xdr_nis_result, - (caddr_t) res, RPCTIMEOUT); + (char *) &req, (xdrproc_t) _xdr_nis_result, + (char *) res, RPCTIMEOUT); if (result != RPC_SUCCESS) status = NIS_RPCERROR; diff --git a/nis/nis_mkdir.c b/nis/nis_mkdir.c index 84630b4230..a6daf8a2da 100644 --- a/nis/nis_mkdir.c +++ b/nis/nis_mkdir.c @@ -29,13 +29,13 @@ nis_mkdir (const_nis_name dir, const nis_server *server) if (server == NULL) res2 = __do_niscall (dir, NIS_MKDIR, (xdrproc_t) _xdr_nis_name, - (caddr_t) &dir, (xdrproc_t) _xdr_nis_error, - (caddr_t) &res, 0, NULL); + (char *) &dir, (xdrproc_t) _xdr_nis_error, + (char *) &res, 0, NULL); else res2 = __do_niscall2 (server, 1, NIS_MKDIR, (xdrproc_t) _xdr_nis_name, - (caddr_t) &dir, (xdrproc_t) _xdr_nis_error, - (caddr_t) &res, 0, NULL); + (char *) &dir, (xdrproc_t) _xdr_nis_error, + (char *) &res, 0, NULL); if (res2 != NIS_SUCCESS) return res2; diff --git a/nis/nis_modify.c b/nis/nis_modify.c index bb10ff1600..d00879746a 100644 --- a/nis/nis_modify.c +++ b/nis/nis_modify.c @@ -62,8 +62,8 @@ nis_modify (const_nis_name name, const nis_object *obj2) req.ns_object.ns_object_len = 1; status = __do_niscall (name, NIS_MODIFY, (xdrproc_t) _xdr_ns_request, - (caddr_t) & req, (xdrproc_t) _xdr_nis_result, - (caddr_t) res, MASTER_ONLY, + (char *) & req, (xdrproc_t) _xdr_nis_result, + (char *) res, MASTER_ONLY, NULL); if (status != NIS_SUCCESS) NIS_RES_STATUS (res) = status; diff --git a/nis/nis_ping.c b/nis/nis_ping.c index 1d388d8151..e2cb50b90e 100644 --- a/nis/nis_ping.c +++ b/nis/nis_ping.c @@ -64,8 +64,8 @@ nis_ping (const_nis_name dirname, unsigned int utime, for (i = 1; i < obj->DI_data.do_servers.do_servers_len; ++i) __do_niscall2 (&obj->DI_data.do_servers.do_servers_val[i], 1, NIS_PING, (xdrproc_t) _xdr_ping_args, - (caddr_t) &args, (xdrproc_t) xdr_void, - (caddr_t) NULL, 0, NULL); + (char *) &args, (xdrproc_t) xdr_void, + (char *) NULL, 0, NULL); nis_freeresult (res); } libnsl_hidden_nolink_def (nis_ping, GLIBC_2_1) diff --git a/nis/nis_remove.c b/nis/nis_remove.c index d879af1f3e..5f4d50728c 100644 --- a/nis/nis_remove.c +++ b/nis/nis_remove.c @@ -47,8 +47,8 @@ nis_remove (const_nis_name name, const nis_object *obj) } if ((status = __do_niscall (name, NIS_REMOVE, (xdrproc_t) _xdr_ns_request, - (caddr_t) &req, (xdrproc_t) _xdr_nis_result, - (caddr_t) res, MASTER_ONLY, + (char *) &req, (xdrproc_t) _xdr_nis_result, + (char *) res, MASTER_ONLY, NULL)) != NIS_SUCCESS) NIS_RES_STATUS (res) = status; diff --git a/nis/nis_rmdir.c b/nis/nis_rmdir.c index 4063ebed94..ebeddc66de 100644 --- a/nis/nis_rmdir.c +++ b/nis/nis_rmdir.c @@ -32,8 +32,8 @@ nis_rmdir (const_nis_name dir, const nis_server *server) res2 = __do_niscall2 (server, 1, NIS_RMDIR, (xdrproc_t) _xdr_nis_name, - (caddr_t) &dir, (xdrproc_t) _xdr_nis_error, - (caddr_t) &res, 0, NULL); + (char *) &dir, (xdrproc_t) _xdr_nis_error, + (char *) &res, 0, NULL); if (res2 != NIS_SUCCESS) return res2; diff --git a/nis/nis_server.c b/nis/nis_server.c index 537c7b3907..a9ed987d61 100644 --- a/nis/nis_server.c +++ b/nis/nis_server.c @@ -40,8 +40,8 @@ nis_servstate (const nis_server *serv, const nis_tag *tags, return NIS_BADOBJECT; if (__do_niscall2 (serv, 1, NIS_SERVSTATE, (xdrproc_t) _xdr_nis_taglist, - (caddr_t) &taglist, (xdrproc_t) _xdr_nis_taglist, - (caddr_t) &tagres, 0, NULL) != NIS_SUCCESS) + (char *) &taglist, (xdrproc_t) _xdr_nis_taglist, + (char *) &tagres, 0, NULL) != NIS_SUCCESS) return NIS_RPCERROR; *result = tagres.tags.tags_val; @@ -67,8 +67,8 @@ nis_stats (const nis_server *serv, const nis_tag *tags, return NIS_BADOBJECT; if (__do_niscall2 (serv, 1, NIS_STATUS, (xdrproc_t) _xdr_nis_taglist, - (caddr_t) &taglist, (xdrproc_t) _xdr_nis_taglist, - (caddr_t) &tagres, 0, NULL) != NIS_SUCCESS) + (char *) &taglist, (xdrproc_t) _xdr_nis_taglist, + (char *) &tagres, 0, NULL) != NIS_SUCCESS) return NIS_RPCERROR; *result = tagres.tags.tags_val; diff --git a/nis/nis_table.c b/nis/nis_table.c index c443f53133..f31075f1ca 100644 --- a/nis/nis_table.c +++ b/nis/nis_table.c @@ -146,8 +146,8 @@ get_tablepath (char *name, dir_binding *bptr) req.ns_object.ns_object_val = NULL; result = clnt_call (bptr->clnt, NIS_LOOKUP, (xdrproc_t) _xdr_ns_request, - (caddr_t) &req, (xdrproc_t) _xdr_nis_result, - (caddr_t) &res, RPCTIMEOUT); + (char *) &req, (xdrproc_t) _xdr_nis_result, + (char *) &res, RPCTIMEOUT); const char *cptr; if (result == RPC_SUCCESS && NIS_RES_STATUS (&res) == NIS_SUCCESS @@ -308,9 +308,9 @@ nis_list (const_nis_name name, unsigned int flags, again: clnt_status = clnt_call (bptr.clnt, NIS_IBLIST, - (xdrproc_t) _xdr_ib_request, (caddr_t) ibreq, + (xdrproc_t) _xdr_ib_request, (char *) ibreq, (xdrproc_t) _xdr_nis_result, - (caddr_t) res, RPCTIMEOUT); + (char *) res, RPCTIMEOUT); if (__glibc_unlikely (clnt_status != RPC_SUCCESS)) NIS_RES_STATUS (res) = NIS_RPCERROR; @@ -604,9 +604,9 @@ nis_add_entry (const_nis_name name, const nis_object *obj2, unsigned int flags) nis_error status = __do_niscall (ibreq->ibr_name, NIS_IBADD, (xdrproc_t) _xdr_ib_request, - (caddr_t) ibreq, + (char *) ibreq, (xdrproc_t) _xdr_nis_result, - (caddr_t) res, 0, NULL); + (char *) res, 0, NULL); if (__glibc_unlikely (status != NIS_SUCCESS)) NIS_RES_STATUS (res) = status; @@ -663,8 +663,8 @@ nis_modify_entry (const_nis_name name, const nis_object *obj2, status = __do_niscall (ibreq->ibr_name, NIS_IBMODIFY, (xdrproc_t) _xdr_ib_request, - (caddr_t) ibreq, (xdrproc_t) _xdr_nis_result, - (caddr_t) res, 0, NULL); + (char *) ibreq, (xdrproc_t) _xdr_nis_result, + (char *) res, 0, NULL); if (__glibc_unlikely (status != NIS_SUCCESS)) NIS_RES_STATUS (res) = status; @@ -713,8 +713,8 @@ nis_remove_entry (const_nis_name name, const nis_object *obj, if ((status = __do_niscall (ibreq->ibr_name, NIS_IBREMOVE, (xdrproc_t) _xdr_ib_request, - (caddr_t) ibreq, (xdrproc_t) _xdr_nis_result, - (caddr_t) res, 0, NULL)) != NIS_SUCCESS) + (char *) ibreq, (xdrproc_t) _xdr_nis_result, + (char *) res, 0, NULL)) != NIS_SUCCESS) NIS_RES_STATUS (res) = status; nis_free_request (ibreq); @@ -749,8 +749,8 @@ nis_first_entry (const_nis_name name) status = __do_niscall (ibreq->ibr_name, NIS_IBFIRST, (xdrproc_t) _xdr_ib_request, - (caddr_t) ibreq, (xdrproc_t) _xdr_nis_result, - (caddr_t) res, 0, NULL); + (char *) ibreq, (xdrproc_t) _xdr_nis_result, + (char *) res, 0, NULL); if (__glibc_unlikely (status != NIS_SUCCESS)) NIS_RES_STATUS (res) = status; @@ -793,8 +793,8 @@ nis_next_entry (const_nis_name name, const netobj *cookie) status = __do_niscall (ibreq->ibr_name, NIS_IBNEXT, (xdrproc_t) _xdr_ib_request, - (caddr_t) ibreq, (xdrproc_t) _xdr_nis_result, - (caddr_t) res, 0, NULL); + (char *) ibreq, (xdrproc_t) _xdr_nis_result, + (char *) res, 0, NULL); if (__glibc_unlikely (status != NIS_SUCCESS)) NIS_RES_STATUS (res) = status; diff --git a/nis/nis_util.c b/nis/nis_util.c index fdce926e16..550c563a99 100644 --- a/nis/nis_util.c +++ b/nis/nis_util.c @@ -39,8 +39,8 @@ __nis_finddirectory (directory_obj *dir, const_nis_name name) status = __do_niscall2 (dir->do_servers.do_servers_val, dir->do_servers.do_servers_len, NIS_FINDDIRECTORY, (xdrproc_t) _xdr_fd_args, - (caddr_t) &fd_args, (xdrproc_t) _xdr_fd_result, - (caddr_t) fd_res, NO_AUTHINFO|USE_DGRAM, NULL); + (char *) &fd_args, (xdrproc_t) _xdr_fd_result, + (char *) fd_res, NO_AUTHINFO|USE_DGRAM, NULL); if (status != NIS_SUCCESS) fd_res->status = status; diff --git a/nis/nss_nisplus/nisplus-grp.c b/nis/nss_nisplus/nisplus-grp.c index b7d7aa832f..e44881957e 100644 --- a/nis/nss_nisplus/nisplus-grp.c +++ b/nis/nss_nisplus/nisplus-grp.c @@ -188,9 +188,9 @@ internal_nisplus_getgrent_r (struct group *gr, char *buffer, size_t buflen, status = __do_niscall3 (&bptr, NIS_IBFIRST, (xdrproc_t) _xdr_ib_request, - (caddr_t) ibreq, + (char *) ibreq, (xdrproc_t) _xdr_nis_result, - (caddr_t) &result, + (char *) &result, 0, NULL); } else @@ -200,9 +200,9 @@ internal_nisplus_getgrent_r (struct group *gr, char *buffer, size_t buflen, status = __do_niscall3 (&bptr, NIS_IBNEXT, (xdrproc_t) _xdr_ib_request, - (caddr_t) ibreq, + (char *) ibreq, (xdrproc_t) _xdr_nis_result, - (caddr_t) &result, + (char *) &result, 0, NULL); ibreq->ibr_cookie.n_bytes = NULL; diff --git a/nis/nss_nisplus/nisplus-pwd.c b/nis/nss_nisplus/nisplus-pwd.c index 736e46604c..da4c6c3817 100644 --- a/nis/nss_nisplus/nisplus-pwd.c +++ b/nis/nss_nisplus/nisplus-pwd.c @@ -188,9 +188,9 @@ internal_nisplus_getpwent_r (struct passwd *pw, char *buffer, size_t buflen, status = __do_niscall3 (&bptr, NIS_IBFIRST, (xdrproc_t) _xdr_ib_request, - (caddr_t) ibreq, + (char *) ibreq, (xdrproc_t) _xdr_nis_result, - (caddr_t) &result, + (char *) &result, 0, NULL); } else @@ -200,9 +200,9 @@ internal_nisplus_getpwent_r (struct passwd *pw, char *buffer, size_t buflen, status = __do_niscall3 (&bptr, NIS_IBNEXT, (xdrproc_t) _xdr_ib_request, - (caddr_t) ibreq, + (char *) ibreq, (xdrproc_t) _xdr_nis_result, - (caddr_t) &result, + (char *) &result, 0, NULL); ibreq->ibr_cookie.n_bytes = NULL; diff --git a/nis/rpcsvc/nis_callback.h b/nis/rpcsvc/nis_callback.h index 6f05728e2a..ecbd367621 100644 --- a/nis/rpcsvc/nis_callback.h +++ b/nis/rpcsvc/nis_callback.h @@ -60,7 +60,7 @@ extern void * cbproc_finish_1_svc (void *, struct svc_req *) __THROW; #define CBPROC_ERROR 3 extern void * cbproc_error_1 (nis_error *, CLIENT *) __THROW; extern void * cbproc_error_1_svc (nis_error *, struct svc_req *) __THROW; -extern int cb_prog_1_freeresult (SVCXPRT *, xdrproc_t, caddr_t) __THROW; +extern int cb_prog_1_freeresult (SVCXPRT *, xdrproc_t, char *) __THROW; /* the xdr functions */ diff --git a/nis/rpcsvc/yp.h b/nis/rpcsvc/yp.h index 968b74c42e..407e1fde9c 100644 --- a/nis/rpcsvc/yp.h +++ b/nis/rpcsvc/yp.h @@ -278,7 +278,7 @@ extern ypresp_order *ypproc_order_2_svc (ypreq_nokey *, struct svc_req *); #define YPPROC_MAPLIST 11 extern ypresp_maplist *ypproc_maplist_2 (domainname *, CLIENT *); extern ypresp_maplist *ypproc_maplist_2_svc (domainname *, struct svc_req *); -extern int ypprog_2_freeresult (SVCXPRT *, xdrproc_t, caddr_t); +extern int ypprog_2_freeresult (SVCXPRT *, xdrproc_t, char *); #define YPPUSH_XFRRESPPROG (0x40000000) @@ -290,7 +290,7 @@ extern void *yppushproc_null_1_svc (void *, struct svc_req *); #define YPPUSHPROC_XFRRESP 1 extern void *yppushproc_xfrresp_1 (yppushresp_xfr *, CLIENT *); extern void *yppushproc_xfrresp_1_svc (yppushresp_xfr *, struct svc_req *); -extern int yppush_xfrrespprog_1_freeresult (SVCXPRT *, xdrproc_t, caddr_t); +extern int yppush_xfrrespprog_1_freeresult (SVCXPRT *, xdrproc_t, char *); #define YPBINDPROG 100007 @@ -305,7 +305,7 @@ extern ypbind_resp *ypbindproc_domain_2_svc (domainname *, struct svc_req *); #define YPBINDPROC_SETDOM 2 extern void *ypbindproc_setdom_2 (ypbind_setdom *, CLIENT *); extern void *ypbindproc_setdom_2_svc (ypbind_setdom *, struct svc_req *); -extern int ypbindprog_2_freeresult (SVCXPRT *, xdrproc_t, caddr_t); +extern int ypbindprog_2_freeresult (SVCXPRT *, xdrproc_t, char *); extern bool_t xdr_ypstat (XDR *, ypstat*); diff --git a/nis/ypclnt.c b/nis/ypclnt.c index 3201e375a2..55cae519ea 100644 --- a/nis/ypclnt.c +++ b/nis/ypclnt.c @@ -126,9 +126,9 @@ yp_bind_ypbindprog (const char *domain, dom_binding *ysd) } if (clnt_call (client, YPBINDPROC_DOMAIN, - (xdrproc_t) xdr_domainname, (caddr_t) &domain, + (xdrproc_t) xdr_domainname, (char *) &domain, (xdrproc_t) xdr_ypbind_resp, - (caddr_t) &ypbr, RPCTIMEOUT) != RPC_SUCCESS) + (char *) &ypbr, RPCTIMEOUT) != RPC_SUCCESS) { clnt_destroy (client); return YPERR_YPBIND; @@ -271,7 +271,7 @@ libnsl_hidden_nolink_def(yp_unbind, GLIBC_2_0) static int __ypclnt_call (const char *domain, u_long prog, xdrproc_t xargs, - caddr_t req, xdrproc_t xres, caddr_t resp, dom_binding **ydb, + char *req, xdrproc_t xres, char *resp, dom_binding **ydb, int print_error) { enum clnt_stat result; @@ -294,7 +294,7 @@ __ypclnt_call (const char *domain, u_long prog, xdrproc_t xargs, static int do_ypcall (const char *domain, u_long prog, xdrproc_t xargs, - caddr_t req, xdrproc_t xres, caddr_t resp) + char *req, xdrproc_t xres, char *resp) { dom_binding *ydb; int status; @@ -365,7 +365,7 @@ do_ypcall (const char *domain, u_long prog, xdrproc_t xargs, /* Like do_ypcall, but translate the status value if necessary. */ static int do_ypcall_tr (const char *domain, u_long prog, xdrproc_t xargs, - caddr_t req, xdrproc_t xres, caddr_t resp) + char *req, xdrproc_t xres, char *resp) { int status = do_ypcall (domain, prog, xargs, req, xres, resp); if (status == YPERR_SUCCESS) @@ -451,8 +451,8 @@ yp_match (const char *indomain, const char *inmap, const char *inkey, memset (&resp, '\0', sizeof (resp)); result = do_ypcall_tr (indomain, YPPROC_MATCH, (xdrproc_t) xdr_ypreq_key, - (caddr_t) &req, (xdrproc_t) xdr_ypresp_val, - (caddr_t) &resp); + (char *) &req, (xdrproc_t) xdr_ypresp_val, + (char *) &resp); if (result != YPERR_SUCCESS) return result; @@ -493,8 +493,8 @@ yp_first (const char *indomain, const char *inmap, char **outkey, memset (&resp, '\0', sizeof (resp)); result = do_ypcall (indomain, YPPROC_FIRST, (xdrproc_t) xdr_ypreq_nokey, - (caddr_t) &req, (xdrproc_t) xdr_ypresp_key_val, - (caddr_t) &resp); + (char *) &req, (xdrproc_t) xdr_ypresp_key_val, + (char *) &resp); if (result != RPC_SUCCESS) return YPERR_RPC; @@ -552,8 +552,8 @@ yp_next (const char *indomain, const char *inmap, const char *inkey, memset (&resp, '\0', sizeof (resp)); result = do_ypcall_tr (indomain, YPPROC_NEXT, (xdrproc_t) xdr_ypreq_key, - (caddr_t) &req, (xdrproc_t) xdr_ypresp_key_val, - (caddr_t) &resp); + (char *) &req, (xdrproc_t) xdr_ypresp_key_val, + (char *) &resp); if (result != YPERR_SUCCESS) return result; @@ -602,8 +602,8 @@ yp_master (const char *indomain, const char *inmap, char **outname) memset (&resp, '\0', sizeof (ypresp_master)); result = do_ypcall_tr (indomain, YPPROC_MASTER, (xdrproc_t) xdr_ypreq_nokey, - (caddr_t) &req, (xdrproc_t) xdr_ypresp_master, - (caddr_t) &resp); + (char *) &req, (xdrproc_t) xdr_ypresp_master, + (char *) &resp); if (result != YPERR_SUCCESS) return result; @@ -632,8 +632,8 @@ yp_order (const char *indomain, const char *inmap, unsigned int *outorder) memset (&resp, '\0', sizeof (resp)); result = do_ypcall_tr (indomain, YPPROC_ORDER, (xdrproc_t) xdr_ypreq_nokey, - (caddr_t) &req, (xdrproc_t) xdr_ypresp_order, - (caddr_t) &resp); + (char *) &req, (xdrproc_t) xdr_ypresp_order, + (char *) &resp); if (result != YPERR_SUCCESS) return result; @@ -760,8 +760,8 @@ yp_all (const char *indomain, const char *inmap, data.data = (void *) incallback->data; result = clnt_call (clnt, YPPROC_ALL, (xdrproc_t) xdr_ypreq_nokey, - (caddr_t) &req, (xdrproc_t) __xdr_ypresp_all, - (caddr_t) &data, RPCTIMEOUT); + (char *) &req, (xdrproc_t) __xdr_ypresp_all, + (char *) &data, RPCTIMEOUT); if (__glibc_unlikely (result != RPC_SUCCESS)) { @@ -801,8 +801,8 @@ yp_maplist (const char *indomain, struct ypmaplist **outmaplist) memset (&resp, '\0', sizeof (resp)); result = do_ypcall_tr (indomain, YPPROC_MAPLIST, (xdrproc_t) xdr_domainname, - (caddr_t) &indomain, (xdrproc_t) xdr_ypresp_maplist, - (caddr_t) &resp); + (char *) &indomain, (xdrproc_t) xdr_ypresp_maplist, + (char *) &resp); if (__glibc_likely (result == YPERR_SUCCESS)) { @@ -1007,8 +1007,8 @@ yp_update (char *domain, char *map, unsigned ypop, clnt->cl_auth = authunix_create_default (); again: - r = clnt_call (clnt, ypop, xdr_argument, (caddr_t) &args, - (xdrproc_t) xdr_u_int, (caddr_t) &res, RPCTIMEOUT); + r = clnt_call (clnt, ypop, xdr_argument, (char *) &args, + (xdrproc_t) xdr_u_int, (char *) &res, RPCTIMEOUT); if (r == RPC_AUTHERROR) { diff --git a/posix/bits/types.h b/posix/bits/types.h index 70507ce4bd..73e6a1aef4 100644 --- a/posix/bits/types.h +++ b/posix/bits/types.h @@ -161,7 +161,6 @@ __STD_TYPE __TIME_T_TYPE __time_t; /* Seconds since the Epoch. */ __STD_TYPE __USECONDS_T_TYPE __useconds_t; /* Count of microseconds. */ __STD_TYPE __SUSECONDS_T_TYPE __suseconds_t; /* Signed count of microseconds. */ -__STD_TYPE __DADDR_T_TYPE __daddr_t; /* The type of a disk address. */ __STD_TYPE __KEY_T_TYPE __key_t; /* Type of an IPC key. */ /* Clock ID used in clock and timer functions. */ @@ -200,7 +199,8 @@ __STD_TYPE __SYSCALL_ULONG_TYPE __syscall_ulong_t; /* These few don't really vary by system, they always correspond to one of the other defined types. */ typedef __off64_t __loff_t; /* Type of file sizes and offsets (LFS). */ -typedef char *__caddr_t; +typedef char *__caddr_t; /* Type of a memory address (BSD). */ +__STD_TYPE __S32_TYPE __daddr_t; /* Type of a disk address (BSD). */ /* Duplicates info from stdint.h but this is used in unistd.h. */ __STD_TYPE __SWORD_TYPE __intptr_t; diff --git a/scripts/check-obsolete-constructs.py b/scripts/check-obsolete-constructs.py index 4dc52761c5..701ad5af90 100755 --- a/scripts/check-obsolete-constructs.py +++ b/scripts/check-obsolete-constructs.py @@ -18,7 +18,10 @@ """Verifies that installed headers do not use any obsolete constructs: * legacy BSD typedefs superseded by : - ushort uint ulong u_char u_short u_int u_long u_intNN_t quad_t u_quad_t + ushort uint ulong + u_char u_short u_int u_long + u_intNN_t quad_t u_quad_t + caddr_t daddr_t loff_t register_t (sys/types.h is allowed to _define_ these types, but not to use them to define anything else). """ @@ -254,6 +257,8 @@ class NoCheck(ConstructChecker): OBSOLETE_TYPE_RE_ = re.compile(r"""\A (__)? ( quad_t + | [cd]addr_t + | loff_t | register_t | u(?: short | int | long | _(?: char | short | int(?:[0-9]+_t)? | long | quad_t ))) diff --git a/sunrpc/auth_des.c b/sunrpc/auth_des.c index 5b6f985bc2..7e77f510d2 100644 --- a/sunrpc/auth_des.c +++ b/sunrpc/auth_des.c @@ -189,7 +189,7 @@ authdes_pk_create (const char *servername, netobj *pkey, u_int window, auth->ah_cred.oa_flavor = AUTH_DES; auth->ah_verf.oa_flavor = AUTH_DES; auth->ah_ops = (struct auth_ops *) &authdes_ops; - auth->ah_private = (caddr_t) ad; + auth->ah_private = (char *) ad; if (!authdes_refresh (auth)) goto failed; diff --git a/sunrpc/auth_unix.c b/sunrpc/auth_unix.c index b035fdd870..15de6d06db 100644 --- a/sunrpc/auth_unix.c +++ b/sunrpc/auth_unix.c @@ -115,7 +115,7 @@ no_memory: return NULL; } auth->ah_ops = (struct auth_ops *) &auth_unix_ops; - auth->ah_private = (caddr_t) au; + auth->ah_private = (char *) au; auth->ah_verf = au->au_shcred = _null_auth; au->au_shfaults = 0; @@ -329,7 +329,7 @@ authunix_destroy (AUTH *auth) if (auth->ah_verf.oa_base != NULL) mem_free (auth->ah_verf.oa_base, auth->ah_verf.oa_length); - mem_free ((caddr_t) auth, sizeof (*auth)); + mem_free ((char *) auth, sizeof (*auth)); } /* diff --git a/sunrpc/authdes_prot.c b/sunrpc/authdes_prot.c index 93b7cfc04b..bc23622ae8 100644 --- a/sunrpc/authdes_prot.c +++ b/sunrpc/authdes_prot.c @@ -51,13 +51,13 @@ xdr_authdes_cred (XDR *xdrs, struct authdes_cred *cred) { case ADN_FULLNAME: ATTEMPT (xdr_string (xdrs, &cred->adc_fullname.name, MAXNETNAMELEN)); - ATTEMPT (xdr_opaque (xdrs, (caddr_t) & cred->adc_fullname.key, + ATTEMPT (xdr_opaque (xdrs, (char *) & cred->adc_fullname.key, sizeof (des_block))); - ATTEMPT (xdr_opaque (xdrs, (caddr_t) & cred->adc_fullname.window, + ATTEMPT (xdr_opaque (xdrs, (char *) & cred->adc_fullname.window, sizeof (cred->adc_fullname.window))); return (TRUE); case ADN_NICKNAME: - ATTEMPT (xdr_opaque (xdrs, (caddr_t) & cred->adc_nickname, + ATTEMPT (xdr_opaque (xdrs, (char *) & cred->adc_nickname, sizeof (cred->adc_nickname))); return TRUE; default: @@ -73,9 +73,9 @@ xdr_authdes_verf (register XDR *xdrs, register struct authdes_verf *verf) /* * Unrolled xdr */ - ATTEMPT (xdr_opaque (xdrs, (caddr_t) & verf->adv_xtimestamp, + ATTEMPT (xdr_opaque (xdrs, (char *) & verf->adv_xtimestamp, sizeof (des_block))); - ATTEMPT (xdr_opaque (xdrs, (caddr_t) & verf->adv_int_u, + ATTEMPT (xdr_opaque (xdrs, (char *) & verf->adv_int_u, sizeof (verf->adv_int_u))); return TRUE; } diff --git a/sunrpc/authuxprot.c b/sunrpc/authuxprot.c index 14fe9f56c8..41fd999979 100644 --- a/sunrpc/authuxprot.c +++ b/sunrpc/authuxprot.c @@ -54,7 +54,7 @@ xdr_authunix_parms (XDR * xdrs, struct authunix_parms *p) && (sizeof (gid_t) == sizeof (short int) ? xdr_u_short (xdrs, (u_short *) & (p->aup_gid)) : xdr_u_int (xdrs, (u_int *) & (p->aup_gid))) - && xdr_array (xdrs, (caddr_t *) & (p->aup_gids), + && xdr_array (xdrs, (char **) & (p->aup_gids), & (p->aup_len), NGRPS, sizeof (gid_t), (sizeof (gid_t) == sizeof (short int) ? (xdrproc_t) xdr_u_short diff --git a/sunrpc/clnt_raw.c b/sunrpc/clnt_raw.c index 5b9bd48247..a723dc2b07 100644 --- a/sunrpc/clnt_raw.c +++ b/sunrpc/clnt_raw.c @@ -61,11 +61,11 @@ struct clntraw_private_s }; #define clntraw_private RPC_THREAD_VARIABLE(clntraw_private_s) -static enum clnt_stat clntraw_call (CLIENT *, u_long, xdrproc_t, caddr_t, - xdrproc_t, caddr_t, struct timeval); +static enum clnt_stat clntraw_call (CLIENT *, u_long, xdrproc_t, char *, + xdrproc_t, char *, struct timeval); static void clntraw_abort (void); static void clntraw_geterr (CLIENT *, struct rpc_err *); -static bool_t clntraw_freeres (CLIENT *, xdrproc_t, caddr_t); +static bool_t clntraw_freeres (CLIENT *, xdrproc_t, char *); static bool_t clntraw_control (CLIENT *, int, char *); static void clntraw_destroy (CLIENT *); @@ -129,8 +129,8 @@ clntraw_create (u_long prog, u_long vers) libc_hidden_nolink_sunrpc (clntraw_create, GLIBC_2_0) static enum clnt_stat -clntraw_call (CLIENT *h, u_long proc, xdrproc_t xargs, caddr_t argsp, - xdrproc_t xresults, caddr_t resultsp, struct timeval timeout) +clntraw_call (CLIENT *h, u_long proc, xdrproc_t xargs, char *argsp, + xdrproc_t xresults, char *resultsp, struct timeval timeout) { struct clntraw_private_s *clp = clntraw_private; XDR *xdrs = &clp->xdr_stream; @@ -214,7 +214,7 @@ clntraw_geterr (CLIENT *cl, struct rpc_err *err) static bool_t -clntraw_freeres (CLIENT *cl, xdrproc_t xdr_res, caddr_t res_ptr) +clntraw_freeres (CLIENT *cl, xdrproc_t xdr_res, char *res_ptr) { struct clntraw_private_s *clp = clntraw_private; XDR *xdrs = &clp->xdr_stream; diff --git a/sunrpc/clnt_tcp.c b/sunrpc/clnt_tcp.c index 249e9c3584..4b3533eba7 100644 --- a/sunrpc/clnt_tcp.c +++ b/sunrpc/clnt_tcp.c @@ -76,11 +76,11 @@ struct ct_data static int readtcp (char *, char *, int); static int writetcp (char *, char *, int); -static enum clnt_stat clnttcp_call (CLIENT *, u_long, xdrproc_t, caddr_t, - xdrproc_t, caddr_t, struct timeval); +static enum clnt_stat clnttcp_call (CLIENT *, u_long, xdrproc_t, char *, + xdrproc_t, char *, struct timeval); static void clnttcp_abort (void); static void clnttcp_geterr (CLIENT *, struct rpc_err *); -static bool_t clnttcp_freeres (CLIENT *, xdrproc_t, caddr_t); +static bool_t clnttcp_freeres (CLIENT *, xdrproc_t, char *); static bool_t clnttcp_control (CLIENT *, int, char *); static void clnttcp_destroy (CLIENT *); @@ -135,8 +135,8 @@ clnttcp_create (struct sockaddr_in *raddr, u_long prog, u_long vers, u_short port; if ((port = pmap_getport (raddr, prog, vers, IPPROTO_TCP)) == 0) { - mem_free ((caddr_t) ct, sizeof (struct ct_data)); - mem_free ((caddr_t) h, sizeof (CLIENT)); + mem_free ((char *) ct, sizeof (struct ct_data)); + mem_free ((char *) h, sizeof (CLIENT)); return ((CLIENT *) NULL); } raddr->sin_port = htons (port); @@ -204,9 +204,9 @@ clnttcp_create (struct sockaddr_in *raddr, u_long prog, u_long vers, * and authnone for authentication. */ xdrrec_create (&(ct->ct_xdrs), sendsz, recvsz, - (caddr_t) ct, readtcp, writetcp); + (char *) ct, readtcp, writetcp); h->cl_ops = (struct clnt_ops *) &tcp_ops; - h->cl_private = (caddr_t) ct; + h->cl_private = (char *) ct; h->cl_auth = authnone_create (); return h; @@ -214,8 +214,8 @@ fooy: /* * Something goofed, free stuff and barf */ - mem_free ((caddr_t) ct, sizeof (struct ct_data)); - mem_free ((caddr_t) h, sizeof (CLIENT)); + mem_free ((char *) ct, sizeof (struct ct_data)); + mem_free ((char *) h, sizeof (CLIENT)); return ((CLIENT *) NULL); } #ifdef EXPORT_RPC_SYMBOLS @@ -225,8 +225,8 @@ libc_hidden_nolink_sunrpc (clnttcp_create, GLIBC_2_0) #endif static enum clnt_stat -clnttcp_call (CLIENT *h, u_long proc, xdrproc_t xdr_args, caddr_t args_ptr, - xdrproc_t xdr_results, caddr_t results_ptr, +clnttcp_call (CLIENT *h, u_long proc, xdrproc_t xdr_args, char *args_ptr, + xdrproc_t xdr_results, char *results_ptr, struct timeval timeout) { struct ct_data *ct = (struct ct_data *) h->cl_private; @@ -337,7 +337,7 @@ clnttcp_geterr (CLIENT *h, struct rpc_err *errp) } static bool_t -clnttcp_freeres (CLIENT *cl, xdrproc_t xdr_res, caddr_t res_ptr) +clnttcp_freeres (CLIENT *cl, xdrproc_t xdr_res, char *res_ptr) { struct ct_data *ct = (struct ct_data *) cl->cl_private; XDR *xdrs = &(ct->ct_xdrs); @@ -454,8 +454,8 @@ clnttcp_destroy (CLIENT *h) (void) __close (ct->ct_sock); } XDR_DESTROY (&(ct->ct_xdrs)); - mem_free ((caddr_t) ct, sizeof (struct ct_data)); - mem_free ((caddr_t) h, sizeof (CLIENT)); + mem_free ((char *) ct, sizeof (struct ct_data)); + mem_free ((char *) h, sizeof (CLIENT)); } /* diff --git a/sunrpc/clnt_udp.c b/sunrpc/clnt_udp.c index c2436e3ebc..99f3d7f703 100644 --- a/sunrpc/clnt_udp.c +++ b/sunrpc/clnt_udp.c @@ -63,11 +63,11 @@ extern u_long _create_xid (void); /* * UDP bases client side rpc operations */ -static enum clnt_stat clntudp_call (CLIENT *, u_long, xdrproc_t, caddr_t, - xdrproc_t, caddr_t, struct timeval); +static enum clnt_stat clntudp_call (CLIENT *, u_long, xdrproc_t, char *, + xdrproc_t, char *, struct timeval); static void clntudp_abort (void); static void clntudp_geterr (CLIENT *, struct rpc_err *); -static bool_t clntudp_freeres (CLIENT *, xdrproc_t, caddr_t); +static bool_t clntudp_freeres (CLIENT *, xdrproc_t, char *); static bool_t clntudp_control (CLIENT *, int, char *); static void clntudp_destroy (CLIENT *); @@ -154,7 +154,7 @@ __libc_clntudp_bufcreate (struct sockaddr_in *raddr, u_long program, raddr->sin_port = htons (port); } cl->cl_ops = (struct clnt_ops *) &udp_ops; - cl->cl_private = (caddr_t) cu; + cl->cl_private = (char *) cu; cu->cu_raddr = *raddr; cu->cu_rlen = sizeof (cu->cu_raddr); cu->cu_wait = wait; @@ -202,9 +202,9 @@ __libc_clntudp_bufcreate (struct sockaddr_in *raddr, u_long program, return cl; fooy: if (cu) - mem_free ((caddr_t) cu, sizeof (*cu) + sendsz + recvsz); + mem_free ((char *) cu, sizeof (*cu) + sendsz + recvsz); if (cl) - mem_free ((caddr_t) cl, sizeof (CLIENT)); + mem_free ((char *) cl, sizeof (CLIENT)); return (CLIENT *) NULL; } #ifdef EXPORT_RPC_SYMBOLS @@ -268,11 +268,11 @@ clntudp_call (/* client handle */ /* xdr routine for args */ xdrproc_t xargs, /* pointer to args */ - caddr_t argsp, + char *argsp, /* xdr routine for results */ xdrproc_t xresults, /* pointer to results */ - caddr_t resultsp, + char *resultsp, /* seconds to wait before giving up */ struct timeval utimeout) { @@ -524,7 +524,7 @@ clntudp_geterr (CLIENT *cl, struct rpc_err *errp) static bool_t -clntudp_freeres (CLIENT *cl, xdrproc_t xdr_res, caddr_t res_ptr) +clntudp_freeres (CLIENT *cl, xdrproc_t xdr_res, char *res_ptr) { struct cu_data *cu = (struct cu_data *) cl->cl_private; XDR *xdrs = &(cu->cu_outxdrs); @@ -641,6 +641,6 @@ clntudp_destroy (CLIENT *cl) (void) __close (cu->cu_sock); } XDR_DESTROY (&(cu->cu_outxdrs)); - mem_free ((caddr_t) cu, (sizeof (*cu) + cu->cu_sendsz + cu->cu_recvsz)); - mem_free ((caddr_t) cl, sizeof (CLIENT)); + mem_free ((char *) cu, (sizeof (*cu) + cu->cu_sendsz + cu->cu_recvsz)); + mem_free ((char *) cl, sizeof (CLIENT)); } diff --git a/sunrpc/clnt_unix.c b/sunrpc/clnt_unix.c index 33a02cc8af..51ed935359 100644 --- a/sunrpc/clnt_unix.c +++ b/sunrpc/clnt_unix.c @@ -77,11 +77,11 @@ struct ct_data static int readunix (char *, char *, int); static int writeunix (char *, char *, int); -static enum clnt_stat clntunix_call (CLIENT *, u_long, xdrproc_t, caddr_t, - xdrproc_t, caddr_t, struct timeval); +static enum clnt_stat clntunix_call (CLIENT *, u_long, xdrproc_t, char *, + xdrproc_t, char *, struct timeval); static void clntunix_abort (void); static void clntunix_geterr (CLIENT *, struct rpc_err *); -static bool_t clntunix_freeres (CLIENT *, xdrproc_t, caddr_t); +static bool_t clntunix_freeres (CLIENT *, xdrproc_t, char *); static bool_t clntunix_control (CLIENT *, int, char *); static void clntunix_destroy (CLIENT *); @@ -187,9 +187,9 @@ clntunix_create (struct sockaddr_un *raddr, u_long prog, u_long vers, * and authnone for authentication. */ xdrrec_create (&(ct->ct_xdrs), sendsz, recvsz, - (caddr_t) ct, readunix, writeunix); + (char *) ct, readunix, writeunix); h->cl_ops = (struct clnt_ops *) &unix_ops; - h->cl_private = (caddr_t) ct; + h->cl_private = (char *) ct; h->cl_auth = authnone_create (); return h; @@ -197,15 +197,15 @@ fooy: /* * Something goofed, free stuff and barf */ - mem_free ((caddr_t) ct, sizeof (struct ct_data)); - mem_free ((caddr_t) h, sizeof (CLIENT)); + mem_free ((char *) ct, sizeof (struct ct_data)); + mem_free ((char *) h, sizeof (CLIENT)); return (CLIENT *) NULL; } libc_hidden_nolink_sunrpc (clntunix_create, GLIBC_2_1) static enum clnt_stat -clntunix_call (CLIENT *h, u_long proc, xdrproc_t xdr_args, caddr_t args_ptr, - xdrproc_t xdr_results, caddr_t results_ptr, +clntunix_call (CLIENT *h, u_long proc, xdrproc_t xdr_args, char *args_ptr, + xdrproc_t xdr_results, char *results_ptr, struct timeval timeout) { struct ct_data *ct = (struct ct_data *) h->cl_private; @@ -313,7 +313,7 @@ clntunix_geterr (CLIENT *h, struct rpc_err *errp) } static bool_t -clntunix_freeres (CLIENT *cl, xdrproc_t xdr_res, caddr_t res_ptr) +clntunix_freeres (CLIENT *cl, xdrproc_t xdr_res, char *res_ptr) { struct ct_data *ct = (struct ct_data *) cl->cl_private; XDR *xdrs = &(ct->ct_xdrs); @@ -428,8 +428,8 @@ clntunix_destroy (CLIENT *h) (void) __close (ct->ct_sock); } XDR_DESTROY (&(ct->ct_xdrs)); - mem_free ((caddr_t) ct, sizeof (struct ct_data)); - mem_free ((caddr_t) h, sizeof (CLIENT)); + mem_free ((char *) ct, sizeof (struct ct_data)); + mem_free ((char *) h, sizeof (CLIENT)); } static int @@ -450,7 +450,7 @@ __msgread (int sock, void *data, size_t cnt) msg.msg_name = NULL; msg.msg_namelen = 0; #ifdef SCM_CREDENTIALS - msg.msg_control = (caddr_t) &cm; + msg.msg_control = (char *) &cm; msg.msg_controllen = CMSG_SPACE(sizeof (struct ucred)); #endif msg.msg_flags = 0; diff --git a/sunrpc/key_call.c b/sunrpc/key_call.c index 9b8f9819c9..270a1e9c86 100644 --- a/sunrpc/key_call.c +++ b/sunrpc/key_call.c @@ -228,7 +228,7 @@ key_gendes (des_block *key) return -1; stat = clnt_call (client, KEY_GEN, (xdrproc_t) xdr_void, NULL, - (xdrproc_t) xdr_des_block, (caddr_t) key, + (xdrproc_t) xdr_des_block, (char *) key, tottimeout); clnt_destroy (client); __close (socket); diff --git a/sunrpc/pm_getmaps.c b/sunrpc/pm_getmaps.c index 094492b2b4..b1e8eab7c4 100644 --- a/sunrpc/pm_getmaps.c +++ b/sunrpc/pm_getmaps.c @@ -72,7 +72,7 @@ pmap_getmaps (struct sockaddr_in *address) if (client != (CLIENT *) NULL) { if (CLNT_CALL (client, PMAPPROC_DUMP, (xdrproc_t)xdr_void, NULL, - (xdrproc_t)xdr_pmaplist, (caddr_t)&head, + (xdrproc_t)xdr_pmaplist, (char *)&head, minutetimeout) != RPC_SUCCESS) { clnt_perror (client, _("pmap_getmaps.c: rpc problem")); diff --git a/sunrpc/pm_getport.c b/sunrpc/pm_getport.c index 3e6dd34e58..394c437039 100644 --- a/sunrpc/pm_getport.c +++ b/sunrpc/pm_getport.c @@ -115,8 +115,8 @@ __libc_rpc_getport (struct sockaddr_in *address, u_long program, parms.pm_prot = protocol; parms.pm_port = 0; /* not needed or used */ if (CLNT_CALL (client, PMAPPROC_GETPORT, (xdrproc_t)xdr_pmap, - (caddr_t)&parms, (xdrproc_t)xdr_u_short, - (caddr_t)&port, tottimeout) != RPC_SUCCESS) + (char *)&parms, (xdrproc_t)xdr_u_short, + (char *)&port, tottimeout) != RPC_SUCCESS) { ce->cf_stat = RPC_PMAPFAILURE; clnt_geterr (client, &ce->cf_error); diff --git a/sunrpc/pmap_clnt.c b/sunrpc/pmap_clnt.c index 69b4907b3a..3b1ebe1868 100644 --- a/sunrpc/pmap_clnt.c +++ b/sunrpc/pmap_clnt.c @@ -122,7 +122,7 @@ pmap_set (u_long program, u_long version, int protocol, u_short port) parms.pm_prot = protocol; parms.pm_port = port; if (CLNT_CALL (client, PMAPPROC_SET, (xdrproc_t)xdr_pmap, - (caddr_t)&parms, (xdrproc_t)xdr_bool, (caddr_t)&rslt, + (char *)&parms, (xdrproc_t)xdr_bool, (char *)&rslt, tottimeout) != RPC_SUCCESS) { clnt_perror (client, _("Cannot register service")); @@ -157,7 +157,7 @@ pmap_unset (u_long program, u_long version) parms.pm_vers = version; parms.pm_port = parms.pm_prot = 0; CLNT_CALL (client, PMAPPROC_UNSET, (xdrproc_t)xdr_pmap, - (caddr_t)&parms, (xdrproc_t)xdr_bool, (caddr_t)&rslt, + (char *)&parms, (xdrproc_t)xdr_bool, (char *)&rslt, tottimeout); CLNT_DESTROY (client); /* (void)close(socket); CLNT_DESTROY already closed it */ diff --git a/sunrpc/pmap_prot2.c b/sunrpc/pmap_prot2.c index c414db0298..6825db7fe3 100644 --- a/sunrpc/pmap_prot2.c +++ b/sunrpc/pmap_prot2.c @@ -102,7 +102,7 @@ xdr_pmaplist (XDR *xdrs, struct pmaplist **rp) */ if (freeing) next = (*rp)->pml_next; - if (!xdr_reference (xdrs, (caddr_t *) rp, + if (!xdr_reference (xdrs, (char **) rp, (u_int) sizeof (struct pmaplist), (xdrproc_t) xdr_pmap)) return FALSE; diff --git a/sunrpc/pmap_rmt.c b/sunrpc/pmap_rmt.c index 6b142e5441..0fc406c125 100644 --- a/sunrpc/pmap_rmt.c +++ b/sunrpc/pmap_rmt.c @@ -66,7 +66,7 @@ static const struct timeval timeout = {3, 0}; */ enum clnt_stat pmap_rmtcall (struct sockaddr_in *addr, u_long prog, u_long vers, u_long proc, - xdrproc_t xdrargs, caddr_t argsp, xdrproc_t xdrres, caddr_t resp, + xdrproc_t xdrargs, char *argsp, xdrproc_t xdrres, char *resp, struct timeval tout, u_long *port_ptr) { int socket = -1; @@ -89,8 +89,8 @@ pmap_rmtcall (struct sockaddr_in *addr, u_long prog, u_long vers, u_long proc, r.xdr_results = xdrres; stat = CLNT_CALL (client, PMAPPROC_CALLIT, (xdrproc_t)xdr_rmtcall_args, - (caddr_t)&a, (xdrproc_t)xdr_rmtcallres, - (caddr_t)&r, tout); + (char *)&a, (xdrproc_t)xdr_rmtcallres, + (char *)&r, tout); CLNT_DESTROY (client); } else @@ -143,9 +143,9 @@ libc_hidden_nolink_sunrpc (xdr_rmtcall_args, GLIBC_2_0) bool_t xdr_rmtcallres (XDR *xdrs, struct rmtcallres *crp) { - caddr_t port_ptr; + char *port_ptr; - port_ptr = (caddr_t) crp->port_ptr; + port_ptr = (char *) crp->port_ptr; if (xdr_reference (xdrs, &port_ptr, sizeof (u_long), (xdrproc_t) xdr_u_long) && xdr_u_long (xdrs, &crp->resultslen)) @@ -205,11 +205,11 @@ clnt_broadcast (/* program number */ /* xdr routine for args */ xdrproc_t xargs, /* pointer to args */ - caddr_t argsp, + char *argsp, /* xdr routine for results */ xdrproc_t xresults, /* pointer to results */ - caddr_t resultsp, + char *resultsp, /* call with each result obtained */ resultproc_t eachresult) { @@ -312,7 +312,7 @@ clnt_broadcast (/* program number */ } recv_again: msg.acpted_rply.ar_verf = _null_auth; - msg.acpted_rply.ar_results.where = (caddr_t) & r; + msg.acpted_rply.ar_results.where = (char *) & r; msg.acpted_rply.ar_results.proc = (xdrproc_t) xdr_rmtcallres; milliseconds = t.tv_sec * 1000 + t.tv_usec / 1000; switch (__poll(&fd, 1, milliseconds)) diff --git a/sunrpc/proto.h b/sunrpc/proto.h index ea28565b1e..eef7b91614 100644 --- a/sunrpc/proto.h +++ b/sunrpc/proto.h @@ -17,7 +17,7 @@ void pprocdef(proc_list *proc, version_list *vp, const char *addargtype, int server_p, int mode); void pdeclaration(const char *name, declaration *dec, int tab, const char *separator); -void print_xdr_func_def (char* name, int pointerp, int i); +void print_xdr_func_def (char *name, int pointerp, int i); /****** rpc_main.c ******/ /* nil */ diff --git a/sunrpc/rpc/auth.h b/sunrpc/rpc/auth.h index e01b077214..c506e53749 100644 --- a/sunrpc/rpc/auth.h +++ b/sunrpc/rpc/auth.h @@ -81,7 +81,7 @@ extern bool_t xdr_des_block (XDR *__xdrs, des_block *__blkp) __THROW; */ struct opaque_auth { enum_t oa_flavor; /* flavor of auth */ - caddr_t oa_base; /* address of more auth stuff */ + char * oa_base; /* address of more auth stuff */ u_int oa_length; /* not to exceed MAX_AUTH_BYTES */ }; @@ -101,7 +101,7 @@ struct AUTH { int (*ah_refresh) (AUTH *); /* refresh credentials */ void (*ah_destroy) (AUTH *); /* destroy this structure */ } *ah_ops; - caddr_t ah_private; + char *ah_private; }; diff --git a/sunrpc/rpc/clnt.h b/sunrpc/rpc/clnt.h index f4d4a941c7..88ea9a2ae7 100644 --- a/sunrpc/rpc/clnt.h +++ b/sunrpc/rpc/clnt.h @@ -130,19 +130,19 @@ typedef struct CLIENT CLIENT; struct CLIENT { AUTH *cl_auth; /* authenticator */ struct clnt_ops { - enum clnt_stat (*cl_call) (CLIENT *, u_long, xdrproc_t, caddr_t, xdrproc_t, - caddr_t, struct timeval); + enum clnt_stat (*cl_call) (CLIENT *, u_long, xdrproc_t, char *, xdrproc_t, + char *, struct timeval); /* call remote procedure */ void (*cl_abort) (void); /* abort a call */ void (*cl_geterr) (CLIENT *, struct rpc_err *); /* get specific error code */ - bool_t (*cl_freeres) (CLIENT *, xdrproc_t, caddr_t); + bool_t (*cl_freeres) (CLIENT *, xdrproc_t, char *); /* frees results */ void (*cl_destroy) (CLIENT *); /* destroy this structure */ bool_t (*cl_control) (CLIENT *, int, char *); /* the ioctl() of rpc */ } *cl_ops; - caddr_t cl_private; /* private stuff */ + char *cl_private; /* private stuff */ }; @@ -159,9 +159,9 @@ struct CLIENT { * CLIENT *rh; * u_long proc; * xdrproc_t xargs; - * caddr_t argsp; + * char *argsp; * xdrproc_t xres; - * caddr_t resp; + * char *resp; * struct timeval timeout; */ #define CLNT_CALL(rh, proc, xargs, argsp, xres, resp, secs) \ @@ -191,7 +191,7 @@ struct CLIENT { * CLNT_FREERES(rh, xres, resp); * CLIENT *rh; * xdrproc_t xres; - * caddr_t resp; + * char *resp; */ #define CLNT_FREERES(rh,xres,resp) ((*(rh)->cl_ops->cl_freeres)(rh,xres,resp)) #define clnt_freeres(rh,xres,resp) ((*(rh)->cl_ops->cl_freeres)(rh,xres,resp)) @@ -401,7 +401,7 @@ extern char *clnt_sperrno (enum clnt_stat __num) __THROW; /* string */ /* * get the port number on the host for the rpc program,version and proto */ -extern int getrpcport (const char * __host, u_long __prognum, +extern int getrpcport (const char *__host, u_long __prognum, u_long __versnum, u_int __proto) __THROW; /* diff --git a/sunrpc/rpc/pmap_clnt.h b/sunrpc/rpc/pmap_clnt.h index 1cc94b8fee..1e7a4fb31f 100644 --- a/sunrpc/rpc/pmap_clnt.h +++ b/sunrpc/rpc/pmap_clnt.h @@ -42,7 +42,7 @@ __BEGIN_DECLS -typedef bool_t (*resultproc_t) (caddr_t __resp, struct sockaddr_in *__raddr); +typedef bool_t (*resultproc_t) (char *__resp, struct sockaddr_in *__raddr); /* * Usage: @@ -60,7 +60,7 @@ typedef bool_t (*resultproc_t) (caddr_t __resp, struct sockaddr_in *__raddr); * the procedure eachresult is called. Its form is: * done = eachresult(resp, raddr) * bool_t done; - * caddr_t resp; + * char *resp; * struct sockaddr_in raddr; * where resp points to the results of the call and raddr is the * address if the responder to the broadcast. @@ -76,14 +76,14 @@ extern enum clnt_stat pmap_rmtcall (struct sockaddr_in *__addr, const u_long __vers, const u_long __proc, xdrproc_t __xdrargs, - caddr_t __argsp, xdrproc_t __xdrres, - caddr_t __resp, struct timeval __tout, + char *__argsp, xdrproc_t __xdrres, + char *__resp, struct timeval __tout, u_long *__port_ptr) __THROW; extern enum clnt_stat clnt_broadcast (const u_long __prog, const u_long __vers, const u_long __proc, xdrproc_t __xargs, - caddr_t __argsp, xdrproc_t __xresults, - caddr_t __resultsp, + char *__argsp, xdrproc_t __xresults, + char *__resultsp, resultproc_t __eachresult) __THROW; extern u_short pmap_getport (struct sockaddr_in *__address, const u_long __program, diff --git a/sunrpc/rpc/pmap_rmt.h b/sunrpc/rpc/pmap_rmt.h index f8680141ae..7627b8edfe 100644 --- a/sunrpc/rpc/pmap_rmt.h +++ b/sunrpc/rpc/pmap_rmt.h @@ -44,7 +44,7 @@ __BEGIN_DECLS struct rmtcallargs { u_long prog, vers, proc, arglen; - caddr_t args_ptr; + char *args_ptr; xdrproc_t xdr_args; }; @@ -54,7 +54,7 @@ extern bool_t xdr_rmtcall_args (XDR *__xdrs, struct rmtcallargs *__crp) struct rmtcallres { u_long *port_ptr; u_long resultslen; - caddr_t results_ptr; + char *results_ptr; xdrproc_t xdr_results; }; diff --git a/sunrpc/rpc/rpc_msg.h b/sunrpc/rpc/rpc_msg.h index 273b187d14..a2cc516cd6 100644 --- a/sunrpc/rpc/rpc_msg.h +++ b/sunrpc/rpc/rpc_msg.h @@ -93,7 +93,7 @@ struct accepted_reply { u_long high; } AR_versions; struct { - caddr_t where; + char * where; xdrproc_t proc; } AR_results; /* and many other null cases */ diff --git a/sunrpc/rpc/svc.h b/sunrpc/rpc/svc.h index d22f9f6a38..85d0183d48 100644 --- a/sunrpc/rpc/svc.h +++ b/sunrpc/rpc/svc.h @@ -97,11 +97,11 @@ struct SVCXPRT { enum xprt_stat (*xp_stat) (SVCXPRT *__xprt); /* get transport status */ bool_t (*xp_getargs) (SVCXPRT *__xprt, xdrproc_t __xdr_args, - caddr_t __args_ptr); /* get arguments */ + char *__args_ptr); /* get arguments */ bool_t (*xp_reply) (SVCXPRT *__xprt, struct rpc_msg *__msg); /* send reply */ bool_t (*xp_freeargs) (SVCXPRT *__xprt, xdrproc_t __xdr_args, - caddr_t __args_ptr); + char *__args_ptr); /* free mem allocated for args */ void (*xp_destroy) (SVCXPRT *__xprt); /* destroy this struct */ @@ -109,8 +109,8 @@ struct SVCXPRT { int xp_addrlen; /* length of remote address */ struct sockaddr_in xp_raddr; /* remote address */ struct opaque_auth xp_verf; /* raw response verifier */ - caddr_t xp_p1; /* private */ - caddr_t xp_p2; /* private */ + char * xp_p1; /* private */ + char * xp_p2; /* private */ char xp_pad [256]; /* padding, internal use */ }; @@ -125,7 +125,7 @@ struct SVCXPRT { * SVCXPRT *xprt; * struct rpc_msg *msg; * xdrproc_t xargs; - * caddr_t argsp; + * char * argsp; */ #define SVC_RECV(xprt, msg) \ (*(xprt)->xp_ops->xp_recv)((xprt), (msg)) @@ -166,7 +166,7 @@ struct svc_req { rpcvers_t rq_vers; /* service protocol version */ rpcproc_t rq_proc; /* the desired procedure */ struct opaque_auth rq_cred; /* raw creds from the wire */ - caddr_t rq_clntcred; /* read only cooked cred */ + char *rq_clntcred; /* read only cooked cred */ SVCXPRT *rq_xprt; /* associated transport */ }; @@ -242,7 +242,7 @@ extern void xprt_unregister (SVCXPRT *__xprt) __THROW; */ extern bool_t svc_sendreply (SVCXPRT *__xprt, xdrproc_t __xdr_results, - caddr_t __xdr_location) __THROW; + char *__xdr_location) __THROW; extern void svcerr_decode (SVCXPRT *__xprt) __THROW; diff --git a/sunrpc/rpc/xdr.h b/sunrpc/rpc/xdr.h index d80d8f735d..3007e38d09 100644 --- a/sunrpc/rpc/xdr.h +++ b/sunrpc/rpc/xdr.h @@ -116,7 +116,7 @@ struct XDR /* get a long from underlying stream */ bool_t (*x_putlong) (XDR *__xdrs, const long *__lp); /* put a long to " */ - bool_t (*x_getbytes) (XDR *__xdrs, caddr_t __addr, u_int __len); + bool_t (*x_getbytes) (XDR *__xdrs, char *__addr, u_int __len); /* get some bytes from " */ bool_t (*x_putbytes) (XDR *__xdrs, const char *__addr, u_int __len); /* put some bytes to " */ @@ -134,9 +134,9 @@ struct XDR /* put a int to " */ } *x_ops; - caddr_t x_public; /* users' data */ - caddr_t x_private; /* pointer to private data */ - caddr_t x_base; /* private used for position info */ + char *x_public; /* users' data */ + char *x_private; /* pointer to private data */ + char *x_base; /* private used for position info */ u_int x_handy; /* extra private word */ }; @@ -147,7 +147,7 @@ struct XDR * The opaque pointer generally points to a structure of the data type * to be decoded. If this pointer is 0, then the type routines should * allocate dynamic storage of the appropriate size and return it. - * bool_t (*xdrproc_t)(XDR *, caddr_t *); + * bool_t (*xdrproc_t)(XDR *, char **); */ typedef bool_t (*xdrproc_t) (XDR *, void *,...); @@ -158,7 +158,7 @@ typedef bool_t (*xdrproc_t) (XDR *, void *,...); * XDR *xdrs; * int32_t *int32p; * long *longp; - * caddr_t addr; + * char *addr; * u_int len; * u_int pos; */ @@ -305,12 +305,12 @@ extern bool_t xdr_quad_t (XDR *__xdrs, quad_t *__ip) __THROW; extern bool_t xdr_u_quad_t (XDR *__xdrs, u_quad_t *__up) __THROW; extern bool_t xdr_bool (XDR *__xdrs, bool_t *__bp) __THROW; extern bool_t xdr_enum (XDR *__xdrs, enum_t *__ep) __THROW; -extern bool_t xdr_array (XDR * _xdrs, caddr_t *__addrp, u_int *__sizep, +extern bool_t xdr_array (XDR * _xdrs, char **__addrp, u_int *__sizep, u_int __maxsize, u_int __elsize, xdrproc_t __elproc) __THROW; extern bool_t xdr_bytes (XDR *__xdrs, char **__cpp, u_int *__sizep, u_int __maxsize) __THROW; -extern bool_t xdr_opaque (XDR *__xdrs, caddr_t __cp, u_int __cnt) __THROW; +extern bool_t xdr_opaque (XDR *__xdrs, char *__cp, u_int __cnt) __THROW; extern bool_t xdr_string (XDR *__xdrs, char **__cpp, u_int __maxsize) __THROW; extern bool_t xdr_union (XDR *__xdrs, enum_t *__dscmp, char *__unp, const struct xdr_discrim *__choices, @@ -321,7 +321,7 @@ extern bool_t xdr_vector (XDR *__xdrs, char *__basep, u_int __nelem, u_int __elemsize, xdrproc_t __xdr_elem) __THROW; extern bool_t xdr_float (XDR *__xdrs, float *__fp) __THROW; extern bool_t xdr_double (XDR *__xdrs, double *__dp) __THROW; -extern bool_t xdr_reference (XDR *__xdrs, caddr_t *__xpp, u_int __size, +extern bool_t xdr_reference (XDR *__xdrs, char **__xpp, u_int __size, xdrproc_t __proc) __THROW; extern bool_t xdr_pointer (XDR *__xdrs, char **__objpp, u_int __obj_size, xdrproc_t __xdr_obj) __THROW; @@ -347,7 +347,7 @@ extern bool_t xdr_netobj (XDR *__xdrs, struct netobj *__np) __THROW; */ /* XDR using memory buffers */ -extern void xdrmem_create (XDR *__xdrs, const caddr_t __addr, +extern void xdrmem_create (XDR *__xdrs, const char *__addr, u_int __size, enum xdr_op __xop) __THROW; /* XDR using stdio library */ @@ -356,7 +356,7 @@ extern void xdrstdio_create (XDR *__xdrs, FILE *__file, enum xdr_op __xop) /* XDR pseudo records for tcp */ extern void xdrrec_create (XDR *__xdrs, u_int __sendsize, - u_int __recvsize, caddr_t __tcp_handle, + u_int __recvsize, char *__tcp_handle, int (*__readit) (char *, char *, int), int (*__writeit) (char *, char *, int)) __THROW; diff --git a/sunrpc/rpc_clntout.c b/sunrpc/rpc_clntout.c index ce4d2a4c95..eaacdb637c 100644 --- a/sunrpc/rpc_clntout.c +++ b/sunrpc/rpc_clntout.c @@ -262,7 +262,7 @@ printbody (proc_list * proc) "(clnt_call (clnt, %s, (xdrproc_t) xdr_void, ", proc->proc_name); fprintf (fout, - "(caddr_t) NULL,\n\t\t(xdrproc_t) xdr_%s, (caddr_t) %s%s,", + "(char *) NULL,\n\t\t(xdrproc_t) xdr_%s, (char *) %s%s,", stringfix(proc->res_type), (mtflag)?"":ampr(proc->res_type), RESULT); if (mtflag) @@ -287,7 +287,7 @@ printbody (proc_list * proc) "(clnt_call (clnt, %s, (xdrproc_t) xdr_%s", proc->proc_name, proc->args.argname); fprintf (fout, - ", (caddr_t) &arg,\n\t\t(xdrproc_t) xdr_%s, (caddr_t) %s%s,", + ", (char *) &arg,\n\t\t(xdrproc_t) xdr_%s, (char *) %s%s,", stringfix(proc->res_type), (mtflag)?"":ampr(proc->res_type), RESULT); if (mtflag) @@ -299,7 +299,7 @@ printbody (proc_list * proc) { /* single argument, new or old style */ if (!mtflag) fprintf (fout, - "\tif (clnt_call (clnt, %s,\n\t\t(xdrproc_t) xdr_%s, (caddr_t) %s%s,\n\t\t(xdrproc_t) xdr_%s, (caddr_t) %s%s,\n\t\tTIMEOUT) != RPC_SUCCESS) {\n", + "\tif (clnt_call (clnt, %s,\n\t\t(xdrproc_t) xdr_%s, (char *) %s%s,\n\t\t(xdrproc_t) xdr_%s, (char *) %s%s,\n\t\tTIMEOUT) != RPC_SUCCESS) {\n", proc->proc_name, stringfix (proc->args.decls->decl.type), (newstyle ? "&" : ""), @@ -308,7 +308,7 @@ printbody (proc_list * proc) RESULT); else fprintf(fout, - "\treturn (clnt_call(clnt, %s,\n\t\t(xdrproc_t) xdr_%s, (caddr_t) %s%s,\n\t\t(xdrproc_t) xdr_%s, (caddr_t) %s%s,\n\t\tTIMEOUT));\n", + "\treturn (clnt_call(clnt, %s,\n\t\t(xdrproc_t) xdr_%s, (char *) %s%s,\n\t\t(xdrproc_t) xdr_%s, (char *) %s%s,\n\t\tTIMEOUT));\n", proc->proc_name, stringfix (proc->args.decls->decl.type), (newstyle ? "&" : ""), diff --git a/sunrpc/rpc_cmsg.c b/sunrpc/rpc_cmsg.c index ec8cc6ccca..4164a849f5 100644 --- a/sunrpc/rpc_cmsg.c +++ b/sunrpc/rpc_cmsg.c @@ -76,7 +76,7 @@ xdr_callmsg (XDR *xdrs, struct rpc_msg *cmsg) (void) IXDR_PUT_INT32 (buf, oa->oa_length); if (oa->oa_length) { - memcpy ((caddr_t) buf, oa->oa_base, oa->oa_length); + memcpy ((char *) buf, oa->oa_base, oa->oa_length); buf = (int32_t *) ((char *) buf + RNDUP (oa->oa_length)); } oa = &cmsg->rm_call.cb_verf; @@ -84,7 +84,7 @@ xdr_callmsg (XDR *xdrs, struct rpc_msg *cmsg) (void) IXDR_PUT_INT32 (buf, oa->oa_length); if (oa->oa_length) { - memcpy ((caddr_t) buf, oa->oa_base, oa->oa_length); + memcpy ((char *) buf, oa->oa_base, oa->oa_length); /* no real need.... buf = (long *) ((char *) buf + RNDUP(oa->oa_length)); */ @@ -120,7 +120,7 @@ xdr_callmsg (XDR *xdrs, struct rpc_msg *cmsg) return FALSE; if (oa->oa_base == NULL) { - oa->oa_base = (caddr_t) + oa->oa_base = (char *) mem_alloc (oa->oa_length); } buf = XDR_INLINE (xdrs, RNDUP (oa->oa_length)); @@ -132,7 +132,7 @@ xdr_callmsg (XDR *xdrs, struct rpc_msg *cmsg) } else { - memcpy (oa->oa_base, (caddr_t) buf, oa->oa_length); + memcpy (oa->oa_base, (char *) buf, oa->oa_length); /* no real need.... buf = (long *) ((char *) buf + RNDUP(oa->oa_length)); @@ -160,7 +160,7 @@ xdr_callmsg (XDR *xdrs, struct rpc_msg *cmsg) return FALSE; if (oa->oa_base == NULL) { - oa->oa_base = (caddr_t) + oa->oa_base = (char *) mem_alloc (oa->oa_length); } buf = XDR_INLINE (xdrs, RNDUP (oa->oa_length)); @@ -172,7 +172,7 @@ xdr_callmsg (XDR *xdrs, struct rpc_msg *cmsg) } else { - memcpy (oa->oa_base, (caddr_t) buf, oa->oa_length); + memcpy (oa->oa_base, (char *) buf, oa->oa_length); /* no real need... buf = (long *) ((char *) buf + RNDUP(oa->oa_length)); diff --git a/sunrpc/rpc_hout.c b/sunrpc/rpc_hout.c index 10f793d233..027d687219 100644 --- a/sunrpc/rpc_hout.c +++ b/sunrpc/rpc_hout.c @@ -277,7 +277,7 @@ pfreeprocdef (const char *name, const char *vers, int mode) f_print (fout, "extern int "); pvname (name, vers); if (mode == 1) - f_print (fout,"_freeresult (SVCXPRT *, xdrproc_t, caddr_t);\n"); + f_print (fout,"_freeresult (SVCXPRT *, xdrproc_t, char *);\n"); else f_print (fout,"_freeresult ();\n"); } diff --git a/sunrpc/rpc_prot.c b/sunrpc/rpc_prot.c index 46582f2a35..bd98264de1 100644 --- a/sunrpc/rpc_prot.c +++ b/sunrpc/rpc_prot.c @@ -65,7 +65,7 @@ libc_hidden_nolink_sunrpc (xdr_opaque_auth, GLIBC_2_0) bool_t xdr_des_block (XDR *xdrs, des_block *blkp) { - return xdr_opaque (xdrs, (caddr_t) blkp, sizeof (des_block)); + return xdr_opaque (xdrs, (char *) blkp, sizeof (des_block)); } libc_hidden_nolink_sunrpc (xdr_des_block, GLIBC_2_0) @@ -136,7 +136,7 @@ xdr_replymsg (XDR *xdrs, struct rpc_msg *rmsg) xdr_enum (xdrs, (enum_t *) & (rmsg->rm_direction)) && (rmsg->rm_direction == REPLY)) return xdr_union (xdrs, (enum_t *) & (rmsg->rm_reply.rp_stat), - (caddr_t) & (rmsg->rm_reply.ru), reply_dscrm, + (char *) & (rmsg->rm_reply.ru), reply_dscrm, NULL_xdrproc_t); return FALSE; } diff --git a/sunrpc/rpc_sample.c b/sunrpc/rpc_sample.c index e90b58c080..1a267f1cfa 100644 --- a/sunrpc/rpc_sample.c +++ b/sunrpc/rpc_sample.c @@ -264,13 +264,13 @@ write_sample_server (definition * def) f_print(fout, "\nint\n"); pvname(def->def_name, vp->vers_num); if (Cflag) - f_print(fout,"_freeresult (SVCXPRT *transp, xdrproc_t xdr_result, caddr_t result)\n"); + f_print(fout,"_freeresult (SVCXPRT *transp, xdrproc_t xdr_result, char *result)\n"); else { f_print(fout,"_freeresult (transp, xdr_result, result)\n"); f_print(fout,"\tSVCXPRT *transp;\n"); f_print(fout,"\txdrproc_t xdr_result;\n"); - f_print(fout,"\tcaddr_t result;\n"); + f_print(fout,"\tchar *result;\n"); } f_print(fout, "{\n"); f_print(fout, "\txdr_free (xdr_result, result);\n"); diff --git a/sunrpc/rpc_svcout.c b/sunrpc/rpc_svcout.c index 4f12a8146c..3eca750d46 100644 --- a/sunrpc/rpc_svcout.c +++ b/sunrpc/rpc_svcout.c @@ -624,7 +624,7 @@ write_program (const definition * def, const char *storage) { f_print(fout,"\tif (!"); pvname(def->def_name, vp->vers_num); - f_print(fout,"_freeresult (%s, _xdr_%s, (caddr_t) &%s))\n", + f_print(fout,"_freeresult (%s, _xdr_%s, (char *) &%s))\n", TRANSP, RESULT, RESULT); (void) sprintf(_errbuf, "unable to free results"); print_err_message("\t\t"); @@ -644,7 +644,7 @@ printerr (const char *err, const char *transp) static void printif (const char *proc, const char *transp, const char *arg) { - f_print (fout, "\tif (!svc_%s (%s, (xdrproc_t) _xdr_%s, (caddr_t) &%s)) {\n", + f_print (fout, "\tif (!svc_%s (%s, (xdrproc_t) _xdr_%s, (char *) &%s)) {\n", proc, transp, arg, arg); } @@ -773,7 +773,7 @@ write_msg_out (void) } else { - f_print (fout, "void _msgout (char* msg)\n"); + f_print (fout, "void _msgout (char *msg)\n"); } f_print (fout, "{\n"); f_print (fout, "#ifdef RPC_SVC_FG\n"); diff --git a/sunrpc/svc.c b/sunrpc/svc.c index 39279b40b5..95ecfbb2d1 100644 --- a/sunrpc/svc.c +++ b/sunrpc/svc.c @@ -250,7 +250,7 @@ libc_hidden_nolink_sunrpc (svc_unregister, GLIBC_2_0) /* Send a reply to an rpc request */ bool_t svc_sendreply (register SVCXPRT *xprt, xdrproc_t xdr_results, - caddr_t xdr_location) + char *xdr_location) { struct rpc_msg rply; diff --git a/sunrpc/svc_authux.c b/sunrpc/svc_authux.c index 0c6b0242cd..1a703782f4 100644 --- a/sunrpc/svc_authux.c +++ b/sunrpc/svc_authux.c @@ -78,7 +78,7 @@ _svcauth_unix (struct svc_req *rqst, struct rpc_msg *msg) stat = AUTH_BADCRED; goto done; } - memcpy (aup->aup_machname, (caddr_t) buf, (u_int) str_len); + memcpy (aup->aup_machname, (char *) buf, (u_int) str_len); aup->aup_machname[str_len] = 0; str_len = RNDUP (str_len); buf = (int32_t *) ((char *) buf + str_len); diff --git a/sunrpc/svc_raw.c b/sunrpc/svc_raw.c index f0176311d5..f7a3f913bf 100644 --- a/sunrpc/svc_raw.c +++ b/sunrpc/svc_raw.c @@ -52,9 +52,9 @@ struct svcraw_private_s static bool_t svcraw_recv (SVCXPRT *, struct rpc_msg *); static enum xprt_stat svcraw_stat (SVCXPRT *); -static bool_t svcraw_getargs (SVCXPRT *, xdrproc_t, caddr_t); +static bool_t svcraw_getargs (SVCXPRT *, xdrproc_t, char *); static bool_t svcraw_reply (SVCXPRT *, struct rpc_msg *); -static bool_t svcraw_freeargs (SVCXPRT *, xdrproc_t, caddr_t); +static bool_t svcraw_freeargs (SVCXPRT *, xdrproc_t, char *); static void svcraw_destroy (SVCXPRT *); static const struct xp_ops server_ops = @@ -127,7 +127,7 @@ svcraw_reply (SVCXPRT *xprt, struct rpc_msg *msg) } static bool_t -svcraw_getargs (SVCXPRT *xprt, xdrproc_t xdr_args, caddr_t args_ptr) +svcraw_getargs (SVCXPRT *xprt, xdrproc_t xdr_args, char *args_ptr) { struct svcraw_private_s *srp = svcraw_private; @@ -137,7 +137,7 @@ svcraw_getargs (SVCXPRT *xprt, xdrproc_t xdr_args, caddr_t args_ptr) } static bool_t -svcraw_freeargs (SVCXPRT *xprt, xdrproc_t xdr_args, caddr_t args_ptr) +svcraw_freeargs (SVCXPRT *xprt, xdrproc_t xdr_args, char *args_ptr) { struct svcraw_private_s *srp = svcraw_private; XDR *xdrs; diff --git a/sunrpc/svc_tcp.c b/sunrpc/svc_tcp.c index 484574c11a..4d712a75d8 100644 --- a/sunrpc/svc_tcp.c +++ b/sunrpc/svc_tcp.c @@ -71,9 +71,9 @@ */ static bool_t svctcp_recv (SVCXPRT *, struct rpc_msg *); static enum xprt_stat svctcp_stat (SVCXPRT *); -static bool_t svctcp_getargs (SVCXPRT *, xdrproc_t, caddr_t); +static bool_t svctcp_getargs (SVCXPRT *, xdrproc_t, char *); static bool_t svctcp_reply (SVCXPRT *, struct rpc_msg *); -static bool_t svctcp_freeargs (SVCXPRT *, xdrproc_t, caddr_t); +static bool_t svctcp_freeargs (SVCXPRT *, xdrproc_t, char *); static void svctcp_destroy (SVCXPRT *); static const struct xp_ops svctcp_op = @@ -105,9 +105,9 @@ static const struct xp_ops svctcp_rendezvous_op = { rendezvous_request, rendezvous_stat, - (bool_t (*) (SVCXPRT *, xdrproc_t, caddr_t)) svctcp_rendezvous_abort, + (bool_t (*) (SVCXPRT *, xdrproc_t, char *)) svctcp_rendezvous_abort, (bool_t (*) (SVCXPRT *, struct rpc_msg *)) svctcp_rendezvous_abort, - (bool_t (*) (SVCXPRT *, xdrproc_t, caddr_t)) svctcp_rendezvous_abort, + (bool_t (*) (SVCXPRT *, xdrproc_t, char *)) svctcp_rendezvous_abort, svctcp_destroy }; @@ -194,7 +194,7 @@ svctcp_create (int sock, u_int sendsize, u_int recvsize) r->sendsize = sendsize; r->recvsize = recvsize; xprt->xp_p2 = NULL; - xprt->xp_p1 = (caddr_t) r; + xprt->xp_p1 = (char *) r; xprt->xp_verf = _null_auth; xprt->xp_ops = &svctcp_rendezvous_op; xprt->xp_port = ntohs (addr.sin_port); @@ -237,9 +237,9 @@ makefd_xprt (int fd, u_int sendsize, u_int recvsize) } cd->strm_stat = XPRT_IDLE; xdrrec_create (&(cd->xdrs), sendsize, recvsize, - (caddr_t) xprt, readtcp, writetcp); + (char *) xprt, readtcp, writetcp); xprt->xp_p2 = NULL; - xprt->xp_p1 = (caddr_t) cd; + xprt->xp_p1 = (char *) cd; xprt->xp_verf.oa_base = cd->verf_body; xprt->xp_addrlen = 0; xprt->xp_ops = &svctcp_op; /* truly deals with calls */ @@ -299,8 +299,8 @@ svctcp_destroy (SVCXPRT *xprt) /* an actual connection socket */ XDR_DESTROY (&(cd->xdrs)); } - mem_free ((caddr_t) cd, sizeof (struct tcp_conn)); - mem_free ((caddr_t) xprt, sizeof (SVCXPRT)); + mem_free ((char *) cd, sizeof (struct tcp_conn)); + mem_free ((char *) xprt, sizeof (SVCXPRT)); } @@ -351,7 +351,7 @@ readtcp (char *xprtptr, char *buf, int len) * Any error is fatal and the connection is closed. */ static int -writetcp (char *xprtptr, char * buf, int len) +writetcp (char *xprtptr, char *buf, int len) { SVCXPRT *xprt = (SVCXPRT *)xprtptr; int i, cnt; @@ -398,14 +398,14 @@ svctcp_recv (SVCXPRT *xprt, struct rpc_msg *msg) } static bool_t -svctcp_getargs (SVCXPRT *xprt, xdrproc_t xdr_args, caddr_t args_ptr) +svctcp_getargs (SVCXPRT *xprt, xdrproc_t xdr_args, char *args_ptr) { return ((*xdr_args) (&(((struct tcp_conn *) (xprt->xp_p1))->xdrs), args_ptr)); } static bool_t -svctcp_freeargs (SVCXPRT *xprt, xdrproc_t xdr_args, caddr_t args_ptr) +svctcp_freeargs (SVCXPRT *xprt, xdrproc_t xdr_args, char *args_ptr) { XDR *xdrs = &(((struct tcp_conn *) (xprt->xp_p1))->xdrs); diff --git a/sunrpc/svc_udp.c b/sunrpc/svc_udp.c index 17357c8ced..5193731beb 100644 --- a/sunrpc/svc_udp.c +++ b/sunrpc/svc_udp.c @@ -74,8 +74,8 @@ static bool_t svcudp_recv (SVCXPRT *, struct rpc_msg *); static bool_t svcudp_reply (SVCXPRT *, struct rpc_msg *); static enum xprt_stat svcudp_stat (SVCXPRT *); -static bool_t svcudp_getargs (SVCXPRT *, xdrproc_t, caddr_t); -static bool_t svcudp_freeargs (SVCXPRT *, xdrproc_t, caddr_t); +static bool_t svcudp_getargs (SVCXPRT *, xdrproc_t, char *); +static bool_t svcudp_freeargs (SVCXPRT *, xdrproc_t, char *); static void svcudp_destroy (SVCXPRT *); static const struct xp_ops svcudp_op = @@ -168,7 +168,7 @@ svcudp_bufcreate (int sock, u_int sendsz, u_int recvsz) rpc_buffer (xprt) = buf; xdrmem_create (&(su->su_xdrs), rpc_buffer (xprt), su->su_iosz, XDR_DECODE); su->su_cache = NULL; - xprt->xp_p2 = (caddr_t) su; + xprt->xp_p2 = (char *) su; xprt->xp_verf.oa_base = su->su_verfbody; xprt->xp_ops = &svcudp_op; xprt->xp_port = ntohs (addr.sin_port); @@ -368,14 +368,14 @@ svcudp_reply (SVCXPRT *xprt, struct rpc_msg *msg) } static bool_t -svcudp_getargs (SVCXPRT *xprt, xdrproc_t xdr_args, caddr_t args_ptr) +svcudp_getargs (SVCXPRT *xprt, xdrproc_t xdr_args, char *args_ptr) { return (*xdr_args) (&(su_data (xprt)->su_xdrs), args_ptr); } static bool_t -svcudp_freeargs (SVCXPRT *xprt, xdrproc_t xdr_args, caddr_t args_ptr) +svcudp_freeargs (SVCXPRT *xprt, xdrproc_t xdr_args, char *args_ptr) { XDR *xdrs = &(su_data (xprt)->su_xdrs); @@ -392,8 +392,8 @@ svcudp_destroy (SVCXPRT *xprt) (void) __close (xprt->xp_sock); XDR_DESTROY (&(su->su_xdrs)); mem_free (rpc_buffer (xprt), su->su_iosz); - mem_free ((caddr_t) su, sizeof (struct svcudp_data)); - mem_free ((caddr_t) xprt, sizeof (SVCXPRT)); + mem_free ((char *) su, sizeof (struct svcudp_data)); + mem_free ((char *) xprt, sizeof (SVCXPRT)); } diff --git a/sunrpc/svc_unix.c b/sunrpc/svc_unix.c index eac1ae8fb9..11e8797007 100644 --- a/sunrpc/svc_unix.c +++ b/sunrpc/svc_unix.c @@ -71,9 +71,9 @@ */ static bool_t svcunix_recv (SVCXPRT *, struct rpc_msg *); static enum xprt_stat svcunix_stat (SVCXPRT *); -static bool_t svcunix_getargs (SVCXPRT *, xdrproc_t, caddr_t); +static bool_t svcunix_getargs (SVCXPRT *, xdrproc_t, char *); static bool_t svcunix_reply (SVCXPRT *, struct rpc_msg *); -static bool_t svcunix_freeargs (SVCXPRT *, xdrproc_t, caddr_t); +static bool_t svcunix_freeargs (SVCXPRT *, xdrproc_t, char *); static void svcunix_destroy (SVCXPRT *); static const struct xp_ops svcunix_op = @@ -105,9 +105,9 @@ static const struct xp_ops svcunix_rendezvous_op = { rendezvous_request, rendezvous_stat, - (bool_t (*) (SVCXPRT *, xdrproc_t, caddr_t)) svcunix_rendezvous_abort, + (bool_t (*) (SVCXPRT *, xdrproc_t, char *)) svcunix_rendezvous_abort, (bool_t (*) (SVCXPRT *, struct rpc_msg *)) svcunix_rendezvous_abort, - (bool_t (*) (SVCXPRT *, xdrproc_t, caddr_t)) svcunix_rendezvous_abort, + (bool_t (*) (SVCXPRT *, xdrproc_t, char *)) svcunix_rendezvous_abort, svcunix_destroy }; @@ -194,7 +194,7 @@ svcunix_create (int sock, u_int sendsize, u_int recvsize, char *path) r->sendsize = sendsize; r->recvsize = recvsize; xprt->xp_p2 = NULL; - xprt->xp_p1 = (caddr_t) r; + xprt->xp_p1 = (char *) r; xprt->xp_verf = _null_auth; xprt->xp_ops = &svcunix_rendezvous_op; xprt->xp_port = -1; @@ -233,9 +233,9 @@ makefd_xprt (int fd, u_int sendsize, u_int recvsize) } cd->strm_stat = XPRT_IDLE; xdrrec_create (&(cd->xdrs), sendsize, recvsize, - (caddr_t) xprt, readunix, writeunix); + (char *) xprt, readunix, writeunix); xprt->xp_p2 = NULL; - xprt->xp_p1 = (caddr_t) cd; + xprt->xp_p1 = (char *) cd; xprt->xp_verf.oa_base = cd->verf_body; xprt->xp_addrlen = 0; xprt->xp_ops = &svcunix_op; /* truly deals with calls */ @@ -298,8 +298,8 @@ svcunix_destroy (SVCXPRT *xprt) /* an actual connection socket */ XDR_DESTROY (&(cd->xdrs)); } - mem_free ((caddr_t) cd, sizeof (struct unix_conn)); - mem_free ((caddr_t) xprt, sizeof (SVCXPRT)); + mem_free ((char *) cd, sizeof (struct unix_conn)); + mem_free ((char *) xprt, sizeof (SVCXPRT)); } #ifdef SCM_CREDENTIALS @@ -331,7 +331,7 @@ __msgread (int sock, void *data, size_t cnt) msg.msg_name = NULL; msg.msg_namelen = 0; #ifdef SCM_CREDENTIALS - msg.msg_control = (caddr_t) &cm; + msg.msg_control = (char *) &cm; msg.msg_controllen = sizeof (struct cmessage); #endif msg.msg_flags = 0; @@ -453,7 +453,7 @@ readunix (char *xprtptr, char *buf, int len) * Any error is fatal and the connection is closed. */ static int -writeunix (char *xprtptr, char * buf, int len) +writeunix (char *xprtptr, char *buf, int len) { SVCXPRT *xprt = (SVCXPRT *) xprtptr; int i, cnt; @@ -496,7 +496,7 @@ svcunix_recv (SVCXPRT *xprt, struct rpc_msg *msg) /* set up verifiers */ #ifdef SCM_CREDENTIALS msg->rm_call.cb_verf.oa_flavor = AUTH_UNIX; - msg->rm_call.cb_verf.oa_base = (caddr_t) &cm; + msg->rm_call.cb_verf.oa_base = (char *) &cm; msg->rm_call.cb_verf.oa_length = sizeof (cm); #endif return TRUE; @@ -506,14 +506,14 @@ svcunix_recv (SVCXPRT *xprt, struct rpc_msg *msg) } static bool_t -svcunix_getargs (SVCXPRT *xprt, xdrproc_t xdr_args, caddr_t args_ptr) +svcunix_getargs (SVCXPRT *xprt, xdrproc_t xdr_args, char *args_ptr) { return (*xdr_args) (&(((struct unix_conn *) (xprt->xp_p1))->xdrs), args_ptr); } static bool_t -svcunix_freeargs (SVCXPRT *xprt, xdrproc_t xdr_args, caddr_t args_ptr) +svcunix_freeargs (SVCXPRT *xprt, xdrproc_t xdr_args, char *args_ptr) { XDR *xdrs = &(((struct unix_conn *) (xprt->xp_p1))->xdrs); diff --git a/sunrpc/xdr.c b/sunrpc/xdr.c index b5fb7455e2..98967dfd35 100644 --- a/sunrpc/xdr.c +++ b/sunrpc/xdr.c @@ -539,7 +539,7 @@ libc_hidden_nolink_sunrpc (xdr_enum, GLIBC_2_0) * cp points to the opaque object and cnt gives the byte length. */ bool_t -xdr_opaque (XDR *xdrs, caddr_t cp, u_int cnt) +xdr_opaque (XDR *xdrs, char *cp, u_int cnt) { u_int rndup; static char crud[BYTES_PER_XDR_UNIT]; @@ -566,7 +566,7 @@ xdr_opaque (XDR *xdrs, caddr_t cp, u_int cnt) } if (rndup == 0) return TRUE; - return XDR_GETBYTES (xdrs, (caddr_t)crud, rndup); + return XDR_GETBYTES (xdrs, (char *)crud, rndup); case XDR_ENCODE: if (!XDR_PUTBYTES (xdrs, cp, cnt)) diff --git a/sunrpc/xdr_array.c b/sunrpc/xdr_array.c index 18383d437e..a4f0853843 100644 --- a/sunrpc/xdr_array.c +++ b/sunrpc/xdr_array.c @@ -56,7 +56,7 @@ bool_t xdr_array (XDR *xdrs, /* array pointer */ - caddr_t *addrp, + char **addrp, /* number of elements */ u_int *sizep, /* max numberof elements */ @@ -67,7 +67,7 @@ xdr_array (XDR *xdrs, xdrproc_t elproc) { u_int i; - caddr_t target = *addrp; + char *target = *addrp; u_int c; /* the actual element count */ bool_t stat = TRUE; diff --git a/sunrpc/xdr_mem.c b/sunrpc/xdr_mem.c index 46a1f6f190..f4af0acb39 100644 --- a/sunrpc/xdr_mem.c +++ b/sunrpc/xdr_mem.c @@ -42,7 +42,7 @@ static bool_t xdrmem_getlong (XDR *, long *); static bool_t xdrmem_putlong (XDR *, const long *); -static bool_t xdrmem_getbytes (XDR *, caddr_t, u_int); +static bool_t xdrmem_getbytes (XDR *, char *, u_int); static bool_t xdrmem_putbytes (XDR *, const char *, u_int); static u_int xdrmem_getpos (const XDR *); static bool_t xdrmem_setpos (XDR *, u_int); @@ -70,13 +70,13 @@ static const struct xdr_ops xdrmem_ops = * memory buffer. */ void -xdrmem_create (XDR *xdrs, const caddr_t addr, u_int size, enum xdr_op op) +xdrmem_create (XDR *xdrs, const char *addr, u_int size, enum xdr_op op) { xdrs->x_op = op; /* We have to add the const since the `struct xdr_ops' in `struct XDR' is not `const'. */ xdrs->x_ops = (struct xdr_ops *) &xdrmem_ops; - xdrs->x_private = xdrs->x_base = addr; + xdrs->x_private = xdrs->x_base = (char *)addr; xdrs->x_handy = size; } #ifdef EXPORT_RPC_SYMBOLS @@ -134,7 +134,7 @@ xdrmem_putlong (XDR *xdrs, const long *lp) * a good idea. None of the things pointed to are const. */ static bool_t -xdrmem_getbytes (XDR *xdrs, caddr_t addr, u_int len) +xdrmem_getbytes (XDR *xdrs, char *addr, u_int len) { if (xdrs->x_handy < len) return FALSE; @@ -175,8 +175,8 @@ xdrmem_getpos (const XDR *xdrs) static bool_t xdrmem_setpos (XDR *xdrs, u_int pos) { - caddr_t newaddr = xdrs->x_base + pos; - caddr_t lastaddr = xdrs->x_private + xdrs->x_handy; + char *newaddr = xdrs->x_base + pos; + char *lastaddr = xdrs->x_private + xdrs->x_handy; size_t handy = lastaddr - newaddr; if (newaddr > lastaddr diff --git a/sunrpc/xdr_rec.c b/sunrpc/xdr_rec.c index c9a1eaad63..5d777803ed 100644 --- a/sunrpc/xdr_rec.c +++ b/sunrpc/xdr_rec.c @@ -54,7 +54,7 @@ static bool_t xdrrec_getlong (XDR *, long *); static bool_t xdrrec_putlong (XDR *, const long *); -static bool_t xdrrec_getbytes (XDR *, caddr_t, u_int); +static bool_t xdrrec_getbytes (XDR *, char *, u_int); static bool_t xdrrec_putbytes (XDR *, const char *, u_int); static u_int xdrrec_getpos (const XDR *); static bool_t xdrrec_setpos (XDR *, u_int); @@ -93,15 +93,15 @@ static const struct xdr_ops xdrrec_ops = { typedef struct rec_strm { - caddr_t tcp_handle; - caddr_t the_buffer; + char *tcp_handle; + char *the_buffer; /* * out-going bits */ int (*writeit) (char *, char *, int); - caddr_t out_base; /* output buffer (points to frag header) */ - caddr_t out_finger; /* next output position */ - caddr_t out_boundry; /* data cannot up to this address */ + char *out_base; /* output buffer (points to frag header) */ + char *out_finger; /* next output position */ + char *out_boundry; /* data cannot up to this address */ uint32_t *frag_header; /* beginning of curren fragment */ bool_t frag_sent; /* true if buffer sent in middle of record */ /* @@ -109,9 +109,9 @@ typedef struct rec_strm */ int (*readit) (char *, char *, int); u_long in_size; /* fixed size of the input buffer */ - caddr_t in_base; - caddr_t in_finger; /* location of next byte to be had */ - caddr_t in_boundry; /* can read up to this location */ + char *in_base; + char *in_finger; /* location of next byte to be had */ + char *in_boundry; /* can read up to this location */ long fbtbc; /* fragment bytes to be consumed */ bool_t last_frag; u_int sendsize; @@ -123,7 +123,7 @@ static u_int fix_buf_size (u_int); static bool_t skip_input_bytes (RECSTREAM *, long); static bool_t flush_out (RECSTREAM *, bool_t); static bool_t set_input_fragment (RECSTREAM *); -static bool_t get_input_bytes (RECSTREAM *, caddr_t, int); +static bool_t get_input_bytes (RECSTREAM *, char *, int); /* * Create an xdr handle for xdrrec @@ -136,12 +136,12 @@ static bool_t get_input_bytes (RECSTREAM *, caddr_t, int); */ void xdrrec_create (XDR *xdrs, u_int sendsize, - u_int recvsize, caddr_t tcp_handle, + u_int recvsize, char *tcp_handle, int (*readit) (char *, char *, int), int (*writeit) (char *, char *, int)) { RECSTREAM *rstrm = (RECSTREAM *) mem_alloc (sizeof (RECSTREAM)); - caddr_t tmp; + char *tmp; char *buf; sendsize = fix_buf_size (sendsize); @@ -176,7 +176,7 @@ xdrrec_create (XDR *xdrs, u_int sendsize, /* We have to add the cast since the `struct xdr_ops' in `struct XDR' is not `const'. */ xdrs->x_ops = (struct xdr_ops *) &xdrrec_ops; - xdrs->x_private = (caddr_t) rstrm; + xdrs->x_private = (char *) rstrm; rstrm->tcp_handle = tcp_handle; rstrm->readit = readit; rstrm->writeit = writeit; @@ -216,7 +216,7 @@ xdrrec_getlong (XDR *xdrs, long *lp) } else { - if (!xdrrec_getbytes (xdrs, (caddr_t) & mylong, + if (!xdrrec_getbytes (xdrs, (char *) & mylong, BYTES_PER_XDR_UNIT)) return FALSE; *lp = (int32_t) ntohl (mylong); @@ -248,7 +248,7 @@ xdrrec_putlong (XDR *xdrs, const long *lp) } static bool_t /* must manage buffers, fragments, and records */ -xdrrec_getbytes (XDR *xdrs, caddr_t addr, u_int len) +xdrrec_getbytes (XDR *xdrs, char *addr, u_int len) { RECSTREAM *rstrm = (RECSTREAM *) xdrs->x_private; u_int current; @@ -330,7 +330,7 @@ xdrrec_setpos (XDR *xdrs, u_int pos) RECSTREAM *rstrm = (RECSTREAM *) xdrs->x_private; u_int currpos = xdrrec_getpos (xdrs); int delta = currpos - pos; - caddr_t newpos; + char *newpos; if ((int) currpos != -1) switch (xdrs->x_op) @@ -338,7 +338,7 @@ xdrrec_setpos (XDR *xdrs, u_int pos) case XDR_ENCODE: newpos = rstrm->out_finger - delta; - if (newpos > (caddr_t) rstrm->frag_header && + if (newpos > (char *) rstrm->frag_header && newpos < rstrm->out_boundry) { rstrm->out_finger = newpos; @@ -404,7 +404,7 @@ xdrrec_destroy (XDR *xdrs) mem_free (rstrm->the_buffer, rstrm->sendsize + rstrm->recvsize + BYTES_PER_XDR_UNIT); - mem_free ((caddr_t) rstrm, sizeof (RECSTREAM)); + mem_free ((char *) rstrm, sizeof (RECSTREAM)); } static bool_t @@ -424,7 +424,7 @@ xdrrec_getint32 (XDR *xdrs, int32_t *ip) } else { - if (!xdrrec_getbytes (xdrs, (caddr_t) &mylong, + if (!xdrrec_getbytes (xdrs, (char *) &mylong, BYTES_PER_XDR_UNIT)) return FALSE; *ip = ntohl (mylong); @@ -549,14 +549,14 @@ flush_out (RECSTREAM *rstrm, bool_t eor) != (int) len) return FALSE; rstrm->frag_header = (uint32_t *) rstrm->out_base; - rstrm->out_finger = (caddr_t) rstrm->out_base + BYTES_PER_XDR_UNIT; + rstrm->out_finger = (char *) rstrm->out_base + BYTES_PER_XDR_UNIT; return TRUE; } static bool_t /* knows nothing about records! Only about input buffers */ fill_input_buf (RECSTREAM *rstrm) { - caddr_t where; + char *where; size_t i; int len; @@ -573,7 +573,7 @@ fill_input_buf (RECSTREAM *rstrm) } static bool_t /* knows nothing about records! Only about input buffers */ -get_input_bytes (RECSTREAM *rstrm, caddr_t addr, int len) +get_input_bytes (RECSTREAM *rstrm, char *addr, int len) { int current; @@ -600,7 +600,7 @@ set_input_fragment (RECSTREAM *rstrm) { uint32_t header; - if (! get_input_bytes (rstrm, (caddr_t)&header, BYTES_PER_XDR_UNIT)) + if (! get_input_bytes (rstrm, (char *)&header, BYTES_PER_XDR_UNIT)) return FALSE; header = ntohl (header); rstrm->last_frag = ((header & LAST_FRAG) == 0) ? FALSE : TRUE; diff --git a/sunrpc/xdr_ref.c b/sunrpc/xdr_ref.c index eab3b74227..abb9ac24f5 100644 --- a/sunrpc/xdr_ref.c +++ b/sunrpc/xdr_ref.c @@ -57,13 +57,13 @@ bool_t xdr_reference (XDR *xdrs, /* the pointer to work on */ - caddr_t *pp, + char **pp, /* size of the object pointed to */ u_int size, /* xdr routine to handle the object */ xdrproc_t proc) { - caddr_t loc = *pp; + char *loc = *pp; bool_t stat; if (loc == NULL) @@ -73,7 +73,7 @@ xdr_reference (XDR *xdrs, return TRUE; case XDR_DECODE: - *pp = loc = (caddr_t) calloc (1, size); + *pp = loc = (char *) calloc (1, size); if (loc == NULL) { (void) __fxprintf (NULL, "%s: %s", __func__, _("out of memory\n")); diff --git a/sunrpc/xdr_sizeof.c b/sunrpc/xdr_sizeof.c index 1592406d64..150d043078 100644 --- a/sunrpc/xdr_sizeof.c +++ b/sunrpc/xdr_sizeof.c @@ -87,7 +87,7 @@ x_inline (XDR *xdrs, u_int len) { /* Free the earlier space and allocate new area */ free (xdrs->x_private); - if ((xdrs->x_private = (caddr_t) malloc (len)) == NULL) + if ((xdrs->x_private = (char *) malloc (len)) == NULL) { xdrs->x_base = 0; return NULL; @@ -133,7 +133,7 @@ xdr_sizeof (xdrproc_t func, void *data) bool_t stat; /* to stop ANSI-C compiler from complaining */ typedef bool_t (*dummyfunc1) (XDR *, long *); - typedef bool_t (*dummyfunc2) (XDR *, caddr_t, u_int); + typedef bool_t (*dummyfunc2) (XDR *, char *, u_int); typedef bool_t (*dummyfunc3) (XDR *, int32_t *); ops.x_putlong = x_putlong; @@ -152,8 +152,8 @@ xdr_sizeof (xdrproc_t func, void *data) x.x_op = XDR_ENCODE; x.x_ops = &ops; x.x_handy = 0; - x.x_private = (caddr_t) NULL; - x.x_base = (caddr_t) 0; + x.x_private = (char *) NULL; + x.x_base = (char *) 0; stat = func (&x, data); free (x.x_private); diff --git a/sunrpc/xdr_stdio.c b/sunrpc/xdr_stdio.c index 0c2cbb78de..459585bf0d 100644 --- a/sunrpc/xdr_stdio.c +++ b/sunrpc/xdr_stdio.c @@ -49,7 +49,7 @@ static bool_t xdrstdio_getlong (XDR *, long *); static bool_t xdrstdio_putlong (XDR *, const long *); -static bool_t xdrstdio_getbytes (XDR *, caddr_t, u_int); +static bool_t xdrstdio_getbytes (XDR *, char *, u_int); static bool_t xdrstdio_putbytes (XDR *, const char *, u_int); static u_int xdrstdio_getpos (const XDR *); static bool_t xdrstdio_setpos (XDR *, u_int); @@ -87,7 +87,7 @@ xdrstdio_create (XDR *xdrs, FILE *file, enum xdr_op op) /* We have to add the const since the `struct xdr_ops' in `struct XDR' is not `const'. */ xdrs->x_ops = (struct xdr_ops *) &xdrstdio_ops; - xdrs->x_private = (caddr_t) file; + xdrs->x_private = (char *) file; xdrs->x_handy = 0; xdrs->x_base = 0; } @@ -108,7 +108,7 @@ xdrstdio_getlong (XDR *xdrs, long *lp) { uint32_t mycopy; - if (fread ((caddr_t) &mycopy, 4, 1, (FILE *) xdrs->x_private) != 1) + if (fread ((char *) &mycopy, 4, 1, (FILE *) xdrs->x_private) != 1) return FALSE; *lp = (long) ntohl (mycopy); return TRUE; @@ -119,13 +119,13 @@ xdrstdio_putlong (XDR *xdrs, const long *lp) { int32_t mycopy = htonl ((uint32_t) *lp); - if (fwrite ((caddr_t) &mycopy, 4, 1, (FILE *) xdrs->x_private) != 1) + if (fwrite ((char *) &mycopy, 4, 1, (FILE *) xdrs->x_private) != 1) return FALSE; return TRUE; } static bool_t -xdrstdio_getbytes (XDR *xdrs, const caddr_t addr, u_int len) +xdrstdio_getbytes (XDR *xdrs, char *addr, u_int len) { if ((len != 0) && (fread (addr, (int) len, 1, (FILE *) xdrs->x_private) != 1)) @@ -174,7 +174,7 @@ xdrstdio_getint32 (XDR *xdrs, int32_t *ip) { int32_t mycopy; - if (fread ((caddr_t) &mycopy, 4, 1, (FILE *) xdrs->x_private) != 1) + if (fread ((char *) &mycopy, 4, 1, (FILE *) xdrs->x_private) != 1) return FALSE; *ip = ntohl (mycopy); return TRUE; @@ -186,7 +186,7 @@ xdrstdio_putint32 (XDR *xdrs, const int32_t *ip) int32_t mycopy = htonl (*ip); ip = &mycopy; - if (fwrite ((caddr_t) ip, 4, 1, (FILE *) xdrs->x_private) != 1) + if (fwrite ((char *) ip, 4, 1, (FILE *) xdrs->x_private) != 1) return FALSE; return TRUE; } diff --git a/support/xunistd.h b/support/xunistd.h index 338eb86a1b..76b74b5f76 100644 --- a/support/xunistd.h +++ b/support/xunistd.h @@ -64,8 +64,8 @@ void *xmmap (void *addr, size_t length, int prot, int flags, int fd); void xmprotect (void *addr, size_t length, int prot); void xmunmap (void *addr, size_t length); -ssize_t xcopy_file_range(int fd_in, loff_t *off_in, int fd_out, - loff_t *off_out, size_t len, unsigned int flags); +ssize_t xcopy_file_range(int fd_in, off64_t *off_in, int fd_out, + off64_t *off_out, size_t len, unsigned int flags); __END_DECLS diff --git a/sysdeps/gnu/net/if.h b/sysdeps/gnu/net/if.h index 303d092739..e94ed67c21 100644 --- a/sysdeps/gnu/net/if.h +++ b/sysdeps/gnu/net/if.h @@ -145,7 +145,7 @@ struct ifreq struct ifmap ifru_map; char ifru_slave[IFNAMSIZ]; /* Just fits the size */ char ifru_newname[IFNAMSIZ]; - __caddr_t ifru_data; + char *ifru_data; } ifr_ifru; }; # define ifr_name ifr_ifrn.ifrn_name /* interface name */ @@ -178,7 +178,7 @@ struct ifconf int ifc_len; /* Size of buffer. */ union { - __caddr_t ifcu_buf; + char *ifcu_buf; struct ifreq *ifcu_req; } ifc_ifcu; }; diff --git a/sysdeps/gnu/sys/mtio.h b/sysdeps/gnu/sys/mtio.h index 69a1dce02d..0ce41c58df 100644 --- a/sysdeps/gnu/sys/mtio.h +++ b/sysdeps/gnu/sys/mtio.h @@ -90,8 +90,8 @@ struct mtget long int mt_gstat; /* Generic (device independent) status. */ long int mt_erreg; /* Error register. */ /* The next two fields are not always used. */ - __daddr_t mt_fileno; /* Number of current file on tape. */ - __daddr_t mt_blkno; /* Current block number. */ + int mt_fileno; /* Number of current file on tape. */ + int mt_blkno; /* Current block number. */ }; #define _IOT_mtget /* Hurd ioctl type field. */ \ _IOT (_IOTS (long), 7, 0, 0, 0, 0) diff --git a/sysdeps/mach/hurd/bits/typesizes.h b/sysdeps/mach/hurd/bits/typesizes.h index 94b0afcdaf..23ee7af95c 100644 --- a/sysdeps/mach/hurd/bits/typesizes.h +++ b/sysdeps/mach/hurd/bits/typesizes.h @@ -50,7 +50,6 @@ #define __TIME_T_TYPE __SLONGWORD_TYPE #define __USECONDS_T_TYPE __U32_TYPE #define __SUSECONDS_T_TYPE __SLONGWORD_TYPE -#define __DADDR_T_TYPE __S32_TYPE #define __KEY_T_TYPE __S32_TYPE #define __CLOCKID_T_TYPE __S32_TYPE #define __TIMER_T_TYPE __S32_TYPE diff --git a/sysdeps/unix/sysv/linux/alpha/bits/typesizes.h b/sysdeps/unix/sysv/linux/alpha/bits/typesizes.h index 0485dd1eb7..d733e4b6a8 100644 --- a/sysdeps/unix/sysv/linux/alpha/bits/typesizes.h +++ b/sysdeps/unix/sysv/linux/alpha/bits/typesizes.h @@ -49,7 +49,6 @@ #define __TIME_T_TYPE __SLONGWORD_TYPE #define __USECONDS_T_TYPE __U32_TYPE #define __SUSECONDS_T_TYPE __S64_TYPE -#define __DADDR_T_TYPE __S32_TYPE #define __KEY_T_TYPE __S32_TYPE #define __CLOCKID_T_TYPE __S32_TYPE #define __TIMER_T_TYPE void * diff --git a/sysdeps/unix/sysv/linux/generic/bits/typesizes.h b/sysdeps/unix/sysv/linux/generic/bits/typesizes.h index c738ff50a5..26dabcfb39 100644 --- a/sysdeps/unix/sysv/linux/generic/bits/typesizes.h +++ b/sysdeps/unix/sysv/linux/generic/bits/typesizes.h @@ -51,7 +51,6 @@ #define __TIME_T_TYPE __SLONGWORD_TYPE #define __USECONDS_T_TYPE __U32_TYPE #define __SUSECONDS_T_TYPE __SLONGWORD_TYPE -#define __DADDR_T_TYPE __S32_TYPE #define __KEY_T_TYPE __S32_TYPE #define __CLOCKID_T_TYPE __S32_TYPE #define __TIMER_T_TYPE void * diff --git a/sysdeps/unix/sysv/linux/generic/wordsize-32/overflow.h b/sysdeps/unix/sysv/linux/generic/wordsize-32/overflow.h index 6c17047e4c..a8516e1aed 100644 --- a/sysdeps/unix/sysv/linux/generic/wordsize-32/overflow.h +++ b/sysdeps/unix/sysv/linux/generic/wordsize-32/overflow.h @@ -24,7 +24,7 @@ in with standard 64-bit syscalls but return them through APIs that only expose the low 32 bits of some fields. */ -static inline off_t lseek_overflow (loff_t res) +static inline off_t lseek_overflow (off64_t res) { off_t retval = (off_t) res; if (retval == res) diff --git a/sysdeps/unix/sysv/linux/lseek.c b/sysdeps/unix/sysv/linux/lseek.c index 6d17d0e667..4a078920b6 100644 --- a/sysdeps/unix/sysv/linux/lseek.c +++ b/sysdeps/unix/sysv/linux/lseek.c @@ -28,7 +28,7 @@ in with standard 64-bit syscalls but return them through APIs that only expose the low 32 bits of some fields. */ -static inline off_t lseek_overflow (loff_t res) +static inline off_t lseek_overflow (off64_t res) { off_t retval = (off_t) res; if (retval == res) @@ -42,7 +42,7 @@ off_t __lseek (int fd, off_t offset, int whence) { # ifdef __NR__llseek - loff_t res; + off64_t res; int rc = INLINE_SYSCALL_CALL (_llseek, fd, (long) (((uint64_t) (offset)) >> 32), (long) offset, &res, whence); diff --git a/sysdeps/unix/sysv/linux/lseek64.c b/sysdeps/unix/sysv/linux/lseek64.c index ecf4338cdb..4f53244387 100644 --- a/sysdeps/unix/sysv/linux/lseek64.c +++ b/sysdeps/unix/sysv/linux/lseek64.c @@ -27,7 +27,7 @@ off64_t __lseek64 (int fd, off64_t offset, int whence) { #ifdef __NR__llseek - loff_t res; + off64_t res; int rc = INLINE_SYSCALL_CALL (_llseek, fd, (long) (((uint64_t) (offset)) >> 32), (long) offset, &res, whence); diff --git a/sysdeps/unix/sysv/linux/mips/bits/typesizes.h b/sysdeps/unix/sysv/linux/mips/bits/typesizes.h index 1132670b1c..7c1bedd9af 100644 --- a/sysdeps/unix/sysv/linux/mips/bits/typesizes.h +++ b/sysdeps/unix/sysv/linux/mips/bits/typesizes.h @@ -50,7 +50,6 @@ #define __TIME_T_TYPE __SLONGWORD_TYPE #define __USECONDS_T_TYPE __U32_TYPE #define __SUSECONDS_T_TYPE __SLONGWORD_TYPE -#define __DADDR_T_TYPE __S32_TYPE #define __KEY_T_TYPE __S32_TYPE #define __CLOCKID_T_TYPE __S32_TYPE #define __TIMER_T_TYPE void * diff --git a/sysdeps/unix/sysv/linux/s390/bits/typesizes.h b/sysdeps/unix/sysv/linux/s390/bits/typesizes.h index c578237817..712264a84f 100644 --- a/sysdeps/unix/sysv/linux/s390/bits/typesizes.h +++ b/sysdeps/unix/sysv/linux/s390/bits/typesizes.h @@ -50,7 +50,6 @@ #define __TIME_T_TYPE __SLONGWORD_TYPE #define __USECONDS_T_TYPE __U32_TYPE #define __SUSECONDS_T_TYPE __SLONGWORD_TYPE -#define __DADDR_T_TYPE __S32_TYPE #define __KEY_T_TYPE __S32_TYPE #define __CLOCKID_T_TYPE __S32_TYPE #define __TIMER_T_TYPE void * diff --git a/sysdeps/unix/sysv/linux/sparc/bits/typesizes.h b/sysdeps/unix/sysv/linux/sparc/bits/typesizes.h index 0db18f4913..b2d39294e9 100644 --- a/sysdeps/unix/sysv/linux/sparc/bits/typesizes.h +++ b/sysdeps/unix/sysv/linux/sparc/bits/typesizes.h @@ -50,7 +50,6 @@ #define __TIME_T_TYPE __SLONGWORD_TYPE #define __USECONDS_T_TYPE __U32_TYPE #define __SUSECONDS_T_TYPE __S32_TYPE -#define __DADDR_T_TYPE __S32_TYPE #define __KEY_T_TYPE __S32_TYPE #define __CLOCKID_T_TYPE __S32_TYPE #define __TIMER_T_TYPE void * diff --git a/sysdeps/unix/sysv/linux/splice.c b/sysdeps/unix/sysv/linux/splice.c index 24dae37841..392874ad39 100644 --- a/sysdeps/unix/sysv/linux/splice.c +++ b/sysdeps/unix/sysv/linux/splice.c @@ -20,7 +20,7 @@ #include ssize_t -splice (int fd_in, loff_t *off_in, int fd_out, loff_t *off_out, size_t len, +splice (int fd_in, off64_t *off_in, int fd_out, off64_t *off_out, size_t len, unsigned int flags) { return SYSCALL_CANCEL (splice, fd_in, off_in, fd_out, off_out, len, flags); diff --git a/sysdeps/unix/sysv/linux/sys/quota.h b/sysdeps/unix/sysv/linux/sys/quota.h index 18b9f2e317..8c3a5a1da6 100644 --- a/sysdeps/unix/sysv/linux/sys/quota.h +++ b/sysdeps/unix/sysv/linux/sys/quota.h @@ -114,7 +114,7 @@ struct dqblk #define dq_btime dq_dqb.dqb_btime #define dq_itime dq_dqb.dqb_itime -#define dqoff(UID) ((__loff_t)((UID) * sizeof (struct dqblk))) +#define dqoff(UID) ((__off64_t)((UID) * sizeof (struct dqblk))) /* Old name for struct if_dqinfo. */ struct dqinfo @@ -128,7 +128,7 @@ struct dqinfo __BEGIN_DECLS extern int quotactl (int __cmd, const char *__special, int __id, - __caddr_t __addr) __THROW; + char *__addr) __THROW; __END_DECLS diff --git a/sysdeps/unix/sysv/linux/test-errno-linux.c b/sysdeps/unix/sysv/linux/test-errno-linux.c index cb979d44bd..1cd4f4f6aa 100644 --- a/sysdeps/unix/sysv/linux/test-errno-linux.c +++ b/sysdeps/unix/sysv/linux/test-errno-linux.c @@ -162,7 +162,7 @@ do_test (void) CONFIG_QUOTA, and may return EPERM if called within certain types of containers. */ fails |= test_wrp2 (LIST (ENODEV, ENOSYS, EPERM), - quotactl, Q_GETINFO, NULL, -1, (caddr_t) &dqblk); + quotactl, Q_GETINFO, NULL, -1, (char *) &dqblk); fails |= test_wrp (EINVAL, sched_getparam, -1, &sch_param); fails |= test_wrp (EINVAL, sched_getscheduler, -1); fails |= test_wrp (EINVAL, sched_get_priority_max, -1); diff --git a/sysdeps/unix/sysv/linux/ustat.c b/sysdeps/unix/sysv/linux/ustat.c index 39cb21fbe0..6638ed59f2 100644 --- a/sysdeps/unix/sysv/linux/ustat.c +++ b/sysdeps/unix/sysv/linux/ustat.c @@ -36,12 +36,13 @@ }) # endif +/* INLINE_SYSCALL_CALL requires all pointer arguments to point to + complete types, but we do not need to access any of the fields of + this structure. It was formerly 20, 24, or 32 bytes, depending on + architecture and _FILE_OFFSET_BITS. */ struct ustat { - __daddr_t f_tfree; /* Number of free blocks. */ - __ino_t f_tinode; /* Number of free inodes. */ - char f_fname[6]; - char f_fpack[6]; + char dummy[32]; }; int diff --git a/sysdeps/unix/sysv/linux/x86/bits/typesizes.h b/sysdeps/unix/sysv/linux/x86/bits/typesizes.h index 0a71e30681..fb724e6a7a 100644 --- a/sysdeps/unix/sysv/linux/x86/bits/typesizes.h +++ b/sysdeps/unix/sysv/linux/x86/bits/typesizes.h @@ -66,7 +66,6 @@ #define __TIME_T_TYPE __SYSCALL_SLONG_TYPE #define __USECONDS_T_TYPE __U32_TYPE #define __SUSECONDS_T_TYPE __SYSCALL_SLONG_TYPE -#define __DADDR_T_TYPE __S32_TYPE #define __KEY_T_TYPE __S32_TYPE #define __CLOCKID_T_TYPE __S32_TYPE #define __TIMER_T_TYPE void * From patchwork Wed Jun 26 17:49:50 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Zack Weinberg X-Patchwork-Id: 1122954 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-103179-incoming=patchwork.ozlabs.org@sourceware.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=panix.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.b="HJzEqg2u"; 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 45YrZD1zXbz9s4Y for ; Thu, 27 Jun 2019 04:06:27 +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:in-reply-to :references:mime-version:content-type:content-transfer-encoding; q=dns; s=default; b=DyiyIWIJVy+23JLfaeM6YHwgA9FNrYzf+Fdm3cWAR44 YxGj+rxNQHHMmfAFqPJJxPH9UH93Xvw0jb5Aehwu3QoDsB9CuVaiT10A3bL2pSU5 bXjqgLi5X8TpLyE2aTiiy/nUnH/9nPbatWii9BbzMNclxj449l7ZydEZk/u8YJP4 = 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:in-reply-to :references:mime-version:content-type:content-transfer-encoding; s=default; bh=fhgd6yx5sNpd5fOpk6OxSj4NXHs=; b=HJzEqg2uyTbmld8O9 Ub977Wf/qoOJRZsEnW8Y1LdpNAMmzvhWzbNV6l3qgt+4SWfqgaeWsoPJ4aOBBYdO nG88ZkZQ8IJLjz5wKNd8HUpoaRZJ3kz+xnTwx2MgA3/NLC96yGUCwb3SWnX5NlLw hyceus/JKsqc6fLlQnj/xGw7o8= Received: (qmail 54305 invoked by alias); 26 Jun 2019 18:06:20 -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 54295 invoked by uid 89); 26 Jun 2019 18:06:20 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-16.7 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, SPF_HELO_PASS, SPF_PASS autolearn=ham version=3.3.1 spammy=HContent-Transfer-Encoding:8bit X-HELO: l2mail1.panix.com From: Zack Weinberg To: libc-alpha@sourceware.org Cc: joseph@codesourcery.com, carlos@redhat.com Subject: [PATCH 05/25] Simplify definition of __time64_t. Date: Wed, 26 Jun 2019 13:49:50 -0400 Message-Id: <20190626174954.8009-6-zackw@panix.com> In-Reply-To: <20190626174954.8009-1-zackw@panix.com> References: <20190626174954.8009-1-zackw@panix.com> MIME-Version: 1.0 bits/time64.h always sets __TIME64_T_TYPE to be __time_t when __TIMESIZE == 64, so we can unconditionally use __TIME64_T_TYPE to define __time64_t; we don’t need another conditional in bits/types.h. Also move the definition of __time64_t next to the definition of __time_t. * posix/bits/types.h (__time64_t): Unconditionally define as __TIME64_T_TYPE. Move definition next to __time_t. --- posix/bits/types.h | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/posix/bits/types.h b/posix/bits/types.h index 73e6a1aef4..1f079505a7 100644 --- a/posix/bits/types.h +++ b/posix/bits/types.h @@ -158,6 +158,7 @@ __STD_TYPE __RLIM_T_TYPE __rlim_t; /* Type for resource measurement. */ __STD_TYPE __RLIM64_T_TYPE __rlim64_t; /* Type for resource measurement (LFS). */ __STD_TYPE __ID_T_TYPE __id_t; /* General type for IDs. */ __STD_TYPE __TIME_T_TYPE __time_t; /* Seconds since the Epoch. */ +__STD_TYPE __TIME64_T_TYPE __time64_t; /* Seconds since the Epoch (Y2038). */ __STD_TYPE __USECONDS_T_TYPE __useconds_t; /* Count of microseconds. */ __STD_TYPE __SUSECONDS_T_TYPE __suseconds_t; /* Signed count of microseconds. */ @@ -213,15 +214,6 @@ __STD_TYPE __U32_TYPE __socklen_t; It is not currently necessary for this to be machine-specific. */ typedef int __sig_atomic_t; -/* Seconds since the Epoch, visible to user code when time_t is too - narrow only for consistency with the old way of widening too-narrow - types. User code should never use __time64_t. */ -#if __TIMESIZE == 64 && defined __LIBC -# define __time64_t __time_t -#elif __TIMESIZE != 64 -__STD_TYPE __TIME64_T_TYPE __time64_t; -#endif - /* BSD: Size of a general-purpose integer register. */ __STD_TYPE __REGISTER_T_TYPE __register_t; From patchwork Wed Jun 26 17:49:51 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Zack Weinberg X-Patchwork-Id: 1122944 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-103168-incoming=patchwork.ozlabs.org@sourceware.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=panix.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.b="panrbcdj"; 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 45YrDb1f4Vz9s8m for ; Thu, 27 Jun 2019 03:51:11 +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:in-reply-to :references:mime-version:content-type:content-transfer-encoding; q=dns; s=default; b=CBe9E4gvjGQDbgSkRHFrqZ5z0I9kjg8jS4C69SxQvN3 +YWLcdCVMbtIAGkLb7GMjGvdaTudaIgy4OYSBGqdjVqcT8admWLWfaMOKmWuShP8 dZPxRVMgKS+ATpPpbyz+/+F/BOpg644lj0DU++KuLy3b2e6O7X533ur3yA5a9V7k = 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:in-reply-to :references:mime-version:content-type:content-transfer-encoding; s=default; bh=EIqU7r8XI6U7DNP3xdi2SByooyk=; b=panrbcdjQXdYo8mT6 1VtBU8bf71Jyqw43ALjrt6nCSLFlcubBHj22+RUBkUUrH1OO5DVxXvSc2x79rp4W uXkP+u0UN12g/vYI+HBjT92LsPB47gCyb00U77tbUzxPfLdsDwfeexSAbXq0/DH/ 6tlarXUWgS8MV13VwtS1nIq1C8= Received: (qmail 8254 invoked by alias); 26 Jun 2019 17:50:05 -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 8187 invoked by uid 89); 26 Jun 2019 17:50:05 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-16.0 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, SPF_HELO_PASS, SPF_PASS autolearn=ham version=3.3.1 spammy=presently, Factory, serial, nonstandard X-HELO: l2mail1.panix.com From: Zack Weinberg To: libc-alpha@sourceware.org Cc: joseph@codesourcery.com, carlos@redhat.com Subject: [PATCH 06/25] Clean up bits/types.h. Date: Wed, 26 Jun 2019 13:49:51 -0400 Message-Id: <20190626174954.8009-7-zackw@panix.com> In-Reply-To: <20190626174954.8009-1-zackw@panix.com> References: <20190626174954.8009-1-zackw@panix.com> MIME-Version: 1.0 This makes four linked changes to bits/types.h. First, we use __(u)?int(16|32|64)_t to define __[SU](16|32|64)_TYPE. In addition to reducing the amount of ifdeffage, this means __STD_TYPE is no longer necessary, since gcc -std=c89 will complain about ‘typedef long long foo_t’ but not ‘typedef __int64_t foo_t’, even if the underlying type of __int64_t is long long. Second, we eliminate __UQUAD_TYPE and __SQUAD_TYPE from the set of macros bits/typesizes.h should use to define __FOO_T_TYPE macros, since they are always the same as __U64_TYPE and __S64_TYPE respectively. Third, we remove __u_char, __u_short, __u_int, __u_long, __u_quad_t, and __quad_t, we add __uintptr_t, and we define __intmax_t and __uintmax_t as __int64_t and __uint64_t. Fourth, we reorganize the list of typedefs into groups by the standard (if any) that defines them, and sort them alphabetically within each group. * posix/bits/types.h: Move #error for __WORDSIZE neither 32 nor 64 to first group of conditionals on __WORDSIZE, and make it more explicit. Update commentary. Define all __foo_t types with regular ‘typedef’. Reorganize all __foo_t types into the same groups that sys/types.h uses. (__u_char, __u_short, __u_int, __u_long, __quad_t, __u_quad_t) (__UQUAD_TYPE, __SQUAD_TYPE, __STD_TYPE): Don’t define. (__S16_TYPE): Define unconditionally as __int16_t. (__U16_TYPE): Define unconditionally as __uint16_t. (__S32_TYPE): Define unconditionally as __int32_t. (__U32_TYPE): Define unconditionally as __uint32_t. (__S64_TYPE): Define unconditionally as __int64_t. (__U64_TYPE): Define unconditionally as __uint64_t. (__intmax_t): Define unconditionally as __int64_t. (__uintmax_t): Define unconditionally as __uint64_t. (__uintptr_t): New typedef. * bits/time64.h * bits/typesizes.h * sysdeps/mach/hurd/bits/typesizes.h * sysdeps/unix/sysv/linux/alpha/bits/typesizes.h * sysdeps/unix/sysv/linux/generic/bits/typesizes.h * sysdeps/unix/sysv/linux/mips/bits/typesizes.h * sysdeps/unix/sysv/linux/s390/bits/typesizes.h * sysdeps/unix/sysv/linux/sparc/bits/typesizes.h * sysdeps/unix/sysv/linux/x86/bits/typesizes.h: Replace all uses of __UQUAD_TYPE with __U64_TYPE, and all uses of __SQUAD_TYPE with __S64_TYPE. * posix/sys/types.h, rpc/sys/types.h (u_char): Define as unsigned char. (u_short): Define as unsigned short. (u_int): Define as unsigned int. (u_long): Define as unsigned long. (quad_t): Define as __int64_t. (u_quad_t): Define as __uint64_t. * stdlib/stdint.h (intptr_t): Define as __intptr_t. (uintptr_t): Define as __uintptr_t. * scripts/check-obsolete-constructs.py: Update allowed definitions for the obsolete types. No longer allow __STD_TYPE as an alias for typedef. --- bits/time64.h | 2 +- bits/typesizes.h | 14 +- posix/bits/types.h | 194 +++++++----------- posix/sys/types.h | 12 +- scripts/check-obsolete-constructs.py | 71 +++---- stdlib/stdint.h | 13 +- sunrpc/rpc/types.h | 12 +- sysdeps/mach/hurd/bits/typesizes.h | 14 +- .../unix/sysv/linux/generic/bits/typesizes.h | 14 +- sysdeps/unix/sysv/linux/mips/bits/typesizes.h | 16 +- sysdeps/unix/sysv/linux/s390/bits/typesizes.h | 14 +- .../unix/sysv/linux/sparc/bits/typesizes.h | 14 +- sysdeps/unix/sysv/linux/x86/bits/typesizes.h | 20 +- 13 files changed, 177 insertions(+), 233 deletions(-) diff --git a/bits/time64.h b/bits/time64.h index c0f8a24d8a..de38d3da03 100644 --- a/bits/time64.h +++ b/bits/time64.h @@ -30,7 +30,7 @@ # define __TIME64_T_TYPE __TIME_T_TYPE #else /* Define a 64-bit time type alongsize the 32-bit one. */ -# define __TIME64_T_TYPE __SQUAD_TYPE +# define __TIME64_T_TYPE __S64_TYPE #endif #endif /* bits/time64.h */ diff --git a/bits/typesizes.h b/bits/typesizes.h index a7291465ca..bd21cf31cd 100644 --- a/bits/typesizes.h +++ b/bits/typesizes.h @@ -26,24 +26,24 @@ /* See for the meaning of these macros. This file exists so that need not vary across different GNU platforms. */ -#define __DEV_T_TYPE __UQUAD_TYPE +#define __DEV_T_TYPE __U64_TYPE #define __UID_T_TYPE __U32_TYPE #define __GID_T_TYPE __U32_TYPE #define __INO_T_TYPE __ULONGWORD_TYPE -#define __INO64_T_TYPE __UQUAD_TYPE +#define __INO64_T_TYPE __U64_TYPE #define __MODE_T_TYPE __U32_TYPE #define __NLINK_T_TYPE __UWORD_TYPE #define __OFF_T_TYPE __SLONGWORD_TYPE -#define __OFF64_T_TYPE __SQUAD_TYPE +#define __OFF64_T_TYPE __S64_TYPE #define __PID_T_TYPE __S32_TYPE #define __RLIM_T_TYPE __ULONGWORD_TYPE -#define __RLIM64_T_TYPE __UQUAD_TYPE +#define __RLIM64_T_TYPE __U64_TYPE #define __BLKCNT_T_TYPE __SLONGWORD_TYPE -#define __BLKCNT64_T_TYPE __SQUAD_TYPE +#define __BLKCNT64_T_TYPE __S64_TYPE #define __FSBLKCNT_T_TYPE __ULONGWORD_TYPE -#define __FSBLKCNT64_T_TYPE __UQUAD_TYPE +#define __FSBLKCNT64_T_TYPE __U64_TYPE #define __FSFILCNT_T_TYPE __ULONGWORD_TYPE -#define __FSFILCNT64_T_TYPE __UQUAD_TYPE +#define __FSFILCNT64_T_TYPE __U64_TYPE #define __FSWORD_T_TYPE __SWORD_TYPE #define __ID_T_TYPE __U32_TYPE #define __CLOCK_T_TYPE __SLONGWORD_TYPE diff --git a/posix/bits/types.h b/posix/bits/types.h index 1f079505a7..4a6043cdc8 100644 --- a/posix/bits/types.h +++ b/posix/bits/types.h @@ -27,12 +27,6 @@ #include #include -/* Convenience types. */ -typedef unsigned char __u_char; -typedef unsigned short int __u_short; -typedef unsigned int __u_int; -typedef unsigned long int __u_long; - /* Fixed-size types, underlying types depend on word size and compiler. */ typedef signed char __int8_t; typedef unsigned char __uint8_t; @@ -43,9 +37,11 @@ typedef unsigned int __uint32_t; #if __WORDSIZE == 64 typedef signed long int __int64_t; typedef unsigned long int __uint64_t; -#else +#elif __WORDSIZE == 32 __extension__ typedef signed long long int __int64_t; __extension__ typedef unsigned long long int __uint64_t; +#else +# error "Unsupported value for __WORDSIZE" #endif /* Smallest types with at least a given width. */ @@ -58,24 +54,9 @@ typedef __uint32_t __uint_least32_t; typedef __int64_t __int_least64_t; typedef __uint64_t __uint_least64_t; -/* quad_t is also 64 bits. */ -#if __WORDSIZE == 64 -typedef long int __quad_t; -typedef unsigned long int __u_quad_t; -#else -__extension__ typedef long long int __quad_t; -__extension__ typedef unsigned long long int __u_quad_t; -#endif - /* Largest integral types. */ -#if __WORDSIZE == 64 -typedef long int __intmax_t; -typedef unsigned long int __uintmax_t; -#else -__extension__ typedef long long int __intmax_t; -__extension__ typedef unsigned long long int __uintmax_t; -#endif - +typedef __int64_t __intmax_t; +typedef __uint64_t __uintmax_t; /* The machine-dependent file defines __*_T_TYPE macros for each of the OS types we define below. The definitions @@ -87,136 +68,107 @@ __extension__ typedef unsigned long long int __uintmax_t; 32 -- "natural" 32-bit type (always int) 64 -- "natural" 64-bit type (long or long long) LONG32 -- 32-bit type, traditionally long - QUAD -- 64-bit type, traditionally long long WORD -- natural type of __WORDSIZE bits (int or long) LONGWORD -- type of __WORDSIZE bits, traditionally long - We distinguish WORD/LONGWORD, 32/LONG32, and 64/QUAD so that the - conventional uses of `long' or `long long' type modifiers match the - types we define, even when a less-adorned type would be the same size. - This matters for (somewhat) portably writing printf/scanf formats for - these types, where using the appropriate l or ll format modifiers can - make the typedefs and the formats match up across all GNU platforms. If - we used `long' when it's 64 bits where `long long' is expected, then the - compiler would warn about the formats not matching the argument types, - and the programmer changing them to shut up the compiler would break the - program's portability. + We distinguish WORD/LONGWORD and 64/QUAD so that the conventional + uses of `long' or `long long' type modifiers match the types we + define, even when a less-adorned type would be the same size. + This matters for (somewhat) portably writing printf/scanf formats + for these types, where using the appropriate l or ll format + modifiers can make the typedefs and the formats match up across all + GNU platforms. If we used `long' when it's 64 bits where `long + long' is expected, then the compiler would warn about the formats + not matching the argument types, and the programmer changing them + to shut up the compiler would break the program's portability. Here we assume what is presently the case in all the GCC configurations we support: long long is always 64 bits, long is always word/address size, and int is always 32 bits. */ -#define __S16_TYPE short int -#define __U16_TYPE unsigned short int -#define __S32_TYPE int -#define __U32_TYPE unsigned int +#define __S16_TYPE __int16_t +#define __U16_TYPE __uint16_t +#define __S32_TYPE __int32_t +#define __U32_TYPE __uint32_t +#define __S64_TYPE __int64_t +#define __U64_TYPE __uint64_t + #define __SLONGWORD_TYPE long int #define __ULONGWORD_TYPE unsigned long int #if __WORDSIZE == 32 -# define __SQUAD_TYPE __int64_t -# define __UQUAD_TYPE __uint64_t # define __SWORD_TYPE int # define __UWORD_TYPE unsigned int # define __SLONG32_TYPE long int # define __ULONG32_TYPE unsigned long int -# define __S64_TYPE __int64_t -# define __U64_TYPE __uint64_t -/* We want __extension__ before typedef's that use nonstandard base types - such as `long long' in C89 mode. */ -# define __STD_TYPE __extension__ typedef -#elif __WORDSIZE == 64 -# define __SQUAD_TYPE long int -# define __UQUAD_TYPE unsigned long int +#else /* __WORDSIZE == 64 */ # define __SWORD_TYPE long int # define __UWORD_TYPE unsigned long int # define __SLONG32_TYPE int # define __ULONG32_TYPE unsigned int -# define __S64_TYPE long int -# define __U64_TYPE unsigned long int -/* No need to mark the typedef with __extension__. */ -# define __STD_TYPE typedef -#else -# error #endif #include /* Defines __*_T_TYPE macros. */ #include /* Defines __TIME*_T_TYPE macros. */ +/* Types from core POSIX: */ +typedef __BLKCNT_T_TYPE __blkcnt_t; /* Disk block counts. */ +typedef __CLOCKID_T_TYPE __clockid_t; /* Clock IDs. */ +typedef __DEV_T_TYPE __dev_t; /* Device numbers. */ +typedef __FSBLKCNT_T_TYPE __fsblkcnt_t; /* File system block counts. */ +typedef __FSFILCNT_T_TYPE __fsfilcnt_t; /* File system inode counts. */ +typedef __GID_T_TYPE __gid_t; /* Group IDs. */ +typedef __INO_T_TYPE __ino_t; /* File serial numbers. */ +typedef __MODE_T_TYPE __mode_t; /* File attribute bitmasks. */ +typedef __NLINK_T_TYPE __nlink_t; /* File link counts. */ +typedef __OFF_T_TYPE __off_t; /* File sizes and offsets. */ +typedef __PID_T_TYPE __pid_t; /* Process IDs. */ +typedef __RLIM_T_TYPE __rlim_t; /* Resource measurements. */ +typedef __SSIZE_T_TYPE __ssize_t; /* Byte count, or error. */ +typedef __TIME_T_TYPE __time_t; /* Seconds since the Epoch. */ +typedef __TIMER_T_TYPE __timer_t; /* Timer IDs. */ +typedef __UID_T_TYPE __uid_t; /* Type of user identifications. */ -__STD_TYPE __DEV_T_TYPE __dev_t; /* Type of device numbers. */ -__STD_TYPE __UID_T_TYPE __uid_t; /* Type of user identifications. */ -__STD_TYPE __GID_T_TYPE __gid_t; /* Type of group identifications. */ -__STD_TYPE __INO_T_TYPE __ino_t; /* Type of file serial numbers. */ -__STD_TYPE __INO64_T_TYPE __ino64_t; /* Type of file serial numbers (LFS).*/ -__STD_TYPE __MODE_T_TYPE __mode_t; /* Type of file attribute bitmasks. */ -__STD_TYPE __NLINK_T_TYPE __nlink_t; /* Type of file link counts. */ -__STD_TYPE __OFF_T_TYPE __off_t; /* Type of file sizes and offsets. */ -__STD_TYPE __OFF64_T_TYPE __off64_t; /* Type of file sizes and offsets (LFS). */ -__STD_TYPE __PID_T_TYPE __pid_t; /* Type of process identifications. */ -__STD_TYPE __FSID_T_TYPE __fsid_t; /* Type of file system IDs. */ -__STD_TYPE __CLOCK_T_TYPE __clock_t; /* Type of CPU usage counts. */ -__STD_TYPE __RLIM_T_TYPE __rlim_t; /* Type for resource measurement. */ -__STD_TYPE __RLIM64_T_TYPE __rlim64_t; /* Type for resource measurement (LFS). */ -__STD_TYPE __ID_T_TYPE __id_t; /* General type for IDs. */ -__STD_TYPE __TIME_T_TYPE __time_t; /* Seconds since the Epoch. */ -__STD_TYPE __TIME64_T_TYPE __time64_t; /* Seconds since the Epoch (Y2038). */ -__STD_TYPE __USECONDS_T_TYPE __useconds_t; /* Count of microseconds. */ -__STD_TYPE __SUSECONDS_T_TYPE __suseconds_t; /* Signed count of microseconds. */ +/* Types added by LFS: */ +typedef __BLKCNT64_T_TYPE __blkcnt64_t; +typedef __FSBLKCNT64_T_TYPE __fsblkcnt64_t; +typedef __FSFILCNT64_T_TYPE __fsfilcnt64_t; +typedef __INO64_T_TYPE __ino64_t; +typedef __OFF64_T_TYPE __off64_t; +typedef __RLIM64_T_TYPE __rlim64_t; -__STD_TYPE __KEY_T_TYPE __key_t; /* Type of an IPC key. */ +/* Types added by Y2038: */ +typedef __TIME64_T_TYPE __time64_t; -/* Clock ID used in clock and timer functions. */ -__STD_TYPE __CLOCKID_T_TYPE __clockid_t; +/* Types added by XSI: */ +typedef __BLKSIZE_T_TYPE __blksize_t; /* Size of a disk block. */ +typedef __CLOCK_T_TYPE __clock_t; /* CPU usage counts. */ +typedef __ID_T_TYPE __id_t; /* General IDs. */ +typedef __KEY_T_TYPE __key_t; /* "SysV" IPC keys. */ +typedef __SUSECONDS_T_TYPE __suseconds_t; /* Signed count of microseconds. */ +typedef __USECONDS_T_TYPE __useconds_t; /* Count of microseconds. */ -/* Timer ID returned by `timer_create'. */ -__STD_TYPE __TIMER_T_TYPE __timer_t; +/* Types added by BSD: */ +typedef __FSID_T_TYPE __fsid_t; /* File system IDs. */ +typedef __REGISTER_T_TYPE __register_t; /* Integer register. */ -/* Type to represent block size. */ -__STD_TYPE __BLKSIZE_T_TYPE __blksize_t; - -/* Types from the Large File Support interface. */ - -/* Type to count number of disk blocks. */ -__STD_TYPE __BLKCNT_T_TYPE __blkcnt_t; -__STD_TYPE __BLKCNT64_T_TYPE __blkcnt64_t; - -/* Type to count file system blocks. */ -__STD_TYPE __FSBLKCNT_T_TYPE __fsblkcnt_t; -__STD_TYPE __FSBLKCNT64_T_TYPE __fsblkcnt64_t; - -/* Type to count file system nodes. */ -__STD_TYPE __FSFILCNT_T_TYPE __fsfilcnt_t; -__STD_TYPE __FSFILCNT64_T_TYPE __fsfilcnt64_t; - -/* Type of miscellaneous file system fields. */ -__STD_TYPE __FSWORD_T_TYPE __fsword_t; - -__STD_TYPE __SSIZE_T_TYPE __ssize_t; /* Type of a byte count, or error. */ - -/* Signed long type used in system calls. */ -__STD_TYPE __SYSCALL_SLONG_TYPE __syscall_slong_t; -/* Unsigned long type used in system calls. */ -__STD_TYPE __SYSCALL_ULONG_TYPE __syscall_ulong_t; +/* Types added by Linux: */ +typedef __FSWORD_T_TYPE __fsword_t; /* Miscellaneous file system fields. */ +typedef __SYSCALL_SLONG_TYPE __syscall_slong_t; +typedef __SYSCALL_ULONG_TYPE __syscall_ulong_t; /* These few don't really vary by system, they always correspond to one of the other defined types. */ -typedef __off64_t __loff_t; /* Type of file sizes and offsets (LFS). */ -typedef char *__caddr_t; /* Type of a memory address (BSD). */ -__STD_TYPE __S32_TYPE __daddr_t; /* Type of a disk address (BSD). */ -/* Duplicates info from stdint.h but this is used in unistd.h. */ -__STD_TYPE __SWORD_TYPE __intptr_t; +/* ISO C: */ +typedef __SWORD_TYPE __intptr_t; /* Signed type that can hold void*. */ +typedef __UWORD_TYPE __uintptr_t; /* Unsigned type that can hold void*. */ +typedef int __sig_atomic_t; /* Atomic access relative to signals. */ -/* Duplicate info from sys/socket.h. */ -__STD_TYPE __U32_TYPE __socklen_t; +/* POSIX: */ +typedef __U32_TYPE __socklen_t; /* Size of a socket address. */ -/* C99: An integer type that can be accessed as an atomic entity, - even in the presence of asynchronous interrupts. - It is not currently necessary for this to be machine-specific. */ -typedef int __sig_atomic_t; - -/* BSD: Size of a general-purpose integer register. */ -__STD_TYPE __REGISTER_T_TYPE __register_t; - -#undef __STD_TYPE +/* BSD: */ +typedef char *__caddr_t; /* Memory address. */ +typedef __S32_TYPE __daddr_t; /* Disk address. */ +typedef __off64_t __loff_t; /* File sizes and offsets. */ #endif /* bits/types.h */ diff --git a/posix/sys/types.h b/posix/sys/types.h index 7327904346..2d8cfd19d2 100644 --- a/posix/sys/types.h +++ b/posix/sys/types.h @@ -30,12 +30,12 @@ __BEGIN_DECLS #ifdef __USE_MISC # ifndef __u_char_defined -typedef __u_char u_char; -typedef __u_short u_short; -typedef __u_int u_int; -typedef __u_long u_long; -typedef __quad_t quad_t; -typedef __u_quad_t u_quad_t; +typedef unsigned char u_char; +typedef unsigned short int u_short; +typedef unsigned int u_int; +typedef unsigned long int u_long; +typedef __int64_t quad_t; +typedef __uint64_t u_quad_t; typedef __fsid_t fsid_t; # define __u_char_defined # endif diff --git a/scripts/check-obsolete-constructs.py b/scripts/check-obsolete-constructs.py index 701ad5af90..518de7523e 100755 --- a/scripts/check-obsolete-constructs.py +++ b/scripts/check-obsolete-constructs.py @@ -280,9 +280,8 @@ class ObsoletePrivateDefinitionsAllowed(ConstructChecker): self.prev_token = None def examine(self, tok): - # bits/types.h hides 'typedef' in a macro sometimes. if (tok.kind == "IDENT" - and tok.text in ("typedef", "__STD_TYPE") + and tok.text == "typedef" and tok.context is None): self.in_typedef = True elif tok.kind == "PUNCTUATOR" and tok.text == ";" and self.in_typedef: @@ -312,9 +311,12 @@ class ObsoletePublicDefinitionsAllowed(ConstructChecker): typedef __obsolete obsolete; // identifiers must agree typedef __uintN_t u_intN_t; // N must agree - typedef unsigned long int ulong; - typedef unsigned short int ushort; - typedef unsigned int uint; + typedef unsigned long int u_?long; + typedef unsigned short int u_?short; + typedef unsigned int u_?int; + typedef unsigned char u_char; + typedef __int64_t quad_t; + typedef __uint64_t u_quad_t; """ def __init__(self, reporter): super().__init__(reporter) @@ -357,41 +359,40 @@ class ObsoletePublicDefinitionsAllowed(ConstructChecker): self._reset() def _permissible_public_definition(self, m): - if m.group(1) == "__": return False - name = m.group(2) - toks = self.typedef_tokens - ntok = len(toks) - if ntok == 3 and toks[1].kind == "IDENT": - defn = toks[1].text - n = OBSOLETE_TYPE_RE_.match(defn) - if n and n.group(1) == "__" and n.group(2) == name: - return True - - if (name[:5] == "u_int" and name[-2:] == "_t" - and defn[:6] == "__uint" and defn[-2:] == "_t" - and name[5:-2] == defn[6:-2]): - return True - + if m.group(1) == "__": return False + name = m.group(2) - if (name == "ulong" and ntok == 5 - and toks[1].kind == "IDENT" and toks[1].text == "unsigned" - and toks[2].kind == "IDENT" and toks[2].text == "long" - and toks[3].kind == "IDENT" and toks[3].text == "int"): - return True + toks = self.typedef_tokens + if len(toks) > 5: + return False + if any(tk.kind != "IDENT" for tk in toks): + return False + defn = " ".join(tk.text for tk in toks[1:-1]) - if (name == "ushort" and ntok == 5 - and toks[1].kind == "IDENT" and toks[1].text == "unsigned" - and toks[2].kind == "IDENT" and toks[2].text == "short" - and toks[3].kind == "IDENT" and toks[3].text == "int"): - return True + if name == "u_char": + return defn == "unsigned char" - if (name == "uint" and ntok == 4 - and toks[1].kind == "IDENT" and toks[1].text == "unsigned" - and toks[2].kind == "IDENT" and toks[2].text == "int"): - return True + if name in ("ushort", "u_short"): + return defn == "unsigned short int" + + if name in ("uint", "u_int"): + return defn == "unsigned int" + + if name in ("ulong", "u_long"): + return defn == "unsigned long int" + + if name == "quad_t": + return defn == "__int64_t" + + if name == "u_quad_t": + return defn == "__uint64_t" + + if name[:5] == "u_int" and name[-2:] == "_t": + return defn == "__uint" + name[5:-2] + "_t" + + return defn == "__" + name - return False def ObsoleteTypedefChecker(reporter, fname): """Factory: produce an instance of the appropriate diff --git a/stdlib/stdint.h b/stdlib/stdint.h index 1ad538fc48..8645d91cfc 100644 --- a/stdlib/stdint.h +++ b/stdlib/stdint.h @@ -82,20 +82,11 @@ typedef unsigned long long int uint_fast64_t; /* Types for `void *' pointers. */ -#if __WORDSIZE == 64 # ifndef __intptr_t_defined -typedef long int intptr_t; +typedef __intptr_t intptr_t; # define __intptr_t_defined # endif -typedef unsigned long int uintptr_t; -#else -# ifndef __intptr_t_defined -typedef int intptr_t; -# define __intptr_t_defined -# endif -typedef unsigned int uintptr_t; -#endif - +typedef __uintptr_t uintptr_t; /* Largest integral types. */ typedef __intmax_t intmax_t; diff --git a/sunrpc/rpc/types.h b/sunrpc/rpc/types.h index beded52555..99e5f4f151 100644 --- a/sunrpc/rpc/types.h +++ b/sunrpc/rpc/types.h @@ -75,12 +75,12 @@ typedef unsigned long rpcport_t; #endif #ifndef __u_char_defined -typedef __u_char u_char; -typedef __u_short u_short; -typedef __u_int u_int; -typedef __u_long u_long; -typedef __quad_t quad_t; -typedef __u_quad_t u_quad_t; +typedef unsigned char u_char; +typedef unsigned short int u_short; +typedef unsigned int u_int; +typedef unsigned long int u_long; +typedef __int64_t quad_t; +typedef __uint64_t u_quad_t; typedef __fsid_t fsid_t; # define __u_char_defined #endif diff --git a/sysdeps/mach/hurd/bits/typesizes.h b/sysdeps/mach/hurd/bits/typesizes.h index 23ee7af95c..eaeaab1e32 100644 --- a/sysdeps/mach/hurd/bits/typesizes.h +++ b/sysdeps/mach/hurd/bits/typesizes.h @@ -30,20 +30,20 @@ #define __UID_T_TYPE __U32_TYPE #define __GID_T_TYPE __U32_TYPE #define __INO_T_TYPE __ULONGWORD_TYPE -#define __INO64_T_TYPE __UQUAD_TYPE +#define __INO64_T_TYPE __U64_TYPE #define __MODE_T_TYPE __U32_TYPE #define __NLINK_T_TYPE __UWORD_TYPE #define __OFF_T_TYPE __SLONGWORD_TYPE -#define __OFF64_T_TYPE __SQUAD_TYPE +#define __OFF64_T_TYPE __S64_TYPE #define __PID_T_TYPE __S32_TYPE #define __RLIM_T_TYPE __ULONGWORD_TYPE -#define __RLIM64_T_TYPE __UQUAD_TYPE +#define __RLIM64_T_TYPE __U64_TYPE #define __BLKCNT_T_TYPE __SLONGWORD_TYPE -#define __BLKCNT64_T_TYPE __SQUAD_TYPE +#define __BLKCNT64_T_TYPE __S64_TYPE #define __FSBLKCNT_T_TYPE __ULONGWORD_TYPE -#define __FSBLKCNT64_T_TYPE __UQUAD_TYPE +#define __FSBLKCNT64_T_TYPE __U64_TYPE #define __FSFILCNT_T_TYPE __ULONGWORD_TYPE -#define __FSFILCNT64_T_TYPE __UQUAD_TYPE +#define __FSFILCNT64_T_TYPE __U64_TYPE #define __FSWORD_T_TYPE __SWORD_TYPE #define __ID_T_TYPE __U32_TYPE #define __CLOCK_T_TYPE __SLONGWORD_TYPE @@ -54,7 +54,7 @@ #define __CLOCKID_T_TYPE __S32_TYPE #define __TIMER_T_TYPE __S32_TYPE #define __BLKSIZE_T_TYPE __SLONGWORD_TYPE -#define __FSID_T_TYPE __UQUAD_TYPE +#define __FSID_T_TYPE __U64_TYPE #define __SSIZE_T_TYPE __SWORD_TYPE #define __SYSCALL_SLONG_TYPE __SLONGWORD_TYPE #define __SYSCALL_ULONG_TYPE __ULONGWORD_TYPE diff --git a/sysdeps/unix/sysv/linux/generic/bits/typesizes.h b/sysdeps/unix/sysv/linux/generic/bits/typesizes.h index 26dabcfb39..fb4a5605f2 100644 --- a/sysdeps/unix/sysv/linux/generic/bits/typesizes.h +++ b/sysdeps/unix/sysv/linux/generic/bits/typesizes.h @@ -27,24 +27,24 @@ /* See for the meaning of these macros. This file exists so that need not vary across different GNU platforms. */ -#define __DEV_T_TYPE __UQUAD_TYPE +#define __DEV_T_TYPE __U64_TYPE #define __UID_T_TYPE __U32_TYPE #define __GID_T_TYPE __U32_TYPE #define __INO_T_TYPE __ULONGWORD_TYPE -#define __INO64_T_TYPE __UQUAD_TYPE +#define __INO64_T_TYPE __U64_TYPE #define __MODE_T_TYPE __U32_TYPE #define __NLINK_T_TYPE __U32_TYPE #define __OFF_T_TYPE __SLONGWORD_TYPE -#define __OFF64_T_TYPE __SQUAD_TYPE +#define __OFF64_T_TYPE __S64_TYPE #define __PID_T_TYPE __S32_TYPE #define __RLIM_T_TYPE __ULONGWORD_TYPE -#define __RLIM64_T_TYPE __UQUAD_TYPE +#define __RLIM64_T_TYPE __U64_TYPE #define __BLKCNT_T_TYPE __SLONGWORD_TYPE -#define __BLKCNT64_T_TYPE __SQUAD_TYPE +#define __BLKCNT64_T_TYPE __S64_TYPE #define __FSBLKCNT_T_TYPE __ULONGWORD_TYPE -#define __FSBLKCNT64_T_TYPE __UQUAD_TYPE +#define __FSBLKCNT64_T_TYPE __U64_TYPE #define __FSFILCNT_T_TYPE __ULONGWORD_TYPE -#define __FSFILCNT64_T_TYPE __UQUAD_TYPE +#define __FSFILCNT64_T_TYPE __U64_TYPE #define __FSWORD_T_TYPE __SWORD_TYPE #define __ID_T_TYPE __U32_TYPE #define __CLOCK_T_TYPE __SLONGWORD_TYPE diff --git a/sysdeps/unix/sysv/linux/mips/bits/typesizes.h b/sysdeps/unix/sysv/linux/mips/bits/typesizes.h index 7c1bedd9af..e73bba4ee7 100644 --- a/sysdeps/unix/sysv/linux/mips/bits/typesizes.h +++ b/sysdeps/unix/sysv/linux/mips/bits/typesizes.h @@ -26,24 +26,24 @@ /* See for the meaning of these macros. This file exists so that need not vary across different GNU platforms. */ -#define __DEV_T_TYPE __UQUAD_TYPE +#define __DEV_T_TYPE __U64_TYPE #define __UID_T_TYPE __U32_TYPE #define __GID_T_TYPE __U32_TYPE #define __INO_T_TYPE __ULONGWORD_TYPE -#define __INO64_T_TYPE __UQUAD_TYPE +#define __INO64_T_TYPE __U64_TYPE #define __MODE_T_TYPE __U32_TYPE #define __NLINK_T_TYPE __UWORD_TYPE #define __OFF_T_TYPE __SLONGWORD_TYPE -#define __OFF64_T_TYPE __SQUAD_TYPE +#define __OFF64_T_TYPE __S64_TYPE #define __PID_T_TYPE __S32_TYPE #define __RLIM_T_TYPE __ULONGWORD_TYPE -#define __RLIM64_T_TYPE __UQUAD_TYPE +#define __RLIM64_T_TYPE __U64_TYPE #define __BLKCNT_T_TYPE __SLONGWORD_TYPE -#define __BLKCNT64_T_TYPE __SQUAD_TYPE +#define __BLKCNT64_T_TYPE __S64_TYPE #define __FSBLKCNT_T_TYPE __ULONGWORD_TYPE -#define __FSBLKCNT64_T_TYPE __UQUAD_TYPE +#define __FSBLKCNT64_T_TYPE __U64_TYPE #define __FSFILCNT_T_TYPE __ULONGWORD_TYPE -#define __FSFILCNT64_T_TYPE __UQUAD_TYPE +#define __FSFILCNT64_T_TYPE __U64_TYPE #define __FSWORD_T_TYPE __SWORD_TYPE #define __ID_T_TYPE __U32_TYPE #define __CLOCK_T_TYPE __SLONGWORD_TYPE @@ -61,7 +61,7 @@ #define __CPU_MASK_TYPE __ULONGWORD_TYPE #if defined _ABIN32 && _MIPS_SIM == _ABIN32 -#define __REGISTER_T_TYPE __SQUAD_TYPE +#define __REGISTER_T_TYPE __S64_TYPE #else #define __REGISTER_T_TYPE __SWORD_TYPE #endif diff --git a/sysdeps/unix/sysv/linux/s390/bits/typesizes.h b/sysdeps/unix/sysv/linux/s390/bits/typesizes.h index 712264a84f..741dfaed77 100644 --- a/sysdeps/unix/sysv/linux/s390/bits/typesizes.h +++ b/sysdeps/unix/sysv/linux/s390/bits/typesizes.h @@ -26,24 +26,24 @@ /* See for the meaning of these macros. This file exists so that need not vary across different GNU platforms. */ -#define __DEV_T_TYPE __UQUAD_TYPE +#define __DEV_T_TYPE __U64_TYPE #define __UID_T_TYPE __U32_TYPE #define __GID_T_TYPE __U32_TYPE #define __INO_T_TYPE __ULONGWORD_TYPE -#define __INO64_T_TYPE __UQUAD_TYPE +#define __INO64_T_TYPE __U64_TYPE #define __MODE_T_TYPE __U32_TYPE #define __NLINK_T_TYPE __UWORD_TYPE #define __OFF_T_TYPE __SLONGWORD_TYPE -#define __OFF64_T_TYPE __SQUAD_TYPE +#define __OFF64_T_TYPE __S64_TYPE #define __PID_T_TYPE __S32_TYPE #define __RLIM_T_TYPE __ULONGWORD_TYPE -#define __RLIM64_T_TYPE __UQUAD_TYPE +#define __RLIM64_T_TYPE __U64_TYPE #define __BLKCNT_T_TYPE __SLONGWORD_TYPE -#define __BLKCNT64_T_TYPE __SQUAD_TYPE +#define __BLKCNT64_T_TYPE __S64_TYPE #define __FSBLKCNT_T_TYPE __ULONGWORD_TYPE -#define __FSBLKCNT64_T_TYPE __UQUAD_TYPE +#define __FSBLKCNT64_T_TYPE __U64_TYPE #define __FSFILCNT_T_TYPE __ULONGWORD_TYPE -#define __FSFILCNT64_T_TYPE __UQUAD_TYPE +#define __FSFILCNT64_T_TYPE __U64_TYPE #define __FSWORD_T_TYPE __SWORD_TYPE #define __ID_T_TYPE __U32_TYPE #define __CLOCK_T_TYPE __SLONGWORD_TYPE diff --git a/sysdeps/unix/sysv/linux/sparc/bits/typesizes.h b/sysdeps/unix/sysv/linux/sparc/bits/typesizes.h index b2d39294e9..c084ebd6b6 100644 --- a/sysdeps/unix/sysv/linux/sparc/bits/typesizes.h +++ b/sysdeps/unix/sysv/linux/sparc/bits/typesizes.h @@ -26,24 +26,24 @@ /* See for the meaning of these macros. This file exists so that need not vary across different GNU platforms. */ -#define __DEV_T_TYPE __UQUAD_TYPE +#define __DEV_T_TYPE __U64_TYPE #define __UID_T_TYPE __U32_TYPE #define __GID_T_TYPE __U32_TYPE #define __INO_T_TYPE __ULONGWORD_TYPE -#define __INO64_T_TYPE __UQUAD_TYPE +#define __INO64_T_TYPE __U64_TYPE #define __MODE_T_TYPE __U32_TYPE #define __NLINK_T_TYPE __U32_TYPE #define __OFF_T_TYPE __SLONGWORD_TYPE -#define __OFF64_T_TYPE __SQUAD_TYPE +#define __OFF64_T_TYPE __S64_TYPE #define __PID_T_TYPE __S32_TYPE #define __RLIM_T_TYPE __ULONGWORD_TYPE -#define __RLIM64_T_TYPE __UQUAD_TYPE +#define __RLIM64_T_TYPE __U64_TYPE #define __BLKCNT_T_TYPE __SLONGWORD_TYPE -#define __BLKCNT64_T_TYPE __SQUAD_TYPE +#define __BLKCNT64_T_TYPE __S64_TYPE #define __FSBLKCNT_T_TYPE __ULONGWORD_TYPE -#define __FSBLKCNT64_T_TYPE __UQUAD_TYPE +#define __FSBLKCNT64_T_TYPE __U64_TYPE #define __FSFILCNT_T_TYPE __ULONGWORD_TYPE -#define __FSFILCNT64_T_TYPE __UQUAD_TYPE +#define __FSFILCNT64_T_TYPE __U64_TYPE #define __FSWORD_T_TYPE __SWORD_TYPE #define __ID_T_TYPE __U32_TYPE #define __CLOCK_T_TYPE __SLONGWORD_TYPE diff --git a/sysdeps/unix/sysv/linux/x86/bits/typesizes.h b/sysdeps/unix/sysv/linux/x86/bits/typesizes.h index fb724e6a7a..37fac92bf8 100644 --- a/sysdeps/unix/sysv/linux/x86/bits/typesizes.h +++ b/sysdeps/unix/sysv/linux/x86/bits/typesizes.h @@ -28,20 +28,20 @@ /* X32 kernel interface is 64-bit. */ #if defined __x86_64__ && defined __ILP32__ -# define __SYSCALL_SLONG_TYPE __SQUAD_TYPE -# define __SYSCALL_ULONG_TYPE __UQUAD_TYPE -# define __REGISTER_T_TYPE __SQUAD_TYPE +# define __SYSCALL_SLONG_TYPE __S64_TYPE +# define __SYSCALL_ULONG_TYPE __U64_TYPE +# define __REGISTER_T_TYPE __S64_TYPE #else # define __SYSCALL_SLONG_TYPE __SLONGWORD_TYPE # define __SYSCALL_ULONG_TYPE __ULONGWORD_TYPE # define __REGISTER_T_TYPE __SWORD_TYPE #endif -#define __DEV_T_TYPE __UQUAD_TYPE +#define __DEV_T_TYPE __U64_TYPE #define __UID_T_TYPE __U32_TYPE #define __GID_T_TYPE __U32_TYPE #define __INO_T_TYPE __SYSCALL_ULONG_TYPE -#define __INO64_T_TYPE __UQUAD_TYPE +#define __INO64_T_TYPE __U64_TYPE #define __MODE_T_TYPE __U32_TYPE #ifdef __x86_64__ # define __NLINK_T_TYPE __SYSCALL_ULONG_TYPE @@ -51,16 +51,16 @@ # define __FSWORD_T_TYPE __SWORD_TYPE #endif #define __OFF_T_TYPE __SYSCALL_SLONG_TYPE -#define __OFF64_T_TYPE __SQUAD_TYPE +#define __OFF64_T_TYPE __S64_TYPE #define __PID_T_TYPE __S32_TYPE #define __RLIM_T_TYPE __SYSCALL_ULONG_TYPE -#define __RLIM64_T_TYPE __UQUAD_TYPE +#define __RLIM64_T_TYPE __U64_TYPE #define __BLKCNT_T_TYPE __SYSCALL_SLONG_TYPE -#define __BLKCNT64_T_TYPE __SQUAD_TYPE +#define __BLKCNT64_T_TYPE __S64_TYPE #define __FSBLKCNT_T_TYPE __SYSCALL_ULONG_TYPE -#define __FSBLKCNT64_T_TYPE __UQUAD_TYPE +#define __FSBLKCNT64_T_TYPE __U64_TYPE #define __FSFILCNT_T_TYPE __SYSCALL_ULONG_TYPE -#define __FSFILCNT64_T_TYPE __UQUAD_TYPE +#define __FSFILCNT64_T_TYPE __U64_TYPE #define __ID_T_TYPE __U32_TYPE #define __CLOCK_T_TYPE __SYSCALL_SLONG_TYPE #define __TIME_T_TYPE __SYSCALL_SLONG_TYPE From patchwork Wed Jun 26 17:49:52 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zack Weinberg X-Patchwork-Id: 1122957 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-103182-incoming=patchwork.ozlabs.org@sourceware.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=panix.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.b="LcXVbeGu"; 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 45YrZw50vMz9s4Y for ; Thu, 27 Jun 2019 04:07:04 +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:in-reply-to :references:mime-version:content-transfer-encoding; q=dns; s= default; b=MxaGzIXwHMxyj5jv7v4SO5AVkHClEfKZfpFzpqtKAJ2iLsqzBOC6P 3X/liONViCfb8Jq4s88Q2Ig9poFRf8BbYmvq5mX+Ba6iA3J5+RGLCQahrAhSL4If SGJ8vbhNiuzn4N2cLrrOeSfhFKNX9U35U6a/18N5gN/2PXgxOEAvf8= 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:in-reply-to :references:mime-version:content-transfer-encoding; s=default; bh=q56ayePTenqP1J/0FFWt/wHJ6/8=; b=LcXVbeGuTtaWNJ5LBbIiNqBOFU1w BlpVmqA6TmtRxauoAH5Iv3MC6GINYL2roKXIAMyG8EnkNaXaV2iGYXCnK8LOAh+Z lwnVdlO5Jxx5pKVXfBb5Ac0ZZTQbPZpMylWZRcbkWARqnOyKTZz3HRRcXLFw9lbT 4vN0WHJL1POigiI= Received: (qmail 55371 invoked by alias); 26 Jun 2019 18:06:29 -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 55281 invoked by uid 89); 26 Jun 2019 18:06:28 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-16.9 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, SPF_HELO_PASS, SPF_PASS autolearn=ham version=3.3.1 spammy= X-HELO: l2mail1.panix.com From: Zack Weinberg To: libc-alpha@sourceware.org Cc: joseph@codesourcery.com, carlos@redhat.com Subject: [PATCH 07/25] Create bits/types headers for most remaining __T_defined macros. Date: Wed, 26 Jun 2019 13:49:52 -0400 Message-Id: <20190626174954.8009-8-zackw@panix.com> In-Reply-To: <20190626174954.8009-1-zackw@panix.com> References: <20190626174954.8009-1-zackw@panix.com> MIME-Version: 1.0 This doesn't exactly fit the theme but as long as I'm tinkering with sys/types.h it makes sense to go through and create single-declaration bits/types/ headers for all of the remaining cases where we have two or more headers declaring a public type. The remaining uses of the original __T_defined idiom are: __error_t_defined in files shared with gnulib, which probably has to remain as is; ____gwchar_t_defined in inttypes.h, which may not be necessary anymore and should be addressed separately, and __ldiv_t_defined and __lldiv_t_defined in stdlib.h, ditto. Our handling of LFS types is a little inconsistent: some headers declare both off_t and off64_t (for instance) when _LARGEFILE64_SOURCE, others will only declare off_t regardless of _LARGEFILE64_SOURCE. I don't know if this was intentional or not. I am tempted to centralize responsibility for _LARGEFILE64_SOURCE as well as _FILE_OFFSET_BITS=64 in bits/types/off_t.h (etc) so that any header that declares off_t will automatically also declare off64_t when _LARGEFILE64_SOURCE. sunrpc/rpc/types.h is special, because it is included in files compiled by the *build* compiler (cross-rpcgen-objs), and therefore it cannot unconditionally assume bits/types headers are available. What I did was have it include the appropriate bits/types headers only if including sys/types.h did not cause __BIT_TYPES_DEFINED__ to be defined. This will do the right thing when an installed rpc/types.h is included by application code compiled without __USE_MISC in effect. During the build, we rely on the fact that we compile all of our own code with __USE_MISC in effect. This is fragile, but should be acceptable for code that's no longer built by default anyway. scripts/check-obsolete-constructs.py ensures that only sys/types.h and rpc/types.h include the bits/types/ headers that define obsolete types. * posix/bits/types/blkcnt64_t.h * posix/bits/types/blkcnt_t.h * posix/bits/types/blksize_t.h * posix/bits/types/dev_t.h * posix/bits/types/fsblkcnt64_t.h * posix/bits/types/fsblkcnt_t.h * posix/bits/types/fsfilcnt64_t.h * posix/bits/types/fsfilcnt_t.h * posix/bits/types/fsid_t.h * posix/bits/types/gid_t.h * posix/bits/types/id_t.h * posix/bits/types/ino64_t.h * posix/bits/types/ino_t.h * posix/bits/types/intptr_t.h * posix/bits/types/key_t.h * posix/bits/types/loff_t.h * posix/bits/types/mode_t.h * posix/bits/types/nlink_t.h * posix/bits/types/off64_t.h * posix/bits/types/off_t.h * posix/bits/types/pid_t.h * posix/bits/types/socklen_t.h * posix/bits/types/ssize_t.h * posix/bits/types/suseconds_t.h * posix/bits/types/uid_t.h * posix/bits/types/useconds_t.h: New single-declaration headers for standard types canonically defined by sys/types.h, sys/socket.h, or inttypes.h but also exposed by other headers under some circumstances. Code moved from posix/sys/types.h, socket/sys/socket.h, stdlib/inttypes.h as appropriate. * posix/bits/types/uint.h * posix/bits/types/u_int.h * posix/bits/types/u_intN_t.h * posix/bits/types/caddr_t.h * posix/bits/types/daddr_t.h * posix/bits/types/loff_t.h * posix/bits/types/register_t.h: Similarly, but for obsolete BSD-derived types whose canonical home is sys/types.h. Some of these headers define more than one type. * posix/Makefile (headers): Install the above new headers. Rewrap the list. * posix/sys/types.h: All definitions of public types now accomplished using the above new headers. Consolidate groups of definitions controlled by the same feature selection macros. * inet/arpa/inet.h, bits/socket.h * sysdeps/mach/hurd/bits/socket.h * sysdeps/unix/sysv/linux/bits/socket.h: Use bits/types/socklen_t.h. * dirent/dirent.h: Use bits/types/ino_t.h and bits/types/ino64_t.h. * grp/grp.h: Use bits/types/gid_t.h. * io/fcntl.h: Use bits/types/mode_t.h, bits/types/off_t.h, bits/types/pid_t.h, and bits/types/off64_t.h. * io/sys/stat.h: Use bits/types/dev_t.h, bits/types/gid_t.h, bits/types/ino_t.h, bits/types/mode_t.h, bits/types/nlink_t.h, bits/types/off_t.h, bits/types/uid_t.h, and bits/types/blkcnt_t.h. * libio/stdio.h: Use bits/types/off_t.h, bits/types/off64_t.h, and bits/types/ssize_t.h. * misc/sys/mman.h: Use bits/types/off_t.h and bits/types/mode_t.h. * misc/sys/select.h: Use bits/types/suseconds_t.h. * posix/sched.h: Use bits/types/pid_t.h. * posix/sys/wait.h: Use bits/types/pid_t.h and bits/types/id_t.h. * posix/unistd.h: Use bits/types/gid_t.h, bits/types/uid_t.h, bits/types/off_t.h, bits/types/off64_t.h, bits/types/useconds_t.h, bits/types/intptr_t.h, and bits/types/socklen_t.h. * pwd/pwd.h: Use bits/types/gid_t.h and bits/types/uid_t.h. * resource/sys/resource.h: Use bits/types/id_t.h. * signal/signal.h: Use bits/types/pid_t.h and bits/types/uid_t.h. * stdlib/monetary.h: Use bits/types/ssize_t.h. * sysdeps/gnu/utmpx.h: Use bits/types/pid_t.h. * sysvipc/sys/ipc.h: Use bits/types/uid_t.h, bits/types/gid_t.h, bits/types/mode_t.h, and bits/types/key_t.h. * sysvipc/sys/msg.h: Use bits/types/pid_t.h and bits/types/ssize_t.h. * sysvipc/sys/shm.h: Use bits/types/pid_t.h. * termios/termios.h: Use bits/types/pid_t.h. * time/sys/time.h: Use bits/types/suseconds_t.h. * time/time.h: Use bits/types/pid_t.h. * sunrpc/rpc/types.h: Consolidate all #includes at the top of the file. If __BIT_TYPES_DEFINED__ is not defined after including sys/types.h, also include bits/types/caddr_t.h, bits/types/daddr_t.h, bits/types/fsid_t.h, and bits/types/u_int.h. * scripts/check-obsolete-constructs.py (OBSOLETE_TYPE_HDR_RE_): New. (ObsoleteIndirectDefinitionsAllowed): New; allows inclusion of bits/types/ headers that define obsolete typedefs, but not direct definitions of those types. (ObsoleteNotAllowed, ObsoletePrivateDefinitionsAllowed) (ObsoletePublicDefinitionsAllowed): Do not allow inclusion of bits/types/ headers that define obsolete typedefs. * include/bits/types/blkcnt64_t.h * include/bits/types/blkcnt_t.h * include/bits/types/blksize_t.h * include/bits/types/caddr_t.h * include/bits/types/daddr_t.h * include/bits/types/dev_t.h * include/bits/types/fsblkcnt64_t.h * include/bits/types/fsblkcnt_t.h * include/bits/types/fsfilcnt64_t.h * include/bits/types/fsfilcnt_t.h * include/bits/types/fsid_t.h * include/bits/types/gid_t.h * include/bits/types/id_t.h * include/bits/types/ino64_t.h * include/bits/types/ino_t.h * include/bits/types/intptr_t.h * include/bits/types/key_t.h * include/bits/types/loff_t.h * include/bits/types/mode_t.h * include/bits/types/nlink_t.h * include/bits/types/off64_t.h * include/bits/types/off_t.h * include/bits/types/pid_t.h * include/bits/types/register_t.h * include/bits/types/socklen_t.h * include/bits/types/ssize_t.h * include/bits/types/suseconds_t.h * include/bits/types/u_char.h * include/bits/types/u_intN_t.h * include/bits/types/uchar.h * include/bits/types/uid_t.h * include/bits/types/useconds_t.h: New wrappers. --- bits/socket.h | 8 +- dirent/dirent.h | 14 +- grp/grp.h | 6 +- include/bits/types/blkcnt64_t.h | 1 + include/bits/types/blkcnt_t.h | 1 + include/bits/types/blksize_t.h | 1 + include/bits/types/caddr_t.h | 1 + include/bits/types/daddr_t.h | 1 + include/bits/types/dev_t.h | 1 + include/bits/types/fsblkcnt64_t.h | 1 + include/bits/types/fsblkcnt_t.h | 1 + include/bits/types/fsfilcnt64_t.h | 1 + include/bits/types/fsfilcnt_t.h | 1 + include/bits/types/fsid_t.h | 1 + include/bits/types/gid_t.h | 1 + include/bits/types/id_t.h | 1 + include/bits/types/ino64_t.h | 1 + include/bits/types/ino_t.h | 1 + include/bits/types/intptr_t.h | 1 + include/bits/types/key_t.h | 1 + include/bits/types/loff_t.h | 1 + include/bits/types/mode_t.h | 1 + include/bits/types/nlink_t.h | 1 + include/bits/types/off64_t.h | 1 + include/bits/types/off_t.h | 1 + include/bits/types/pid_t.h | 1 + include/bits/types/register_t.h | 1 + include/bits/types/socklen_t.h | 1 + include/bits/types/ssize_t.h | 1 + include/bits/types/suseconds_t.h | 1 + include/bits/types/u_int.h | 1 + include/bits/types/u_intN_t.h | 1 + include/bits/types/uid_t.h | 1 + include/bits/types/uint.h | 1 + include/bits/types/useconds_t.h | 1 + inet/arpa/inet.h | 7 +- io/fcntl.h | 27 +--- io/sys/stat.h | 66 ++------ io/sys/statvfs.h | 21 +-- libio/stdio.h | 19 +-- misc/sys/mman.h | 16 +- misc/sys/select.h | 7 +- posix/Makefile | 37 +++-- posix/bits/types/blkcnt64_t.h | 9 ++ posix/bits/types/blkcnt_t.h | 13 ++ posix/bits/types/blksize_t.h | 9 ++ posix/bits/types/caddr_t.h | 9 ++ posix/bits/types/daddr_t.h | 9 ++ posix/bits/types/dev_t.h | 9 ++ posix/bits/types/fsblkcnt64_t.h | 9 ++ posix/bits/types/fsblkcnt_t.h | 13 ++ posix/bits/types/fsfilcnt64_t.h | 9 ++ posix/bits/types/fsfilcnt_t.h | 13 ++ posix/bits/types/fsid_t.h | 9 ++ posix/bits/types/gid_t.h | 9 ++ posix/bits/types/id_t.h | 10 ++ posix/bits/types/ino64_t.h | 9 ++ posix/bits/types/ino_t.h | 13 ++ posix/bits/types/intptr_t.h | 10 ++ posix/bits/types/key_t.h | 9 ++ posix/bits/types/loff_t.h | 9 ++ posix/bits/types/mode_t.h | 9 ++ posix/bits/types/nlink_t.h | 9 ++ posix/bits/types/off64_t.h | 9 ++ posix/bits/types/off_t.h | 13 ++ posix/bits/types/pid_t.h | 9 ++ posix/bits/types/register_t.h | 9 ++ posix/bits/types/socklen_t.h | 9 ++ posix/bits/types/ssize_t.h | 9 ++ posix/bits/types/suseconds_t.h | 9 ++ posix/bits/types/u_int.h | 15 ++ posix/bits/types/u_intN_t.h | 17 ++ posix/bits/types/uid_t.h | 9 ++ posix/bits/types/uint.h | 10 ++ posix/bits/types/useconds_t.h | 9 ++ posix/sched.h | 6 +- posix/sys/types.h | 218 ++++++-------------------- posix/sys/wait.h | 11 +- posix/unistd.h | 54 ++----- pwd/pwd.h | 11 +- resource/sys/resource.h | 6 +- scripts/check-obsolete-constructs.py | 74 +++++++-- signal/signal.h | 12 +- stdlib/monetary.h | 7 +- stdlib/stdint.h | 5 +- sunrpc/rpc/types.h | 44 ++---- sysdeps/gnu/utmpx.h | 5 +- sysdeps/mach/hurd/bits/socket.h | 8 +- sysdeps/unix/sysv/linux/bits/socket.h | 7 +- sysvipc/sys/ipc.h | 24 +-- sysvipc/sys/msg.h | 12 +- sysvipc/sys/shm.h | 9 +- termios/termios.h | 8 +- time/sys/time.h | 6 +- time/time.h | 5 +- 95 files changed, 574 insertions(+), 543 deletions(-) create mode 100644 include/bits/types/blkcnt64_t.h create mode 100644 include/bits/types/blkcnt_t.h create mode 100644 include/bits/types/blksize_t.h create mode 100644 include/bits/types/caddr_t.h create mode 100644 include/bits/types/daddr_t.h create mode 100644 include/bits/types/dev_t.h create mode 100644 include/bits/types/fsblkcnt64_t.h create mode 100644 include/bits/types/fsblkcnt_t.h create mode 100644 include/bits/types/fsfilcnt64_t.h create mode 100644 include/bits/types/fsfilcnt_t.h create mode 100644 include/bits/types/fsid_t.h create mode 100644 include/bits/types/gid_t.h create mode 100644 include/bits/types/id_t.h create mode 100644 include/bits/types/ino64_t.h create mode 100644 include/bits/types/ino_t.h create mode 100644 include/bits/types/intptr_t.h create mode 100644 include/bits/types/key_t.h create mode 100644 include/bits/types/loff_t.h create mode 100644 include/bits/types/mode_t.h create mode 100644 include/bits/types/nlink_t.h create mode 100644 include/bits/types/off64_t.h create mode 100644 include/bits/types/off_t.h create mode 100644 include/bits/types/pid_t.h create mode 100644 include/bits/types/register_t.h create mode 100644 include/bits/types/socklen_t.h create mode 100644 include/bits/types/ssize_t.h create mode 100644 include/bits/types/suseconds_t.h create mode 100644 include/bits/types/u_int.h create mode 100644 include/bits/types/u_intN_t.h create mode 100644 include/bits/types/uid_t.h create mode 100644 include/bits/types/uint.h create mode 100644 include/bits/types/useconds_t.h create mode 100644 posix/bits/types/blkcnt64_t.h create mode 100644 posix/bits/types/blkcnt_t.h create mode 100644 posix/bits/types/blksize_t.h create mode 100644 posix/bits/types/caddr_t.h create mode 100644 posix/bits/types/daddr_t.h create mode 100644 posix/bits/types/dev_t.h create mode 100644 posix/bits/types/fsblkcnt64_t.h create mode 100644 posix/bits/types/fsblkcnt_t.h create mode 100644 posix/bits/types/fsfilcnt64_t.h create mode 100644 posix/bits/types/fsfilcnt_t.h create mode 100644 posix/bits/types/fsid_t.h create mode 100644 posix/bits/types/gid_t.h create mode 100644 posix/bits/types/id_t.h create mode 100644 posix/bits/types/ino64_t.h create mode 100644 posix/bits/types/ino_t.h create mode 100644 posix/bits/types/intptr_t.h create mode 100644 posix/bits/types/key_t.h create mode 100644 posix/bits/types/loff_t.h create mode 100644 posix/bits/types/mode_t.h create mode 100644 posix/bits/types/nlink_t.h create mode 100644 posix/bits/types/off64_t.h create mode 100644 posix/bits/types/off_t.h create mode 100644 posix/bits/types/pid_t.h create mode 100644 posix/bits/types/register_t.h create mode 100644 posix/bits/types/socklen_t.h create mode 100644 posix/bits/types/ssize_t.h create mode 100644 posix/bits/types/suseconds_t.h create mode 100644 posix/bits/types/u_int.h create mode 100644 posix/bits/types/u_intN_t.h create mode 100644 posix/bits/types/uid_t.h create mode 100644 posix/bits/types/uint.h create mode 100644 posix/bits/types/useconds_t.h diff --git a/bits/socket.h b/bits/socket.h index fdcf015192..6687a47740 100644 --- a/bits/socket.h +++ b/bits/socket.h @@ -28,13 +28,7 @@ #include #include - -/* Type for length arguments in socket calls. */ -#ifndef __socklen_t_defined -typedef __socklen_t socklen_t; -# define __socklen_t_defined -#endif - +#include /* Types of sockets. */ enum __socket_type diff --git a/dirent/dirent.h b/dirent/dirent.h index fc4d4859fe..9639ae96d4 100644 --- a/dirent/dirent.h +++ b/dirent/dirent.h @@ -29,17 +29,9 @@ __BEGIN_DECLS #include #ifdef __USE_XOPEN -# ifndef __ino_t_defined -# ifndef __USE_FILE_OFFSET64 -typedef __ino_t ino_t; -# else -typedef __ino64_t ino_t; -# endif -# define __ino_t_defined -# endif -# if defined __USE_LARGEFILE64 && !defined __ino64_t_defined -typedef __ino64_t ino64_t; -# define __ino64_t_defined +# include +# ifdef __USE_LARGEFILE64 +# include # endif #endif diff --git a/grp/grp.h b/grp/grp.h index 0663c8f83c..d8f7683d1f 100644 --- a/grp/grp.h +++ b/grp/grp.h @@ -31,11 +31,9 @@ __BEGIN_DECLS #define __need_size_t #include - /* For the Single Unix specification we must define this type here. */ -#if (defined __USE_XOPEN || defined __USE_XOPEN2K) && !defined __gid_t_defined -typedef __gid_t gid_t; -# define __gid_t_defined +#if defined __USE_XOPEN || defined __USE_XOPEN2K +# include #endif /* The group structure. */ diff --git a/include/bits/types/blkcnt64_t.h b/include/bits/types/blkcnt64_t.h new file mode 100644 index 0000000000..c0c2ceded0 --- /dev/null +++ b/include/bits/types/blkcnt64_t.h @@ -0,0 +1 @@ +#include diff --git a/include/bits/types/blkcnt_t.h b/include/bits/types/blkcnt_t.h new file mode 100644 index 0000000000..ad8ed2455b --- /dev/null +++ b/include/bits/types/blkcnt_t.h @@ -0,0 +1 @@ +#include diff --git a/include/bits/types/blksize_t.h b/include/bits/types/blksize_t.h new file mode 100644 index 0000000000..d6ed861acb --- /dev/null +++ b/include/bits/types/blksize_t.h @@ -0,0 +1 @@ +#include diff --git a/include/bits/types/caddr_t.h b/include/bits/types/caddr_t.h new file mode 100644 index 0000000000..9d499e7fff --- /dev/null +++ b/include/bits/types/caddr_t.h @@ -0,0 +1 @@ +#include diff --git a/include/bits/types/daddr_t.h b/include/bits/types/daddr_t.h new file mode 100644 index 0000000000..90050fae5e --- /dev/null +++ b/include/bits/types/daddr_t.h @@ -0,0 +1 @@ +#include diff --git a/include/bits/types/dev_t.h b/include/bits/types/dev_t.h new file mode 100644 index 0000000000..f0451c00ad --- /dev/null +++ b/include/bits/types/dev_t.h @@ -0,0 +1 @@ +#include diff --git a/include/bits/types/fsblkcnt64_t.h b/include/bits/types/fsblkcnt64_t.h new file mode 100644 index 0000000000..b5951d5121 --- /dev/null +++ b/include/bits/types/fsblkcnt64_t.h @@ -0,0 +1 @@ +#include diff --git a/include/bits/types/fsblkcnt_t.h b/include/bits/types/fsblkcnt_t.h new file mode 100644 index 0000000000..9fc9e4104b --- /dev/null +++ b/include/bits/types/fsblkcnt_t.h @@ -0,0 +1 @@ +#include diff --git a/include/bits/types/fsfilcnt64_t.h b/include/bits/types/fsfilcnt64_t.h new file mode 100644 index 0000000000..d3152d44a8 --- /dev/null +++ b/include/bits/types/fsfilcnt64_t.h @@ -0,0 +1 @@ +#include diff --git a/include/bits/types/fsfilcnt_t.h b/include/bits/types/fsfilcnt_t.h new file mode 100644 index 0000000000..fc092c5673 --- /dev/null +++ b/include/bits/types/fsfilcnt_t.h @@ -0,0 +1 @@ +#include diff --git a/include/bits/types/fsid_t.h b/include/bits/types/fsid_t.h new file mode 100644 index 0000000000..9d1e517229 --- /dev/null +++ b/include/bits/types/fsid_t.h @@ -0,0 +1 @@ +#include diff --git a/include/bits/types/gid_t.h b/include/bits/types/gid_t.h new file mode 100644 index 0000000000..d8cf23be0e --- /dev/null +++ b/include/bits/types/gid_t.h @@ -0,0 +1 @@ +#include diff --git a/include/bits/types/id_t.h b/include/bits/types/id_t.h new file mode 100644 index 0000000000..5eaae0bf76 --- /dev/null +++ b/include/bits/types/id_t.h @@ -0,0 +1 @@ +#include diff --git a/include/bits/types/ino64_t.h b/include/bits/types/ino64_t.h new file mode 100644 index 0000000000..42037642c9 --- /dev/null +++ b/include/bits/types/ino64_t.h @@ -0,0 +1 @@ +#include diff --git a/include/bits/types/ino_t.h b/include/bits/types/ino_t.h new file mode 100644 index 0000000000..2624ae5034 --- /dev/null +++ b/include/bits/types/ino_t.h @@ -0,0 +1 @@ +#include diff --git a/include/bits/types/intptr_t.h b/include/bits/types/intptr_t.h new file mode 100644 index 0000000000..455151b5b6 --- /dev/null +++ b/include/bits/types/intptr_t.h @@ -0,0 +1 @@ +#include diff --git a/include/bits/types/key_t.h b/include/bits/types/key_t.h new file mode 100644 index 0000000000..c4d96aa4e0 --- /dev/null +++ b/include/bits/types/key_t.h @@ -0,0 +1 @@ +#include diff --git a/include/bits/types/loff_t.h b/include/bits/types/loff_t.h new file mode 100644 index 0000000000..933175cbcb --- /dev/null +++ b/include/bits/types/loff_t.h @@ -0,0 +1 @@ +#include diff --git a/include/bits/types/mode_t.h b/include/bits/types/mode_t.h new file mode 100644 index 0000000000..58602b5d76 --- /dev/null +++ b/include/bits/types/mode_t.h @@ -0,0 +1 @@ +#include diff --git a/include/bits/types/nlink_t.h b/include/bits/types/nlink_t.h new file mode 100644 index 0000000000..f330ae2d9e --- /dev/null +++ b/include/bits/types/nlink_t.h @@ -0,0 +1 @@ +#include diff --git a/include/bits/types/off64_t.h b/include/bits/types/off64_t.h new file mode 100644 index 0000000000..002d92055b --- /dev/null +++ b/include/bits/types/off64_t.h @@ -0,0 +1 @@ +#include diff --git a/include/bits/types/off_t.h b/include/bits/types/off_t.h new file mode 100644 index 0000000000..1f18d157b7 --- /dev/null +++ b/include/bits/types/off_t.h @@ -0,0 +1 @@ +#include diff --git a/include/bits/types/pid_t.h b/include/bits/types/pid_t.h new file mode 100644 index 0000000000..6de6affc13 --- /dev/null +++ b/include/bits/types/pid_t.h @@ -0,0 +1 @@ +#include diff --git a/include/bits/types/register_t.h b/include/bits/types/register_t.h new file mode 100644 index 0000000000..68286206d1 --- /dev/null +++ b/include/bits/types/register_t.h @@ -0,0 +1 @@ +#include diff --git a/include/bits/types/socklen_t.h b/include/bits/types/socklen_t.h new file mode 100644 index 0000000000..229f676c50 --- /dev/null +++ b/include/bits/types/socklen_t.h @@ -0,0 +1 @@ +#include diff --git a/include/bits/types/ssize_t.h b/include/bits/types/ssize_t.h new file mode 100644 index 0000000000..374e4386c7 --- /dev/null +++ b/include/bits/types/ssize_t.h @@ -0,0 +1 @@ +#include diff --git a/include/bits/types/suseconds_t.h b/include/bits/types/suseconds_t.h new file mode 100644 index 0000000000..85f0dbe6f0 --- /dev/null +++ b/include/bits/types/suseconds_t.h @@ -0,0 +1 @@ +#include diff --git a/include/bits/types/u_int.h b/include/bits/types/u_int.h new file mode 100644 index 0000000000..2b17d5b831 --- /dev/null +++ b/include/bits/types/u_int.h @@ -0,0 +1 @@ +#include diff --git a/include/bits/types/u_intN_t.h b/include/bits/types/u_intN_t.h new file mode 100644 index 0000000000..ffb17bceb1 --- /dev/null +++ b/include/bits/types/u_intN_t.h @@ -0,0 +1 @@ +#include diff --git a/include/bits/types/uid_t.h b/include/bits/types/uid_t.h new file mode 100644 index 0000000000..1e2b106f52 --- /dev/null +++ b/include/bits/types/uid_t.h @@ -0,0 +1 @@ +#include diff --git a/include/bits/types/uint.h b/include/bits/types/uint.h new file mode 100644 index 0000000000..a446b7fb06 --- /dev/null +++ b/include/bits/types/uint.h @@ -0,0 +1 @@ +#include diff --git a/include/bits/types/useconds_t.h b/include/bits/types/useconds_t.h new file mode 100644 index 0000000000..71f720bd7c --- /dev/null +++ b/include/bits/types/useconds_t.h @@ -0,0 +1 @@ +#include diff --git a/inet/arpa/inet.h b/inet/arpa/inet.h index 4db2087af8..facee279a8 100644 --- a/inet/arpa/inet.h +++ b/inet/arpa/inet.h @@ -20,12 +20,7 @@ #include #include /* To define `struct in_addr'. */ - -/* Type for length arguments in socket calls. */ -#ifndef __socklen_t_defined -typedef __socklen_t socklen_t; -# define __socklen_t_defined -#endif +#include __BEGIN_DECLS diff --git a/io/fcntl.h b/io/fcntl.h index 7af8dfba69..2e973e6eb0 100644 --- a/io/fcntl.h +++ b/io/fcntl.h @@ -46,28 +46,11 @@ __BEGIN_DECLS /* POSIX.1-2001 specifies that these types are defined by . Earlier POSIX standards permitted any type ending in `_t' to be defined by any POSIX header, so we don't conditionalize the definitions here. */ -#ifndef __mode_t_defined -typedef __mode_t mode_t; -# define __mode_t_defined -#endif - -#ifndef __off_t_defined -# ifndef __USE_FILE_OFFSET64 -typedef __off_t off_t; -# else -typedef __off64_t off_t; -# endif -# define __off_t_defined -#endif - -#if defined __USE_LARGEFILE64 && !defined __off64_t_defined -typedef __off64_t off64_t; -# define __off64_t_defined -#endif - -#ifndef __pid_t_defined -typedef __pid_t pid_t; -# define __pid_t_defined +#include +#include +#include +#ifdef __USE_LARGEFILE64 +#include #endif /* For XPG all symbols from should also be available. */ diff --git a/io/sys/stat.h b/io/sys/stat.h index 2de5eb65d9..e05985e782 100644 --- a/io/sys/stat.h +++ b/io/sys/stat.h @@ -33,67 +33,19 @@ #if defined __USE_XOPEN || defined __USE_XOPEN2K /* The Single Unix specification says that some more types are available here. */ - # include - -# ifndef __dev_t_defined -typedef __dev_t dev_t; -# define __dev_t_defined -# endif - -# ifndef __gid_t_defined -typedef __gid_t gid_t; -# define __gid_t_defined -# endif - -# ifndef __ino_t_defined -# ifndef __USE_FILE_OFFSET64 -typedef __ino_t ino_t; -# else -typedef __ino64_t ino_t; -# endif -# define __ino_t_defined -# endif - -# ifndef __mode_t_defined -typedef __mode_t mode_t; -# define __mode_t_defined -# endif - -# ifndef __nlink_t_defined -typedef __nlink_t nlink_t; -# define __nlink_t_defined -# endif - -# ifndef __off_t_defined -# ifndef __USE_FILE_OFFSET64 -typedef __off_t off_t; -# else -typedef __off64_t off_t; -# endif -# define __off_t_defined -# endif - -# ifndef __uid_t_defined -typedef __uid_t uid_t; -# define __uid_t_defined -# endif +# include +# include +# include +# include +# include +# include +# include #endif /* X/Open */ #ifdef __USE_UNIX98 -# ifndef __blkcnt_t_defined -# ifndef __USE_FILE_OFFSET64 -typedef __blkcnt_t blkcnt_t; -# else -typedef __blkcnt64_t blkcnt_t; -# endif -# define __blkcnt_t_defined -# endif - -# ifndef __blksize_t_defined -typedef __blksize_t blksize_t; -# define __blksize_t_defined -# endif +# include +# include #endif /* Unix98 */ __BEGIN_DECLS diff --git a/io/sys/statvfs.h b/io/sys/statvfs.h index 89abf02447..d7283ddcba 100644 --- a/io/sys/statvfs.h +++ b/io/sys/statvfs.h @@ -24,25 +24,8 @@ /* Get the system-specific definition of `struct statfs'. */ #include -#ifndef __USE_FILE_OFFSET64 -# ifndef __fsblkcnt_t_defined -typedef __fsblkcnt_t fsblkcnt_t; /* Type to count file system blocks. */ -# define __fsblkcnt_t_defined -# endif -# ifndef __fsfilcnt_t_defined -typedef __fsfilcnt_t fsfilcnt_t; /* Type to count file system inodes. */ -# define __fsfilcnt_t_defined -# endif -#else -# ifndef __fsblkcnt_t_defined -typedef __fsblkcnt64_t fsblkcnt_t; /* Type to count file system blocks. */ -# define __fsblkcnt_t_defined -# endif -# ifndef __fsfilcnt_t_defined -typedef __fsfilcnt64_t fsfilcnt_t; /* Type to count file system inodes. */ -# define __fsfilcnt_t_defined -# endif -#endif +#include +#include __BEGIN_DECLS diff --git a/libio/stdio.h b/libio/stdio.h index b63ee88a77..6fabdbedc2 100644 --- a/libio/stdio.h +++ b/libio/stdio.h @@ -58,25 +58,14 @@ typedef __gnuc_va_list va_list; #endif #if defined __USE_UNIX98 || defined __USE_XOPEN2K -# ifndef __off_t_defined -# ifndef __USE_FILE_OFFSET64 -typedef __off_t off_t; -# else -typedef __off64_t off_t; -# endif -# define __off_t_defined -# endif -# if defined __USE_LARGEFILE64 && !defined __off64_t_defined -typedef __off64_t off64_t; -# define __off64_t_defined +# include +# ifdef __USE_LARGEFILE64 +# include # endif #endif #ifdef __USE_XOPEN2K8 -# ifndef __ssize_t_defined -typedef __ssize_t ssize_t; -# define __ssize_t_defined -# endif +# include #endif /* The type of the second argument to `fgetpos' and `fsetpos'. */ diff --git a/misc/sys/mman.h b/misc/sys/mman.h index b27512063b..43552c3dfa 100644 --- a/misc/sys/mman.h +++ b/misc/sys/mman.h @@ -21,22 +21,12 @@ #include #include + #define __need_size_t #include -#ifndef __off_t_defined -# ifndef __USE_FILE_OFFSET64 -typedef __off_t off_t; -# else -typedef __off64_t off_t; -# endif -# define __off_t_defined -#endif - -#ifndef __mode_t_defined -typedef __mode_t mode_t; -# define __mode_t_defined -#endif +#include +#include #include diff --git a/misc/sys/select.h b/misc/sys/select.h index 8b10702bdc..84e2ae3a66 100644 --- a/misc/sys/select.h +++ b/misc/sys/select.h @@ -38,12 +38,7 @@ #ifdef __USE_XOPEN2K # include #endif - -#ifndef __suseconds_t_defined -typedef __suseconds_t suseconds_t; -# define __suseconds_t_defined -#endif - +#include /* The fd_set member is required to be an array of longs. */ typedef long int __fd_mask; diff --git a/posix/Makefile b/posix/Makefile index 8ac6743ad7..882f78c5ec 100644 --- a/posix/Makefile +++ b/posix/Makefile @@ -22,17 +22,32 @@ subdir := posix include ../Makeconfig -headers := sys/utsname.h sys/times.h sys/wait.h sys/types.h unistd.h \ - glob.h regex.h wordexp.h fnmatch.h \ - getopt.h bits/getopt_core.h bits/getopt_ext.h bits/getopt_posix.h \ - bits/types.h bits/typesizes.h bits/pthreadtypes.h \ - bits/pthreadtypes-arch.h bits/thread-shared-types.h \ - bits/posix1_lim.h bits/posix2_lim.h bits/posix_opt.h \ - bits/local_lim.h tar.h bits/utsname.h bits/confname.h \ - bits/waitflags.h bits/waitstatus.h sys/unistd.h sched.h \ - bits/sched.h bits/cpu-set.h re_comp.h wait.h bits/environments.h \ - cpio.h spawn.h bits/unistd.h bits/types/struct_sched_param.h \ - bits/unistd_ext.h +headers := sys/utsname.h sys/times.h sys/wait.h sys/types.h unistd.h \ + glob.h regex.h wordexp.h fnmatch.h getopt.h \ + bits/getopt_core.h bits/getopt_ext.h bits/getopt_posix.h \ + bits/types.h bits/typesizes.h bits/pthreadtypes.h \ + bits/pthreadtypes-arch.h bits/thread-shared-types.h \ + bits/posix1_lim.h bits/posix2_lim.h bits/posix_opt.h \ + bits/local_lim.h tar.h bits/utsname.h bits/confname.h \ + bits/waitflags.h bits/waitstatus.h sys/unistd.h sched.h \ + bits/sched.h bits/cpu-set.h re_comp.h wait.h \ + bits/environments.h cpio.h spawn.h bits/unistd.h \ + bits/types/struct_sched_param.h bits/unistd_ext.h \ + bits/types/blkcnt64_t.h bits/types/blkcnt_t.h \ + bits/types/blksize_t.h bits/types/caddr_t.h \ + bits/types/daddr_t.h bits/types/dev_t.h \ + bits/types/fsblkcnt64_t.h bits/types/fsblkcnt_t.h \ + bits/types/fsfilcnt64_t.h bits/types/fsfilcnt_t.h \ + bits/types/fsid_t.h bits/types/gid_t.h bits/types/id_t.h \ + bits/types/ino64_t.h bits/types/ino_t.h \ + bits/types/intptr_t.h bits/types/key_t.h \ + bits/types/loff_t.h bits/types/mode_t.h \ + bits/types/nlink_t.h bits/types/off64_t.h \ + bits/types/off_t.h bits/types/pid_t.h \ + bits/types/register_t.h bits/types/ssize_t.h \ + bits/types/socklen_t.h bits/types/suseconds_t.h \ + bits/types/uid_t.h bits/types/uint.h bits/types/u_int.h \ + bits/types/u_intN_t.h bits/types/useconds_t.h routines := \ uname \ diff --git a/posix/bits/types/blkcnt64_t.h b/posix/bits/types/blkcnt64_t.h new file mode 100644 index 0000000000..d5d81e75be --- /dev/null +++ b/posix/bits/types/blkcnt64_t.h @@ -0,0 +1,9 @@ +#ifndef __blkcnt64_t_defined +#define __blkcnt64_t_defined 1 + +#include + +/* Type to count disk blocks (LFS). */ +typedef __blkcnt64_t blkcnt64_t; + +#endif diff --git a/posix/bits/types/blkcnt_t.h b/posix/bits/types/blkcnt_t.h new file mode 100644 index 0000000000..badcd47ccc --- /dev/null +++ b/posix/bits/types/blkcnt_t.h @@ -0,0 +1,13 @@ +#ifndef __blkcnt_t_defined +#define __blkcnt_t_defined 1 + +#include + +/* Type to count number of disk blocks (POSIX). */ +#ifndef __USE_FILE_OFFSET64 +typedef __blkcnt_t blkcnt_t; +#else +typedef __blkcnt64_t blkcnt_t; +#endif + +#endif diff --git a/posix/bits/types/blksize_t.h b/posix/bits/types/blksize_t.h new file mode 100644 index 0000000000..9d6ada4e4d --- /dev/null +++ b/posix/bits/types/blksize_t.h @@ -0,0 +1,9 @@ +#ifndef __blksize_t_defined +#define __blksize_t_defined 1 + +#include + +/* Type for sizes of disk blocks (POSIX). */ +typedef __blksize_t blksize_t; + +#endif diff --git a/posix/bits/types/caddr_t.h b/posix/bits/types/caddr_t.h new file mode 100644 index 0000000000..fc010bd8a6 --- /dev/null +++ b/posix/bits/types/caddr_t.h @@ -0,0 +1,9 @@ +#ifndef __caddr_t_defined +#define __caddr_t_defined 1 + +#include + +/* Obsolete type for a memory address (BSD). */ +typedef __caddr_t caddr_t; + +#endif diff --git a/posix/bits/types/daddr_t.h b/posix/bits/types/daddr_t.h new file mode 100644 index 0000000000..59f0b1b85b --- /dev/null +++ b/posix/bits/types/daddr_t.h @@ -0,0 +1,9 @@ +#ifndef __daddr_t_defined +#define __daddr_t_defined 1 + +#include + +/* Obsolete type for a disk address (BSD). */ +typedef __daddr_t daddr_t; + +#endif diff --git a/posix/bits/types/dev_t.h b/posix/bits/types/dev_t.h new file mode 100644 index 0000000000..0b45f915eb --- /dev/null +++ b/posix/bits/types/dev_t.h @@ -0,0 +1,9 @@ +#ifndef __dev_t_defined +#define __dev_t_defined 1 + +#include + +/* Type for device IDs (POSIX). */ +typedef __dev_t dev_t; + +#endif diff --git a/posix/bits/types/fsblkcnt64_t.h b/posix/bits/types/fsblkcnt64_t.h new file mode 100644 index 0000000000..690d6016aa --- /dev/null +++ b/posix/bits/types/fsblkcnt64_t.h @@ -0,0 +1,9 @@ +#ifndef __fsblkcnt64_t_defined +#define __fsblkcnt64_t_defined 1 + +#include + +/* Type to count file system blocks (LFS). */ +typedef __fsblkcnt64_t fsblkcnt64_t; + +#endif diff --git a/posix/bits/types/fsblkcnt_t.h b/posix/bits/types/fsblkcnt_t.h new file mode 100644 index 0000000000..2c7e80d41a --- /dev/null +++ b/posix/bits/types/fsblkcnt_t.h @@ -0,0 +1,13 @@ +#ifndef __fsblkcnt_t_defined +#define __fsblkcnt_t_defined 1 + +#include + +/* Type to count file system blocks (POSIX). */ +#ifndef __USE_FILE_OFFSET64 +typedef __fsblkcnt_t fsblkcnt_t; +#else +typedef __fsblkcnt64_t fsblkcnt_t; +#endif + +#endif diff --git a/posix/bits/types/fsfilcnt64_t.h b/posix/bits/types/fsfilcnt64_t.h new file mode 100644 index 0000000000..56fcbc7930 --- /dev/null +++ b/posix/bits/types/fsfilcnt64_t.h @@ -0,0 +1,9 @@ +#ifndef __fsfilcnt64_t_defined +#define __fsfilcnt64_t_defined 1 + +#include + +/* Type to count file system inodes (LFS). */ +typedef __fsfilcnt64_t fsfilcnt64_t; + +#endif diff --git a/posix/bits/types/fsfilcnt_t.h b/posix/bits/types/fsfilcnt_t.h new file mode 100644 index 0000000000..18d0f7ebdb --- /dev/null +++ b/posix/bits/types/fsfilcnt_t.h @@ -0,0 +1,13 @@ +#ifndef __fsfilcnt_t_defined +#define __fsfilcnt_t_defined 1 + +#include + +/* Type to count file system inodes (POSIX). */ +#ifndef __USE_FILE_OFFSET64 +typedef __fsfilcnt_t fsfilcnt_t; +#else +typedef __fsfilcnt64_t fsfilcnt_t; +#endif + +#endif diff --git a/posix/bits/types/fsid_t.h b/posix/bits/types/fsid_t.h new file mode 100644 index 0000000000..a198d30a07 --- /dev/null +++ b/posix/bits/types/fsid_t.h @@ -0,0 +1,9 @@ +#ifndef __fsid_t_defined +#define __fsid_t_defined 1 + +#include + +/* Type for a file system ID (BSD). */ +typedef __fsid_t fsid_t; + +#endif diff --git a/posix/bits/types/gid_t.h b/posix/bits/types/gid_t.h new file mode 100644 index 0000000000..52974a1fa3 --- /dev/null +++ b/posix/bits/types/gid_t.h @@ -0,0 +1,9 @@ +#ifndef __gid_t_defined +#define __gid_t_defined 1 + +#include + +/* Type for group IDs (POSIX). */ +typedef __gid_t gid_t; + +#endif diff --git a/posix/bits/types/id_t.h b/posix/bits/types/id_t.h new file mode 100644 index 0000000000..1cb3b76ef8 --- /dev/null +++ b/posix/bits/types/id_t.h @@ -0,0 +1,10 @@ +#ifndef __id_t_defined +#define __id_t_defined 1 + +#include + +/* Type for a general identifier, can hold any pid_t, uid_t, or gid_t + value (POSIX). */ +typedef __id_t id_t; + +#endif diff --git a/posix/bits/types/ino64_t.h b/posix/bits/types/ino64_t.h new file mode 100644 index 0000000000..e61e75a3ef --- /dev/null +++ b/posix/bits/types/ino64_t.h @@ -0,0 +1,9 @@ +#ifndef __ino64_t_defined +#define __ino64_t_defined 1 + +#include + +/* Type for file serial numbers (LFS). */ +typedef __ino64_t ino64_t; + +#endif diff --git a/posix/bits/types/ino_t.h b/posix/bits/types/ino_t.h new file mode 100644 index 0000000000..808821f2c8 --- /dev/null +++ b/posix/bits/types/ino_t.h @@ -0,0 +1,13 @@ +#ifndef __ino_t_defined +#define __ino_t_defined 1 + +#include + +/* Type for file serial numbers (POSIX). */ +# ifndef __USE_FILE_OFFSET64 +typedef __ino_t ino_t; +# else +typedef __ino64_t ino_t; +# endif + +#endif diff --git a/posix/bits/types/intptr_t.h b/posix/bits/types/intptr_t.h new file mode 100644 index 0000000000..47948f9161 --- /dev/null +++ b/posix/bits/types/intptr_t.h @@ -0,0 +1,10 @@ +#ifndef __intptr_t_defined +#define __intptr_t_defined 1 + +#include + +/* Signed integral type capable of representing a `void *' without + data loss (C1999). */ +typedef __intptr_t intptr_t; + +#endif diff --git a/posix/bits/types/key_t.h b/posix/bits/types/key_t.h new file mode 100644 index 0000000000..424d250268 --- /dev/null +++ b/posix/bits/types/key_t.h @@ -0,0 +1,9 @@ +#ifndef __key_t_defined +#define __key_t_defined 1 + +#include + +/* Type used by interprocess communication operations (XSI). */ +typedef __key_t key_t; + +#endif diff --git a/posix/bits/types/loff_t.h b/posix/bits/types/loff_t.h new file mode 100644 index 0000000000..ecb9989681 --- /dev/null +++ b/posix/bits/types/loff_t.h @@ -0,0 +1,9 @@ +#ifndef __loff_t_defined +#define __loff_t_defined 1 + +#include + +/* Obsolete type for file sizes and offsets within a file (BSD). */ +typedef __loff_t loff_t; + +#endif diff --git a/posix/bits/types/mode_t.h b/posix/bits/types/mode_t.h new file mode 100644 index 0000000000..3aaa70dc70 --- /dev/null +++ b/posix/bits/types/mode_t.h @@ -0,0 +1,9 @@ +#ifndef __mode_t_defined +#define __mode_t_defined 1 + +#include + +/* Type for file attribute bits (POSIX). */ +typedef __mode_t mode_t; + +#endif diff --git a/posix/bits/types/nlink_t.h b/posix/bits/types/nlink_t.h new file mode 100644 index 0000000000..2f9125b488 --- /dev/null +++ b/posix/bits/types/nlink_t.h @@ -0,0 +1,9 @@ +#ifndef __nlink_t_defined +#define __nlink_t_defined 1 + +#include + +/* Type for link counts (POSIX). */ +typedef __nlink_t nlink_t; + +#endif diff --git a/posix/bits/types/off64_t.h b/posix/bits/types/off64_t.h new file mode 100644 index 0000000000..f00bd82f48 --- /dev/null +++ b/posix/bits/types/off64_t.h @@ -0,0 +1,9 @@ +#ifndef __off64_t_defined +#define __off64_t_defined 1 + +#include + +/* Type for file sizes and offsets within a file (LFS). */ +typedef __off64_t off64_t; + +#endif diff --git a/posix/bits/types/off_t.h b/posix/bits/types/off_t.h new file mode 100644 index 0000000000..9ef5395e99 --- /dev/null +++ b/posix/bits/types/off_t.h @@ -0,0 +1,13 @@ +#ifndef __off_t_defined +#define __off_t_defined 1 + +#include + +/* Type for file sizes and offsets within a file (POSIX). */ +# ifndef __USE_FILE_OFFSET64 +typedef __off_t off_t; +# else +typedef __off64_t off_t; +# endif + +#endif diff --git a/posix/bits/types/pid_t.h b/posix/bits/types/pid_t.h new file mode 100644 index 0000000000..249e070953 --- /dev/null +++ b/posix/bits/types/pid_t.h @@ -0,0 +1,9 @@ +#ifndef __pid_t_defined +#define __pid_t_defined 1 + +#include + +/* Type for process IDs and process group IDs (POSIX). */ +typedef __pid_t pid_t; + +#endif diff --git a/posix/bits/types/register_t.h b/posix/bits/types/register_t.h new file mode 100644 index 0000000000..099b472f9e --- /dev/null +++ b/posix/bits/types/register_t.h @@ -0,0 +1,9 @@ +#ifndef __register_t_defined +#define __register_t_defined 1 + +#include + +/* Type of a general-purpose integer register (BSD). */ +typedef __register_t register_t; + +#endif diff --git a/posix/bits/types/socklen_t.h b/posix/bits/types/socklen_t.h new file mode 100644 index 0000000000..836963058e --- /dev/null +++ b/posix/bits/types/socklen_t.h @@ -0,0 +1,9 @@ +#ifndef __socklen_t_defined +#define __socklen_t_defined 1 + +#include + +/* Type for size of socket addresses (POSIX). */ +typedef __socklen_t socklen_t; + +#endif diff --git a/posix/bits/types/ssize_t.h b/posix/bits/types/ssize_t.h new file mode 100644 index 0000000000..41e1fd7ea7 --- /dev/null +++ b/posix/bits/types/ssize_t.h @@ -0,0 +1,9 @@ +#ifndef __ssize_t_defined +#define __ssize_t_defined 1 + +#include + +/* Type used for a count of bytes or an error indication (POSIX). */ +typedef __ssize_t ssize_t; + +#endif diff --git a/posix/bits/types/suseconds_t.h b/posix/bits/types/suseconds_t.h new file mode 100644 index 0000000000..62ded6fd84 --- /dev/null +++ b/posix/bits/types/suseconds_t.h @@ -0,0 +1,9 @@ +#ifndef __suseconds_t_defined +#define __suseconds_t_defined 1 + +#include + +/* Type for time in microseconds (signed) (XSI). */ +typedef __suseconds_t suseconds_t; + +#endif diff --git a/posix/bits/types/u_int.h b/posix/bits/types/u_int.h new file mode 100644 index 0000000000..4c9235f3fc --- /dev/null +++ b/posix/bits/types/u_int.h @@ -0,0 +1,15 @@ +#ifndef __u_int_defined +#define __u_int_defined 1 + +#include + +/* Obsolete shorthand names for unsigned types, used by old BSD + networking code and Sun RPC. */ +typedef unsigned char u_char; +typedef unsigned short int u_short; +typedef unsigned int u_int; +typedef unsigned long int u_long; +typedef __int64_t quad_t; +typedef __uint64_t u_quad_t; + +#endif diff --git a/posix/bits/types/u_intN_t.h b/posix/bits/types/u_intN_t.h new file mode 100644 index 0000000000..625767412f --- /dev/null +++ b/posix/bits/types/u_intN_t.h @@ -0,0 +1,17 @@ +#ifndef __u_intN_t_defined +#define __u_intN_t_defined 1 + +#include + +/* These size-specific names are used by some of the inet code. + They were defined by ISO C without the first `_'. */ +typedef __uint8_t u_int8_t; +typedef __uint16_t u_int16_t; +typedef __uint32_t u_int32_t; +typedef __uint64_t u_int64_t; + +/* Some code from BIND tests this macro to see if the types above are + defined. */ +#define __BIT_TYPES_DEFINED__ 1 + +#endif diff --git a/posix/bits/types/uid_t.h b/posix/bits/types/uid_t.h new file mode 100644 index 0000000000..371cb055c8 --- /dev/null +++ b/posix/bits/types/uid_t.h @@ -0,0 +1,9 @@ +#ifndef __uid_t_defined +#define __uid_t_defined 1 + +#include + +/* Type for user IDs (POSIX). */ +typedef __uid_t uid_t; + +#endif diff --git a/posix/bits/types/uint.h b/posix/bits/types/uint.h new file mode 100644 index 0000000000..69829c6f16 --- /dev/null +++ b/posix/bits/types/uint.h @@ -0,0 +1,10 @@ +#ifndef __uint_defined +#define __uint_defined 1 + +/* Obsolete shorthand names for unsigned types, used by old BSD + networking code and Sun RPC. */ +typedef unsigned short int ushort; +typedef unsigned int uint; +typedef unsigned long int ulong; + +#endif diff --git a/posix/bits/types/useconds_t.h b/posix/bits/types/useconds_t.h new file mode 100644 index 0000000000..a363558b2d --- /dev/null +++ b/posix/bits/types/useconds_t.h @@ -0,0 +1,9 @@ +#ifndef __useconds_t_defined +#define __useconds_t_defined 1 + +#include + +/* Type for time in microseconds (unsigned) (XSI). */ +typedef __useconds_t useconds_t; + +#endif diff --git a/posix/sched.h b/posix/sched.h index 90ef6fcfd1..56c1470521 100644 --- a/posix/sched.h +++ b/posix/sched.h @@ -33,11 +33,7 @@ #ifndef __USE_XOPEN2K # include #endif - -#ifndef __pid_t_defined -typedef __pid_t pid_t; -# define __pid_t_defined -#endif +#include /* Get system specific constant and data structure definitions. */ #include diff --git a/posix/sys/types.h b/posix/sys/types.h index 2d8cfd19d2..8f6d328692 100644 --- a/posix/sys/types.h +++ b/posix/sys/types.h @@ -28,120 +28,51 @@ __BEGIN_DECLS #include -#ifdef __USE_MISC -# ifndef __u_char_defined -typedef unsigned char u_char; -typedef unsigned short int u_short; -typedef unsigned int u_int; -typedef unsigned long int u_long; -typedef __int64_t quad_t; -typedef __uint64_t u_quad_t; -typedef __fsid_t fsid_t; -# define __u_char_defined -# endif -typedef __loff_t loff_t; +#define __need_size_t +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#ifdef __USE_LARGEFILE64 +# include +# include +# include +# include +# include #endif -#ifndef __ino_t_defined -# ifndef __USE_FILE_OFFSET64 -typedef __ino_t ino_t; -# else -typedef __ino64_t ino_t; -# endif -# define __ino_t_defined -#endif -#if defined __USE_LARGEFILE64 && !defined __ino64_t_defined -typedef __ino64_t ino64_t; -# define __ino64_t_defined -#endif - -#ifndef __dev_t_defined -typedef __dev_t dev_t; -# define __dev_t_defined -#endif - -#ifndef __gid_t_defined -typedef __gid_t gid_t; -# define __gid_t_defined -#endif - -#ifndef __mode_t_defined -typedef __mode_t mode_t; -# define __mode_t_defined -#endif - -#ifndef __nlink_t_defined -typedef __nlink_t nlink_t; -# define __nlink_t_defined -#endif - -#ifndef __uid_t_defined -typedef __uid_t uid_t; -# define __uid_t_defined -#endif - -#ifndef __off_t_defined -# ifndef __USE_FILE_OFFSET64 -typedef __off_t off_t; -# else -typedef __off64_t off_t; -# endif -# define __off_t_defined -#endif -#if defined __USE_LARGEFILE64 && !defined __off64_t_defined -typedef __off64_t off64_t; -# define __off64_t_defined -#endif - -#ifndef __pid_t_defined -typedef __pid_t pid_t; -# define __pid_t_defined -#endif - -#if (defined __USE_XOPEN || defined __USE_XOPEN2K8) \ - && !defined __id_t_defined -typedef __id_t id_t; -# define __id_t_defined -#endif - -#ifndef __ssize_t_defined -typedef __ssize_t ssize_t; -# define __ssize_t_defined -#endif - -#ifdef __USE_MISC -# ifndef __daddr_t_defined -typedef __daddr_t daddr_t; -typedef __caddr_t caddr_t; -# define __daddr_t_defined -# endif -#endif - -#if (defined __USE_MISC || defined __USE_XOPEN) && !defined __key_t_defined -typedef __key_t key_t; -# define __key_t_defined +#ifdef __USE_XOPEN +# include +# include #endif #if defined __USE_XOPEN || defined __USE_XOPEN2K8 # include -#endif -#include -#include -#include - -#ifdef __USE_XOPEN -# ifndef __useconds_t_defined -typedef __useconds_t useconds_t; -# define __useconds_t_defined -# endif -# ifndef __suseconds_t_defined -typedef __suseconds_t suseconds_t; -# define __suseconds_t_defined -# endif +# include +# include #endif -#define __need_size_t -#include +#if defined __USE_UNIX98 || defined __USE_XOPEN2K8 +#include +#endif + +#if defined __USE_POSIX199506 || defined __USE_UNIX98 +# include +#endif /* POSIX does not require intN_t to be defined in this header, so technically this ought to be under __USE_MISC, but it doesn't @@ -150,24 +81,17 @@ typedef __suseconds_t suseconds_t; #include #ifdef __USE_MISC -/* Old compatibility names for C types. */ -typedef unsigned long int ulong; -typedef unsigned short int ushort; -typedef unsigned int uint; +/* Additional typedefs from BSD, mostly obsolete. */ +# include +# include +# include +# include +# include -/* These size-specific names are used by some of the inet code. - They were defined by ISO C without the first `_'. */ -typedef __uint8_t u_int8_t; -typedef __uint16_t u_int16_t; -typedef __uint32_t u_int32_t; -typedef __uint64_t u_int64_t; - -/* Type of a general-purpose integer register (BSD). */ -typedef __register_t register_t; - -/* Some code from BIND tests this macro to see if the types above are - defined. */ -#define __BIT_TYPES_DEFINED__ 1 +/* Shorthand unsigned types, mostly superseded by stdint.h. */ +# include +# include +# include /* In BSD is expected to define BYTE_ORDER. */ # include @@ -176,54 +100,6 @@ typedef __register_t register_t; # include #endif /* Use misc. */ - -#if (defined __USE_UNIX98 || defined __USE_XOPEN2K8) \ - && !defined __blksize_t_defined -typedef __blksize_t blksize_t; -# define __blksize_t_defined -#endif - -/* Types from the Large File Support interface. */ -#ifndef __USE_FILE_OFFSET64 -# ifndef __blkcnt_t_defined -typedef __blkcnt_t blkcnt_t; /* Type to count number of disk blocks. */ -# define __blkcnt_t_defined -# endif -# ifndef __fsblkcnt_t_defined -typedef __fsblkcnt_t fsblkcnt_t; /* Type to count file system blocks. */ -# define __fsblkcnt_t_defined -# endif -# ifndef __fsfilcnt_t_defined -typedef __fsfilcnt_t fsfilcnt_t; /* Type to count file system inodes. */ -# define __fsfilcnt_t_defined -# endif -#else -# ifndef __blkcnt_t_defined -typedef __blkcnt64_t blkcnt_t; /* Type to count number of disk blocks. */ -# define __blkcnt_t_defined -# endif -# ifndef __fsblkcnt_t_defined -typedef __fsblkcnt64_t fsblkcnt_t; /* Type to count file system blocks. */ -# define __fsblkcnt_t_defined -# endif -# ifndef __fsfilcnt_t_defined -typedef __fsfilcnt64_t fsfilcnt_t; /* Type to count file system inodes. */ -# define __fsfilcnt_t_defined -# endif -#endif - -#ifdef __USE_LARGEFILE64 -typedef __blkcnt64_t blkcnt64_t; /* Type to count number of disk blocks. */ -typedef __fsblkcnt64_t fsblkcnt64_t; /* Type to count file system blocks. */ -typedef __fsfilcnt64_t fsfilcnt64_t; /* Type to count file system inodes. */ -#endif - - -/* Now add the thread types. */ -#if defined __USE_POSIX199506 || defined __USE_UNIX98 -# include -#endif - __END_DECLS #endif /* sys/types.h */ diff --git a/posix/sys/wait.h b/posix/sys/wait.h index 9bd4399ed7..691be2759c 100644 --- a/posix/sys/wait.h +++ b/posix/sys/wait.h @@ -27,10 +27,7 @@ __BEGIN_DECLS #include -#ifndef __pid_t_defined -typedef __pid_t pid_t; -# define __pid_t_defined -#endif +#include #if defined __USE_XOPEN_EXTENDED || defined __USE_XOPEN2K8 # include @@ -111,11 +108,7 @@ extern __pid_t wait (int *__stat_loc); extern __pid_t waitpid (__pid_t __pid, int *__stat_loc, int __options); #if defined __USE_XOPEN_EXTENDED || defined __USE_XOPEN2K8 -# ifndef __id_t_defined -typedef __id_t id_t; -# define __id_t_defined -# endif - +# include # include /* Wait for a childing matching IDTYPE and ID to change the status and diff --git a/posix/unistd.h b/posix/unistd.h index 55a989f7bb..407f2fee5f 100644 --- a/posix/unistd.h +++ b/posix/unistd.h @@ -215,11 +215,7 @@ __BEGIN_DECLS /* All functions that are not declared anywhere else. */ #include - -#ifndef __ssize_t_defined -typedef __ssize_t ssize_t; -# define __ssize_t_defined -#endif +#include #define __need_size_t #define __need_NULL @@ -228,52 +224,22 @@ typedef __ssize_t ssize_t; #if defined __USE_XOPEN || defined __USE_XOPEN2K /* The Single Unix specification says that some more types are available here. */ -# ifndef __gid_t_defined -typedef __gid_t gid_t; -# define __gid_t_defined -# endif - -# ifndef __uid_t_defined -typedef __uid_t uid_t; -# define __uid_t_defined -# endif - -# ifndef __off_t_defined -# ifndef __USE_FILE_OFFSET64 -typedef __off_t off_t; -# else -typedef __off64_t off_t; -# endif -# define __off_t_defined -# endif -# if defined __USE_LARGEFILE64 && !defined __off64_t_defined -typedef __off64_t off64_t; -# define __off64_t_defined -# endif - -# ifndef __useconds_t_defined -typedef __useconds_t useconds_t; -# define __useconds_t_defined -# endif - -# ifndef __pid_t_defined -typedef __pid_t pid_t; -# define __pid_t_defined +# include +# include +# include +# ifdef __USE_LARGEFILE64 +# include # endif +# include +# include #endif /* X/Open */ #if defined __USE_XOPEN_EXTENDED || defined __USE_XOPEN2K -# ifndef __intptr_t_defined -typedef __intptr_t intptr_t; -# define __intptr_t_defined -# endif +# include #endif #if defined __USE_MISC || defined __USE_XOPEN -# ifndef __socklen_t_defined -typedef __socklen_t socklen_t; -# define __socklen_t_defined -# endif +# include #endif /* Values for the second argument to access. diff --git a/pwd/pwd.h b/pwd/pwd.h index 1002ed39b6..ccb3bc0ff8 100644 --- a/pwd/pwd.h +++ b/pwd/pwd.h @@ -34,15 +34,8 @@ __BEGIN_DECLS #if defined __USE_XOPEN || defined __USE_XOPEN2K /* The Single Unix specification says that some more types are available here. */ -# ifndef __gid_t_defined -typedef __gid_t gid_t; -# define __gid_t_defined -# endif - -# ifndef __uid_t_defined -typedef __uid_t uid_t; -# define __uid_t_defined -# endif +# include +# include #endif /* A record in the user database. */ diff --git a/resource/sys/resource.h b/resource/sys/resource.h index 928646b074..3ed33c4bcd 100644 --- a/resource/sys/resource.h +++ b/resource/sys/resource.h @@ -22,11 +22,7 @@ /* Get the system-dependent definitions of structures and bit values. */ #include - -#ifndef __id_t_defined -typedef __id_t id_t; -# define __id_t_defined -#endif +#include __BEGIN_DECLS diff --git a/scripts/check-obsolete-constructs.py b/scripts/check-obsolete-constructs.py index 518de7523e..49338c06b7 100755 --- a/scripts/check-obsolete-constructs.py +++ b/scripts/check-obsolete-constructs.py @@ -28,6 +28,7 @@ import argparse import collections +import os.path import re import sys @@ -264,15 +265,40 @@ OBSOLETE_TYPE_RE_ = re.compile(r"""\A | _(?: char | short | int(?:[0-9]+_t)? | long | quad_t ))) \Z""", re.VERBOSE) +# The headers that declare them: +OBSOLETE_TYPE_HDR_RE_ = re.compile(r"""\A + [<"] bits/types/ + (?: [cd]addr_t + | loff_t + | register_t + | uint + | u_int + | u_intN_t ) \.h [">] +\Z""", re.VERBOSE) + class ObsoleteNotAllowed(ConstructChecker): - """Don't allow any use of the obsolete typedefs.""" + """Don't allow any use of the obsolete typedefs, + or the headers that declare them.""" def examine(self, tok): - if OBSOLETE_TYPE_RE_.match(tok.text): + if ((tok.kind == "IDENT" + and OBSOLETE_TYPE_RE_.match(tok.text)) + or (tok.kind == "HEADER_NAME" + and OBSOLETE_TYPE_HDR_RE_.match(tok.text))): + self.reporter.error(tok, "use of {!r}") + +class ObsoleteIndirectDefinitionsAllowed(ConstructChecker): + """Don't allow any use of the obsolete typedefs, + but do allow inclusion of the headers that declare them.""" + def examine(self, tok): + if (tok.kind == "IDENT" + and OBSOLETE_TYPE_RE_.match(tok.text)): self.reporter.error(tok, "use of {!r}") class ObsoletePrivateDefinitionsAllowed(ConstructChecker): """Allow definitions of the private versions of the obsolete typedefs; that is, 'typedef [anything] __obsolete;' + Don't allow inclusion of headers that declare the public + versions. """ def __init__(self, reporter): super().__init__(reporter) @@ -300,10 +326,14 @@ class ObsoletePrivateDefinitionsAllowed(ConstructChecker): self._check_prev() def _check_prev(self): - if (self.prev_token is not None - and self.prev_token.kind == "IDENT" - and OBSOLETE_TYPE_RE_.match(self.prev_token.text)): - self.reporter.error(self.prev_token, "use of {!r}") + tok = self.prev_token + if tok is None: + return + if ((tok.kind == "IDENT" + and OBSOLETE_TYPE_RE_.match(tok.text)) + or (tok.kind == "HEADER_NAME" + and OBSOLETE_TYPE_HDR_RE_.match(tok.text))): + self.reporter.error(tok, "use of {!r}") class ObsoletePublicDefinitionsAllowed(ConstructChecker): """Allow definitions of the public versions of the obsolete @@ -317,6 +347,9 @@ class ObsoletePublicDefinitionsAllowed(ConstructChecker): typedef unsigned char u_char; typedef __int64_t quad_t; typedef __uint64_t u_quad_t; + + Don't allow inclusion of headers that declare public + versions of other obsolete typedefs. """ def __init__(self, reporter): super().__init__(reporter) @@ -337,6 +370,10 @@ class ObsoletePublicDefinitionsAllowed(ConstructChecker): elif tok.kind == "PUNCTUATOR" and tok.text == ";": self._finish() + elif tok.kind == "HEADER_NAME": + if OBSOLETE_TYPE_HDR_RE_.match(tok.text): + self.reporter.error(tok, "use of {!r}") + elif self.typedef_tokens: self.typedef_tokens.append(tok) @@ -406,19 +443,38 @@ def ObsoleteTypedefChecker(reporter, fname): or fname.startswith("rpcsvc/") or "/rpc/" in fname or "/rpcsvc/" in fname): + sys.stderr.write("# No typedef checks for {}\n".format(fname)) return NoCheck(reporter) # bits/types.h is allowed to define the __-versions of the # obsolete types. if (fname == "bits/types.h" or fname.endswith("/bits/types.h")): + sys.stderr.write("# Obsolete private defs allowed for {}\n" + .format(fname)) return ObsoletePrivateDefinitionsAllowed(reporter) - # sys/types.h is allowed to use the __-versions of the - # obsolete types, but only to define the unprefixed versions. + # Certain bits/types/ headers are allowed to define the + # unprefixed versions of the obsolete types. + if ((fname.startswith("bits/types/") + or "/bits/types/" in fname) + and os.path.basename(fname) in ("caddr_t.h", + "daddr_t.h", + "loff_t.h", + "register_t.h", + "uint.h", + "u_int.h", + "u_intN_t.h")): + sys.stderr.write("# Obsolete public defs allowed for {}\n" + .format(fname)) + return ObsoletePublicDefinitionsAllowed(reporter) + + # sys/types.h is allowed to include the above bits/types/ headers. if (fname == "sys/types.h" or fname.endswith("/sys/types.h")): - return ObsoletePublicDefinitionsAllowed(reporter) + sys.stderr.write("# Obsolete indirect defs allowed for {}\n" + .format(fname)) + return ObsoleteIndirectDefinitionsAllowed(reporter) return ObsoleteNotAllowed(reporter) diff --git a/signal/signal.h b/signal/signal.h index 4c0de7f6ce..ec701012e1 100644 --- a/signal/signal.h +++ b/signal/signal.h @@ -36,16 +36,8 @@ __BEGIN_DECLS #endif #if defined __USE_XOPEN || defined __USE_XOPEN2K -# ifndef __pid_t_defined -typedef __pid_t pid_t; -# define __pid_t_defined -#endif -#ifdef __USE_XOPEN -# endif -# ifndef __uid_t_defined -typedef __uid_t uid_t; -# define __uid_t_defined -# endif +# include +# include #endif /* Unix98 */ #ifdef __USE_POSIX199309 diff --git a/stdlib/monetary.h b/stdlib/monetary.h index 1cecd05012..1f3347a6ec 100644 --- a/stdlib/monetary.h +++ b/stdlib/monetary.h @@ -25,12 +25,7 @@ #define __need_size_t #include #include - -#ifndef __ssize_t_defined -typedef __ssize_t ssize_t; -# define __ssize_t_defined -#endif - +#include __BEGIN_DECLS diff --git a/stdlib/stdint.h b/stdlib/stdint.h index 8645d91cfc..aca50d1bc9 100644 --- a/stdlib/stdint.h +++ b/stdlib/stdint.h @@ -82,10 +82,7 @@ typedef unsigned long long int uint_fast64_t; /* Types for `void *' pointers. */ -# ifndef __intptr_t_defined -typedef __intptr_t intptr_t; -# define __intptr_t_defined -# endif +#include typedef __uintptr_t uintptr_t; /* Largest integral types. */ diff --git a/sunrpc/rpc/types.h b/sunrpc/rpc/types.h index 99e5f4f151..13ef47f3c9 100644 --- a/sunrpc/rpc/types.h +++ b/sunrpc/rpc/types.h @@ -34,6 +34,19 @@ #ifndef _RPC_TYPES_H #define _RPC_TYPES_H 1 +#include +#include +#include +#include +#include + +#ifndef __BIT_TYPES_DEFINED__ +#include +#include +#include +#include +#endif + typedef int bool_t; typedef int enum_t; /* This needs to be changed to uint32_t in the future */ @@ -57,7 +70,6 @@ typedef unsigned long rpcport_t; # define NULL 0 #endif -#include /* For malloc decl. */ #define mem_alloc(bsize) malloc(bsize) /* * XXX: This must not use the second argument, or code in xdr_array.c needs @@ -65,36 +77,6 @@ typedef unsigned long rpcport_t; */ #define mem_free(ptr, bsize) free(ptr) -#ifndef makedev /* ie, we haven't already included it */ -#include -#endif - -#if defined __APPLE_CC__ || defined __FreeBSD__ -# define __u_char_defined -# define __daddr_t_defined -#endif - -#ifndef __u_char_defined -typedef unsigned char u_char; -typedef unsigned short int u_short; -typedef unsigned int u_int; -typedef unsigned long int u_long; -typedef __int64_t quad_t; -typedef __uint64_t u_quad_t; -typedef __fsid_t fsid_t; -# define __u_char_defined -#endif -#ifndef __daddr_t_defined -typedef __daddr_t daddr_t; -typedef __caddr_t caddr_t; -# define __daddr_t_defined -#endif - -#include -#include - -#include - #ifndef INADDR_LOOPBACK #define INADDR_LOOPBACK (u_long)0x7F000001 #endif diff --git a/sysdeps/gnu/utmpx.h b/sysdeps/gnu/utmpx.h index 927410234d..41c122d970 100644 --- a/sysdeps/gnu/utmpx.h +++ b/sysdeps/gnu/utmpx.h @@ -22,10 +22,7 @@ #include /* Required according to Unix98. */ -#ifndef __pid_t_defined -typedef __pid_t pid_t; -# define __pid_t_defined -#endif +#include /* Get system dependent values and data structures. */ #include diff --git a/sysdeps/mach/hurd/bits/socket.h b/sysdeps/mach/hurd/bits/socket.h index f7f3cc4059..429e66c56a 100644 --- a/sysdeps/mach/hurd/bits/socket.h +++ b/sysdeps/mach/hurd/bits/socket.h @@ -29,13 +29,7 @@ #include #include - -/* Type for length arguments in socket calls. */ -#ifndef __socklen_t_defined -typedef __socklen_t socklen_t; -# define __socklen_t_defined -#endif - +#include /* Types of sockets. */ enum __socket_type diff --git a/sysdeps/unix/sysv/linux/bits/socket.h b/sysdeps/unix/sysv/linux/bits/socket.h index 99af01d2a4..cf3c03a9ec 100644 --- a/sysdeps/unix/sysv/linux/bits/socket.h +++ b/sysdeps/unix/sysv/linux/bits/socket.h @@ -27,12 +27,7 @@ #include #include - -/* Type for length arguments in socket calls. */ -#ifndef __socklen_t_defined -typedef __socklen_t socklen_t; -# define __socklen_t_defined -#endif +#include /* Get the architecture-dependent definition of enum __socket_type. */ #include diff --git a/sysvipc/sys/ipc.h b/sysvipc/sys/ipc.h index 516e275d49..8aa7f38d0d 100644 --- a/sysvipc/sys/ipc.h +++ b/sysvipc/sys/ipc.h @@ -23,26 +23,10 @@ /* Get system dependent definition of `struct ipc_perm' and more. */ #include #include - -#ifndef __uid_t_defined -typedef __uid_t uid_t; -# define __uid_t_defined -#endif - -#ifndef __gid_t_defined -typedef __gid_t gid_t; -# define __gid_t_defined -#endif - -#ifndef __mode_t_defined -typedef __mode_t mode_t; -# define __mode_t_defined -#endif - -#ifndef __key_t_defined -typedef __key_t key_t; -# define __key_t_defined -#endif +#include +#include +#include +#include __BEGIN_DECLS diff --git a/sysvipc/sys/msg.h b/sysvipc/sys/msg.h index 1ce4672cc1..f2f18f4dc5 100644 --- a/sysvipc/sys/msg.h +++ b/sysvipc/sys/msg.h @@ -31,16 +31,8 @@ /* Define types required by the standard. */ #include - -#ifndef __pid_t_defined -typedef __pid_t pid_t; -# define __pid_t_defined -#endif - -#ifndef __ssize_t_defined -typedef __ssize_t ssize_t; -# define __ssize_t_defined -#endif +#include +#include /* The following System V style IPC functions implement a message queue system. The definition is found in XPG2. */ diff --git a/sysvipc/sys/shm.h b/sysvipc/sys/shm.h index c15f419f09..bf836a75f1 100644 --- a/sysvipc/sys/shm.h +++ b/sysvipc/sys/shm.h @@ -31,14 +31,9 @@ /* Define types required by the standard. */ #include - #ifdef __USE_XOPEN -# ifndef __pid_t_defined -typedef __pid_t pid_t; -# define __pid_t_defined -# endif -#endif /* X/Open */ - +# include +#endif __BEGIN_DECLS diff --git a/termios/termios.h b/termios/termios.h index 223420883d..b883dc8aae 100644 --- a/termios/termios.h +++ b/termios/termios.h @@ -23,13 +23,9 @@ #define _TERMIOS_H 1 #include + #if defined __USE_XOPEN_EXTENDED || defined __USE_XOPEN2K8 -/* We need `pid_t'. */ -# include -# ifndef __pid_t_defined -typedef __pid_t pid_t; -# define __pid_t_defined -# endif +# include #endif __BEGIN_DECLS diff --git a/time/sys/time.h b/time/sys/time.h index 5dbc7fc627..1059d30ab7 100644 --- a/time/sys/time.h +++ b/time/sys/time.h @@ -23,11 +23,7 @@ #include #include #include - -#ifndef __suseconds_t_defined -typedef __suseconds_t suseconds_t; -# define __suseconds_t_defined -#endif +#include #include diff --git a/time/time.h b/time/time.h index cba6d15260..232531c6f0 100644 --- a/time/time.h +++ b/time/time.h @@ -50,10 +50,7 @@ struct sigevent; #endif #ifdef __USE_XOPEN2K -# ifndef __pid_t_defined -typedef __pid_t pid_t; -# define __pid_t_defined -# endif +# include #endif #ifdef __USE_XOPEN2K8 From patchwork Wed Jun 26 17:49:53 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Zack Weinberg X-Patchwork-Id: 1122941 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-103165-incoming=patchwork.ozlabs.org@sourceware.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=panix.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.b="iGPGr6sb"; 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 45YrCs4q6bz9s4V for ; Thu, 27 Jun 2019 03:50:33 +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:in-reply-to :references:mime-version:content-type:content-transfer-encoding; q=dns; s=default; b=me0GjxEZ3OmE5VM8IbQm8Fytktzo20i1BFYTNtFZ5lg V2HdTTuvZNOswNS9Nw5LKjAMavAKEGJUvn9RNxK1noPi53BY/NVOyy2KNfyxa+uo 8MqUIJIWdsKaAszY5CpgiMgdu4DVc2bI8YnUEFtUChytUrnUqqLpzRyX/jrLxvMI = 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:in-reply-to :references:mime-version:content-type:content-transfer-encoding; s=default; bh=0OVIqAS76/KwQFZVZafwWhc4iVo=; b=iGPGr6sbIF0GiwTfM tX47UiRqrtZMpasV25t5k9JEdCUicJFWcQyAm0Y3Nlke9lKgKxHKU1vaXHP1wykD 2/ghrJChrBUpc7et+bs9NE0y44OoDlZpzr61fgrWep6m9OLDn9kYxXyj9k5rCF46 HoJqAZD92YH/bodkF3EyUnOWGk= Received: (qmail 7615 invoked by alias); 26 Jun 2019 17:50:00 -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 7565 invoked by uid 89); 26 Jun 2019 17:50:00 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-15.8 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, SPF_HELO_PASS, SPF_PASS autolearn=ham version=3.3.1 spammy=conclude, 6214, HX-Languages-Length:2114, HContent-Transfer-Encoding:8bit X-HELO: l2mail1.panix.com From: Zack Weinberg To: libc-alpha@sourceware.org Cc: joseph@codesourcery.com, carlos@redhat.com Subject: [PATCH 08/25] =?utf-8?q?Don=E2=80=99t_conditionalize_declarations?= =?utf-8?b?IG9mIGxkaXZfdCwgbGxkaXZfdCwgX19nd2NoYXJfdC4=?= Date: Wed, 26 Jun 2019 13:49:53 -0400 Message-Id: <20190626174954.8009-9-zackw@panix.com> In-Reply-To: <20190626174954.8009-1-zackw@panix.com> References: <20190626174954.8009-1-zackw@panix.com> MIME-Version: 1.0 The declarations of ldiv_t, lldiv_t, and __gwchar_t are all wrapped in __foo_t_defined conditionals, despite there being only one header in glibc that declares them. I checked codesearch.debian.net and only found one other program that refers to the __foo_t_defined conditionals: u-boot provides its own definition of ldiv_t if __ldiv_t_defined is not defined by stdlib.h. I conclude that the conditionals are not necessary, but the definitions of __ldiv_t_defined and __lldiv_t_defined should be preserved. * stdlib/inttypes.h: Unconditionally define __gwchar_t. Don’t define ____gwchar_t_defined. * stdlib/stdlib.h: Unconditionally define ldiv_t. Condition lldiv_t only on __USE_ISOC99. --- stdlib/inttypes.h | 15 ++++++--------- stdlib/stdlib.h | 6 ++---- 2 files changed, 8 insertions(+), 13 deletions(-) diff --git a/stdlib/inttypes.h b/stdlib/inttypes.h index ddcb171b09..c5fb12056e 100644 --- a/stdlib/inttypes.h +++ b/stdlib/inttypes.h @@ -27,17 +27,14 @@ #include /* Get a definition for wchar_t. But we must not define wchar_t itself. */ -#ifndef ____gwchar_t_defined -# ifdef __cplusplus -# define __gwchar_t wchar_t -# elif defined __WCHAR_TYPE__ +#ifdef __cplusplus +# define __gwchar_t wchar_t +#elif defined __WCHAR_TYPE__ typedef __WCHAR_TYPE__ __gwchar_t; -# else -# define __need_wchar_t -# include +#else +# define __need_wchar_t +# include typedef wchar_t __gwchar_t; -# endif -# define ____gwchar_t_defined 1 #endif # if __WORDSIZE == 64 diff --git a/stdlib/stdlib.h b/stdlib/stdlib.h index a9fd989d39..34996e3ee7 100644 --- a/stdlib/stdlib.h +++ b/stdlib/stdlib.h @@ -62,16 +62,14 @@ typedef struct } div_t; /* Returned by `ldiv'. */ -#ifndef __ldiv_t_defined typedef struct { long int quot; /* Quotient. */ long int rem; /* Remainder. */ } ldiv_t; -# define __ldiv_t_defined 1 -#endif +#define __ldiv_t_defined 1 -#if defined __USE_ISOC99 && !defined __lldiv_t_defined +#if defined __USE_ISOC99 /* Returned by `lldiv'. */ __extension__ typedef struct { From patchwork Wed Jun 26 17:49:54 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Zack Weinberg X-Patchwork-Id: 1122943 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-103167-incoming=patchwork.ozlabs.org@sourceware.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=panix.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.b="ry/+XNQr"; 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 45YrDM6jHQz9s4V for ; Thu, 27 Jun 2019 03:50:59 +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:in-reply-to :references:mime-version:content-type:content-transfer-encoding; q=dns; s=default; b=JyROJqvToJcObnu9Q78md4tCbsiMpz2/KMvtFkHqEXJ cif9GkDtfGb2vJAWGrHbmfhpsylaftiLlrg31HELN5hl8zahL6C/9q9hZqRtbTz7 Pn2KdYqEQOS7vHLzu/JxiPoyPrhQcecY/TOT2fCcwFifSOyBPMrZ/FCyul612QbE = 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:in-reply-to :references:mime-version:content-type:content-transfer-encoding; s=default; bh=3T0RanN8c5/WKBtPuqQtsamYjjQ=; b=ry/+XNQrLLhP8QBHi fpvMDHJ8D2k9yLi00Wv3XBN6qQPBa7LdIGAJVhv/JargTNCc8tIlqtP3BddY/YKw /732gTbtmfJenjNGUH8pH7lphNzwaeUklPzcLy7VhbI0k4RJD1OfZq4/IOJDJ9jh 34yTGUUmhsGiGDxjpHNE6uUdIk= Received: (qmail 8073 invoked by alias); 26 Jun 2019 17:50:04 -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 8002 invoked by uid 89); 26 Jun 2019 17:50:03 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-15.9 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_SHORT, SPF_HELO_PASS, SPF_PASS autolearn=ham version=3.3.1 spammy=exempt, Alternative X-HELO: l2mail1.panix.com From: Zack Weinberg To: libc-alpha@sourceware.org Cc: joseph@codesourcery.com, carlos@redhat.com Subject: [PATCH 09/25] Add check-obsolete-constructs checker for nested includes. Date: Wed, 26 Jun 2019 13:49:54 -0400 Message-Id: <20190626174954.8009-10-zackw@panix.com> In-Reply-To: <20190626174954.8009-1-zackw@panix.com> References: <20190626174954.8009-1-zackw@panix.com> MIME-Version: 1.0 As a first step toward minimizing the number of public headers that include other public headers, add a checker to check-obsolete-constructs that will error out on any such inclusion that’s not on a whitelist. The whitelist is initialized to all of the nested inclusions that already exist; subsequent patches will remove nested inclusions and shrink the whitelist, hopefully to the point where we only have nested inclusions as mandated by the relevant standards. Hurd headers and Sun RPC headers and interface definitions are exempt from these checks. The former is because minimizing their cross-inclusions would require making Hurd-specific design decisions, which I feel is best left to the Hurd maintainers. The latter is because they are obsolete in glibc; cleanups should be done under the auspices of TIRPC. * scripts/check-obsolete-constructs.py (UNIVERSAL_ALLOWED_INCLUDES, HEADER_ALLOWED_INCLUDES) (SYSDEP_ALLOWED_INCLUDES, NESTED_INCLUDES_EXEMPT_RE) (get_allowed_nested, NestedIncludeCheckerWhitelistOnly) (NestedIncludeChecker): New. (HeaderChecker): Instantiate and run a NestedIncludeChecker for each header. --- scripts/check-obsolete-constructs.py | 420 +++++++++++++++++++++++++++ 1 file changed, 420 insertions(+) diff --git a/scripts/check-obsolete-constructs.py b/scripts/check-obsolete-constructs.py index 49338c06b7..5efe824b8d 100755 --- a/scripts/check-obsolete-constructs.py +++ b/scripts/check-obsolete-constructs.py @@ -17,6 +17,7 @@ # . """Verifies that installed headers do not use any obsolete constructs: + * legacy BSD typedefs superseded by : ushort uint ulong u_char u_short u_int u_long @@ -24,6 +25,9 @@ caddr_t daddr_t loff_t register_t (sys/types.h is allowed to _define_ these types, but not to use them to define anything else). + + * nested includes of other top-level headers, except as required by + the relevant standards """ import argparse @@ -478,6 +482,420 @@ def ObsoleteTypedefChecker(reporter, fname): return ObsoleteNotAllowed(reporter) +# +# Nested includes +# + +# All header files are allowed to include these headers. +# TODO: Every header file _should_ include features.h as its first inclusion, +# but we are not ready to enforce that yet. +UNIVERSAL_ALLOWED_INCLUDES = { + "features.h", + + # Technically these should only ever be included with __need + # macros active, but some headers deliberately break this rule + # when they think they're dealing with freestanding headers from a + # non-GNU compiler, so enforcing it would be more trouble than + # it's worth. + "stddef.h", + "stdarg.h", +} + +# Specific headers are allowed to include specific other headers. +# Each key in this dictionary should be the installed name of a +# header, and its value is a list of installed names that are allowed +# to be included. (We do not currently enforce any rules about <> vs +# "" inclusion.) +HEADER_ALLOWED_INCLUDES = { + # ISO C standard headers + # mandated: inttypes.h -> stdint.h + # tgmath.h -> complex.h, math.h + # threads.h -> time.h + "ctype.h": [ "endian.h" ], + "inttypes.h": [ "stdint.h" ], + "signal.h": [ "sys/ucontext.h" ], + "stdlib.h": [ "alloca.h", "sys/types.h" ], + "string.h": [ "strings.h" ], + "tgmath.h": [ "complex.h", "math.h" ], + "threads.h": [ "time.h" ], + + # POSIX top-level headers + # mandated: pthread.h -> sched.h, time.h + # allowed: ftw.h -> sys/stat.h + # mqueue.h -> fcntl.h + # sched.h -> time.h + # spawn.h -> sched.h + "aio.h": [ "sys/types.h" ], + "ftw.h": [ "sys/stat.h", "sys/types.h" ], + "glob.h": [ "sys/cdefs.h" ], + "langinfo.h": [ "nl_types.h" ], + "mqueue.h": [ "fcntl.h", "sys/types.h" ], + "poll.h": [ "sys/poll.h" ], + "pthread.h": [ "endian.h", "sched.h", "time.h", + "sys/cdefs.h" ], + "regex.h": [ "limits.h", "sys/types.h" ], + "sched.h": [ "time.h" ], + "semaphore.h": [ "sys/types.h" ], + "spawn.h": [ "sched.h", "sys/types.h" ], + "termios.h": [ "sys/ttydefaults.h" ], + + # POSIX sys/ headers + # mandated: sys/msg.h -> sys/ipc.h + # sys/sem.h -> sys/ipc.h + # sys/shm.h -> sys/ipc.h + # allowed: sys/time.h -> sys/select.h + # sys/wait.h -> signal.h + "sys/msg.h": [ "sys/ipc.h" ], + "sys/sem.h": [ "sys/ipc.h" ], + "sys/shm.h": [ "sys/ipc.h" ], + "sys/time.h": [ "sys/select.h" ], + "sys/types.h": [ "endian.h", "sys/select.h" ], + "sys/uio.h": [ "sys/types.h" ], + "sys/un.h": [ "string.h", "sys/cdefs.h" ], + "sys/wait.h": [ "signal.h" ], + + # POSIX networking headers + # allowed: netdb.h -> netinet/in.h + # arpa/inet.h -> netinet/in.h + "netdb.h": [ "netinet/in.h", "rpc/netdb.h" ], + "arpa/inet.h": [ "netinet/in.h" ], + "net/if.h": [ "sys/socket.h", "sys/types.h" ], + "netinet/in.h": [ "endian.h", "sys/socket.h" ], + "netinet/tcp.h": [ "stdint.h", "sys/socket.h", + "sys/types.h" ], + + # Nonstandardized top-level headers + "aliases.h": [ "sys/types.h" ], + "ar.h": [ "sys/cdefs.h" ], + "argp.h": [ "ctype.h", "errno.h", "getopt.h", + "limits.h", "stdio.h" ], + "argz.h": [ "errno.h", "string.h" ], + "elf.h": [ "stdint.h" ], + "envz.h": [ "argz.h", "errno.h" ], + "fts.h": [ "sys/types.h" ], + "gshadow.h": [ "paths.h" ], + "ieee754.h": [ "endian.h", "float.h" ], + "lastlog.h": [ "utmp.h" ], + "libintl.h": [ "locale.h" ], + "link.h": [ "dlfcn.h", "elf.h", "sys/types.h" ], + "mntent.h": [ "paths.h" ], + "nss.h": [ "stdint.h" ], + "obstack.h": [ "string.h" ], + "proc_service.h": [ "sys/procfs.h" ], + "pty.h": [ "sys/ioctl.h", "termios.h" ], + "sgtty.h": [ "sys/ioctl.h" ], + "shadow.h": [ "paths.h" ], + "stdio_ext.h": [ "stdio.h" ], + "thread_db.h": [ "pthread.h", "stdint.h", "sys/procfs.h", + "sys/types.h" ], + "ucontext.h": [ "sys/ucontext.h" ], + "utmp.h": [ "sys/types.h" ], + "utmpx.h": [ "sys/time.h" ], + "values.h": [ "float.h", "limits.h" ], + + # Nonstandardized sys/ headers + "sys/acct.h": [ "endian.h", "stdint.h", "sys/types.h" ], + "sys/auxv.h": [ "elf.h", "sys/cdefs.h" ], + "sys/elf.h": [ "sys/procfs.h" ], + "sys/epoll.h": [ "stdint.h", "sys/types.h" ], + "sys/eventfd.h": [ "stdint.h" ], + "sys/fanotify.h": [ "stdint.h" ], + "sys/file.h": [ "fcntl.h" ], + "sys/fsuid.h": [ "sys/types.h" ], + "sys/gmon.h": [ "sys/types.h" ], + "sys/inotify.h": [ "stdint.h" ], + "sys/ioctl.h": [ "sys/ttydefaults.h" ], + "sys/mount.h": [ "sys/ioctl.h" ], + "sys/mtio.h": [ "sys/ioctl.h", "sys/types.h" ], + "sys/param.h": [ "endian.h", "limits.h", "signal.h", + "sys/types.h" ], + "sys/platform/ppc.h": [ "stdint.h" ], + "sys/procfs.h": [ "sys/time.h", "sys/types.h", + "sys/user.h" ], + "sys/profil.h": [ "sys/time.h", "sys/types.h" ], + "sys/ptrace.h": [ "sys/ucontext.h" ], + "sys/quota.h": [ "sys/types.h" ], + "sys/random.h": [ "sys/types.h" ], + "sys/raw.h": [ "stdint.h", "sys/ioctl.h" ], + "sys/sendfile.h": [ "sys/types.h" ], + "sys/signalfd.h": [ "stdint.h" ], + "sys/socketvar.h": [ "sys/socket.h" ], + "sys/timerfd.h": [ "time.h" ], + "sys/timex.h": [ "sys/time.h" ], + "sys/ttychars.h": [ "sys/ttydefaults.h" ], + "sys/ucontext.h": [ "sys/procfs.h" ], + "sys/user.h": [ "sys/types.h" ], + "sys/vfs.h": [ "sys/statfs.h" ], + "sys/xattr.h": [ "sys/types.h" ], + + # Nonstandardized headers that do nothing but include some other + # header(s). These exist for compatibility with old systems where + # the included header did not exist or didn't provide all the + # necessary definitions. + "memory.h": [ "string.h" ], + "poll.h": [ "sys/poll.h" ], + "re_comp.h": [ "regex.h" ], + "syslog.h": [ "sys/syslog.h" ], + "sys/bitypes.h": [ "sys/types.h" ], + "sys/dir.h": [ "dirent.h" ], + "sys/errno.h": [ "errno.h" ], + "sys/fcntl.h": [ "fcntl.h" ], + "sys/signal.h": [ "signal.h" ], + "sys/termios.h": [ "termios.h" ], + "sys/unistd.h": [ "unistd.h" ], + "syscall.h": [ "sys/syscall.h" ], + "termio.h": [ "sys/ioctl.h", "termios.h" ], + "wait.h": [ "sys/wait.h" ], + + # Nonstandardized networking headers + "ifaddrs.h": [ "sys/socket.h" ], + "resolv.h": [ "arpa/nameser.h", "netinet/in.h", + "stdio.h", "sys/cdefs.h", "sys/param.h",\ + "sys/types.h" ], + + "arpa/nameser.h": [ "arpa/nameser_compat.h", "stdint.h", + "sys/param.h", "sys/types.h" ], + "arpa/nameser_compat.h": [ "endian.h" ], + "net/ethernet.h": [ "stdint.h", "sys/types.h", "sys/cdefs.h", + "net/if_ether.h" ], + "net/if_arp.h": [ "stdint.h", "sys/socket.h", + "sys/types.h", "sys/cdefs.h" ], + "net/if_ppp.h": [ "net/if.h", "net/ppp_defs.h", "stdint.h", + "sys/ioctl.h", "sys/types.h" ], + "net/if_shaper.h": [ "net/if.h", "stdint.h", "sys/ioctl.h", + "sys/types.h" ], + "net/route.h": [ "netinet/in.h", "sys/socket.h", + "sys/types.h" ], + "netatalk/at.h": [ "sys/socket.h" ], + "netinet/ether.h": [ "netinet/if_ether.h" ], + "netinet/icmp6.h": [ "inttypes.h", "netinet/in.h", "string.h", + "sys/types.h" ], + "netinet/if_ether.h": [ "net/ethernet.h", "net/if_arp.h", + "sys/types.h", "stdint.h" ], + "netinet/if_fddi.h": [ "stdint.h", "sys/types.h" ], + "netinet/if_tr.h": [ "stdint.h", "sys/types.h" ], + "netinet/igmp.h": [ "netinet/in.h", "sys/cdefs.h", + "sys/types.h" ], + "netinet/in_systm.h": [ "stdint.h", "sys/types.h" ], + "netinet/ip.h": [ "netinet/in.h", "sys/types.h" ], + "netinet/ip6.h": [ "inttypes.h", "netinet/in.h" ], + "netinet/ip_icmp.h": [ "netinet/in.h", "netinet/ip.h", + "stdint.h", "sys/types.h" ], + "netinet/udp.h": [ "stdint.h", "sys/types.h" ], + "netipx/ipx.h": [ "stdint.h", "sys/types.h" ], + "netrom/netrom.h": [ "netax25/ax25.h" ], + "netrose/rose.h": [ "netax25/ax25.h", "sys/socket.h" ], + "protocols/routed.h": [ "sys/socket.h" ], + "protocols/rwhod.h": [ "paths.h", "sys/types.h" ], + "protocols/talkd.h": [ "stdint.h", "sys/socket.h", + "sys/types.h" ], + "protocols/timed.h": [ "sys/time.h", "sys/types.h" ], + + # Internal headers + "features.h": [ "gnu/stubs.h", "stdc-predef.h", + "sys/cdefs.h" ], + + "bits/fcntl.h": [ "sys/types.h" ], + "bits/ipc.h": [ "sys/types.h" ], + "bits/procfs.h": [ "signal.h", "sys/ucontext.h" ], + "bits/pthreadtypes-arch.h": [ "endian.h" ], + "bits/sem.h": [ "sys/types.h" ], + "bits/socket.h": [ "sys/types.h" ], + "bits/stat.h": [ "endian.h" ], + "bits/statfs.h": [ "endian.h" ], + "bits/types/res_state.h": [ "netinet/in.h", "sys/types.h" ], + "bits/utmp.h": [ "paths.h", "sys/time.h", "sys/types.h" ], + "bits/utmpx.h": [ "paths.h", "sys/time.h" ], + "bits/wctype-wchar.h": [ "endian.h" ], +} + +# As above, but each group of whitelist entries is only used for +# headers whose pathname includes a sysdeps directory with that name. +# This allows us, for instance, to restrict the use of Linux kernel +# headers to the Linux-specific variants of glibc headers. +SYSDEP_ALLOWED_INCLUDES = { + 'linux': { + # Nonstandardized sys/ headers + "sys/cachectl.h": [ "asm/cachectl.h" ], + "sys/fanotify.h": [ "linux/fanotify.h" ], + "sys/kd.h": [ "linux/kd.h" ], + "sys/pci.h": [ "linux/pci.h" ], + "sys/prctl.h": [ "linux/prctl.h" ], + "sys/quota.h": [ "linux/quota.h" ], + "sys/syscall.h": [ "asm/unistd.h" ], + "sys/sysctl.h": [ "linux/sysctl.h" ], + "sys/sysinfo.h": [ "linux/kernel.h" ], + "sys/user.h": [ "asm/ptrace.h", "asm/reg.h" ], + "sys/vm86.h": [ "asm/vm86.h" ], + + # Nonstandardized networking headers + "net/ethernet.h": [ "linux/if_ether.h" ], + "net/if_slip.h": [ "linux/if_slip.h" ], + "net/ppp_defs.h": [ "asm/types.h", "linux/ppp_defs.h" ], + "netatalk/at.h": [ "asm/types.h", "linux/atalk.h" ], + "netinet/if_ether.h": [ "linux/if_ether.h" ], + "netinet/if_fddi.h": [ "linux/if_fddi.h" ], + + # Alternative names for kernel headers + "net/ppp-comp.h": [ "linux/ppp-comp.h" ], + "nfs/nfs.h": [ "linux/nfs.h" ], + "sys/soundcard.h": [ "linux/soundcard.h" ], + "sys/vt.h": [ "linux/vt.h" ], + + # Internal headers + "bits/errno.h": [ "linux/errno.h" ], + "bits/fcntl-linux.h": [ "linux/falloc.h" ], + "bits/ioctl-types.h": [ "asm/ioctls.h" ], + "bits/ioctls.h": [ "asm/ioctls.h", "linux/sockios.h" ], + "bits/local_lim.h": [ "linux/limits.h" ], + "bits/param.h": [ "linux/limits.h", "linux/param.h" ], + "bits/procfs.h": [ "asm/ptrace.h" ], + "bits/sigcontext.h": [ "asm/sigcontext.h" ], + "bits/socket.h": [ "asm/socket.h" ], + }, + + 'mach': { + "bits/spin-lock-inline.h": [ "errno.h", "lock-intern.h" ], + "bits/sigcontext.h": [ "mach/machine/fp_reg.h" ], + }, + + 'mips': { + "fpregdef.h": [ "sys/fpregdef.h" ], + "regdef.h": [ "sys/fpregdef.h", "sys/regdef.h" ], + + "sys/asm.h": [ "sgidefs.h" ], + "sys/fpregdef.h": [ "sgidefs.h" ], + "sys/regdef.h": [ "sgidefs.h" ], + "sys/tas.h": [ "sgidefs.h" ], + "sys/ucontext.h": [ "sgidefs.h" ], + "sys/user.h": [ "sgidefs.h" ], + + "bits/fcntl.h": [ "sgidefs.h" ], + "bits/link.h": [ "sgidefs.h" ], + "bits/long-double.h": [ "sgidefs.h" ], + "bits/procfs.h": [ "sgidefs.h" ], + "bits/setjmp.h": [ "sgidefs.h" ], + "bits/sigcontext.h": [ "sgidefs.h" ], + "bits/stat.h": [ "sgidefs.h" ], + "bits/wordsize.h": [ "sgidefs.h" ], + }, +} + +# Headers that are exempt from the nested includes check. This is a +# giant regex because fnmatch.fnmatch doesn't treat / specially and +# glob.glob can't be applied to anything but the file system. +# +# Hurd-specific headers are exempt for now, because for them, nested +# include minimization is not a pure cleanup project, the way it is +# for the standard headers. The Hurd maintainers first need to make +# some design decisions about which headers _should_ include which +# other headers. +# +# Sun RPC headers are exempt because most of them are obsolete within +# glibc; cleanups should be done within the TIRPC project instead. +# (Same rationale as for exempting them from the obsolete-types checks.) +NESTED_INCLUDES_EXEMPT_RE = re.compile(r""" + (?: \A | / ) (?: + + # Hurd-specific headers + faultexc_server\.h + | hurd\.h + | lock-intern\.h + | mach\.h + | mach_error\.h + | mach_init\.h + | mach-shortcuts\.h + | spin-lock\.h + | device/[^/]+?\.h + | mach/[^/]+?\.h + | mach/i386/[^/]+?\.h + | hurd/[^/]+?\.h + + # Sun RPC headers + | rpc/[^/]+?\.[hx] + | rpcsvc/[^/]+?\.[hx] + + ) \Z +""", re.VERBOSE) + + +def get_allowed_nested(fname): + """Retrieve the set of allowed nested includes for a header whose + filename is FNAME.""" + HEADER_ALLOWED = HEADER_ALLOWED_INCLUDES + SYSDEP_ALLOWED = SYSDEP_ALLOWED_INCLUDES + + allowed = UNIVERSAL_ALLOWED_INCLUDES.copy() + sysdirs = {} + + # HEADER_ALLOWED is keyed by the name to be used in an #include, + # which is some suffix of the filename; we don't know how many + # directory components to chop off, so we go one at a time until + # we find a match. os.path does not include a utility function to + # chop off the _first_ component of a pathname. + fname = os.path.normpath(fname) + inc = fname + while True: + try: + allowed.update(HEADER_ALLOWED[inc]) + break + + except KeyError: + pos = inc.find('/') + if pos == -1: + break + dirname = inc[:pos] + inc = inc[(pos+1):] + if not inc: + break + if dirname in SYSDEP_ALLOWED and dirname not in sysdirs: + sysdirs[dirname] = SYSDEP_ALLOWED[dirname] + + for hgroup in sysdirs.values(): + inc = fname + while True: + try: + allowed.update(hgroup[inc]) + break + except KeyError: + pos = inc.find('/') + if pos == -1: + break + dirname = inc[:pos] + inc = inc[(pos+1):] + if not inc: + break + + return frozenset(allowed) + +class NestedIncludeWhitelistOnly(ConstructChecker): + def __init__(self, reporter, fname): + super().__init__(reporter) + self.allowed_nested = get_allowed_nested(fname) + + def examine(self, tok): + if tok.kind == "HEADER_NAME": + included = tok.text[1:-1] # chop off "" or <> + if included in self.allowed_nested: + pass + # We allow any public header to include any bits header. + # More specific rules about which bits headers should be + # used by which public headers are enforced by the bits + # headers themselves. + elif included.startswith("bits/"): + pass + else: + self.reporter.error(tok, "inappropriate inclusion of {!r}") + + +def NestedIncludeChecker(reporter, fname): + if NESTED_INCLUDES_EXEMPT_RE.search(fname): + sys.stderr.write("# Arbitrary nested includes allowed for {}\n" + .format(fname)) + return NoCheck(reporter) + else: + return NestedIncludeWhitelistOnly(reporter, fname) + # # Master control # @@ -508,9 +926,11 @@ class HeaderChecker: return typedef_checker = ObsoleteTypedefChecker(self, self.fname) + nested_checker = NestedIncludeChecker(self, self.fname) for tok in tokenize_c(contents, self): typedef_checker.examine(tok) + nested_checker.examine(tok) def main(): ap = argparse.ArgumentParser(description=__doc__) From patchwork Wed Jun 26 17:50:14 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Zack Weinberg X-Patchwork-Id: 1122946 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-103170-incoming=patchwork.ozlabs.org@sourceware.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=panix.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.b="oCJJK7sD"; 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 45YrFC2n0Nz9s4V for ; Thu, 27 Jun 2019 03:51:43 +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 :mime-version:content-type:content-transfer-encoding; q=dns; s= default; b=VGYDPdbNDWsZNQSs8olnyRDi2M9BoMQIU0R6jhItpPYO2C7aWITqJ yhp06JhmPeUw44vbqQJoZu4V8m/wr9mh3vPJ7oRZoliNr3xJeh7GTJaJQCUdzZMH w6CREh8iEbUwxOsE9eOmGm5C23SveTBIe2YSluzp9Ucer6t3LTMMG0= 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 :mime-version:content-type:content-transfer-encoding; s=default; bh=+ipiXqGnpLljxEoL0tgSZTdiAGw=; b=oCJJK7sDAQV+AY4MGwTqdJa6kOs/ ezxnxqEkvhX33RVtUaSgz6QnTpmz2VmfV4vzLxRyrmBjGe7It5AHoTFKwaUnlsWZ YRg1eKHnDoCcHbJ3DCQKl3S5IE9kU5fA8sLMGV84REAiSuBirlUQ5XjTdIO1PsJG STAdSqdsYZ41YF4= Received: (qmail 11960 invoked by alias); 26 Jun 2019 17:50:37 -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 11597 invoked by uid 89); 26 Jun 2019 17:50:34 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-16.2 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_SHORT, SPF_PASS autolearn=ham version=3.3.1 spammy=arrangement, Exchange, 81 X-HELO: mailbackend.panix.com From: Zack Weinberg To: libc-alpha@sourceware.org Cc: joseph@codesourcery.com, carlos@redhat.com Subject: [PATCH 10/25] Swap sys/syslog.h with syslog.h. Date: Wed, 26 Jun 2019 13:50:14 -0400 Message-Id: <20190626175029.4699-1-zackw@panix.com> MIME-Version: 1.0 Our installed syslog.h is a trivial wrapper around sys/syslog.h, which is where all the actual declarations are. This is backward from POSIX, which specifies syslog.h and its contents, and does not specify sys/syslog.h. This arrangement appears to have been inherited from some BSD-phylum C library, and probably pre-dates any standardization of syslog. This patch swaps the contents of syslog.h and sys/syslog.h, so that the actual declarations appear under the standardized name. Since it is necessary to adjust all of syslog.h’s bits headers, I also added multiple-include guards to those files that didn’t already have them. (All installed headers should have multiple-include guards, even if they are internal and only used in one public header. The “never include this file directly” #error convention doesn’t protect against including the internal header a second time after its parent header has already been included.) * misc/sys/syslog.h: Exchange contents with... * misc/syslog.h: ...this file. Adjust multiple-include guards. * include/sys/syslog.h: Exchange contents with... * include/syslog.h: ...this file. Adjust multiple-include guards. * bits/syslog-path.h, misc/bits/syslog-ldbl.h * misc/bits/syslog.h: Allow inclusion by syslog.h, not sys/syslog.h. Add multiple-include guard where not already present. * scripts/check-obsolete-constructs.py (HEADER_ALLOWED_INCLUDES): Update. --- bits/syslog-path.h | 8 +- include/sys/syslog.h | 19 +-- include/{sys => }/syslog.h | 5 +- misc/bits/syslog-ldbl.h | 9 +- misc/bits/syslog.h | 9 +- misc/sys/syslog.h | 218 +-------------------------- misc/{sys => }/syslog.h | 4 +- scripts/check-obsolete-constructs.py | 2 +- 8 files changed, 29 insertions(+), 245 deletions(-) rewrite include/sys/syslog.h (93%) copy include/{sys => }/syslog.h (81%) rewrite misc/sys/syslog.h (99%) copy misc/{sys => }/syslog.h (99%) diff --git a/bits/syslog-path.h b/bits/syslog-path.h index 5b97fa7db5..5677f468b5 100644 --- a/bits/syslog-path.h +++ b/bits/syslog-path.h @@ -16,13 +16,13 @@ License along with the GNU C Library; if not, see . */ -#ifndef _SYS_SYSLOG_H -# error "Never include this file directly. Use instead" -#endif - #ifndef _BITS_SYSLOG_PATH_H #define _BITS_SYSLOG_PATH_H 1 +#ifndef _SYSLOG_H +# error "Never include directly. Use instead" +#endif + #define _PATH_LOG "/dev/log" #endif /* bits/syslog-path.h */ diff --git a/include/sys/syslog.h b/include/sys/syslog.h dissimilarity index 93% index 89d3479ebc..7d6e3bc46c 100644 --- a/include/sys/syslog.h +++ b/include/sys/syslog.h @@ -?,? +1,3 @@ +#ifndef _SYSLOG_H +#include +#endif diff --git a/include/sys/syslog.h b/include/syslog.h similarity index 81% copy from include/sys/syslog.h copy to include/syslog.h index 89d3479ebc..5dc6e76b7e 100644 --- a/include/sys/syslog.h +++ b/include/syslog.h @@ -1,6 +1,5 @@ -#ifndef _LIBC_SYS_SYSLOG_H -#define _LIBC_SYS_SYSLOG_H 1 -#include +#ifndef _SYSLOG_H +# include #ifndef _ISOMAC libc_hidden_proto (syslog) diff --git a/misc/bits/syslog-ldbl.h b/misc/bits/syslog-ldbl.h index e3117552ae..4c2eea74e6 100644 --- a/misc/bits/syslog-ldbl.h +++ b/misc/bits/syslog-ldbl.h @@ -16,8 +16,11 @@ License along with the GNU C Library; if not, see . */ -#ifndef _SYS_SYSLOG_H -# error "Never include directly; use instead." +#ifndef _BITS_SYSLOG_LDBL_H +#define _BITS_SYSLOG_LDBL_H 1 + +#ifndef _SYSLOG_H +# error "Never include directly; use instead." #endif __LDBL_REDIR_DECL (syslog) @@ -33,3 +36,5 @@ __LDBL_REDIR_DECL (__syslog_chk) __LDBL_REDIR_DECL (__vsyslog_chk) # endif #endif + +#endif /* bits/syslog-ldbl.h */ diff --git a/misc/bits/syslog.h b/misc/bits/syslog.h index 86d94536ee..e796955c1c 100644 --- a/misc/bits/syslog.h +++ b/misc/bits/syslog.h @@ -16,8 +16,11 @@ License along with the GNU C Library; if not, see . */ -#ifndef _SYS_SYSLOG_H -# error "Never include directly; use instead." +#ifndef _BITS_SYSLOG_H +#define _BITS_SYSLOG_H 1 + +#ifndef _SYSLOG_H +# error "Never include directly; use instead." #endif @@ -47,3 +50,5 @@ vsyslog (int __pri, const char *__fmt, __gnuc_va_list __ap) __vsyslog_chk (__pri, __USE_FORTIFY_LEVEL - 1, __fmt, __ap); } #endif + +#endif /* bits/syslog.h */ diff --git a/misc/sys/syslog.h b/misc/sys/syslog.h dissimilarity index 99% index ee01478c4b..9fc15930fb 100644 --- a/misc/sys/syslog.h +++ b/misc/sys/syslog.h @@ -?,? +1,3 @@ +#ifndef _SYSLOG_H +# include +#endif diff --git a/misc/sys/syslog.h b/misc/syslog.h similarity index 99% copy from misc/sys/syslog.h copy to misc/syslog.h index ee01478c4b..406133ba71 100644 --- a/misc/sys/syslog.h +++ b/misc/syslog.h @@ -29,8 +29,8 @@ * @(#)syslog.h 8.1 (Berkeley) 6/2/93 */ -#ifndef _SYS_SYSLOG_H -#define _SYS_SYSLOG_H 1 +#ifndef _SYSLOG_H +#define _SYSLOG_H 1 #include #define __need___va_list diff --git a/scripts/check-obsolete-constructs.py b/scripts/check-obsolete-constructs.py index 5efe824b8d..c437c8e00b 100755 --- a/scripts/check-obsolete-constructs.py +++ b/scripts/check-obsolete-constructs.py @@ -635,12 +635,12 @@ HEADER_ALLOWED_INCLUDES = { "memory.h": [ "string.h" ], "poll.h": [ "sys/poll.h" ], "re_comp.h": [ "regex.h" ], - "syslog.h": [ "sys/syslog.h" ], "sys/bitypes.h": [ "sys/types.h" ], "sys/dir.h": [ "dirent.h" ], "sys/errno.h": [ "errno.h" ], "sys/fcntl.h": [ "fcntl.h" ], "sys/signal.h": [ "signal.h" ], + "sys/syslog.h": [ "syslog.h" ], "sys/termios.h": [ "termios.h" ], "sys/unistd.h": [ "unistd.h" ], "syscall.h": [ "sys/syscall.h" ], From patchwork Wed Jun 26 17:50:15 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Zack Weinberg X-Patchwork-Id: 1122947 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-103171-incoming=patchwork.ozlabs.org@sourceware.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=panix.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.b="NgfRqMjc"; 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 45YrFP3RkLz9sLt for ; Thu, 27 Jun 2019 03:51:53 +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:in-reply-to :references:mime-version:content-type:content-transfer-encoding; q=dns; s=default; b=uh2b/Ga+12MBB+VK3EM80UBnvC27RNBLfUZjs9LNa2i D9xGBn7JuqVyYpYz0kcf/Mb6BrD18sEG6FTQ+h73EUcivYKsUslbQq2TK3iX/WK1 Lo2fSDUorkXy5zEsenffO0z0axyrpOHM+oCYiQ5sf52Tv88tTsGmDYnKJiOGhpDI = 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:in-reply-to :references:mime-version:content-type:content-transfer-encoding; s=default; bh=4Zl52VywawGI+VwwI6Wh/BwDGCQ=; b=NgfRqMjczp1IMOfxr O5j/wNPkdVTij2oB4VpCqKAarcdHvfPYahMcAvkbEbFZOTH2USBNttbVi/TkNC1Q H6ShLuJSMA6YiLWgfsQyDAH/DbgUV1YlUvnV4Mqe6KrM0j729jaW6oxGckbCC9Gq jXy6Xd5aq7Z/KDmWlr+pg4gbGc= Received: (qmail 11982 invoked by alias); 26 Jun 2019 17:50:37 -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 11920 invoked by uid 89); 26 Jun 2019 17:50:37 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-16.2 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_SHORT, SPF_PASS autolearn=ham version=3.3.1 spammy=Exchange, 5307 X-HELO: mailbackend.panix.com From: Zack Weinberg To: libc-alpha@sourceware.org Cc: joseph@codesourcery.com, carlos@redhat.com Subject: [PATCH 11/25] Swap sys/poll.h with poll.h. Date: Wed, 26 Jun 2019 13:50:15 -0400 Message-Id: <20190626175029.4699-2-zackw@panix.com> In-Reply-To: <20190626175029.4699-1-zackw@panix.com> References: <20190626175029.4699-1-zackw@panix.com> MIME-Version: 1.0 Similarly to (sys/)syslog.h, poll.h is the header standardized by POSIX, but we had all of its contents in sys/, for historical reasons. This patch exchanges the contents of the two headers, and adds multiple-include guards to all of poll.h’s bits headers. * io/poll.h: Exchange contents with... * io/sys/poll.h: ...this file. Adjust guard macros. * include/poll.h: Exchange contents with... * include/sys/poll.h: ...this file. Adjust guard macros. * bits/poll.h, io/bits/poll2.h * sysdeps/unix/sysv/linux/bits/poll.h * sysdeps/unix/sysv/linux/m68k/bits/poll.h * sysdeps/unix/sysv/linux/mips/bits/poll.h * sysdeps/unix/sysv/linux/sparc/bits/poll.h: Allow inclusion by poll.h, not sys/poll.h. Add multiple- include guards where not already present. * scripts/check-obsolete-constructs.py (HEADER_ALLOWED_INCLUDES): Update. --- bits/poll.h | 9 ++- include/poll.h | 12 +++- include/sys/poll.h | 10 +-- io/bits/poll2.h | 9 ++- io/{sys => }/poll.h | 6 +- io/sys/poll.h | 79 +---------------------- scripts/check-obsolete-constructs.py | 3 +- sysdeps/unix/sysv/linux/bits/poll.h | 9 ++- sysdeps/unix/sysv/linux/m68k/bits/poll.h | 9 ++- sysdeps/unix/sysv/linux/mips/bits/poll.h | 9 ++- sysdeps/unix/sysv/linux/sparc/bits/poll.h | 9 ++- 11 files changed, 61 insertions(+), 103 deletions(-) copy io/{sys => }/poll.h (95%) rewrite io/sys/poll.h (99%) diff --git a/bits/poll.h b/bits/poll.h index c0d8e82a88..a00ede717e 100644 --- a/bits/poll.h +++ b/bits/poll.h @@ -15,8 +15,11 @@ License along with the GNU C Library; if not, see . */ -#ifndef _SYS_POLL_H -# error "Never use directly; include instead." +#ifndef _BITS_POLL_H +#define _BITS_POLL_H 1 + +#ifndef _POLL_H +# error "Never use directly; include instead." #endif /* Event types that can be polled for. These bits may be set in `events' @@ -40,3 +43,5 @@ #define POLLERR 010 /* Error condition. */ #define POLLHUP 020 /* Hung up. */ #define POLLNVAL 040 /* Invalid polling request. */ + +#endif /* bits/poll.h */ diff --git a/include/poll.h b/include/poll.h index 75181925aa..c1d6bbbdee 100644 --- a/include/poll.h +++ b/include/poll.h @@ -1 +1,11 @@ -#include +#ifndef _POLL_H +# include + +#ifndef _ISOMAC +extern int __poll (struct pollfd *__fds, unsigned long int __nfds, + int __timeout); +libc_hidden_proto (__poll) +libc_hidden_proto (ppoll) +#endif + +#endif diff --git a/include/sys/poll.h b/include/sys/poll.h index a42bc93873..5365742a4b 100644 --- a/include/sys/poll.h +++ b/include/sys/poll.h @@ -1,11 +1,3 @@ -#ifndef _SYS_POLL_H +#ifndef _POLL_H # include - -#ifndef _ISOMAC -extern int __poll (struct pollfd *__fds, unsigned long int __nfds, - int __timeout); -libc_hidden_proto (__poll) -libc_hidden_proto (ppoll) -#endif - #endif diff --git a/io/bits/poll2.h b/io/bits/poll2.h index ff38ef7ae1..335953e21e 100644 --- a/io/bits/poll2.h +++ b/io/bits/poll2.h @@ -16,8 +16,11 @@ License along with the GNU C Library; if not, see . */ -#ifndef _SYS_POLL_H -# error "Never include directly; use instead." +#ifndef _BITS_POLL2_H +#define _BITS_POLL2_H 1 + +#ifndef _POLL_H +# error "Never include directly; use instead." #endif @@ -79,3 +82,5 @@ ppoll (struct pollfd *__fds, nfds_t __nfds, const struct timespec *__timeout, #endif __END_DECLS + +#endif /* bits/poll2.h */ diff --git a/io/sys/poll.h b/io/poll.h similarity index 95% copy from io/sys/poll.h copy to io/poll.h index 6711a1518d..2e18206c75 100644 --- a/io/sys/poll.h +++ b/io/poll.h @@ -1,4 +1,4 @@ -/* Compatibility definitions for System V `poll' interface. +/* System V `poll' interface. Copyright (C) 1994-2019 Free Software Foundation, Inc. This file is part of the GNU C Library. @@ -16,8 +16,8 @@ License along with the GNU C Library; if not, see . */ -#ifndef _SYS_POLL_H -#define _SYS_POLL_H 1 +#ifndef _POLL_H +#define _POLL_H 1 #include diff --git a/io/sys/poll.h b/io/sys/poll.h dissimilarity index 99% index 6711a1518d..43ee82dcbc 100644 --- a/io/sys/poll.h +++ b/io/sys/poll.h @@ -?,? +1,3 @@ +#ifndef _POLL_H +# include +#endif diff --git a/scripts/check-obsolete-constructs.py b/scripts/check-obsolete-constructs.py index c437c8e00b..08534348d7 100755 --- a/scripts/check-obsolete-constructs.py +++ b/scripts/check-obsolete-constructs.py @@ -530,7 +530,6 @@ HEADER_ALLOWED_INCLUDES = { "glob.h": [ "sys/cdefs.h" ], "langinfo.h": [ "nl_types.h" ], "mqueue.h": [ "fcntl.h", "sys/types.h" ], - "poll.h": [ "sys/poll.h" ], "pthread.h": [ "endian.h", "sched.h", "time.h", "sys/cdefs.h" ], "regex.h": [ "limits.h", "sys/types.h" ], @@ -633,12 +632,12 @@ HEADER_ALLOWED_INCLUDES = { # the included header did not exist or didn't provide all the # necessary definitions. "memory.h": [ "string.h" ], - "poll.h": [ "sys/poll.h" ], "re_comp.h": [ "regex.h" ], "sys/bitypes.h": [ "sys/types.h" ], "sys/dir.h": [ "dirent.h" ], "sys/errno.h": [ "errno.h" ], "sys/fcntl.h": [ "fcntl.h" ], + "sys/poll.h": [ "poll.h" ], "sys/signal.h": [ "signal.h" ], "sys/syslog.h": [ "syslog.h" ], "sys/termios.h": [ "termios.h" ], diff --git a/sysdeps/unix/sysv/linux/bits/poll.h b/sysdeps/unix/sysv/linux/bits/poll.h index 50f0111fe5..6ea656a488 100644 --- a/sysdeps/unix/sysv/linux/bits/poll.h +++ b/sysdeps/unix/sysv/linux/bits/poll.h @@ -15,8 +15,11 @@ License along with the GNU C Library; if not, see . */ -#ifndef _SYS_POLL_H -# error "Never use directly; include instead." +#ifndef _BITS_POLL_H +#define _BITS_POLL_H 1 + +#ifndef _POLL_H +# error "Never use directly; include instead." #endif /* Event types that can be polled for. These bits may be set in `events' @@ -47,3 +50,5 @@ #define POLLERR 0x008 /* Error condition. */ #define POLLHUP 0x010 /* Hung up. */ #define POLLNVAL 0x020 /* Invalid polling request. */ + +#endif /* bits/poll.h */ diff --git a/sysdeps/unix/sysv/linux/m68k/bits/poll.h b/sysdeps/unix/sysv/linux/m68k/bits/poll.h index 8833255c20..f3713d2ede 100644 --- a/sysdeps/unix/sysv/linux/m68k/bits/poll.h +++ b/sysdeps/unix/sysv/linux/m68k/bits/poll.h @@ -15,8 +15,11 @@ License along with the GNU C Library. If not, see . */ -#ifndef _SYS_POLL_H -# error "Never use directly; include instead." +#ifndef _BITS_POLL_H +#define _BITS_POLL_H 1 + +#ifndef _POLL_H +# error "Never use directly; include instead." #endif /* Event types that can be polled for. These bits may be set in `events' @@ -47,3 +50,5 @@ #define POLLERR 0x008 /* Error condition. */ #define POLLHUP 0x010 /* Hung up. */ #define POLLNVAL 0x020 /* Invalid polling request. */ + +#endif /* bits/poll.h */ diff --git a/sysdeps/unix/sysv/linux/mips/bits/poll.h b/sysdeps/unix/sysv/linux/mips/bits/poll.h index 8833255c20..f3713d2ede 100644 --- a/sysdeps/unix/sysv/linux/mips/bits/poll.h +++ b/sysdeps/unix/sysv/linux/mips/bits/poll.h @@ -15,8 +15,11 @@ License along with the GNU C Library. If not, see . */ -#ifndef _SYS_POLL_H -# error "Never use directly; include instead." +#ifndef _BITS_POLL_H +#define _BITS_POLL_H 1 + +#ifndef _POLL_H +# error "Never use directly; include instead." #endif /* Event types that can be polled for. These bits may be set in `events' @@ -47,3 +50,5 @@ #define POLLERR 0x008 /* Error condition. */ #define POLLHUP 0x010 /* Hung up. */ #define POLLNVAL 0x020 /* Invalid polling request. */ + +#endif /* bits/poll.h */ diff --git a/sysdeps/unix/sysv/linux/sparc/bits/poll.h b/sysdeps/unix/sysv/linux/sparc/bits/poll.h index c2c0da927f..5070cf4a55 100644 --- a/sysdeps/unix/sysv/linux/sparc/bits/poll.h +++ b/sysdeps/unix/sysv/linux/sparc/bits/poll.h @@ -15,8 +15,11 @@ License along with the GNU C Library; if not, see . */ -#ifndef _SYS_POLL_H -# error "Never use directly; include instead." +#ifndef _BITS_POLL_H +#define _BITS_POLL_H 1 + +#ifndef _POLL_H +# error "Never use directly; include instead." #endif /* Event types that can be polled for. These bits may be set in `events' @@ -47,3 +50,5 @@ #define POLLERR 0x008 /* Error condition. */ #define POLLHUP 0x010 /* Hung up. */ #define POLLNVAL 0x020 /* Invalid polling request. */ + +#endif /* bits/poll.h */ From patchwork Wed Jun 26 17:50:16 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Zack Weinberg X-Patchwork-Id: 1122948 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-103172-incoming=patchwork.ozlabs.org@sourceware.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=panix.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.b="Ohc+eVHl"; 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 45YrFb6DrDz9sLt for ; Thu, 27 Jun 2019 03:52:03 +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:in-reply-to :references:mime-version:content-type:content-transfer-encoding; q=dns; s=default; b=SgU62UgbExdCz1UCiPs8TxPXDCujztpYrsMfbj50z9Z hi22NrX0sBtCKyr9oJ+ekMk4O4V6gtSGegVDHr64ESjf6KMgh26JPyOW6AGRFZ8G QYAIzfzyW91BFkgTaXqsS7nRGWebHSTEqhw/YeVMOSrDm0Qm8P8Tx33hiHnhPA0I = 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:in-reply-to :references:mime-version:content-type:content-transfer-encoding; s=default; bh=kJoKlq/01pyGx2udxd/vX6Atvj0=; b=Ohc+eVHljxfzDE8MT /8OFBojNxymWgygJfsSMTY9c+Nx+p2w/FRckLW2g1iQ373LjvoNlDcNjirqY9OkW Ok7vpkkS8KkIADixd5E39KurcAer0KnkVnhgtv58qYOlZVZ7D0cCcR4/i7r8cGMZ 4mJZujC8TAjaHHbrmZmFHZ57lw= Received: (qmail 12040 invoked by alias); 26 Jun 2019 17:50:38 -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 11939 invoked by uid 89); 26 Jun 2019 17:50:37 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-16.3 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, SPF_HELO_PASS, SPF_PASS autolearn=ham version=3.3.1 spammy=persuade X-HELO: l2mail1.panix.com From: Zack Weinberg To: libc-alpha@sourceware.org Cc: joseph@codesourcery.com, carlos@redhat.com Subject: [PATCH 12/25] =?utf-8?q?Don=E2=80=99t_include_sys/cdefs=2Eh_direc?= =?utf-8?q?tly_from_public_headers=2E?= Date: Wed, 26 Jun 2019 13:50:16 -0400 Message-Id: <20190626175029.4699-3-zackw@panix.com> In-Reply-To: <20190626175029.4699-1-zackw@panix.com> References: <20190626175029.4699-1-zackw@panix.com> MIME-Version: 1.0 The convention throughout glibc is that every public header includes features.h directly, as its first action, and relies on features.h to include sys/cdefs.h. In a few places, though, it’s been done the other way around, usually in headers that were copied from a BSD source (where the convention is exactly the opposite). This patch makes all installed headers match the glibc convention. This patch also corrects a bug in glob.h: it may declare size_t without notifying stddef.h that it has done this, so e.g. #define _XOPEN_SOURCE 700 #include #include int dummy; declares size_t twice, which is invalid prior to C2011. I wasn’t able to persuade gcc 8 to issue an error, even with -std=c89 -Wsystem-headers, but clang is not so lenient. * posix/glob.h: Include features.h, not sys/cdefs.h. When __USE_XOPEN || USE_XOPEN2K8, include stddef.h for size_t; otherwise, issue an immediate #error if __SIZE_TYPE__ is not available. Use __gsize_t, not __size_t, as an impl-namespace alternative name for size_t. * conform/data/glob.h-data: Adjust to match. * inet/netinet/igmp.h, mach/lock-intern.h, misc/ar.h * misc/sys/auxv.h, resolv/resolv.h, socket/sys/un.h * sunrpc/rpc/auth_des.h, sunrpc/rpc/rpc_msg.h * sysdeps/generic/memcopy.h, sysdeps/generic/netinet/tcp.h * sysdeps/htl/pthread.h, sysdeps/mach/hurd/net/ethernet.h * sysdeps/mach/hurd/net/if_arp.h: Include features.h, not sys/cdefs.h. * scripts/check-obsolete-constructs.py (HEADER_ALLOWED_INCLUDES): Update. --- conform/data/glob.h-data | 2 +- inet/netinet/igmp.h | 3 ++- mach/lock-intern.h | 3 ++- misc/ar.h | 2 +- misc/sys/auxv.h | 3 ++- posix/glob.h | 33 +++++++++++++++------------- resolv/resolv.h | 3 ++- scripts/check-obsolete-constructs.py | 18 ++++++--------- socket/sys/un.h | 2 +- sunrpc/rpc/auth_des.h | 3 ++- sunrpc/rpc/rpc_msg.h | 2 +- sysdeps/generic/memcopy.h | 3 ++- sysdeps/generic/netinet/tcp.h | 3 +-- sysdeps/htl/pthread.h | 1 - sysdeps/mach/hurd/net/ethernet.h | 3 ++- sysdeps/mach/hurd/net/if_arp.h | 4 ++-- 16 files changed, 46 insertions(+), 42 deletions(-) diff --git a/conform/data/glob.h-data b/conform/data/glob.h-data index eca83937af..6268134b35 100644 --- a/conform/data/glob.h-data +++ b/conform/data/glob.h-data @@ -1,6 +1,6 @@ #if !defined ISO && !defined ISO99 && !defined ISO11 #ifdef POSIX -# define size_t __size_t +# define size_t __gsize_t #endif type glob_t diff --git a/inet/netinet/igmp.h b/inet/netinet/igmp.h index 451b1abf47..2884db59df 100644 --- a/inet/netinet/igmp.h +++ b/inet/netinet/igmp.h @@ -18,7 +18,8 @@ #ifndef _NETINET_IGMP_H #define _NETINET_IGMP_H 1 -#include +#include + #include #ifdef __USE_MISC diff --git a/mach/lock-intern.h b/mach/lock-intern.h index 1988c89b09..a409abbe62 100644 --- a/mach/lock-intern.h +++ b/mach/lock-intern.h @@ -18,7 +18,8 @@ #ifndef _LOCK_INTERN_H #define _LOCK_INTERN_H -#include +#include + #if defined __USE_EXTERN_INLINES && defined _LIBC # include #endif diff --git a/misc/ar.h b/misc/ar.h index ef2303ecfe..adcfda47e2 100644 --- a/misc/ar.h +++ b/misc/ar.h @@ -19,7 +19,7 @@ #ifndef _AR_H #define _AR_H 1 -#include +#include /* Archive files start with the ARMAG identifying string. Then follows a `struct ar_hdr', and as many bytes of member file data as its `ar_size' diff --git a/misc/sys/auxv.h b/misc/sys/auxv.h index 68363b364d..404da6f400 100644 --- a/misc/sys/auxv.h +++ b/misc/sys/auxv.h @@ -19,8 +19,9 @@ #ifndef _SYS_AUXV_H #define _SYS_AUXV_H 1 +#include + #include -#include #include __BEGIN_DECLS diff --git a/posix/glob.h b/posix/glob.h index 378b80af8f..e49e6c000d 100644 --- a/posix/glob.h +++ b/posix/glob.h @@ -18,21 +18,24 @@ #ifndef _GLOB_H #define _GLOB_H 1 -#include +#include __BEGIN_DECLS -/* We need `size_t' for the following definitions. */ -#ifndef __size_t -typedef __SIZE_TYPE__ __size_t; -# if defined __USE_XOPEN || defined __USE_XOPEN2K8 -typedef __SIZE_TYPE__ size_t; -# endif +/* Structures below have size_t fields, but this header is not supposed to + define size_t itself, unless XSI or POSIX.1-2008 features are active. + We can't use __size_t as an alternative name, as we do for most types + with this kind of constraint, because GCC's stddef.h uses __size_t for + a different purpose. */ + +#if defined __USE_XOPEN || defined __USE_XOPEN2K8 +# define __need_size_t +# include +typedef size_t __gsize_t; +#elif defined __SIZE_TYPE__ +typedef __SIZE_TYPE__ __gsize_t; #else -/* The GNU CC stddef.h version defines __size_t as empty. We need a real - definition. */ -# undef __size_t -# define __size_t size_t +# error "Don't know how to define __gsize_t" #endif /* Bits set in the FLAGS argument to `glob'. */ @@ -81,9 +84,9 @@ struct stat; #endif typedef struct { - __size_t gl_pathc; /* Count of paths matched by the pattern. */ + __gsize_t gl_pathc; /* Count of paths matched by the pattern. */ char **gl_pathv; /* List of matched pathnames. */ - __size_t gl_offs; /* Slots to reserve in `gl_pathv'. */ + __gsize_t gl_offs; /* Slots to reserve in `gl_pathv'. */ int gl_flags; /* Set to FLAGS, maybe | GLOB_MAGCHAR. */ /* If the GLOB_ALTDIRFUNC flag is set, the following functions @@ -110,9 +113,9 @@ struct stat64; # endif typedef struct { - __size_t gl_pathc; + __gsize_t gl_pathc; char **gl_pathv; - __size_t gl_offs; + __gsize_t gl_offs; int gl_flags; /* If the GLOB_ALTDIRFUNC flag is set, the following functions diff --git a/resolv/resolv.h b/resolv/resolv.h index 7a8023ae9d..b4ef66fdfa 100644 --- a/resolv/resolv.h +++ b/resolv/resolv.h @@ -52,7 +52,8 @@ #ifndef _RESOLV_H_ #define _RESOLV_H_ -#include +#include + #include #include #include diff --git a/scripts/check-obsolete-constructs.py b/scripts/check-obsolete-constructs.py index 08534348d7..e383a304db 100755 --- a/scripts/check-obsolete-constructs.py +++ b/scripts/check-obsolete-constructs.py @@ -527,11 +527,9 @@ HEADER_ALLOWED_INCLUDES = { # spawn.h -> sched.h "aio.h": [ "sys/types.h" ], "ftw.h": [ "sys/stat.h", "sys/types.h" ], - "glob.h": [ "sys/cdefs.h" ], "langinfo.h": [ "nl_types.h" ], "mqueue.h": [ "fcntl.h", "sys/types.h" ], - "pthread.h": [ "endian.h", "sched.h", "time.h", - "sys/cdefs.h" ], + "pthread.h": [ "sched.h", "time.h" ], "regex.h": [ "limits.h", "sys/types.h" ], "sched.h": [ "time.h" ], "semaphore.h": [ "sys/types.h" ], @@ -550,7 +548,7 @@ HEADER_ALLOWED_INCLUDES = { "sys/time.h": [ "sys/select.h" ], "sys/types.h": [ "endian.h", "sys/select.h" ], "sys/uio.h": [ "sys/types.h" ], - "sys/un.h": [ "string.h", "sys/cdefs.h" ], + "sys/un.h": [ "string.h" ], "sys/wait.h": [ "signal.h" ], # POSIX networking headers @@ -565,7 +563,6 @@ HEADER_ALLOWED_INCLUDES = { # Nonstandardized top-level headers "aliases.h": [ "sys/types.h" ], - "ar.h": [ "sys/cdefs.h" ], "argp.h": [ "ctype.h", "errno.h", "getopt.h", "limits.h", "stdio.h" ], "argz.h": [ "errno.h", "string.h" ], @@ -594,7 +591,7 @@ HEADER_ALLOWED_INCLUDES = { # Nonstandardized sys/ headers "sys/acct.h": [ "endian.h", "stdint.h", "sys/types.h" ], - "sys/auxv.h": [ "elf.h", "sys/cdefs.h" ], + "sys/auxv.h": [ "elf.h" ], "sys/elf.h": [ "sys/procfs.h" ], "sys/epoll.h": [ "stdint.h", "sys/types.h" ], "sys/eventfd.h": [ "stdint.h" ], @@ -649,16 +646,16 @@ HEADER_ALLOWED_INCLUDES = { # Nonstandardized networking headers "ifaddrs.h": [ "sys/socket.h" ], "resolv.h": [ "arpa/nameser.h", "netinet/in.h", - "stdio.h", "sys/cdefs.h", "sys/param.h",\ + "stdio.h", "sys/param.h", "sys/types.h" ], "arpa/nameser.h": [ "arpa/nameser_compat.h", "stdint.h", "sys/param.h", "sys/types.h" ], "arpa/nameser_compat.h": [ "endian.h" ], - "net/ethernet.h": [ "stdint.h", "sys/types.h", "sys/cdefs.h", + "net/ethernet.h": [ "stdint.h", "sys/types.h", "net/if_ether.h" ], "net/if_arp.h": [ "stdint.h", "sys/socket.h", - "sys/types.h", "sys/cdefs.h" ], + "sys/types.h" ], "net/if_ppp.h": [ "net/if.h", "net/ppp_defs.h", "stdint.h", "sys/ioctl.h", "sys/types.h" ], "net/if_shaper.h": [ "net/if.h", "stdint.h", "sys/ioctl.h", @@ -673,8 +670,7 @@ HEADER_ALLOWED_INCLUDES = { "sys/types.h", "stdint.h" ], "netinet/if_fddi.h": [ "stdint.h", "sys/types.h" ], "netinet/if_tr.h": [ "stdint.h", "sys/types.h" ], - "netinet/igmp.h": [ "netinet/in.h", "sys/cdefs.h", - "sys/types.h" ], + "netinet/igmp.h": [ "netinet/in.h", "sys/types.h" ], "netinet/in_systm.h": [ "stdint.h", "sys/types.h" ], "netinet/ip.h": [ "netinet/in.h", "sys/types.h" ], "netinet/ip6.h": [ "inttypes.h", "netinet/in.h" ], diff --git a/socket/sys/un.h b/socket/sys/un.h index 12683607ce..8c7433a3dc 100644 --- a/socket/sys/un.h +++ b/socket/sys/un.h @@ -18,7 +18,7 @@ #ifndef _SYS_UN_H #define _SYS_UN_H 1 -#include +#include /* Get the definition of the macro to define the common sockaddr members. */ #include diff --git a/sunrpc/rpc/auth_des.h b/sunrpc/rpc/auth_des.h index 245675ff51..e60e795cad 100644 --- a/sunrpc/rpc/auth_des.h +++ b/sunrpc/rpc/auth_des.h @@ -18,7 +18,8 @@ #ifndef _RPC_AUTH_DES_H #define _RPC_AUTH_DES_H 1 -#include +#include + #include __BEGIN_DECLS diff --git a/sunrpc/rpc/rpc_msg.h b/sunrpc/rpc/rpc_msg.h index a2cc516cd6..efd9ee4a2f 100644 --- a/sunrpc/rpc/rpc_msg.h +++ b/sunrpc/rpc/rpc_msg.h @@ -35,7 +35,7 @@ #ifndef _RPC_MSG_H #define _RPC_MSG_H 1 -#include +#include #include #include diff --git a/sysdeps/generic/memcopy.h b/sysdeps/generic/memcopy.h index e10d01ea08..de32e56f1a 100644 --- a/sysdeps/generic/memcopy.h +++ b/sysdeps/generic/memcopy.h @@ -20,6 +20,8 @@ #ifndef _MEMCOPY_H #define _MEMCOPY_H 1 +#include + /* The strategy of the memory functions is: 1. Copy bytes until the destination pointer is aligned. @@ -38,7 +40,6 @@ exhaustive in the sense that I tried all alignment and length combinations, with and without overlap. */ -#include #include #include diff --git a/sysdeps/generic/netinet/tcp.h b/sysdeps/generic/netinet/tcp.h index 49f1bfbc26..3b59e949d8 100644 --- a/sysdeps/generic/netinet/tcp.h +++ b/sysdeps/generic/netinet/tcp.h @@ -30,10 +30,9 @@ */ #ifndef _NETINET_TCP_H - #define _NETINET_TCP_H 1 -#include +#include __BEGIN_DECLS diff --git a/sysdeps/htl/pthread.h b/sysdeps/htl/pthread.h index a8205519f2..158a095417 100644 --- a/sysdeps/htl/pthread.h +++ b/sysdeps/htl/pthread.h @@ -25,7 +25,6 @@ #include -#include #ifndef __extern_inline /* GCC 4.3 and above with -std=c99 or -std=gnu99 implements ISO C99 inline semantics, unless -fgnu89-inline is used. */ diff --git a/sysdeps/mach/hurd/net/ethernet.h b/sysdeps/mach/hurd/net/ethernet.h index 4aa67ea347..8956694b59 100644 --- a/sysdeps/mach/hurd/net/ethernet.h +++ b/sysdeps/mach/hurd/net/ethernet.h @@ -21,7 +21,8 @@ #ifndef __NET_ETHERNET_H #define __NET_ETHERNET_H 1 -#include +#include + #include #include #include /* IEEE 802.3 Ethernet constants */ diff --git a/sysdeps/mach/hurd/net/if_arp.h b/sysdeps/mach/hurd/net/if_arp.h index 6ef93c96dd..9e1b2233ce 100644 --- a/sysdeps/mach/hurd/net/if_arp.h +++ b/sysdeps/mach/hurd/net/if_arp.h @@ -20,9 +20,9 @@ /* Based on the 4.4BSD and Linux version of this file. */ #ifndef _NET_IF_ARP_H - #define _NET_IF_ARP_H 1 -#include + +#include #include #include From patchwork Wed Jun 26 17:50:17 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Zack Weinberg X-Patchwork-Id: 1122951 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-103175-incoming=patchwork.ozlabs.org@sourceware.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=panix.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.b="Y5gtdJzw"; 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 45YrGC0FVlz9s4V for ; Thu, 27 Jun 2019 03:52:34 +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:in-reply-to :references:mime-version:content-type:content-transfer-encoding; q=dns; s=default; b=cZIx1GjCpUPqDQr/iBmKdYQsqcHBR6iP4QyVhMB1nNW +2gwXeVmO8KS9rZ3MYMjjq0ioqV8QjArs5QTnZfPdcEJBigBIfsfBuK7uJSYAQO3 jwTkUpeCRDHR6aCEcnyg7hYnNIg7Ap1zbf1Ypccs4Dx12oINwOxHAYkA4vpCcwkM = 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:in-reply-to :references:mime-version:content-type:content-transfer-encoding; s=default; bh=Zmllz61RQWuxESvT8yCg9610AGc=; b=Y5gtdJzwOOPUwjPN+ CFplAASyKi0T/j4gK3zBRrln8am30odeOSl4GrVWgoWBszxijNYYHU0E0lO45EAb WB7ZJ18soKVzAtvUMn+X7lHLQLkwgqXhJ1/QtFpL0Gt7FbXJ2wdJBDSxiTIR9sAh VPufw+L4xCHrB2nDV5T+7DAxtE= Received: (qmail 12591 invoked by alias); 26 Jun 2019 17:50:42 -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 12359 invoked by uid 89); 26 Jun 2019 17:50:40 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-16.4 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_SHORT, SPF_PASS autolearn=ham version=3.3.1 spammy=selectable, deserve, Alpha X-HELO: mailbackend.panix.com From: Zack Weinberg To: libc-alpha@sourceware.org Cc: joseph@codesourcery.com, carlos@redhat.com Subject: [PATCH 13/25] Split up endian.h to minimize exposure of BYTE_ORDER. Date: Wed, 26 Jun 2019 13:50:17 -0400 Message-Id: <20190626175029.4699-4-zackw@panix.com> In-Reply-To: <20190626175029.4699-1-zackw@panix.com> References: <20190626175029.4699-1-zackw@panix.com> MIME-Version: 1.0 With only two exceptions (sys/types.h and sys/param.h, both of which historically might have defined BYTE_ORDER) the public headers that include only want to be able to test __BYTE_ORDER against __*_ENDIAN. This patch creates a new bits/endian.h that can be included by any header that wants to be able to test __BYTE_ORDER and/or __FLOAT_WORD_ORDER against the __*_ENDIAN constants, or needs __LONG_LONG_PAIR. It only defines macros in the implementation namespace. The existing bits/endian.h (which could not be included independently of endian.h, and only defines __BYTE_ORDER and maybe __FLOAT_WORD_ORDER) is renamed to bits/endianness.h. I also took the opportunity to canonicalize the form of this header, which we are stuck with having one copy of per architecture. Since they are so short, this means git doesn’t understand that they were renamed from existing headers, sigh. endian.h itself is a nonstandard header and its only remaining use from a standard header is guarded by __USE_MISC, so I dropped the __USE_MISC conditionals from around all of the public-namespace things it defines. (This means, an application that requests strict library conformance but includes endian.h will still see the definition of BYTE_ORDER.) A few changes to specific bits/endian(ness).h variants deserve mention: - sysdeps/unix/sysv/linux/ia64/bits/endian.h is moved to sysdeps/ia64/bits/endianness.h. If I remember correctly, ia64 did have selectable endianness, but we have assembly code in sysdeps/ia64 that assumes it’s little-endian, so there is no reason to treat the ia64 endianness.h as linux-specific. - The C-SKY port does not fully support big-endian mode, but I do not think this is sufficient reason to make csky/bits/endian(ness).h error out if __CSKYBE__ is defined, so it now defines __BYTE_ORDER appropriately for whichever mode the compiler is in. - The PowerPC port had extra logic in its bits/endian.h to detect a broken compiler, which strikes me as unnecessary, so I removed it. - The only files that defined __FLOAT_WORD_ORDER always defined it to the same value as __BYTE_ORDER, so I removed those definitions. The SH bits/endian(ness).h had comments inconsistent with the actual setting of __FLOAT_WORD_ORDER, which I also removed. - I *removed* copyright boilerplate from the few bits/endian(ness).h headers that had it; these files record a single fact in a fashion dictated by an external spec, so I do not think they are copyrightable. As long as I was changing every copy of ieee754.h in the tree, I noticed that only the MIPS variant includes float.h, because it uses LDBL_MANT_DIG to decide among three different versions of ieee854_long_double. This patch makes it not include float.h when GCC’s intrinsic __LDBL_MANT_DIG__ is available. * string/endian.h: Unconditionally define LITTLE_ENDIAN, BIG_ENDIAN, PDP_ENDIAN, and BYTE_ORDER. Condition byteswapping macros only on !__ASSEMBLER__. Move the definitions of __BIG_ENDIAN, __LITTLE_ENDIAN, __PDP_ENDIAN, __FLOAT_WORD_ORDER, and __LONG_LONG_PAIR to... * string/bits/endian.h: ...this new file, which includes the renamed header bits/endianness.h for the definition of __BYTE_ORDER and possibly __FLOAT_WORD_ORDER. * string/Makefile: Install bits/endianness.h. * include/bits/endian.h: New wrapper. * bits/endian.h: Rename to bits/endianness.h. Add multiple-include guard. Rewrite the comment explaining what the machine-specific variants of this file should do. * sysdeps/unix/sysv/linux/ia64/bits/endian.h: Move to sysdeps/ia64. * sysdeps/aarch64/bits/endian.h * sysdeps/alpha/bits/endian.h * sysdeps/arm/bits/endian.h * sysdeps/csky/bits/endian.h * sysdeps/hppa/bits/endian.h * sysdeps/ia64/bits/endian.h * sysdeps/m68k/bits/endian.h * sysdeps/microblaze/bits/endian.h * sysdeps/mips/bits/endian.h * sysdeps/nios2/bits/endian.h * sysdeps/powerpc/bits/endian.h * sysdeps/riscv/bits/endian.h * sysdeps/s390/bits/endian.h * sysdeps/sh/bits/endian.h * sysdeps/sparc/bits/endian.h * sysdeps/x86/bits/endian.h: Rename to endianness.h; canonicalize form of file; remove redundant definitions of __FLOAT_WORD_ORDER. * sysdeps/csky/bits/endianness.h: Do not error out if __CSKYEB__ is defined. * sysdeps/powerpc/bits/endianness.h: Remove logic to check for broken compilers. * ctype/ctype.h * inet/netinet/in.h * resolv/arpa/nameser_compat.h * sysdeps/aarch64/nptl/bits/pthreadtypes-arch.h * sysdeps/arm/nptl/bits/pthreadtypes-arch.h * sysdeps/csky/nptl/bits/pthreadtypes-arch.h * sysdeps/ia64/ieee754.h * sysdeps/ieee754/ieee754.h * sysdeps/ieee754/ldbl-128/ieee754.h * sysdeps/ieee754/ldbl-128ibm/ieee754.h * sysdeps/m68k/nptl/bits/pthreadtypes-arch.h * sysdeps/microblaze/nptl/bits/pthreadtypes-arch.h * sysdeps/mips/ieee754/ieee754.h * sysdeps/mips/nptl/bits/pthreadtypes-arch.h * sysdeps/nios2/nptl/bits/pthreadtypes-arch.h * sysdeps/nptl/pthread.h * sysdeps/riscv/nptl/bits/pthreadtypes-arch.h * sysdeps/sh/nptl/bits/pthreadtypes-arch.h * sysdeps/sparc/sparc32/ieee754.h * sysdeps/unix/sysv/linux/generic/bits/stat.h * sysdeps/unix/sysv/linux/generic/bits/statfs.h * sysdeps/unix/sysv/linux/sys/acct.h * wctype/bits/wctype-wchar.h: Include bits/endian.h, not endian.h. * sysdeps/unix/sysv/linux/hppa/pthread.h: Don’t include endian.h. * sysdeps/mips/ieee754/ieee754.h: Use __LDBL_MANT_DIG__ in ifdefs, instead of LDBL_MANT_DIG. Only include float.h when __LDBL_MANT_DIG__ is not predefined, in which case define __LDBL_MANT_DIG__ to equal LDBL_MANT_DIG. * scripts/check-obsolete-constructs.h: Remove most of the whitelist entries for endian.h and float.h. --- bits/endian.h | 13 ----- bits/endianness.h | 17 +++++++ ctype/ctype.h | 2 +- include/bits/endian.h | 1 + inet/netinet/in.h | 2 +- resolv/arpa/nameser_compat.h | 2 +- scripts/check-obsolete-constructs.py | 10 +--- string/Makefile | 3 +- string/bits/endian.h | 48 +++++++++++++++++++ string/endian.h | 39 +++------------ sysdeps/aarch64/bits/endian.h | 30 ------------ sysdeps/aarch64/bits/endianness.h | 15 ++++++ sysdeps/aarch64/nptl/bits/pthreadtypes-arch.h | 2 +- sysdeps/alpha/bits/endian.h | 7 --- sysdeps/alpha/bits/endianness.h | 11 +++++ sysdeps/arm/bits/endian.h | 10 ---- sysdeps/arm/bits/endianness.h | 15 ++++++ sysdeps/arm/nptl/bits/pthreadtypes-arch.h | 2 +- sysdeps/csky/bits/endian.h | 9 ---- sysdeps/csky/bits/endianness.h | 15 ++++++ sysdeps/csky/nptl/bits/pthreadtypes-arch.h | 2 +- sysdeps/hppa/bits/endian.h | 7 --- sysdeps/hppa/bits/endianness.h | 11 +++++ sysdeps/ia64/bits/endianness.h | 11 +++++ sysdeps/ia64/ieee754.h | 4 +- sysdeps/ieee754/ieee754.h | 4 +- sysdeps/ieee754/ldbl-128/ieee754.h | 4 +- sysdeps/ieee754/ldbl-128ibm/ieee754.h | 4 +- sysdeps/m68k/bits/endian.h | 7 --- sysdeps/m68k/bits/endianness.h | 11 +++++ sysdeps/m68k/nptl/bits/pthreadtypes-arch.h | 2 +- sysdeps/microblaze/bits/endian.h | 30 ------------ sysdeps/microblaze/bits/endianness.h | 15 ++++++ .../microblaze/nptl/bits/pthreadtypes-arch.h | 2 +- sysdeps/mips/bits/endian.h | 15 ------ sysdeps/mips/bits/endianness.h | 16 +++++++ sysdeps/mips/ieee754/ieee754.h | 17 ++++--- sysdeps/mips/nptl/bits/pthreadtypes-arch.h | 2 +- sysdeps/nios2/bits/endian.h | 12 ----- sysdeps/nios2/bits/endianness.h | 16 +++++++ sysdeps/nios2/nptl/bits/pthreadtypes-arch.h | 2 +- sysdeps/nptl/pthread.h | 2 +- sysdeps/powerpc/bits/endian.h | 36 -------------- sysdeps/powerpc/bits/endianness.h | 16 +++++++ sysdeps/riscv/bits/endian.h | 5 -- sysdeps/riscv/bits/endianness.h | 11 +++++ sysdeps/riscv/nptl/bits/pthreadtypes-arch.h | 2 +- sysdeps/s390/bits/endian.h | 7 --- sysdeps/s390/bits/endianness.h | 11 +++++ sysdeps/sh/bits/endian.h | 13 ----- sysdeps/sh/bits/endianness.h | 15 ++++++ sysdeps/sh/nptl/bits/pthreadtypes-arch.h | 2 +- sysdeps/sparc/bits/endian.h | 12 ----- sysdeps/sparc/bits/endianness.h | 16 +++++++ sysdeps/sparc/sparc32/ieee754.h | 4 +- sysdeps/unix/sysv/linux/generic/bits/stat.h | 2 +- sysdeps/unix/sysv/linux/generic/bits/statfs.h | 2 +- sysdeps/unix/sysv/linux/hppa/pthread.h | 1 - sysdeps/unix/sysv/linux/ia64/bits/endian.h | 7 --- sysdeps/unix/sysv/linux/powerpc/htm.h | 2 +- sysdeps/unix/sysv/linux/sys/acct.h | 2 +- sysdeps/x86/bits/endian.h | 7 --- sysdeps/x86/bits/endianness.h | 11 +++++ wctype/bits/wctype-wchar.h | 2 +- 64 files changed, 330 insertions(+), 305 deletions(-) delete mode 100644 bits/endian.h create mode 100644 bits/endianness.h create mode 100644 include/bits/endian.h create mode 100644 string/bits/endian.h delete mode 100644 sysdeps/aarch64/bits/endian.h create mode 100644 sysdeps/aarch64/bits/endianness.h delete mode 100644 sysdeps/alpha/bits/endian.h create mode 100644 sysdeps/alpha/bits/endianness.h delete mode 100644 sysdeps/arm/bits/endian.h create mode 100644 sysdeps/arm/bits/endianness.h delete mode 100644 sysdeps/csky/bits/endian.h create mode 100644 sysdeps/csky/bits/endianness.h delete mode 100644 sysdeps/hppa/bits/endian.h create mode 100644 sysdeps/hppa/bits/endianness.h create mode 100644 sysdeps/ia64/bits/endianness.h delete mode 100644 sysdeps/m68k/bits/endian.h create mode 100644 sysdeps/m68k/bits/endianness.h delete mode 100644 sysdeps/microblaze/bits/endian.h create mode 100644 sysdeps/microblaze/bits/endianness.h delete mode 100644 sysdeps/mips/bits/endian.h create mode 100644 sysdeps/mips/bits/endianness.h delete mode 100644 sysdeps/nios2/bits/endian.h create mode 100644 sysdeps/nios2/bits/endianness.h delete mode 100644 sysdeps/powerpc/bits/endian.h create mode 100644 sysdeps/powerpc/bits/endianness.h delete mode 100644 sysdeps/riscv/bits/endian.h create mode 100644 sysdeps/riscv/bits/endianness.h delete mode 100644 sysdeps/s390/bits/endian.h create mode 100644 sysdeps/s390/bits/endianness.h delete mode 100644 sysdeps/sh/bits/endian.h create mode 100644 sysdeps/sh/bits/endianness.h delete mode 100644 sysdeps/sparc/bits/endian.h create mode 100644 sysdeps/sparc/bits/endianness.h delete mode 100644 sysdeps/unix/sysv/linux/ia64/bits/endian.h delete mode 100644 sysdeps/x86/bits/endian.h create mode 100644 sysdeps/x86/bits/endianness.h diff --git a/bits/endian.h b/bits/endian.h deleted file mode 100644 index 45afd4ae47..0000000000 diff --git a/bits/endianness.h b/bits/endianness.h new file mode 100644 index 0000000000..b83040ddec --- /dev/null +++ b/bits/endianness.h @@ -0,0 +1,17 @@ +/* This file must be overridden for each supported CPU architecture. + It should define __BYTE_ORDER to one of the constants defined in + string/bits/endian.h, as appropriate for the machine in + question. If floating-point quantities are not stored in the + same byte order as integer quantities, it should also define + __FLOAT_WORD_ORDER as appropriate. */ + +#ifndef _BITS_ENDIANNESS_H +#define _BITS_ENDIANNESS_H 1 + +#ifndef _BITS_ENDIAN_H +# error "Never use directly; include instead." +#endif + +#error "Machine byte order unknown." + +#endif /* bits/endianness.h */ diff --git a/ctype/ctype.h b/ctype/ctype.h index 78a455e227..3d070d71bf 100644 --- a/ctype/ctype.h +++ b/ctype/ctype.h @@ -36,7 +36,7 @@ __BEGIN_DECLS endian). We define the bit value interpretations here dependent on the machine's byte order. */ -# include +# include # if __BYTE_ORDER == __BIG_ENDIAN # define _ISbit(bit) (1 << (bit)) # else /* __BYTE_ORDER == __LITTLE_ENDIAN */ diff --git a/include/bits/endian.h b/include/bits/endian.h new file mode 100644 index 0000000000..ad614f1c1a --- /dev/null +++ b/include/bits/endian.h @@ -0,0 +1 @@ +#include diff --git a/inet/netinet/in.h b/inet/netinet/in.h index 24caf3c77d..b411ba939c 100644 --- a/inet/netinet/in.h +++ b/inet/netinet/in.h @@ -380,9 +380,9 @@ extern uint32_t htonl (uint32_t __hostlong) extern uint16_t htons (uint16_t __hostshort) __THROW __attribute__ ((__const__)); -#include /* Get machine dependent optimized versions of byte swapping functions. */ +#include #include #include diff --git a/resolv/arpa/nameser_compat.h b/resolv/arpa/nameser_compat.h index f1c390f3b9..37c178b524 100644 --- a/resolv/arpa/nameser_compat.h +++ b/resolv/arpa/nameser_compat.h @@ -29,7 +29,7 @@ #ifndef _ARPA_NAMESER_COMPAT_ #define _ARPA_NAMESER_COMPAT_ -#include +#include /*% * Structure for query header. The order of the fields is machine- and diff --git a/scripts/check-obsolete-constructs.py b/scripts/check-obsolete-constructs.py index e383a304db..4ef5775932 100755 --- a/scripts/check-obsolete-constructs.py +++ b/scripts/check-obsolete-constructs.py @@ -511,7 +511,6 @@ HEADER_ALLOWED_INCLUDES = { # mandated: inttypes.h -> stdint.h # tgmath.h -> complex.h, math.h # threads.h -> time.h - "ctype.h": [ "endian.h" ], "inttypes.h": [ "stdint.h" ], "signal.h": [ "sys/ucontext.h" ], "stdlib.h": [ "alloca.h", "sys/types.h" ], @@ -557,7 +556,7 @@ HEADER_ALLOWED_INCLUDES = { "netdb.h": [ "netinet/in.h", "rpc/netdb.h" ], "arpa/inet.h": [ "netinet/in.h" ], "net/if.h": [ "sys/socket.h", "sys/types.h" ], - "netinet/in.h": [ "endian.h", "sys/socket.h" ], + "netinet/in.h": [ "sys/socket.h" ], "netinet/tcp.h": [ "stdint.h", "sys/socket.h", "sys/types.h" ], @@ -570,7 +569,7 @@ HEADER_ALLOWED_INCLUDES = { "envz.h": [ "argz.h", "errno.h" ], "fts.h": [ "sys/types.h" ], "gshadow.h": [ "paths.h" ], - "ieee754.h": [ "endian.h", "float.h" ], + "ieee754.h": [ "float.h" ], "lastlog.h": [ "utmp.h" ], "libintl.h": [ "locale.h" ], "link.h": [ "dlfcn.h", "elf.h", "sys/types.h" ], @@ -651,7 +650,6 @@ HEADER_ALLOWED_INCLUDES = { "arpa/nameser.h": [ "arpa/nameser_compat.h", "stdint.h", "sys/param.h", "sys/types.h" ], - "arpa/nameser_compat.h": [ "endian.h" ], "net/ethernet.h": [ "stdint.h", "sys/types.h", "net/if_ether.h" ], "net/if_arp.h": [ "stdint.h", "sys/socket.h", @@ -693,15 +691,11 @@ HEADER_ALLOWED_INCLUDES = { "bits/fcntl.h": [ "sys/types.h" ], "bits/ipc.h": [ "sys/types.h" ], "bits/procfs.h": [ "signal.h", "sys/ucontext.h" ], - "bits/pthreadtypes-arch.h": [ "endian.h" ], "bits/sem.h": [ "sys/types.h" ], "bits/socket.h": [ "sys/types.h" ], - "bits/stat.h": [ "endian.h" ], - "bits/statfs.h": [ "endian.h" ], "bits/types/res_state.h": [ "netinet/in.h", "sys/types.h" ], "bits/utmp.h": [ "paths.h", "sys/time.h", "sys/types.h" ], "bits/utmpx.h": [ "paths.h", "sys/time.h" ], - "bits/wctype-wchar.h": [ "endian.h" ], } # As above, but each group of whitelist entries is only used for diff --git a/string/Makefile b/string/Makefile index 38b26a0f8e..3e5721e0f4 100644 --- a/string/Makefile +++ b/string/Makefile @@ -25,7 +25,8 @@ include ../Makeconfig headers := string.h bits/string_fortified.h \ strings.h bits/strings_fortified.h \ byteswap.h bits/byteswap.h \ - endian.h bits/endian.h bits/uintn-identity.h \ + endian.h bits/endian.h bits/endianness.h \ + bits/uintn-identity.h \ memory.h argz.h envz.h routines := strcat strchr strcmp strcoll strcpy strcspn \ diff --git a/string/bits/endian.h b/string/bits/endian.h new file mode 100644 index 0000000000..ed2ee578c3 --- /dev/null +++ b/string/bits/endian.h @@ -0,0 +1,48 @@ +/* Copyright (C) 1992-2019 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#ifndef _BITS_ENDIAN_H +#define _BITS_ENDIAN_H 1 + +/* Definitions for byte order, according to significance of bytes, + from low addresses to high addresses. The value is what you get by + putting '4' in the most significant byte, '3' in the second most + significant byte, '2' in the second least significant byte, and '1' + in the least significant byte, and then writing down one digit for + each byte, starting with the byte at the lowest address at the left, + and proceeding to the byte with the highest address at the right. */ + +#define __LITTLE_ENDIAN 1234 +#define __BIG_ENDIAN 4321 +#define __PDP_ENDIAN 3412 + +/* This file defines `__BYTE_ORDER' for the particular machine. */ +#include + +/* Some machines may need to use a different endianness for floating point + values. */ +#ifndef __FLOAT_WORD_ORDER +# define __FLOAT_WORD_ORDER __BYTE_ORDER +#endif + +#if __BYTE_ORDER == __LITTLE_ENDIAN +# define __LONG_LONG_PAIR(HI, LO) LO, HI +#elif __BYTE_ORDER == __BIG_ENDIAN +# define __LONG_LONG_PAIR(HI, LO) HI, LO +#endif + +#endif /* bits/endian.h */ diff --git a/string/endian.h b/string/endian.h index e62b735625..9d6b10ce62 100644 --- a/string/endian.h +++ b/string/endian.h @@ -20,42 +20,15 @@ #include -/* Definitions for byte order, according to significance of bytes, - from low addresses to high addresses. The value is what you get by - putting '4' in the most significant byte, '3' in the second most - significant byte, '2' in the second least significant byte, and '1' - in the least significant byte, and then writing down one digit for - each byte, starting with the byte at the lowest address at the left, - and proceeding to the byte with the highest address at the right. */ - -#define __LITTLE_ENDIAN 1234 -#define __BIG_ENDIAN 4321 -#define __PDP_ENDIAN 3412 - -/* This file defines `__BYTE_ORDER' for the particular machine. */ +/* Get the definitions of __*_ENDIAN, __BYTE_ORDER, and __FLOAT_WORD_ORDER. */ #include -/* Some machines may need to use a different endianness for floating point - values. */ -#ifndef __FLOAT_WORD_ORDER -# define __FLOAT_WORD_ORDER __BYTE_ORDER -#endif +#define LITTLE_ENDIAN __LITTLE_ENDIAN +#define BIG_ENDIAN __BIG_ENDIAN +#define PDP_ENDIAN __PDP_ENDIAN +#define BYTE_ORDER __BYTE_ORDER -#ifdef __USE_MISC -# define LITTLE_ENDIAN __LITTLE_ENDIAN -# define BIG_ENDIAN __BIG_ENDIAN -# define PDP_ENDIAN __PDP_ENDIAN -# define BYTE_ORDER __BYTE_ORDER -#endif - -#if __BYTE_ORDER == __LITTLE_ENDIAN -# define __LONG_LONG_PAIR(HI, LO) LO, HI -#elif __BYTE_ORDER == __BIG_ENDIAN -# define __LONG_LONG_PAIR(HI, LO) HI, LO -#endif - - -#if defined __USE_MISC && !defined __ASSEMBLER__ +#ifndef __ASSEMBLER__ /* Conversion interfaces. */ # include # include diff --git a/sysdeps/aarch64/bits/endian.h b/sysdeps/aarch64/bits/endian.h deleted file mode 100644 index c0a40e082a..0000000000 diff --git a/sysdeps/aarch64/bits/endianness.h b/sysdeps/aarch64/bits/endianness.h new file mode 100644 index 0000000000..300ebc8f9c --- /dev/null +++ b/sysdeps/aarch64/bits/endianness.h @@ -0,0 +1,15 @@ +#ifndef _BITS_ENDIANNESS_H +#define _BITS_ENDIANNESS_H 1 + +#ifndef _BITS_ENDIAN_H +# error "Never use directly; include instead." +#endif + +/* AArch64 has selectable endianness. */ +#ifdef __AARCH64EB__ +# define __BYTE_ORDER __BIG_ENDIAN +#else +# define __BYTE_ORDER __LITTLE_ENDIAN +#endif + +#endif /* bits/endianness.h */ diff --git a/sysdeps/aarch64/nptl/bits/pthreadtypes-arch.h b/sysdeps/aarch64/nptl/bits/pthreadtypes-arch.h index 8a2a5155db..5b05111be0 100644 --- a/sysdeps/aarch64/nptl/bits/pthreadtypes-arch.h +++ b/sysdeps/aarch64/nptl/bits/pthreadtypes-arch.h @@ -19,7 +19,7 @@ #ifndef _BITS_PTHREADTYPES_ARCH_H #define _BITS_PTHREADTYPES_ARCH_H 1 -#include +#include #ifdef __ILP32__ # define __SIZEOF_PTHREAD_ATTR_T 32 diff --git a/sysdeps/alpha/bits/endian.h b/sysdeps/alpha/bits/endian.h deleted file mode 100644 index 8a16e14e24..0000000000 diff --git a/sysdeps/alpha/bits/endianness.h b/sysdeps/alpha/bits/endianness.h new file mode 100644 index 0000000000..69f9a147f6 --- /dev/null +++ b/sysdeps/alpha/bits/endianness.h @@ -0,0 +1,11 @@ +#ifndef _BITS_ENDIANNESS_H +#define _BITS_ENDIANNESS_H 1 + +#ifndef _BITS_ENDIAN_H +# error "Never use directly; include instead." +#endif + +/* Alpha is little-endian. */ +#define __BYTE_ORDER __LITTLE_ENDIAN + +#endif /* bits/endianness.h */ diff --git a/sysdeps/arm/bits/endian.h b/sysdeps/arm/bits/endian.h deleted file mode 100644 index f49f6ab1c9..0000000000 diff --git a/sysdeps/arm/bits/endianness.h b/sysdeps/arm/bits/endianness.h new file mode 100644 index 0000000000..2d671fff66 --- /dev/null +++ b/sysdeps/arm/bits/endianness.h @@ -0,0 +1,15 @@ +#ifndef _BITS_ENDIANNESS_H +#define _BITS_ENDIANNESS_H 1 + +#ifndef _BITS_ENDIAN_H +# error "Never use directly; include instead." +#endif + +/* ARM has selectable endianness. */ +#ifdef __ARMEB__ +#define __BYTE_ORDER __BIG_ENDIAN +#else +#define __BYTE_ORDER __LITTLE_ENDIAN +#endif + +#endif /* bits/endianness.h */ diff --git a/sysdeps/arm/nptl/bits/pthreadtypes-arch.h b/sysdeps/arm/nptl/bits/pthreadtypes-arch.h index 332b288067..734828a0bb 100644 --- a/sysdeps/arm/nptl/bits/pthreadtypes-arch.h +++ b/sysdeps/arm/nptl/bits/pthreadtypes-arch.h @@ -18,7 +18,7 @@ #ifndef _BITS_PTHREADTYPES_ARCH_H #define _BITS_PTHREADTYPES_ARCH_H 1 -#include +#include #define __SIZEOF_PTHREAD_ATTR_T 36 #define __SIZEOF_PTHREAD_MUTEX_T 24 diff --git a/sysdeps/csky/bits/endian.h b/sysdeps/csky/bits/endian.h deleted file mode 100644 index 51df38d8f9..0000000000 diff --git a/sysdeps/csky/bits/endianness.h b/sysdeps/csky/bits/endianness.h new file mode 100644 index 0000000000..14652f5b37 --- /dev/null +++ b/sysdeps/csky/bits/endianness.h @@ -0,0 +1,15 @@ +#ifndef _BITS_ENDIANNESS_H +#define _BITS_ENDIANNESS_H 1 + +#ifndef _BITS_ENDIAN_H +# error "Never use directly; include instead." +#endif + +/* C-SKY has selectable endianness. */ +#ifdef __CSKYBE__ +# define __BYTE_ORDER __BIG_ENDIAN +#else +# define __BYTE_ORDER __LITTLE_ENDIAN +#endif + +#endif /* bits/endianness.h */ diff --git a/sysdeps/csky/nptl/bits/pthreadtypes-arch.h b/sysdeps/csky/nptl/bits/pthreadtypes-arch.h index 5a49114eac..0f737a1654 100644 --- a/sysdeps/csky/nptl/bits/pthreadtypes-arch.h +++ b/sysdeps/csky/nptl/bits/pthreadtypes-arch.h @@ -19,7 +19,7 @@ #ifndef _BITS_PTHREADTYPES_ARCH_H #define _BITS_PTHREADTYPES_ARCH_H 1 -#include +#include #define __SIZEOF_PTHREAD_ATTR_T 36 #define __SIZEOF_PTHREAD_MUTEX_T 24 diff --git a/sysdeps/hppa/bits/endian.h b/sysdeps/hppa/bits/endian.h deleted file mode 100644 index 585db0c0fa..0000000000 diff --git a/sysdeps/hppa/bits/endianness.h b/sysdeps/hppa/bits/endianness.h new file mode 100644 index 0000000000..96fd5ae5ef --- /dev/null +++ b/sysdeps/hppa/bits/endianness.h @@ -0,0 +1,11 @@ +#ifndef _BITS_ENDIANNESS_H +#define _BITS_ENDIANNESS_H 1 + +#ifndef _BITS_ENDIAN_H +# error "Never use directly; include instead." +#endif + +/* HP-PA is big-endian. */ +#define __BYTE_ORDER __BIG_ENDIAN + +#endif /* bits/endianness.h */ diff --git a/sysdeps/ia64/bits/endianness.h b/sysdeps/ia64/bits/endianness.h new file mode 100644 index 0000000000..70c211e569 --- /dev/null +++ b/sysdeps/ia64/bits/endianness.h @@ -0,0 +1,11 @@ +#ifndef _BITS_ENDIANNESS_H +#define _BITS_ENDIANNESS_H 1 + +#ifndef _BITS_ENDIAN_H +# error "Never use directly; include instead." +#endif + +/* IA64 is little-endian. */ +#define __BYTE_ORDER __LITTLE_ENDIAN + +#endif /* bits/endianness.h */ diff --git a/sysdeps/ia64/ieee754.h b/sysdeps/ia64/ieee754.h index 3c533812c5..f9ff748528 100644 --- a/sysdeps/ia64/ieee754.h +++ b/sysdeps/ia64/ieee754.h @@ -16,11 +16,11 @@ . */ #ifndef _IEEE754_H - #define _IEEE754_H 1 + #include -#include +#include __BEGIN_DECLS diff --git a/sysdeps/ieee754/ieee754.h b/sysdeps/ieee754/ieee754.h index a88cbb6943..b457a10b41 100644 --- a/sysdeps/ieee754/ieee754.h +++ b/sysdeps/ieee754/ieee754.h @@ -16,11 +16,11 @@ . */ #ifndef _IEEE754_H - #define _IEEE754_H 1 + #include -#include +#include __BEGIN_DECLS diff --git a/sysdeps/ieee754/ldbl-128/ieee754.h b/sysdeps/ieee754/ldbl-128/ieee754.h index 0f206db928..bda95aca4d 100644 --- a/sysdeps/ieee754/ldbl-128/ieee754.h +++ b/sysdeps/ieee754/ldbl-128/ieee754.h @@ -16,11 +16,11 @@ . */ #ifndef _IEEE754_H - #define _IEEE754_H 1 + #include -#include +#include __BEGIN_DECLS diff --git a/sysdeps/ieee754/ldbl-128ibm/ieee754.h b/sysdeps/ieee754/ldbl-128ibm/ieee754.h index d0438c1bd5..eeb9d37e0c 100644 --- a/sysdeps/ieee754/ldbl-128ibm/ieee754.h +++ b/sysdeps/ieee754/ldbl-128ibm/ieee754.h @@ -16,11 +16,11 @@ . */ #ifndef _IEEE754_H - #define _IEEE754_H 1 + #include -#include +#include __BEGIN_DECLS diff --git a/sysdeps/m68k/bits/endian.h b/sysdeps/m68k/bits/endian.h deleted file mode 100644 index bf4ecb60a4..0000000000 diff --git a/sysdeps/m68k/bits/endianness.h b/sysdeps/m68k/bits/endianness.h new file mode 100644 index 0000000000..7e5f0d2969 --- /dev/null +++ b/sysdeps/m68k/bits/endianness.h @@ -0,0 +1,11 @@ +#ifndef _BITS_ENDIANNESS_H +#define _BITS_ENDIANNESS_H 1 + +#ifndef _BITS_ENDIAN_H +# error "Never use directly; include instead." +#endif + +/* m68k is big-endian. */ +#define __BYTE_ORDER __BIG_ENDIAN + +#endif /* bits/endianness.h */ diff --git a/sysdeps/m68k/nptl/bits/pthreadtypes-arch.h b/sysdeps/m68k/nptl/bits/pthreadtypes-arch.h index 731cdec69a..a8497d6816 100644 --- a/sysdeps/m68k/nptl/bits/pthreadtypes-arch.h +++ b/sysdeps/m68k/nptl/bits/pthreadtypes-arch.h @@ -19,7 +19,7 @@ #ifndef _BITS_PTHREADTYPES_ARCH_H #define _BITS_PTHREADTYPES_ARCH_H 1 -#include +#include #define __SIZEOF_PTHREAD_ATTR_T 36 #define __SIZEOF_PTHREAD_MUTEX_T 24 diff --git a/sysdeps/microblaze/bits/endian.h b/sysdeps/microblaze/bits/endian.h deleted file mode 100644 index 3650f3d564..0000000000 diff --git a/sysdeps/microblaze/bits/endianness.h b/sysdeps/microblaze/bits/endianness.h new file mode 100644 index 0000000000..c4bb7e5f2e --- /dev/null +++ b/sysdeps/microblaze/bits/endianness.h @@ -0,0 +1,15 @@ +#ifndef _BITS_ENDIANNESS_H +#define _BITS_ENDIANNESS_H 1 + +#ifndef _BITS_ENDIAN_H +# error "Never use directly; include instead." +#endif + +/* MicroBlaze has selectable endianness. */ +#ifdef _BIG_ENDIAN +# define __BYTE_ORDER __BIG_ENDIAN +#else +# define __BYTE_ORDER __LITTLE_ENDIAN +#endif + +#endif /* bits/endianness.h */ diff --git a/sysdeps/microblaze/nptl/bits/pthreadtypes-arch.h b/sysdeps/microblaze/nptl/bits/pthreadtypes-arch.h index 838e71f4e1..77b4e6c3d2 100644 --- a/sysdeps/microblaze/nptl/bits/pthreadtypes-arch.h +++ b/sysdeps/microblaze/nptl/bits/pthreadtypes-arch.h @@ -19,7 +19,7 @@ #ifndef _BITS_PTHREADTYPES_ARCH_H # define _BITS_PTHREADTYPES_ARCH_H 1 -# include +# include # define __SIZEOF_PTHREAD_ATTR_T 36 # define __SIZEOF_PTHREAD_MUTEX_T 24 diff --git a/sysdeps/mips/bits/endian.h b/sysdeps/mips/bits/endian.h deleted file mode 100644 index 126059799d..0000000000 diff --git a/sysdeps/mips/bits/endianness.h b/sysdeps/mips/bits/endianness.h new file mode 100644 index 0000000000..09e138b89b --- /dev/null +++ b/sysdeps/mips/bits/endianness.h @@ -0,0 +1,16 @@ +#ifndef _BITS_ENDIANNESS_H +#define _BITS_ENDIANNESS_H 1 + +#ifndef _BITS_ENDIAN_H +# error "Never use directly; include instead." +#endif + +/* MIPS has selectable endianness. */ +#ifdef __MIPSEB +# define __BYTE_ORDER __BIG_ENDIAN +#endif +#ifdef __MIPSEL +# define __BYTE_ORDER __LITTLE_ENDIAN +#endif + +#endif /* bits/endianness.h */ diff --git a/sysdeps/mips/ieee754/ieee754.h b/sysdeps/mips/ieee754/ieee754.h index d5fb9fce47..e36ef0f5b8 100644 --- a/sysdeps/mips/ieee754/ieee754.h +++ b/sysdeps/mips/ieee754/ieee754.h @@ -16,13 +16,16 @@ . */ #ifndef _IEEE754_H - #define _IEEE754_H 1 + #include -#include +#include -#include +#ifndef __LDBL_MANT_DIG__ +# include +# define __LDBL_MANT_DIG__ LDBL_MANT_DIG +#endif __BEGIN_DECLS @@ -127,7 +130,7 @@ union ieee754_double #define IEEE754_DOUBLE_BIAS 0x3ff /* Added to exponent. */ -#if LDBL_MANT_DIG == 113 +#if __LDBL_MANT_DIG__ == 113 union ieee854_long_double { @@ -184,7 +187,7 @@ union ieee854_long_double #define IEEE854_LONG_DOUBLE_BIAS 0x3fff /* Added to exponent. */ -#elif LDBL_MANT_DIG == 64 +#elif __LDBL_MANT_DIG__ == 64 union ieee854_long_double { @@ -253,7 +256,7 @@ union ieee854_long_double #define IEEE854_LONG_DOUBLE_BIAS 0x3fff -#elif LDBL_MANT_DIG == 53 +#elif __LDBL_MANT_DIG__ == 53 union ieee854_long_double { @@ -316,7 +319,7 @@ union ieee854_long_double #define IEEE854_LONG_DOUBLE_BIAS 0x3ff /* Added to exponent. */ -#endif /* LDBL_MANT_DIG == 53 */ +#endif /* __LDBL_MANT_DIG__ == 53 */ __END_DECLS diff --git a/sysdeps/mips/nptl/bits/pthreadtypes-arch.h b/sysdeps/mips/nptl/bits/pthreadtypes-arch.h index bebee00258..bf69766897 100644 --- a/sysdeps/mips/nptl/bits/pthreadtypes-arch.h +++ b/sysdeps/mips/nptl/bits/pthreadtypes-arch.h @@ -19,7 +19,7 @@ #ifndef _BITS_PTHREADTYPES_ARCH_H #define _BITS_PTHREADTYPES_ARCH_H 1 -#include +#include #if _MIPS_SIM == _ABI64 # define __SIZEOF_PTHREAD_ATTR_T 56 diff --git a/sysdeps/nios2/bits/endian.h b/sysdeps/nios2/bits/endian.h deleted file mode 100644 index 164f9e4d78..0000000000 diff --git a/sysdeps/nios2/bits/endianness.h b/sysdeps/nios2/bits/endianness.h new file mode 100644 index 0000000000..87e66ebd71 --- /dev/null +++ b/sysdeps/nios2/bits/endianness.h @@ -0,0 +1,16 @@ +#ifndef _BITS_ENDIANNESS_H +#define _BITS_ENDIANNESS_H 1 + +#ifndef _BITS_ENDIAN_H +# error "Never use directly; include instead." +#endif + +/* Nios II has selectable endianness. */ +#ifdef __nios2_big_endian__ +# define __BYTE_ORDER __BIG_ENDIAN +#endif +#ifdef __nios2_little_endian__ +# define __BYTE_ORDER __LITTLE_ENDIAN +#endif + +#endif /* bits/endianness.h */ diff --git a/sysdeps/nios2/nptl/bits/pthreadtypes-arch.h b/sysdeps/nios2/nptl/bits/pthreadtypes-arch.h index 1091e63eac..459c8bcee0 100644 --- a/sysdeps/nios2/nptl/bits/pthreadtypes-arch.h +++ b/sysdeps/nios2/nptl/bits/pthreadtypes-arch.h @@ -19,7 +19,7 @@ #ifndef _BITS_PTHREADTYPES_ARCH_H #define _BITS_PTHREADTYPES_ARCH_H 1 -#include +#include #define __SIZEOF_PTHREAD_ATTR_T 36 #define __SIZEOF_PTHREAD_MUTEX_T 24 diff --git a/sysdeps/nptl/pthread.h b/sysdeps/nptl/pthread.h index 704a3c48d6..e5a7efcb1d 100644 --- a/sysdeps/nptl/pthread.h +++ b/sysdeps/nptl/pthread.h @@ -19,10 +19,10 @@ #define _PTHREAD_H 1 #include -#include #include #include +#include #include #include #include diff --git a/sysdeps/powerpc/bits/endian.h b/sysdeps/powerpc/bits/endian.h deleted file mode 100644 index cd8ae4fc50..0000000000 diff --git a/sysdeps/powerpc/bits/endianness.h b/sysdeps/powerpc/bits/endianness.h new file mode 100644 index 0000000000..3e7735237e --- /dev/null +++ b/sysdeps/powerpc/bits/endianness.h @@ -0,0 +1,16 @@ +#ifndef _BITS_ENDIANNESS_H +#define _BITS_ENDIANNESS_H 1 + +#ifndef _BITS_ENDIAN_H +# error "Never use directly; include instead." +#endif + +/* PowerPC has selectable endianness. */ +#if defined __BIG_ENDIAN__ || defined _BIG_ENDIAN +# define __BYTE_ORDER __BIG_ENDIAN +#endif +#if defined __LITTLE_ENDIAN__ || defined _LITTLE_ENDIAN +# define __BYTE_ORDER __LITTLE_ENDIAN +#endif + +#endif /* bits/endianness.h */ diff --git a/sysdeps/riscv/bits/endian.h b/sysdeps/riscv/bits/endian.h deleted file mode 100644 index 4aaf559d4f..0000000000 diff --git a/sysdeps/riscv/bits/endianness.h b/sysdeps/riscv/bits/endianness.h new file mode 100644 index 0000000000..952d08595a --- /dev/null +++ b/sysdeps/riscv/bits/endianness.h @@ -0,0 +1,11 @@ +#ifndef _BITS_ENDIANNESS_H +#define _BITS_ENDIANNESS_H 1 + +#ifndef _BITS_ENDIAN_H +# error "Never use directly; include instead." +#endif + +/* RISC-V is little-endian. */ +#define __BYTE_ORDER __LITTLE_ENDIAN + +#endif /* bits/endianness.h */ diff --git a/sysdeps/riscv/nptl/bits/pthreadtypes-arch.h b/sysdeps/riscv/nptl/bits/pthreadtypes-arch.h index e3fecc3208..22dc949158 100644 --- a/sysdeps/riscv/nptl/bits/pthreadtypes-arch.h +++ b/sysdeps/riscv/nptl/bits/pthreadtypes-arch.h @@ -19,7 +19,7 @@ #ifndef _BITS_PTHREADTYPES_ARCH_H #define _BITS_PTHREADTYPES_ARCH_H 1 -#include +#include #if __riscv_xlen == 64 # define __SIZEOF_PTHREAD_ATTR_T 56 diff --git a/sysdeps/s390/bits/endian.h b/sysdeps/s390/bits/endian.h deleted file mode 100644 index ac27f0119a..0000000000 diff --git a/sysdeps/s390/bits/endianness.h b/sysdeps/s390/bits/endianness.h new file mode 100644 index 0000000000..c2d34e1c3e --- /dev/null +++ b/sysdeps/s390/bits/endianness.h @@ -0,0 +1,11 @@ +#ifndef _BITS_ENDIANNESS_H +#define _BITS_ENDIANNESS_H 1 + +#ifndef _BITS_ENDIAN_H +# error "Never use directly; include instead." +#endif + +/* S/390 is big-endian. */ +#define __BYTE_ORDER __BIG_ENDIAN + +#endif /* bits/endianness.h */ diff --git a/sysdeps/sh/bits/endian.h b/sysdeps/sh/bits/endian.h deleted file mode 100644 index 1fef1ff938..0000000000 diff --git a/sysdeps/sh/bits/endianness.h b/sysdeps/sh/bits/endianness.h new file mode 100644 index 0000000000..45c7c83a63 --- /dev/null +++ b/sysdeps/sh/bits/endianness.h @@ -0,0 +1,15 @@ +#ifndef _BITS_ENDIANNESS_H +#define _BITS_ENDIANNESS_H 1 + +#ifndef _BITS_ENDIAN_H +# error "Never use directly; include instead." +#endif + +/* SH has selectable endianness. */ +#ifdef __LITTLE_ENDIAN__ +#define __BYTE_ORDER __LITTLE_ENDIAN +#else +#define __BYTE_ORDER __BIG_ENDIAN +#endif + +#endif /* bits/endianness.h */ diff --git a/sysdeps/sh/nptl/bits/pthreadtypes-arch.h b/sysdeps/sh/nptl/bits/pthreadtypes-arch.h index 64d9d43b3a..3e2d826b56 100644 --- a/sysdeps/sh/nptl/bits/pthreadtypes-arch.h +++ b/sysdeps/sh/nptl/bits/pthreadtypes-arch.h @@ -18,7 +18,7 @@ #ifndef _BITS_PTHREADTYPES_ARCH_H #define _BITS_PTHREADTYPES_ARCH_H 1 -#include +#include #define __SIZEOF_PTHREAD_ATTR_T 36 #define __SIZEOF_PTHREAD_MUTEX_T 24 diff --git a/sysdeps/sparc/bits/endian.h b/sysdeps/sparc/bits/endian.h deleted file mode 100644 index 8acfdf5df6..0000000000 diff --git a/sysdeps/sparc/bits/endianness.h b/sysdeps/sparc/bits/endianness.h new file mode 100644 index 0000000000..0b6f5bf8b2 --- /dev/null +++ b/sysdeps/sparc/bits/endianness.h @@ -0,0 +1,16 @@ +#ifndef _BITS_ENDIANNESS_H +#define _BITS_ENDIANNESS_H 1 + +#ifndef _BITS_ENDIAN_H +# error "Never use directly; include instead." +#endif + +/* Sparc is big-endian, but v9 supports endian conversion on loads/stores + and GCC supports such a mode. Be prepared. */ +#ifdef __LITTLE_ENDIAN__ +# define __BYTE_ORDER __LITTLE_ENDIAN +#else +# define __BYTE_ORDER __BIG_ENDIAN +#endif + +#endif /* bits/endianness.h */ diff --git a/sysdeps/sparc/sparc32/ieee754.h b/sysdeps/sparc/sparc32/ieee754.h index 0f206db928..bda95aca4d 100644 --- a/sysdeps/sparc/sparc32/ieee754.h +++ b/sysdeps/sparc/sparc32/ieee754.h @@ -16,11 +16,11 @@ . */ #ifndef _IEEE754_H - #define _IEEE754_H 1 + #include -#include +#include __BEGIN_DECLS diff --git a/sysdeps/unix/sysv/linux/generic/bits/stat.h b/sysdeps/unix/sysv/linux/generic/bits/stat.h index e5c2650104..2570c8374a 100644 --- a/sysdeps/unix/sysv/linux/generic/bits/stat.h +++ b/sysdeps/unix/sysv/linux/generic/bits/stat.h @@ -23,7 +23,7 @@ #ifndef _BITS_STAT_H #define _BITS_STAT_H 1 -#include +#include #include /* 64-bit libc uses the kernel's 'struct stat', accessed via the diff --git a/sysdeps/unix/sysv/linux/generic/bits/statfs.h b/sysdeps/unix/sysv/linux/generic/bits/statfs.h index 77de4d2fd0..c85187a1de 100644 --- a/sysdeps/unix/sysv/linux/generic/bits/statfs.h +++ b/sysdeps/unix/sysv/linux/generic/bits/statfs.h @@ -20,7 +20,7 @@ # error "Never include directly; use instead." #endif -#include +#include #include #include diff --git a/sysdeps/unix/sysv/linux/hppa/pthread.h b/sysdeps/unix/sysv/linux/hppa/pthread.h index 45e706c037..78dad4faca 100644 --- a/sysdeps/unix/sysv/linux/hppa/pthread.h +++ b/sysdeps/unix/sysv/linux/hppa/pthread.h @@ -19,7 +19,6 @@ #define _PTHREAD_H 1 #include -#include #include #include diff --git a/sysdeps/unix/sysv/linux/ia64/bits/endian.h b/sysdeps/unix/sysv/linux/ia64/bits/endian.h deleted file mode 100644 index 98a5e23991..0000000000 diff --git a/sysdeps/unix/sysv/linux/powerpc/htm.h b/sysdeps/unix/sysv/linux/powerpc/htm.h index 93b6d403b1..f17c979ff0 100644 --- a/sysdeps/unix/sysv/linux/powerpc/htm.h +++ b/sysdeps/unix/sysv/linux/powerpc/htm.h @@ -50,7 +50,7 @@ #else -#include +#include /* Official HTM intrinsics interface matching GCC, but works on older GCC compatible compilers and binutils. diff --git a/sysdeps/unix/sysv/linux/sys/acct.h b/sysdeps/unix/sysv/linux/sys/acct.h index 619824fe4b..4c119dafd2 100644 --- a/sysdeps/unix/sysv/linux/sys/acct.h +++ b/sysdeps/unix/sysv/linux/sys/acct.h @@ -20,7 +20,7 @@ #include #include -#include +#include #include __BEGIN_DECLS diff --git a/sysdeps/x86/bits/endian.h b/sysdeps/x86/bits/endian.h deleted file mode 100644 index 5a56c726f7..0000000000 diff --git a/sysdeps/x86/bits/endianness.h b/sysdeps/x86/bits/endianness.h new file mode 100644 index 0000000000..962a9ae4d6 --- /dev/null +++ b/sysdeps/x86/bits/endianness.h @@ -0,0 +1,11 @@ +#ifndef _BITS_ENDIANNESS_H +#define _BITS_ENDIANNESS_H 1 + +#ifndef _BITS_ENDIAN_H +# error "Never use directly; include instead." +#endif + +/* i386/x86_64 are little-endian. */ +#define __BYTE_ORDER __LITTLE_ENDIAN + +#endif /* bits/endianness.h */ diff --git a/wctype/bits/wctype-wchar.h b/wctype/bits/wctype-wchar.h index 22ae0abdeb..f3851a7830 100644 --- a/wctype/bits/wctype-wchar.h +++ b/wctype/bits/wctype-wchar.h @@ -42,7 +42,7 @@ typedef unsigned long int wctype_t; endian). We define the bit value interpretations here dependent on the machine's byte order. */ -# include +# include # if __BYTE_ORDER == __BIG_ENDIAN # define _ISwbit(bit) (1 << (bit)) # else /* __BYTE_ORDER == __LITTLE_ENDIAN */ From patchwork Wed Jun 26 17:50:18 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Zack Weinberg X-Patchwork-Id: 1122952 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-103176-incoming=patchwork.ozlabs.org@sourceware.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=panix.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.b="BHgRIZIE"; 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 45YrGX0x0Kz9s8m for ; Thu, 27 Jun 2019 03:52:51 +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:in-reply-to :references:mime-version:content-type:content-transfer-encoding; q=dns; s=default; b=HdiCNTrWUwY4CdDc5pblwd7Mu7FVbjUBtZhDa/RmjKZ FtwNG3kUFBZ369fPkbFvMIPFN+kghnX8vFXU1lYjIlxx2FsPzb/SsGhVnGPeHuiM 0UNK+cfXdlNPXXJehotZGKTJ9ABgbwANP8ss3ADwsZppgnryXowGhITFwAq4Fh4Y = 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:in-reply-to :references:mime-version:content-type:content-transfer-encoding; s=default; bh=nHXG5mpqblsu97eaN+9caUO4O48=; b=BHgRIZIEY8OZew9bB w5cXRqhYlv+zpAUvtW/AZ2NYauGjMEknhXXi5yfJ7tewXwyl2xXtYVfzZJUMvmzW qC9efseKnmj8Q4uxBzsWnf697vkqq4pcQCbOAZPSxUudKkIPt+A9hUbmvxClDzfO r7EZKXeaW7LzNKmCL6vPEuqyMU= Received: (qmail 12898 invoked by alias); 26 Jun 2019 17:50:45 -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 12850 invoked by uid 89); 26 Jun 2019 17:50:44 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-16.6 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_SHORT, SPF_PASS autolearn=ham version=3.3.1 spammy=began, msgid X-HELO: mailbackend.panix.com From: Zack Weinberg To: libc-alpha@sourceware.org Cc: joseph@codesourcery.com, carlos@redhat.com Subject: [PATCH 14/25] Add bits/types/ wrappers for stddef.h and stdarg.h types. Date: Wed, 26 Jun 2019 13:50:18 -0400 Message-Id: <20190626175029.4699-5-zackw@panix.com> In-Reply-To: <20190626175029.4699-1-zackw@panix.com> References: <20190626175029.4699-1-zackw@panix.com> MIME-Version: 1.0 We rely on the compiler's stddef.h and stdarg.h to define size_t, ptrdiff_t, wchar_t, NULL, and __gnuc_va_list, and to implement a convention that allows us to request the definition of a specific one: for instance #define __need_size_t #include is expected to define size_t but not any of the other things stddef.h defines. This patch hides that convention behind a set of bits/types/ headers, which allows check-obsolete-constructs.py to verify that none of our headers include these headers unconditionally. (Both of them define at least one item in the user namespace that no other header is supposed to expose.) It will also facilitate coping with compilers that don’t implement the __need convention. (That scenario is not hypothetical, see the next patch.) Only public headers use the new bits headers. Non-public headers and .c files in our codebase, that were formerly defining __need macros, now just include stddef.h and/or stdarg.h without any __need macros. A few files didn’t need to be including stddef.h / stdarg.h at all. Uses of NULL in public headers that aren’t expected to define NULL are changed to a bare 0. bits/NULL.h is only used by headers that are expected to define NULL. malloc.h and printf.h were, in fact, including stddef.h and/or stdarg.h unconditionally; they no longer do that. This broke a few of our test cases, which are fixed by adding appropriate inclusions to the relevant .c files. * stdlib/bits/NULL.h * stdlib/bits/types/__va_list.h * stdlib/bits/types/ptrdiff_t.h * stdlib/bits/types/size_t.h * stdlib/bits/types/va_list.h * stdlib/bits/types/wchar_t.h: New headers defining a single type or macro each. * stdlib/Makefile: Install new headers. * include/bits/NULL.h * include/bits/types/__va_list.h * include/bits/types/ptrdiff_t.h * include/bits/types/size_t.h * include/bits/types/va_list.h * include/bits/types/wchar_t.h: New wrapper headers. * malloc/malloc.h: Don’t include stdio.h or stddef.h. Include bits/NULL.h, bits/types/size_t.h, bits/types/ptrdiff_t.h, and bits/types/FILE.h. * stdio-common/printf.h: Don’t include stddef.h or stdarg.h. Include bits/types/size_t.h, bits/types/wchar_t.h, and bits/types/__va_list.h. Use __gnuc_va_list instead of va_list in prototypes. * libio/bits/types/struct_FILE.h: Include bits/types/size_t.h. * misc/sys/param.h: Include features.h. * sysvipc/sys/msg.h: Include bits/msq.h after all bits/types/ headers. * sysvipc/sys/sem.h: Include bits/sem.h after all bits/types/ headers. * sysvipc/sys/shm.h: Include bits/shm.h after all bits/types/ headers. * hurd/hurd/signal.h: Don’t use NULL. * hurd/hurd/ioctl.h: Don’t include stdarg.h. * hurd/hurd/userlink.h: Don’t include stddef.h. Don’t use NULL. * intl/libintl.h: Don’t include stddef.h. Don’t use NULL. * intl/gettext.c, intl/ngettext.c: Include stddef.h unconditionally. Don’t define any __need macros first. Don’t include stdlib.h. * sysdeps/posix/sigignore.c:, sysdeps/posix/sigset.c: Don’t include errno.h or string.h. * malloc/tst-malloc-thread-fail.c: Include stddef.h. * malloc/tst-malloc_info.c: Include stdio.h. * stdio-common/tst-vfprintf-user-type.c: Include stdarg.h. * string/tst-cmp.c: Include stdio.h. * debug/wcpcpy_chk.c, iconv/loop.c, iconv/skeleton.c * signal/sighold.c, signal/sigrelse.c, stdio-common/tempname.c * sysdeps/generic/ldsodefs.h, sysdeps/nptl/libc-lock.h * sysdeps/nptl/libc-lockP.h, sysdeps/posix/waitid.c * wcsmbs/wcstol_l.c, wcsmbs/wcstoll_l.c, wcsmbs/wcstoul_l.c * wcsmbs/wcstoull_l.c, sysdeps/posix/sigignore.c * sysdeps/posix/sigset.c: Don’t define __need macros before including stddef.h. * bits/socket.h, bits/types/stack_t.h, dirent/dirent.h * dlfcn/dlfcn.h, gmon/sys/profil.h, grp/grp.h, gshadow/gshadow.h * hurd/hurd/signal.h, hurd/hurd/sigpreempt.h, iconv/gconv.h * include/set-hooks.h, include/stdio.h, inet/aliases.h * io/sys/sendfile.h, libio/stdio.h, misc/bits/types/struct_iovec.h * misc/search.h, misc/sys/mman.h, misc/syslog.h, posix/glob.h * posix/sched.h, posix/sys/types.h, posix/unistd.h * posix/wordexp.h, pwd/pwd.h, shadow/shadow.h, signal/signal.h * socket/sys/socket.h, stdlib/alloca.h, stdlib/monetary.h * stdlib/stdlib.h, stdlib/sys/random.h, string/string.h * string/strings.h, sunrpc/rpc/netdb.h * sysdeps/htl/bits/types/struct___pthread_attr.h * sysdeps/mach/hurd/bits/socket.h * sysdeps/unix/sysv/linux/bits/socket.h * sysdeps/unix/sysv/linux/bits/types/stack_t.h * sysdeps/unix/sysv/linux/ia64/bits/sigcontext.h * sysdeps/unix/sysv/linux/mips/bits/types/stack_t.h * sysdeps/unix/sysv/linux/scsi/sg.h * sysdeps/unix/sysv/linux/sys/sysctl.h * sysvipc/sys/msg.h, sysvipc/sys/sem.h, sysvipc/sys/shm.h * time/time.h, wcsmbs/uchar.h, wcsmbs/wchar.h: Use bits/types/size_t.h instead of __need_size_t. * iconv/gconv.h, iconv/iconv.h, libio/libio.h * stdlib/inttypes.h, stdlib/stdlib.h, wcsmbs/wchar.h: Use bits/types/wchar_t.h instead of __need_wchar_t. * libio/stdio.h, locale/locale.h, misc/sys/param.h * posix/sched.h, posix/unistd.h, stdlib/stdlib.h * string/string.h, sysdeps/unix/sysv/linux/bits/sigcontext.h * time/time.h, wcsmbs/wchar.h: Use bits/NULL.h instead of __need_NULL. * libio/stdio.h, misc/err.h: Use bits/types/__va_list.h instead of __need___va_list. * libio/stdio.h: Use bits/types/va_list.h instead of manually defining va_list. * hurd/hurd/userlink.h, misc/sys/mman.h, posix/sched.h * sysdeps/mach/hurd/bits/socket.h * sysdeps/unix/sysv/linux/ia64/bits/sigcontext.h * wcsmbs/wchar.h: Reorganize includes; no semantic effect. * stdlib/stdlib.h: Normalize format of multiple include guard. * sysdeps/unix/sysv/linux/bits/sigcontext.h: Annotate workarounds for kernel header bugs. * sysdeps/unix/sysv/linux/aarch64/sys/user.h * sysdeps/unix/sysv/linux/arm/sys/user.h * sysdeps/unix/sysv/linux/m68k/sys/user.h * sysdeps/unix/sysv/linux/microblaze/sys/user.h * sysdeps/unix/sysv/linux/nios2/sys/user.h * sysdeps/unix/sysv/linux/s390/sys/user.h * sysdeps/unix/sysv/linux/x86/sys/user.h Include features.h. * sysdeps/unix/sysv/linux/alpha/sys/user.h * sysdeps/unix/sysv/linux/ia64/sys/user.h * sysdeps/unix/sysv/linux/mips/sys/user.h * sysdeps/unix/sysv/linux/powerpc/sys/user.h * sysdeps/unix/sysv/linux/sh/sys/user.h * sysdeps/unix/sysv/linux/sparc/sys/user.h Include features.h and bits/types/size_t.h, in that order. Include kernel headers, if any, after those two. Don’t include stddef.h or sys/types.h. * scripts/check-obsolete-constructs.py (UNIVERSAL_ALLOWED_INCLUDES): Remove stddef.h and stdarg.h. (HEADER_ALLOWED_INCLUDES): Update. --- bits/socket.h | 4 +--- bits/types/stack_t.h | 3 +-- debug/wcpcpy_chk.c | 2 -- dirent/dirent.h | 3 +-- dlfcn/dlfcn.h | 4 ++-- grp/grp.h | 7 +----- gshadow/gshadow.h | 4 +--- hurd/hurd/ioctl.h | 2 -- hurd/hurd/signal.h | 15 +++++-------- hurd/hurd/sigpreempt.h | 3 +-- hurd/hurd/userlink.h | 18 ++++++--------- iconv/gconv.h | 6 ++--- iconv/iconv.h | 3 +-- iconv/loop.c | 1 - iconv/skeleton.c | 2 -- include/bits/NULL.h | 1 + include/bits/types/__va_list.h | 1 + include/bits/types/ptrdiff_t.h | 1 + include/bits/types/size_t.h | 1 + include/bits/types/va_list.h | 1 + include/bits/types/wchar_t.h | 1 + include/set-hooks.h | 3 +-- include/stdio.h | 4 +--- intl/gettext.c | 7 +----- intl/libintl.h | 8 ++----- intl/ngettext.c | 7 +----- libio/bits/types/struct_FILE.h | 1 + libio/libio.h | 4 +--- libio/stdio.h | 19 ++++------------ locale/locale.h | 3 +-- malloc/malloc.h | 7 ++++-- malloc/tst-malloc-thread-fail.c | 1 + malloc/tst-malloc_info.c | 1 + misc/bits/types/struct_iovec.h | 3 +-- misc/err.h | 6 +---- misc/search.h | 3 +-- misc/sys/mman.h | 8 +++---- misc/sys/param.h | 4 ++-- misc/syslog.h | 3 +-- posix/glob.h | 3 +-- posix/sched.h | 9 +++----- posix/sys/types.h | 4 +--- posix/unistd.h | 6 ++--- posix/wordexp.h | 3 +-- pwd/pwd.h | 4 +--- scripts/check-obsolete-constructs.py | 17 ++++++-------- shadow/shadow.h | 4 +--- signal/sighold.c | 1 - signal/signal.h | 4 +--- signal/sigrelse.c | 1 - socket/sys/socket.h | 3 +-- stdio-common/printf.h | 11 ++++------ stdio-common/tempname.c | 1 - stdio-common/tst-vfprintf-user-type.c | 1 + stdlib/Makefile | 4 +++- stdlib/alloca.h | 3 +-- stdlib/bits/NULL.h | 8 +++++++ stdlib/bits/types/__va_list.h | 9 ++++++++ stdlib/bits/types/ptrdiff_t.h | 9 ++++++++ stdlib/bits/types/size_t.h | 9 ++++++++ stdlib/bits/types/va_list.h | 15 +++++++++++++ stdlib/bits/types/wchar_t.h | 9 ++++++++ stdlib/inttypes.h | 3 +-- stdlib/monetary.h | 3 +-- stdlib/stdlib.h | 11 ++++------ string/string.h | 6 ++--- string/strings.h | 3 +-- string/tst-cmp.c | 1 + sunrpc/rpc/netdb.h | 3 +-- sysdeps/generic/ldsodefs.h | 2 -- .../htl/bits/types/struct___pthread_attr.h | 4 +--- sysdeps/mach/hurd/bits/socket.h | 5 ++--- sysdeps/nptl/libc-lock.h | 1 - sysdeps/nptl/libc-lockP.h | 1 - sysdeps/posix/sigignore.c | 3 --- sysdeps/posix/sigset.c | 3 --- sysdeps/posix/waitid.c | 1 - sysdeps/unix/sysv/linux/aarch64/sys/user.h | 2 ++ sysdeps/unix/sysv/linux/alpha/sys/user.h | 8 ++++--- sysdeps/unix/sysv/linux/arm/sys/user.h | 2 ++ sysdeps/unix/sysv/linux/bits/sigcontext.h | 11 ++++++---- sysdeps/unix/sysv/linux/bits/socket.h | 3 +-- sysdeps/unix/sysv/linux/bits/types/stack_t.h | 3 +-- .../unix/sysv/linux/ia64/bits/sigcontext.h | 5 ++--- sysdeps/unix/sysv/linux/ia64/sys/user.h | 2 +- sysdeps/unix/sysv/linux/m68k/sys/user.h | 2 ++ sysdeps/unix/sysv/linux/microblaze/sys/user.h | 2 ++ .../unix/sysv/linux/mips/bits/types/stack_t.h | 3 +-- sysdeps/unix/sysv/linux/mips/sys/user.h | 4 +++- sysdeps/unix/sysv/linux/nios2/sys/user.h | 2 ++ sysdeps/unix/sysv/linux/powerpc/sys/user.h | 4 ++-- sysdeps/unix/sysv/linux/s390/sys/user.h | 2 ++ sysdeps/unix/sysv/linux/scsi/sg.h | 4 +--- sysdeps/unix/sysv/linux/sh/sys/user.h | 5 ++++- sysdeps/unix/sysv/linux/sparc/sys/user.h | 3 ++- sysdeps/unix/sysv/linux/sys/sysctl.h | 4 ++-- sysdeps/unix/sysv/linux/x86/sys/user.h | 2 ++ sysvipc/sys/msg.h | 10 ++++----- sysvipc/sys/sem.h | 11 +++++----- sysvipc/sys/shm.h | 10 ++++----- time/time.h | 10 ++++----- wcsmbs/uchar.h | 4 +--- wcsmbs/wchar.h | 22 ++++++++----------- wcsmbs/wcstol_l.c | 1 - wcsmbs/wcstoll_l.c | 1 - wcsmbs/wcstoul_l.c | 1 - wcsmbs/wcstoull_l.c | 1 - 107 files changed, 233 insertions(+), 274 deletions(-) create mode 100644 include/bits/NULL.h create mode 100644 include/bits/types/__va_list.h create mode 100644 include/bits/types/ptrdiff_t.h create mode 100644 include/bits/types/size_t.h create mode 100644 include/bits/types/va_list.h create mode 100644 include/bits/types/wchar_t.h create mode 100644 stdlib/bits/NULL.h create mode 100644 stdlib/bits/types/__va_list.h create mode 100644 stdlib/bits/types/ptrdiff_t.h create mode 100644 stdlib/bits/types/size_t.h create mode 100644 stdlib/bits/types/va_list.h create mode 100644 stdlib/bits/types/wchar_t.h diff --git a/bits/socket.h b/bits/socket.h index 6687a47740..8f5b85fa98 100644 --- a/bits/socket.h +++ b/bits/socket.h @@ -23,11 +23,9 @@ # error "Never include directly; use instead." #endif -#define __need_size_t -#include - #include #include +#include #include /* Types of sockets. */ diff --git a/bits/types/stack_t.h b/bits/types/stack_t.h index c9df26c931..5427cb98a0 100644 --- a/bits/types/stack_t.h +++ b/bits/types/stack_t.h @@ -19,8 +19,7 @@ #ifndef __stack_t_defined #define __stack_t_defined 1 -#define __need_size_t -#include +#include /* Structure describing a signal stack. */ typedef struct diff --git a/debug/wcpcpy_chk.c b/debug/wcpcpy_chk.c index 0dd62560f2..2be0e2c7f4 100644 --- a/debug/wcpcpy_chk.c +++ b/debug/wcpcpy_chk.c @@ -17,8 +17,6 @@ . */ #include - -#define __need_ptrdiff_t #include diff --git a/dirent/dirent.h b/dirent/dirent.h index 9639ae96d4..3602ed8d40 100644 --- a/dirent/dirent.h +++ b/dirent/dirent.h @@ -233,8 +233,7 @@ extern int dirfd (DIR *__dirp) __THROW __nonnull ((1)); # endif # endif -# define __need_size_t -# include +# include /* Scan the directory DIR, calling SELECTOR on each directory entry. Entries for which SELECT returns nonzero are individually malloc'd, diff --git a/dlfcn/dlfcn.h b/dlfcn/dlfcn.h index c550371999..877ec340a2 100644 --- a/dlfcn/dlfcn.h +++ b/dlfcn/dlfcn.h @@ -20,8 +20,8 @@ #define _DLFCN_H 1 #include -#define __need_size_t -#include + +#include /* Collect various system dependent definitions and declarations. */ #include diff --git a/grp/grp.h b/grp/grp.h index d8f7683d1f..95d7414a80 100644 --- a/grp/grp.h +++ b/grp/grp.h @@ -27,9 +27,7 @@ __BEGIN_DECLS #include - -#define __need_size_t -#include +#include /* For the Single Unix specification we must define this type here. */ #if defined __USE_XOPEN || defined __USE_XOPEN2K @@ -167,9 +165,6 @@ extern int fgetgrent_r (FILE *__restrict __stream, #ifdef __USE_MISC -# define __need_size_t -# include - /* Set the group set for the current user to GROUPS (N of them). */ extern int setgroups (size_t __n, const __gid_t *__groups) __THROW; diff --git a/gshadow/gshadow.h b/gshadow/gshadow.h index c1998083e6..695469ff80 100644 --- a/gshadow/gshadow.h +++ b/gshadow/gshadow.h @@ -23,9 +23,7 @@ #include #include #include - -#define __need_size_t -#include +#include /* Path to the user database files. */ #define GSHADOW _PATH_GSHADOW diff --git a/hurd/hurd/ioctl.h b/hurd/hurd/ioctl.h index aea2fec1aa..7b5f211d56 100644 --- a/hurd/hurd/ioctl.h +++ b/hurd/hurd/ioctl.h @@ -19,8 +19,6 @@ #ifndef _HURD_IOCTL_H #define _HURD_IOCTL_H 1 -#define __need___va_list -#include #include #include diff --git a/hurd/hurd/signal.h b/hurd/hurd/signal.h index 308124c90b..73de52dfc3 100644 --- a/hurd/hurd/signal.h +++ b/hurd/hurd/signal.h @@ -21,10 +21,6 @@ #define _HURD_SIGNAL_H 1 #include -#define __need_size_t -#define __need_NULL -#include - #include #include #include @@ -34,6 +30,7 @@ #include #include #include +#include #include #include @@ -138,7 +135,7 @@ extern struct hurd_sigstate *_hurd_self_sigstate (void) _HURD_SIGNAL_H_EXTERN_INLINE struct hurd_sigstate * _hurd_self_sigstate (void) { - if (THREAD_SELF->_hurd_sigstate == NULL) + if (! THREAD_SELF->_hurd_sigstate) THREAD_SELF->_hurd_sigstate = _hurd_thread_sigstate (__mach_thread_self ()); return THREAD_SELF->_hurd_sigstate; } @@ -187,11 +184,11 @@ _hurd_critical_section_lock (void) #ifdef __LIBC_NO_TLS if (__LIBC_NO_TLS ()) /* TLS is currently initializing, no need to enter critical section. */ - return NULL; + return 0; #endif ss = THREAD_SELF->_hurd_sigstate; - if (ss == NULL) + if (! ss) { /* The thread variable is unset; this must be the first time we've asked for it. In this case, the critical section flag cannot @@ -202,7 +199,7 @@ _hurd_critical_section_lock (void) if (! __spin_try_lock (&ss->critical_section_lock)) /* We are already in a critical section, so do nothing. */ - return NULL; + return 0; /* With the critical section lock held no signal handler will run. Return our sigstate pointer; this will be passed to @@ -219,7 +216,7 @@ extern void _hurd_critical_section_unlock (void *our_lock); _HURD_SIGNAL_H_EXTERN_INLINE void _hurd_critical_section_unlock (void *our_lock) { - if (our_lock == NULL) + if (! our_lock) /* The critical section lock was held when we began. Do nothing. */ return; else diff --git a/hurd/hurd/sigpreempt.h b/hurd/hurd/sigpreempt.h index 44eb614e13..aa61ad9b87 100644 --- a/hurd/hurd/sigpreempt.h +++ b/hurd/hurd/sigpreempt.h @@ -19,8 +19,7 @@ #ifndef _HURD_SIGPREEMPT_H #define _HURD_SIGPREEMPT_H 1 -#define __need_size_t -#include +#include #include #include #include /* For sighandler_t, SIG_ERR. */ diff --git a/hurd/hurd/userlink.h b/hurd/hurd/userlink.h index d70438a48f..0fde97e84b 100644 --- a/hurd/hurd/userlink.h +++ b/hurd/hurd/userlink.h @@ -17,20 +17,16 @@ . */ #ifndef _HURD_USERLINK_H - #define _HURD_USERLINK_H 1 -#include -#define __need_NULL -#include +#include +#include #if defined __USE_EXTERN_INLINES && defined _LIBC # if IS_IN (libc) # include # endif #endif -#include - /* This structure records a link in two doubly-linked lists. We call these the per-resource user list and the per-thread @@ -156,11 +152,11 @@ _hurd_userlink_move (struct hurd_userlink *new_link, { *new_link = *link; - if (new_link->resource.next != NULL) + if (new_link->resource.next) new_link->resource.next->resource.prevp = &new_link->resource.next; *new_link->resource.prevp = new_link; - if (new_link->thread.next != NULL) + if (new_link->thread.next) new_link->thread.next->thread.prevp = &new_link->thread.next; *new_link->thread.prevp = new_link; } @@ -180,13 +176,13 @@ extern int _hurd_userlink_clear (struct hurd_userlink **chainp); _HURD_USERLINK_H_EXTERN_INLINE int _hurd_userlink_clear (struct hurd_userlink **chainp) { - if (*chainp == NULL) + if (! *chainp) return 1; /* Detach the chain of current users from the cell. The last user to remove his link from that chain will deallocate the old resource. */ - (*chainp)->resource.prevp = NULL; - *chainp = NULL; + (*chainp)->resource.prevp = 0; + *chainp = 0; return 0; } # endif diff --git a/iconv/gconv.h b/iconv/gconv.h index 7ce79bcbf6..05746e4707 100644 --- a/iconv/gconv.h +++ b/iconv/gconv.h @@ -24,12 +24,10 @@ #include #include +#include +#include #include -#define __need_size_t -#define __need_wchar_t -#include - /* ISO 10646 value used to signal invalid value. */ #define __UNKNOWN_10646_CHAR ((wchar_t) 0xfffd) diff --git a/iconv/iconv.h b/iconv/iconv.h index 9585ec268e..dded7ef45b 100644 --- a/iconv/iconv.h +++ b/iconv/iconv.h @@ -19,8 +19,7 @@ #define _ICONV_H 1 #include -#define __need_size_t -#include +#include __BEGIN_DECLS diff --git a/iconv/loop.c b/iconv/loop.c index fa98c1a521..e9cea355e5 100644 --- a/iconv/loop.c +++ b/iconv/loop.c @@ -54,7 +54,6 @@ #include #include #include /* For MIN. */ -#define __need_size_t #include #include diff --git a/iconv/skeleton.c b/iconv/skeleton.c index 7c12975de3..c5447708ec 100644 --- a/iconv/skeleton.c +++ b/iconv/skeleton.c @@ -140,8 +140,6 @@ #include #include #include -#define __need_size_t -#define __need_NULL #include #ifndef STATIC_GCONV diff --git a/include/bits/NULL.h b/include/bits/NULL.h new file mode 100644 index 0000000000..0584572ed3 --- /dev/null +++ b/include/bits/NULL.h @@ -0,0 +1 @@ +#include diff --git a/include/bits/types/__va_list.h b/include/bits/types/__va_list.h new file mode 100644 index 0000000000..436e6ed823 --- /dev/null +++ b/include/bits/types/__va_list.h @@ -0,0 +1 @@ +#include diff --git a/include/bits/types/ptrdiff_t.h b/include/bits/types/ptrdiff_t.h new file mode 100644 index 0000000000..d16c0d3c2b --- /dev/null +++ b/include/bits/types/ptrdiff_t.h @@ -0,0 +1 @@ +#include diff --git a/include/bits/types/size_t.h b/include/bits/types/size_t.h new file mode 100644 index 0000000000..feaa04363f --- /dev/null +++ b/include/bits/types/size_t.h @@ -0,0 +1 @@ +#include diff --git a/include/bits/types/va_list.h b/include/bits/types/va_list.h new file mode 100644 index 0000000000..dbc749a752 --- /dev/null +++ b/include/bits/types/va_list.h @@ -0,0 +1 @@ +#include diff --git a/include/bits/types/wchar_t.h b/include/bits/types/wchar_t.h new file mode 100644 index 0000000000..343bd5855d --- /dev/null +++ b/include/bits/types/wchar_t.h @@ -0,0 +1 @@ +#include diff --git a/include/set-hooks.h b/include/set-hooks.h index a0c5101e2d..da24c28435 100644 --- a/include/set-hooks.h +++ b/include/set-hooks.h @@ -19,8 +19,7 @@ #ifndef _SET_HOOKS_H #define _SET_HOOKS_H 1 -#define __need_size_t -#include +#include #include #include diff --git a/include/stdio.h b/include/stdio.h index 5302e61024..c72d410013 100644 --- a/include/stdio.h +++ b/include/stdio.h @@ -81,9 +81,7 @@ libc_hidden_proto (__isoc99_vfscanf) extern FILE *__new_tmpfile (void); extern FILE *__old_tmpfile (void); -# define __need_size_t -# include - +# include # include /* Generate a unique file name (and possibly open it). */ diff --git a/intl/gettext.c b/intl/gettext.c index 5217a589fc..a8240cfb71 100644 --- a/intl/gettext.c +++ b/intl/gettext.c @@ -18,12 +18,7 @@ # include #endif -#ifdef _LIBC -# define __need_NULL -# include -#else -# include /* Just for NULL. */ -#endif +#include /* Just for NULL. */ #include "gettextP.h" #ifdef _LIBC diff --git a/intl/libintl.h b/intl/libintl.h index f03eda0b6f..95cbe2bdbe 100644 --- a/intl/libintl.h +++ b/intl/libintl.h @@ -95,10 +95,6 @@ extern char *bind_textdomain_codeset (const char *__domainname, /* Optimized version of the function above. */ #if defined __OPTIMIZE__ && !defined __cplusplus -/* We need NULL for `gettext'. */ -# define __need_NULL -# include - /* We need LC_MESSAGES for `dgettext'. */ # include @@ -106,12 +102,12 @@ extern char *bind_textdomain_codeset (const char *__domainname, `__builtin_constant_p' predicate in dcgettext would always return false. */ -# define gettext(msgid) dgettext (NULL, msgid) +# define gettext(msgid) dgettext (0, msgid) # define dgettext(domainname, msgid) \ dcgettext (domainname, msgid, LC_MESSAGES) -# define ngettext(msgid1, msgid2, n) dngettext (NULL, msgid1, msgid2, n) +# define ngettext(msgid1, msgid2, n) dngettext (0, msgid1, msgid2, n) # define dngettext(domainname, msgid1, msgid2, n) \ dcngettext (domainname, msgid1, msgid2, n, LC_MESSAGES) diff --git a/intl/ngettext.c b/intl/ngettext.c index 98aa2c90b0..ffd99f6604 100644 --- a/intl/ngettext.c +++ b/intl/ngettext.c @@ -18,12 +18,7 @@ # include #endif -#ifdef _LIBC -# define __need_NULL -# include -#else -# include /* Just for NULL. */ -#endif +#include /* Just for NULL. */ #include "gettextP.h" #ifdef _LIBC diff --git a/libio/bits/types/struct_FILE.h b/libio/bits/types/struct_FILE.h index b725459e58..6b7faf8f56 100644 --- a/libio/bits/types/struct_FILE.h +++ b/libio/bits/types/struct_FILE.h @@ -31,6 +31,7 @@ #endif #include +#include struct _IO_FILE; struct _IO_marker; diff --git a/libio/libio.h b/libio/libio.h index b985c386a2..96fa1062f2 100644 --- a/libio/libio.h +++ b/libio/libio.h @@ -41,10 +41,8 @@ # error "Someone forgot to include stdio-lock.h" #endif -#define __need_wchar_t -#include - #include +#include #include #include diff --git a/libio/stdio.h b/libio/stdio.h index 6fabdbedc2..275091e416 100644 --- a/libio/stdio.h +++ b/libio/stdio.h @@ -28,33 +28,22 @@ __BEGIN_DECLS -#define __need_size_t -#define __need_NULL -#include - -#define __need___va_list -#include - #include #include #include #include +#include #include #include +#include +#include #ifdef __USE_GNU # include #endif #if defined __USE_XOPEN || defined __USE_XOPEN2K8 -# ifdef __GNUC__ -# ifndef _VA_LIST_DEFINED -typedef __gnuc_va_list va_list; -# define _VA_LIST_DEFINED -# endif -# else -# include -# endif +# include #endif #if defined __USE_UNIX98 || defined __USE_XOPEN2K diff --git a/locale/locale.h b/locale/locale.h index 7d8a435fe3..61b904f7b4 100644 --- a/locale/locale.h +++ b/locale/locale.h @@ -24,9 +24,8 @@ #include -#define __need_NULL -#include #include +#include __BEGIN_DECLS diff --git a/malloc/malloc.h b/malloc/malloc.h index 523f1b1af5..be5b2f0e5e 100644 --- a/malloc/malloc.h +++ b/malloc/malloc.h @@ -20,8 +20,11 @@ #define _MALLOC_H 1 #include -#include -#include + +#include +#include +#include +#include #ifdef _LIBC # define __MALLOC_HOOK_VOLATILE diff --git a/malloc/tst-malloc-thread-fail.c b/malloc/tst-malloc-thread-fail.c index 2ffe848107..50a9aee68d 100644 --- a/malloc/tst-malloc-thread-fail.c +++ b/malloc/tst-malloc-thread-fail.c @@ -20,6 +20,7 @@ related to allocation failures, notably switching to a different arena, and falling back to mmap (via sysmalloc). */ +#include #include #include #include diff --git a/malloc/tst-malloc_info.c b/malloc/tst-malloc_info.c index d4bbd5c88d..ca886ec7d6 100644 --- a/malloc/tst-malloc_info.c +++ b/malloc/tst-malloc_info.c @@ -22,6 +22,7 @@ #include #include #include +#include #include #include diff --git a/misc/bits/types/struct_iovec.h b/misc/bits/types/struct_iovec.h index 58261ba27f..01a9bc5881 100644 --- a/misc/bits/types/struct_iovec.h +++ b/misc/bits/types/struct_iovec.h @@ -19,8 +19,7 @@ #ifndef __iovec_defined #define __iovec_defined 1 -#define __need_size_t -#include +#include /* Structure for scatter/gather I/O. */ struct iovec diff --git a/misc/err.h b/misc/err.h index 4dfd9a6f5d..2d12cbe68c 100644 --- a/misc/err.h +++ b/misc/err.h @@ -21,11 +21,7 @@ #include -#define __need___va_list -#include -#ifndef __GNUC_VA_LIST -# define __gnuc_va_list void * -#endif +#include __BEGIN_DECLS diff --git a/misc/search.h b/misc/search.h index 4659c59877..771b4626f8 100644 --- a/misc/search.h +++ b/misc/search.h @@ -21,8 +21,7 @@ #include -#define __need_size_t -#include +#include __BEGIN_DECLS diff --git a/misc/sys/mman.h b/misc/sys/mman.h index 43552c3dfa..41e66a4b77 100644 --- a/misc/sys/mman.h +++ b/misc/sys/mman.h @@ -20,13 +20,11 @@ #define _SYS_MMAN_H 1 #include + #include - -#define __need_size_t -#include - -#include #include +#include +#include #include diff --git a/misc/sys/param.h b/misc/sys/param.h index bf988a9769..bb6478f79b 100644 --- a/misc/sys/param.h +++ b/misc/sys/param.h @@ -19,13 +19,13 @@ #ifndef _SYS_PARAM_H #define _SYS_PARAM_H 1 -#define __need_NULL -#include +#include #include #include #include /* Define BYTE_ORDER et al. */ #include /* Define NSIG. */ +#include /* This file defines some things in system-specific ways. */ #include diff --git a/misc/syslog.h b/misc/syslog.h index 406133ba71..f7b7a6743f 100644 --- a/misc/syslog.h +++ b/misc/syslog.h @@ -33,8 +33,7 @@ #define _SYSLOG_H 1 #include -#define __need___va_list -#include +#include /* This file defines _PATH_LOG. */ #include diff --git a/posix/glob.h b/posix/glob.h index e49e6c000d..3b1535e374 100644 --- a/posix/glob.h +++ b/posix/glob.h @@ -29,8 +29,7 @@ __BEGIN_DECLS a different purpose. */ #if defined __USE_XOPEN || defined __USE_XOPEN2K8 -# define __need_size_t -# include +#include typedef size_t __gsize_t; #elif defined __SIZE_TYPE__ typedef __SIZE_TYPE__ __gsize_t; diff --git a/posix/sched.h b/posix/sched.h index 56c1470521..dfcf84da1f 100644 --- a/posix/sched.h +++ b/posix/sched.h @@ -22,18 +22,15 @@ #include /* Get type definitions. */ +#include #include - -#define __need_size_t -#define __need_NULL -#include - +#include +#include #include #include #ifndef __USE_XOPEN2K # include #endif -#include /* Get system specific constant and data structure definitions. */ #include diff --git a/posix/sys/types.h b/posix/sys/types.h index 8f6d328692..08305cf812 100644 --- a/posix/sys/types.h +++ b/posix/sys/types.h @@ -28,9 +28,6 @@ __BEGIN_DECLS #include -#define __need_size_t -#include - #include #include #include @@ -42,6 +39,7 @@ __BEGIN_DECLS #include #include #include +#include #include #include #include diff --git a/posix/unistd.h b/posix/unistd.h index 407f2fee5f..1d4c70f897 100644 --- a/posix/unistd.h +++ b/posix/unistd.h @@ -214,13 +214,11 @@ __BEGIN_DECLS /* All functions that are not declared anywhere else. */ +#include #include +#include #include -#define __need_size_t -#define __need_NULL -#include - #if defined __USE_XOPEN || defined __USE_XOPEN2K /* The Single Unix specification says that some more types are available here. */ diff --git a/posix/wordexp.h b/posix/wordexp.h index 060f13fe49..f69d143693 100644 --- a/posix/wordexp.h +++ b/posix/wordexp.h @@ -19,8 +19,7 @@ #define _WORDEXP_H 1 #include -#define __need_size_t -#include +#include __BEGIN_DECLS diff --git a/pwd/pwd.h b/pwd/pwd.h index ccb3bc0ff8..75a598e0db 100644 --- a/pwd/pwd.h +++ b/pwd/pwd.h @@ -27,9 +27,7 @@ __BEGIN_DECLS #include - -#define __need_size_t -#include +#include #if defined __USE_XOPEN || defined __USE_XOPEN2K /* The Single Unix specification says that some more types are diff --git a/scripts/check-obsolete-constructs.py b/scripts/check-obsolete-constructs.py index 4ef5775932..5cd3867be1 100755 --- a/scripts/check-obsolete-constructs.py +++ b/scripts/check-obsolete-constructs.py @@ -491,14 +491,6 @@ def ObsoleteTypedefChecker(reporter, fname): # but we are not ready to enforce that yet. UNIVERSAL_ALLOWED_INCLUDES = { "features.h", - - # Technically these should only ever be included with __need - # macros active, but some headers deliberately break this rule - # when they think they're dealing with freestanding headers from a - # non-GNU compiler, so enforcing it would be more trouble than - # it's worth. - "stddef.h", - "stdarg.h", } # Specific headers are allowed to include specific other headers. @@ -575,7 +567,7 @@ HEADER_ALLOWED_INCLUDES = { "link.h": [ "dlfcn.h", "elf.h", "sys/types.h" ], "mntent.h": [ "paths.h" ], "nss.h": [ "stdint.h" ], - "obstack.h": [ "string.h" ], + "obstack.h": [ "stddef.h", "string.h" ], "proc_service.h": [ "sys/procfs.h" ], "pty.h": [ "sys/ioctl.h", "termios.h" ], "sgtty.h": [ "sys/ioctl.h" ], @@ -619,7 +611,6 @@ HEADER_ALLOWED_INCLUDES = { "sys/timex.h": [ "sys/time.h" ], "sys/ttychars.h": [ "sys/ttydefaults.h" ], "sys/ucontext.h": [ "sys/procfs.h" ], - "sys/user.h": [ "sys/types.h" ], "sys/vfs.h": [ "sys/statfs.h" ], "sys/xattr.h": [ "sys/types.h" ], @@ -696,6 +687,12 @@ HEADER_ALLOWED_INCLUDES = { "bits/types/res_state.h": [ "netinet/in.h", "sys/types.h" ], "bits/utmp.h": [ "paths.h", "sys/time.h", "sys/types.h" ], "bits/utmpx.h": [ "paths.h", "sys/time.h" ], + + "bits/types/__va_list.h": [ "stdarg.h" ], + "bits/types/ptrdiff_t.h": [ "stddef.h" ], + "bits/types/size_t.h": [ "stddef.h" ], + "bits/types/wchar_t.h": [ "stddef.h" ], + "bits/NULL.h": [ "stddef.h" ], } # As above, but each group of whitelist entries is only used for diff --git a/shadow/shadow.h b/shadow/shadow.h index d8635db0b1..b36b0c323c 100644 --- a/shadow/shadow.h +++ b/shadow/shadow.h @@ -28,10 +28,8 @@ #include -#define __need_size_t -#include - #include +#include /* Paths to the user database files. */ #define SHADOW _PATH_SHADOW diff --git a/signal/sighold.c b/signal/sighold.c index 8154143b36..27add40850 100644 --- a/signal/sighold.c +++ b/signal/sighold.c @@ -17,7 +17,6 @@ License along with the GNU C Library; if not, see . */ -#define __need_NULL #include #include diff --git a/signal/signal.h b/signal/signal.h index ec701012e1..2c52466791 100644 --- a/signal/signal.h +++ b/signal/signal.h @@ -289,9 +289,7 @@ extern int sigreturn (struct sigcontext *__scp) __THROW; #if defined __USE_XOPEN_EXTENDED || defined __USE_XOPEN2K8 -# define __need_size_t -# include - +# include # include # if defined __USE_XOPEN || defined __USE_XOPEN2K8 /* This will define `ucontext_t' and `mcontext_t'. */ diff --git a/signal/sigrelse.c b/signal/sigrelse.c index 433a258dee..8fc657a1cd 100644 --- a/signal/sigrelse.c +++ b/signal/sigrelse.c @@ -17,7 +17,6 @@ License along with the GNU C Library; if not, see . */ -#define __need_NULL #include #include diff --git a/socket/sys/socket.h b/socket/sys/socket.h index 6f242d088b..1bb90ed67c 100644 --- a/socket/sys/socket.h +++ b/socket/sys/socket.h @@ -23,9 +23,8 @@ __BEGIN_DECLS +#include #include -#define __need_size_t -#include /* This operating system-specific header file defines the SOCK_*, PF_*, AF_*, MSG_*, SOL_*, and SO_* constants, and the `struct sockaddr', diff --git a/stdio-common/printf.h b/stdio-common/printf.h index 0172b234f1..69c9691720 100644 --- a/stdio-common/printf.h +++ b/stdio-common/printf.h @@ -23,12 +23,9 @@ __BEGIN_DECLS #include - -#define __need_size_t -#define __need_wchar_t -#include - -#include +#include +#include +#include struct printf_info @@ -89,7 +86,7 @@ typedef int printf_arginfo_function (const struct printf_info *__info, /* Type of a function to get a value of a user-defined from the variable argument list. */ -typedef void printf_va_arg_function (void *__mem, va_list *__ap); +typedef void printf_va_arg_function (void *__mem, __gnuc_va_list *__ap); /* Register FUNC to be called to format SPEC specifiers; ARGINFO must be diff --git a/stdio-common/tempname.c b/stdio-common/tempname.c index 54c97bf149..b00c14f9df 100644 --- a/stdio-common/tempname.c +++ b/stdio-common/tempname.c @@ -15,7 +15,6 @@ License along with the GNU C Library; if not, see . */ -#define __need_size_t #include #include #include diff --git a/stdio-common/tst-vfprintf-user-type.c b/stdio-common/tst-vfprintf-user-type.c index fed17e4131..8f63e65d6e 100644 --- a/stdio-common/tst-vfprintf-user-type.c +++ b/stdio-common/tst-vfprintf-user-type.c @@ -23,6 +23,7 @@ #include #include +#include #include #include #include diff --git a/stdlib/Makefile b/stdlib/Makefile index 32f6050ecc..fbf1b84a4b 100644 --- a/stdlib/Makefile +++ b/stdlib/Makefile @@ -29,7 +29,9 @@ headers := stdlib.h bits/stdlib.h bits/stdlib-ldbl.h bits/stdlib-float.h \ ucontext.h sys/ucontext.h bits/indirect-return.h \ alloca.h fmtmsg.h \ bits/stdlib-bsearch.h sys/random.h bits/stdint-intn.h \ - bits/stdint-uintn.h bits/time64.h \ + bits/stdint-uintn.h bits/time64.h bits/NULL.h \ + bits/types/ptrdiff_t.h bits/types/size_t.h bits/types/wchar_t.h \ + bits/types/__va_list.h bits/types/va_list.h routines := \ atof atoi atol atoll \ diff --git a/stdlib/alloca.h b/stdlib/alloca.h index ff85901357..908f966e53 100644 --- a/stdlib/alloca.h +++ b/stdlib/alloca.h @@ -20,8 +20,7 @@ #include -#define __need_size_t -#include +#include __BEGIN_DECLS diff --git a/stdlib/bits/NULL.h b/stdlib/bits/NULL.h new file mode 100644 index 0000000000..79285bd7b2 --- /dev/null +++ b/stdlib/bits/NULL.h @@ -0,0 +1,8 @@ +#ifndef _BITS_NULL_H +#define _BITS_NULL_H 1 + +/* We rely on the compiler's stddef.h to define NULL for us. */ +#define __need_NULL +#include + +#endif diff --git a/stdlib/bits/types/__va_list.h b/stdlib/bits/types/__va_list.h new file mode 100644 index 0000000000..e3c53c3e05 --- /dev/null +++ b/stdlib/bits/types/__va_list.h @@ -0,0 +1,9 @@ +#ifndef ____va_list_defined +#define ____va_list_defined 1 + +/* We rely on the compiler's stdarg.h to define __gnuc_va_list for us. */ +#define __need___va_list +#include +#undef __need___va_list + +#endif diff --git a/stdlib/bits/types/ptrdiff_t.h b/stdlib/bits/types/ptrdiff_t.h new file mode 100644 index 0000000000..23a8b986d5 --- /dev/null +++ b/stdlib/bits/types/ptrdiff_t.h @@ -0,0 +1,9 @@ +#ifndef __ptrdiff_t_defined +#define __ptrdiff_t_defined 1 + +/* We rely on the compiler's stddef.h to define ptrdiff_t for us. */ +#define __need_ptrdiff_t +#include +#undef __need_ptrdiff_t + +#endif diff --git a/stdlib/bits/types/size_t.h b/stdlib/bits/types/size_t.h new file mode 100644 index 0000000000..e151458eb3 --- /dev/null +++ b/stdlib/bits/types/size_t.h @@ -0,0 +1,9 @@ +#ifndef __size_t_defined +#define __size_t_defined 1 + +/* We rely on the compiler's stddef.h to define size_t for us. */ +#define __need_size_t +#include +#undef __need_size_t + +#endif diff --git a/stdlib/bits/types/va_list.h b/stdlib/bits/types/va_list.h new file mode 100644 index 0000000000..6f3acac379 --- /dev/null +++ b/stdlib/bits/types/va_list.h @@ -0,0 +1,15 @@ +/* This guard macro needs to match the one used by at least gcc and + clang's stdarg.h to indicate that va_list, specifically, has been + defined. */ +#ifndef _VA_LIST + +#include + +/* Check again, __va_list.h may not have been able to avoid including + all of stdarg.h. */ +# ifndef _VA_LIST +typedef __gnuc_va_list va_list; +# endif +# define _VA_LIST + +#endif diff --git a/stdlib/bits/types/wchar_t.h b/stdlib/bits/types/wchar_t.h new file mode 100644 index 0000000000..1e44e157cc --- /dev/null +++ b/stdlib/bits/types/wchar_t.h @@ -0,0 +1,9 @@ +#ifndef __wchar_t_defined +#define __wchar_t_defined 1 + +/* We rely on the compiler's stddef.h to define wchar_t for us. */ +#define __need_wchar_t +#include +#undef __need_wchar_t + +#endif diff --git a/stdlib/inttypes.h b/stdlib/inttypes.h index c5fb12056e..30c9e84cd3 100644 --- a/stdlib/inttypes.h +++ b/stdlib/inttypes.h @@ -32,8 +32,7 @@ #elif defined __WCHAR_TYPE__ typedef __WCHAR_TYPE__ __gwchar_t; #else -# define __need_wchar_t -# include +#include typedef wchar_t __gwchar_t; #endif diff --git a/stdlib/monetary.h b/stdlib/monetary.h index 1f3347a6ec..1150f11486 100644 --- a/stdlib/monetary.h +++ b/stdlib/monetary.h @@ -22,9 +22,8 @@ #include /* Get needed types. */ -#define __need_size_t -#include #include +#include #include __BEGIN_DECLS diff --git a/stdlib/stdlib.h b/stdlib/stdlib.h index 34996e3ee7..1f26f3639e 100644 --- a/stdlib/stdlib.h +++ b/stdlib/stdlib.h @@ -20,20 +20,17 @@ */ #ifndef _STDLIB_H +#define _STDLIB_H 1 #define __GLIBC_INTERNAL_STARTING_HEADER_IMPLEMENTATION #include -/* Get size_t, wchar_t and NULL from . */ -#define __need_size_t -#define __need_wchar_t -#define __need_NULL -#include +#include +#include +#include __BEGIN_DECLS -#define _STDLIB_H 1 - #if (defined __USE_XOPEN || defined __USE_XOPEN2K8) && !defined _SYS_WAIT_H /* XPG requires a few symbols from being defined. */ # include diff --git a/string/string.h b/string/string.h index c38eea971f..2cc4f50090 100644 --- a/string/string.h +++ b/string/string.h @@ -27,10 +27,8 @@ __BEGIN_DECLS -/* Get size_t and NULL from . */ -#define __need_size_t -#define __need_NULL -#include +#include +#include /* Tell the caller that we provide correct C++ prototypes. */ #if defined __cplusplus && __GNUC_PREREQ (4, 4) diff --git a/string/strings.h b/string/strings.h index 5428bc4feb..17e1bf737f 100644 --- a/string/strings.h +++ b/string/strings.h @@ -19,8 +19,7 @@ #define _STRINGS_H 1 #include -#define __need_size_t -#include +#include /* Tell the caller that we provide correct C++ prototypes. */ #if defined __cplusplus && __GNUC_PREREQ (4, 4) diff --git a/string/tst-cmp.c b/string/tst-cmp.c index 939cf28275..ccdd1e3cec 100644 --- a/string/tst-cmp.c +++ b/string/tst-cmp.c @@ -23,6 +23,7 @@ #include #include #include +#include #include #include #include diff --git a/sunrpc/rpc/netdb.h b/sunrpc/rpc/netdb.h index 529a4ada21..a5aa340e1a 100644 --- a/sunrpc/rpc/netdb.h +++ b/sunrpc/rpc/netdb.h @@ -38,8 +38,7 @@ #include -#define __need_size_t -#include +#include __BEGIN_DECLS diff --git a/sysdeps/generic/ldsodefs.h b/sysdeps/generic/ldsodefs.h index b1fc5c31f9..88fc64df63 100644 --- a/sysdeps/generic/ldsodefs.h +++ b/sysdeps/generic/ldsodefs.h @@ -22,8 +22,6 @@ #include #include -#define __need_size_t -#define __need_NULL #include #include #include diff --git a/sysdeps/htl/bits/types/struct___pthread_attr.h b/sysdeps/htl/bits/types/struct___pthread_attr.h index b2c5c63f27..25cf45ecdb 100644 --- a/sysdeps/htl/bits/types/struct___pthread_attr.h +++ b/sysdeps/htl/bits/types/struct___pthread_attr.h @@ -19,11 +19,9 @@ #ifndef _BITS_TYPES_STRUCT___PTHREAD_ATTR #define _BITS_TYPES_STRUCT___PTHREAD_ATTR 1 +#include #include -#define __need_size_t -#include - enum __pthread_detachstate; enum __pthread_inheritsched; enum __pthread_contentionscope; diff --git a/sysdeps/mach/hurd/bits/socket.h b/sysdeps/mach/hurd/bits/socket.h index 429e66c56a..ad590af3f6 100644 --- a/sysdeps/mach/hurd/bits/socket.h +++ b/sysdeps/mach/hurd/bits/socket.h @@ -24,12 +24,11 @@ # error "Never include directly; use instead." #endif -#define __need_size_t -#include -#include #include +#include #include +#include /* Types of sockets. */ enum __socket_type diff --git a/sysdeps/nptl/libc-lock.h b/sysdeps/nptl/libc-lock.h index a1fe9a766b..3840cc7eda 100644 --- a/sysdeps/nptl/libc-lock.h +++ b/sysdeps/nptl/libc-lock.h @@ -20,7 +20,6 @@ #define _LIBC_LOCK_H 1 #include -#define __need_NULL #include diff --git a/sysdeps/nptl/libc-lockP.h b/sysdeps/nptl/libc-lockP.h index 07d583f11a..1e7d95ca60 100644 --- a/sysdeps/nptl/libc-lockP.h +++ b/sysdeps/nptl/libc-lockP.h @@ -20,7 +20,6 @@ #define _LIBC_LOCKP_H 1 #include -#define __need_NULL #include diff --git a/sysdeps/posix/sigignore.c b/sysdeps/posix/sigignore.c index 46748fd0ab..8b1fa3ae16 100644 --- a/sysdeps/posix/sigignore.c +++ b/sysdeps/posix/sigignore.c @@ -17,11 +17,8 @@ License along with the GNU C Library; if not, see . */ -#include -#define __need_NULL #include #include -#include /* For the real memset prototype. */ #include int diff --git a/sysdeps/posix/sigset.c b/sysdeps/posix/sigset.c index dfc0b35b65..4142a500fa 100644 --- a/sysdeps/posix/sigset.c +++ b/sysdeps/posix/sigset.c @@ -15,11 +15,8 @@ License along with the GNU C Library; if not, see . */ -#include -#define __need_NULL #include #include -#include /* For the real memset prototype. */ #include /* Set the disposition for SIG. */ diff --git a/sysdeps/posix/waitid.c b/sysdeps/posix/waitid.c index d49a2f7883..5cd1352ef0 100644 --- a/sysdeps/posix/waitid.c +++ b/sysdeps/posix/waitid.c @@ -20,7 +20,6 @@ #include #include #include -#define __need_NULL #include #include #include diff --git a/sysdeps/unix/sysv/linux/aarch64/sys/user.h b/sysdeps/unix/sysv/linux/aarch64/sys/user.h index 7f6d8bea89..949484a533 100644 --- a/sysdeps/unix/sysv/linux/aarch64/sys/user.h +++ b/sysdeps/unix/sysv/linux/aarch64/sys/user.h @@ -19,6 +19,8 @@ #ifndef _SYS_USER_H #define _SYS_USER_H 1 +#include + struct user_regs_struct { unsigned long long regs[31]; diff --git a/sysdeps/unix/sysv/linux/alpha/sys/user.h b/sysdeps/unix/sysv/linux/alpha/sys/user.h index 38fcb51c9a..52bc3a287c 100644 --- a/sysdeps/unix/sysv/linux/alpha/sys/user.h +++ b/sysdeps/unix/sysv/linux/alpha/sys/user.h @@ -18,13 +18,15 @@ #ifndef _SYS_USER_H #define _SYS_USER_H 1 +#include +#include + +#include + /* The whole purpose of this file is for gdb/strace and gdb/strace only. Don't read too much into it. Don't use it for anything other than gdb/strace unless you know what you are doing. */ -#include -#include - struct user { unsigned long int regs[EF_SIZE / 8 + 32]; /* integer and fp regs */ diff --git a/sysdeps/unix/sysv/linux/arm/sys/user.h b/sysdeps/unix/sysv/linux/arm/sys/user.h index aae8a99e56..55db6ca181 100644 --- a/sysdeps/unix/sysv/linux/arm/sys/user.h +++ b/sysdeps/unix/sysv/linux/arm/sys/user.h @@ -18,6 +18,8 @@ #ifndef _SYS_USER_H #define _SYS_USER_H 1 +#include + /* The whole purpose of this file is for GDB and GDB only. Don't read too much into it. Don't use it for anything other than GDB unless you know what you are doing. */ diff --git a/sysdeps/unix/sysv/linux/bits/sigcontext.h b/sysdeps/unix/sysv/linux/bits/sigcontext.h index bd33c42a49..a420e20792 100644 --- a/sysdeps/unix/sysv/linux/bits/sigcontext.h +++ b/sysdeps/unix/sysv/linux/bits/sigcontext.h @@ -24,14 +24,17 @@ #ifndef sigcontext_struct /* Kernel headers before 2.1.1 define a struct sigcontext_struct, but - we need sigcontext. */ + we need sigcontext. FIXME: Is this workaround still necessary? + 2.1.1 was many years ago. */ # define sigcontext_struct sigcontext # include -/* The Linux kernel headers redefine NULL wrongly, so cleanup afterwards. */ -# define __need_NULL -# include +/* The Linux kernel headers redefine NULL wrongly, so cleanup afterwards. + FIXME: This won't work if bits/NULL.h or stddef.h has already been + included. Is this workaround still necessary? Current (4.19) uapi + headers do not redefine NULL. */ +#include #endif #endif /* bits/sigcontext.h */ diff --git a/sysdeps/unix/sysv/linux/bits/socket.h b/sysdeps/unix/sysv/linux/bits/socket.h index cf3c03a9ec..19e664842f 100644 --- a/sysdeps/unix/sysv/linux/bits/socket.h +++ b/sysdeps/unix/sysv/linux/bits/socket.h @@ -23,10 +23,9 @@ # error "Never include directly; use instead." #endif -#define __need_size_t -#include #include +#include #include /* Get the architecture-dependent definition of enum __socket_type. */ diff --git a/sysdeps/unix/sysv/linux/bits/types/stack_t.h b/sysdeps/unix/sysv/linux/bits/types/stack_t.h index 5af7a91df0..4c1828ea90 100644 --- a/sysdeps/unix/sysv/linux/bits/types/stack_t.h +++ b/sysdeps/unix/sysv/linux/bits/types/stack_t.h @@ -19,8 +19,7 @@ #ifndef __stack_t_defined #define __stack_t_defined 1 -#define __need_size_t -#include +#include /* Structure describing a signal stack. */ typedef struct diff --git a/sysdeps/unix/sysv/linux/ia64/bits/sigcontext.h b/sysdeps/unix/sysv/linux/ia64/bits/sigcontext.h index 8dba935b15..b1b45ee5de 100644 --- a/sysdeps/unix/sysv/linux/ia64/bits/sigcontext.h +++ b/sysdeps/unix/sysv/linux/ia64/bits/sigcontext.h @@ -23,11 +23,10 @@ # error "Never use directly; include instead." #endif -#define __need_size_t -#include -#include +#include #include #include +#include #include struct __ia64_fpreg diff --git a/sysdeps/unix/sysv/linux/ia64/sys/user.h b/sysdeps/unix/sysv/linux/ia64/sys/user.h index f409e237c9..4e4aae5120 100644 --- a/sysdeps/unix/sysv/linux/ia64/sys/user.h +++ b/sysdeps/unix/sysv/linux/ia64/sys/user.h @@ -19,7 +19,7 @@ #define _SYS_USER_H 1 #include -#include +#include /* This definition comes directly from the kernel headers. If anything changes in them this header has to be changed, too. */ diff --git a/sysdeps/unix/sysv/linux/m68k/sys/user.h b/sysdeps/unix/sysv/linux/m68k/sys/user.h index 210d88f901..e8cdf8b35f 100644 --- a/sysdeps/unix/sysv/linux/m68k/sys/user.h +++ b/sysdeps/unix/sysv/linux/m68k/sys/user.h @@ -18,6 +18,8 @@ #ifndef _SYS_USER_H #define _SYS_USER_H 1 +#include + /* The whole purpose of this file is for GDB and GDB only. Don't read too much into it. Don't use it for anything other than GDB unless you know what you are doing. */ diff --git a/sysdeps/unix/sysv/linux/microblaze/sys/user.h b/sysdeps/unix/sysv/linux/microblaze/sys/user.h index adf08ca275..baf6a28247 100644 --- a/sysdeps/unix/sysv/linux/microblaze/sys/user.h +++ b/sysdeps/unix/sysv/linux/microblaze/sys/user.h @@ -19,6 +19,8 @@ #ifndef _SYS_USER_H # define _SYS_USER_H 1 +#include + /* The whole purpose of this file is for GDB and GDB only. Don't read too much into it. Don't use it for anything other than GDB unless you know what you are doing. */ diff --git a/sysdeps/unix/sysv/linux/mips/bits/types/stack_t.h b/sysdeps/unix/sysv/linux/mips/bits/types/stack_t.h index 4424398528..ad9bd9056f 100644 --- a/sysdeps/unix/sysv/linux/mips/bits/types/stack_t.h +++ b/sysdeps/unix/sysv/linux/mips/bits/types/stack_t.h @@ -19,8 +19,7 @@ #ifndef __stack_t_defined #define __stack_t_defined 1 -#define __need_size_t -#include +#include /* Structure describing a signal stack. */ typedef struct diff --git a/sysdeps/unix/sysv/linux/mips/sys/user.h b/sysdeps/unix/sysv/linux/mips/sys/user.h index 29a6c36785..8ed0df7aad 100644 --- a/sysdeps/unix/sysv/linux/mips/sys/user.h +++ b/sysdeps/unix/sysv/linux/mips/sys/user.h @@ -18,8 +18,10 @@ #ifndef _SYS_USER_H #define _SYS_USER_H 1 +#include +#include + #include -#include /* The whole purpose of this file is for GDB and GDB only. Don't read too much into it. Don't use it for anything other than GDB unless diff --git a/sysdeps/unix/sysv/linux/nios2/sys/user.h b/sysdeps/unix/sysv/linux/nios2/sys/user.h index 8670f77b45..4adb789004 100644 --- a/sysdeps/unix/sysv/linux/nios2/sys/user.h +++ b/sysdeps/unix/sysv/linux/nios2/sys/user.h @@ -19,6 +19,8 @@ #ifndef _SYS_USER_H #define _SYS_USER_H 1 +#include + /* The whole purpose of this file is for GDB and GDB only. Don't read too much into it. Don't use it for anything other than GDB unless you know what you are doing. */ diff --git a/sysdeps/unix/sysv/linux/powerpc/sys/user.h b/sysdeps/unix/sysv/linux/powerpc/sys/user.h index c6f36d79b8..2d90235a14 100644 --- a/sysdeps/unix/sysv/linux/powerpc/sys/user.h +++ b/sysdeps/unix/sysv/linux/powerpc/sys/user.h @@ -16,10 +16,10 @@ . */ #ifndef _SYS_USER_H - #define _SYS_USER_H 1 -#include + #include +#include #include diff --git a/sysdeps/unix/sysv/linux/s390/sys/user.h b/sysdeps/unix/sysv/linux/s390/sys/user.h index ab56f513c4..3fc03f3171 100644 --- a/sysdeps/unix/sysv/linux/s390/sys/user.h +++ b/sysdeps/unix/sysv/linux/s390/sys/user.h @@ -18,6 +18,8 @@ #ifndef _SYS_USER_H #define _SYS_USER_H 1 +#include + /* The whole purpose of this file is for GDB and GDB only. Don't read too much into it. Don't use it for anything other than GDB unless you know what you are doing. */ diff --git a/sysdeps/unix/sysv/linux/scsi/sg.h b/sysdeps/unix/sysv/linux/scsi/sg.h index 1f0b5a156a..9a250a9d7e 100644 --- a/sysdeps/unix/sysv/linux/scsi/sg.h +++ b/sysdeps/unix/sysv/linux/scsi/sg.h @@ -26,9 +26,7 @@ #define _SCSI_SG_H 1 #include -#define __need_size_t -#include - +#include /* New interface introduced in the 3.x SG drivers follows */ diff --git a/sysdeps/unix/sysv/linux/sh/sys/user.h b/sysdeps/unix/sysv/linux/sh/sys/user.h index 54d3d701eb..37d0c0eb5e 100644 --- a/sysdeps/unix/sysv/linux/sh/sys/user.h +++ b/sysdeps/unix/sysv/linux/sh/sys/user.h @@ -18,8 +18,11 @@ #ifndef _SYS_USER_H #define _SYS_USER_H 1 +#include +#include + #include -#include + /* asm/ptrace.h polutes the namespace. */ #undef PTRACE_GETREGS diff --git a/sysdeps/unix/sysv/linux/sparc/sys/user.h b/sysdeps/unix/sysv/linux/sparc/sys/user.h index c9c486a7d7..9e3057af93 100644 --- a/sysdeps/unix/sysv/linux/sparc/sys/user.h +++ b/sysdeps/unix/sysv/linux/sparc/sys/user.h @@ -18,7 +18,8 @@ #ifndef _SYS_USER_H #define _SYS_USER_H 1 -#include +#include +#include struct sunos_regs { diff --git a/sysdeps/unix/sysv/linux/sys/sysctl.h b/sysdeps/unix/sysv/linux/sys/sysctl.h index be34555668..6ca4aaa488 100644 --- a/sysdeps/unix/sysv/linux/sys/sysctl.h +++ b/sysdeps/unix/sysv/linux/sys/sysctl.h @@ -21,8 +21,8 @@ #warning "The header is deprecated and will be removed." #include -#define __need_size_t -#include +#include + /* Prevent more kernel headers than necessary to be included. */ #ifndef _LINUX_KERNEL_H # define _LINUX_KERNEL_H 1 diff --git a/sysdeps/unix/sysv/linux/x86/sys/user.h b/sysdeps/unix/sysv/linux/x86/sys/user.h index b462a00e57..9de2572dac 100644 --- a/sysdeps/unix/sysv/linux/x86/sys/user.h +++ b/sysdeps/unix/sysv/linux/x86/sys/user.h @@ -18,6 +18,8 @@ #ifndef _SYS_USER_H #define _SYS_USER_H 1 +#include + /* The whole purpose of this file is for GDB and GDB only. Don't read too much into it. Don't use it for anything other than GDB unless you know what you are doing. */ diff --git a/sysvipc/sys/msg.h b/sysvipc/sys/msg.h index f2f18f4dc5..d6d0610dff 100644 --- a/sysvipc/sys/msg.h +++ b/sysvipc/sys/msg.h @@ -20,20 +20,18 @@ #include -#define __need_size_t -#include - /* Get common definition of System V style IPC. */ #include -/* Get system dependent definition of `struct msqid_ds' and more. */ -#include - /* Define types required by the standard. */ #include #include +#include #include +/* Get system dependent definition of `struct msqid_ds' and more. */ +#include + /* The following System V style IPC functions implement a message queue system. The definition is found in XPG2. */ diff --git a/sysvipc/sys/sem.h b/sysvipc/sys/sem.h index ea9b66e1ee..6b5d43d71c 100644 --- a/sysvipc/sys/sem.h +++ b/sysvipc/sys/sem.h @@ -20,19 +20,18 @@ #include -#define __need_size_t -#include - /* Get common definition of System V style IPC. */ #include -/* Get system dependent definition of `struct semid_ds' and more. */ -#include - +/* Define types required by the standard. */ +#include #ifdef __USE_GNU # include #endif +/* Get system dependent definition of `struct semid_ds' and more. */ +#include + /* The following System V style IPC functions implement a semaphore handling. The definition is found in XPG2. */ diff --git a/sysvipc/sys/shm.h b/sysvipc/sys/shm.h index bf836a75f1..b935f2789e 100644 --- a/sysvipc/sys/shm.h +++ b/sysvipc/sys/shm.h @@ -20,21 +20,19 @@ #include -#define __need_size_t -#include - /* Get common definition of System V style IPC. */ #include -/* Get system dependent definition of `struct shmid_ds' and more. */ -#include - /* Define types required by the standard. */ +#include #include #ifdef __USE_XOPEN # include #endif +/* Get system dependent definition of `struct shmid_ds' and more. */ +#include + __BEGIN_DECLS /* The following System V style IPC functions implement a shared memory diff --git a/time/time.h b/time/time.h index 232531c6f0..45a02589ec 100644 --- a/time/time.h +++ b/time/time.h @@ -24,17 +24,15 @@ #include -#define __need_size_t -#define __need_NULL -#include - /* This defines CLOCKS_PER_SEC, which is the number of processor clock ticks per second, and possibly a number of other constants. */ #include -/* Many of the typedefs and structs whose official home is this header - may also need to be defined by other headers. */ +/* Typedefs and structs required to be defined by this header. + Many are also defined by other headers. */ +#include #include +#include #include #include diff --git a/wcsmbs/uchar.h b/wcsmbs/uchar.h index 315a01540f..690a25d7cf 100644 --- a/wcsmbs/uchar.h +++ b/wcsmbs/uchar.h @@ -25,10 +25,8 @@ #include -#define __need_size_t -#include - #include +#include #include #ifndef __USE_ISOCXX11 diff --git a/wcsmbs/wchar.h b/wcsmbs/wchar.h index 20deca90bf..ceb72b340c 100644 --- a/wcsmbs/wchar.h +++ b/wcsmbs/wchar.h @@ -27,20 +27,16 @@ #include /* Gather machine dependent type support. */ -#include - -#define __need_size_t -#define __need_wchar_t -#define __need_NULL -#include - -#define __need___va_list -#include - -#include -#include -#include #include +#include +#include +#include +#include +#include + +#include +#include +#include #if defined __USE_UNIX98 || defined __USE_XOPEN2K # include diff --git a/wcsmbs/wcstol_l.c b/wcsmbs/wcstol_l.c index 71e9cd4e90..219381d1f7 100644 --- a/wcsmbs/wcstol_l.c +++ b/wcsmbs/wcstol_l.c @@ -17,7 +17,6 @@ License along with the GNU C Library; if not, see . */ -#define __need_wchar_t #include #include diff --git a/wcsmbs/wcstoll_l.c b/wcsmbs/wcstoll_l.c index aba48ffcae..9bea4afc7c 100644 --- a/wcsmbs/wcstoll_l.c +++ b/wcsmbs/wcstoll_l.c @@ -17,7 +17,6 @@ License along with the GNU C Library; if not, see . */ -#define __need_wchar_t #include #include diff --git a/wcsmbs/wcstoul_l.c b/wcsmbs/wcstoul_l.c index 07d2e18a05..1811cbfafe 100644 --- a/wcsmbs/wcstoul_l.c +++ b/wcsmbs/wcstoul_l.c @@ -17,7 +17,6 @@ License along with the GNU C Library; if not, see . */ -#define __need_wchar_t #include #include diff --git a/wcsmbs/wcstoull_l.c b/wcsmbs/wcstoull_l.c index 179771e24c..cd0ef9c955 100644 --- a/wcsmbs/wcstoull_l.c +++ b/wcsmbs/wcstoull_l.c @@ -17,7 +17,6 @@ License along with the GNU C Library; if not, see . */ -#define __need_wchar_t #include #include From patchwork Wed Jun 26 17:50:19 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Zack Weinberg X-Patchwork-Id: 1122953 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-103177-incoming=patchwork.ozlabs.org@sourceware.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=panix.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.b="VN19idEg"; 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 45YrGp3PZsz9s3Z for ; Thu, 27 Jun 2019 03:53:06 +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:in-reply-to :references:mime-version:content-type:content-transfer-encoding; q=dns; s=default; b=SdV/usdounWn4RoUElzd5IPUhUYwS0TsWWJPWocsiWF 3K7G+3Kf8E3LSuVEB/RLPvCJpUggGsiw1pE7IExMN5UTpO54tOfwumeHeXgSLQ9T msPRQp/60h4zQmaENEg9VaKKMLtuIUuPOdo33Ua9wJpO7rTVPIyU9MiMiIDc4awA = 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:in-reply-to :references:mime-version:content-type:content-transfer-encoding; s=default; bh=ekG5tkZjknJ5jjR/X5Kc9Nv07Fw=; b=VN19idEg2DWipLhdW jeA6GC+J2NLhZ3RmENKjuk4oH4Ced4cWNb4clgBj/kXqQcwV766fcBNedpQZisoR VJIrJAtyMwy0McH/E5fbWW+giI5Lcj+Fn/9Dsv4QN/DquXP5jwW7DkUrcvwkdAS3 Y9LXZhlrPo/kNE+8gLJFUnZPHc= Received: (qmail 13210 invoked by alias); 26 Jun 2019 17:50:48 -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 13120 invoked by uid 89); 26 Jun 2019 17:50:47 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-15.6 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_SHORT, LIKELY_SPAM_BODY, SPF_HELO_PASS, SPF_PASS autolearn=ham version=3.3.1 spammy=advertising, circumstances X-HELO: l2mail1.panix.com From: Zack Weinberg To: libc-alpha@sourceware.org Cc: joseph@codesourcery.com, carlos@redhat.com Subject: [PATCH 15/25] =?utf-8?q?Don=E2=80=99t_rely_on_stddef=2Eh_or_stdar?= =?utf-8?q?g=2Eh_for_individual_type_definitions=2E?= Date: Wed, 26 Jun 2019 13:50:19 -0400 Message-Id: <20190626175029.4699-6-zackw@panix.com> In-Reply-To: <20190626175029.4699-1-zackw@panix.com> References: <20190626175029.4699-1-zackw@panix.com> MIME-Version: 1.0 In the course of developing earlier patches in this series I discovered that clang’s stddef.h does not implement the __need_* convention correctly: in C++, under some circumstances __need_NULL will also cause a definition of nullptr_t, and when the “modules” feature is enabled, all of the __need macros are ignored and all of stddef.h is exposed. (I’m not sure how to actually make either of these things happen, I discovered the problem by reading the file.) Worse, clang’s stdarg.h does not implement __need___va_list *at all*; including its stdarg.h will always expose all of its definitions. These are bugs in clang but it seems prudent to work around them, and the simplest way to do so is to have the bits/types/ headers introduced in the previous patch make definitions themselves, when possible. For size_t, ptrdiff_t, and wchar_t, we can use the predefined macros __SIZE_TYPE__, __PTRDIFF_TYPE__, and __WCHAR_TYPE__, when available, falling back to the old approach. For __gnuc_va_list, we have a whitelist of compilers known to provide __builtin_va_list, falling back to the old approach. NULL and va_list are defined ab initio. An additional complication is that we must be able to tell stddef.h and stdarg.h _not_ to define again things we have already defined. It appears to me, based on inspection of clang, GCC, and icc stddef.h and stdarg.h, that we can use the macros _SIZE_T, _PTRDIFF_T, _WCHAR_T, _VA_LIST, and __GNUC_VA_LIST to accomplish this. Since we are no longer relying on stdarg.h to define an implementation-namespace alias for us, I thought it would make sense also to stop calling it __gnuc_va_list. The bulk of this patch is a mechanical substitution of __va_list for __gnuc_va_list throughout our headers. Copyright boilerplate is added to stdlib/bits/NULL.h and stdlib/bits/types/*.h because they now contain enough commentary and code that they could plausibly be copyrightable. * stdlib/bits/NULL.h: Do not use stddef.h to define NULL. Define NULL ab initio if not already defined, as `((void *)0)` for C, and either `__null` or 0 for C++, depending on compiler support. * stdlib/bits/types/__va_list.h: If __builtin_va_list is known to be available, use it to define __va_list without including stdarg.h. Otherwise use __need___va_list to request a definition of __gnuc_va_list and nothing else from stdarg.h, then use that to define __va_list. * stdlib/bits/types/va_list.h: Use __va_list, not __gnuc_va_list, to define va_list. Improve commentary. * stdlib/bits/types/ptrdiff_t.h: If __PTRDIFF_TYPE__ is defined, use it to define ptrdiff_t without including stddef.h. Otherwise use __need_ptrdiff_t to request a definition of ptrdiff_t and nothing else from stddef.h. Use _PTRDIFF_T as guard macro to match behavior of common stddef.h implementations. * stdlib/bits/types/size_t.h: Similarly for size_t, with __SIZE_TYPE__, __need_size_t, and _SIZE_T. * stdlib/bits/types/wchar_t.h: Similarly for wchar_t, with __WCHAR_TYPE__, __need_wchar_t, and _WCHAR_T. If __cplusplus is defined, do nothing; wchar_t is built-in in C++. * conform/data/stdio.h-data, conform/data/wchar.h-data * include/err.h, include/stdio.h, include/syslog.h, include/wchar.h * libio/bits/stdio.h, libio/bits/stdio2.h, libio/iolibio.h * libio/libio.h, libio/stdio.h, libio/vwprintf.c, misc/bits/syslog.h * misc/err.c, misc/err.h, misc/syslog.h, stdio-common/printf.h * sysdeps/ieee754/ldbl-opt/nldbl-compat.c * sysdeps/ieee754/ldbl-opt/nldbl-compat.h * wcsmbs/bits/wchar2.h, wcsmbs/wchar.h: Replace all uses of __gnuc_va_list with __va_list. * scripts/check-obsolete-constructs.py (HEADER_ALLOWED_INCLUDES): bits/NULL.h is no longer allowed to include stddef.h. --- conform/data/stdio.h-data | 2 +- conform/data/wchar.h-data | 12 ++--- include/err.h | 6 +-- include/stdio.h | 30 ++++++------- include/syslog.h | 2 +- include/wchar.h | 14 +++--- libio/bits/stdio.h | 2 +- libio/bits/stdio2.h | 28 ++++++------ libio/iolibio.h | 2 +- libio/libio.h | 4 +- libio/stdio.h | 33 +++++++------- libio/vwprintf.c | 2 +- misc/bits/syslog.h | 4 +- misc/err.c | 12 ++--- misc/err.h | 8 ++-- misc/syslog.h | 2 +- scripts/check-obsolete-constructs.py | 1 - stdio-common/printf.h | 2 +- stdlib/bits/NULL.h | 55 +++++++++++++++++++---- stdlib/bits/types/__va_list.h | 48 +++++++++++++++++--- stdlib/bits/types/ptrdiff_t.h | 54 ++++++++++++++++++---- stdlib/bits/types/size_t.h | 54 ++++++++++++++++++---- stdlib/bits/types/va_list.h | 31 ++++++++++--- stdlib/bits/types/wchar_t.h | 59 +++++++++++++++++++++---- sysdeps/ieee754/ldbl-opt/nldbl-compat.c | 8 ++-- sysdeps/ieee754/ldbl-opt/nldbl-compat.h | 16 +++---- wcsmbs/bits/wchar2.h | 14 +++--- wcsmbs/wchar.h | 24 +++++----- 28 files changed, 367 insertions(+), 162 deletions(-) rewrite stdlib/bits/NULL.h (93%) rewrite stdlib/bits/types/ptrdiff_t.h (92%) rewrite stdlib/bits/types/size_t.h (93%) rewrite stdlib/bits/types/wchar_t.h (93%) diff --git a/conform/data/stdio.h-data b/conform/data/stdio.h-data index 3ef2460661..60ebea4ee4 100644 --- a/conform/data/stdio.h-data +++ b/conform/data/stdio.h-data @@ -41,7 +41,7 @@ type fpos_t #if !defined ISO && !defined ISO99 && !defined ISO11 && !defined POSIX type va_list #else -#define va_list __gnuc_va_list +#define va_list __va_list #endif type size_t #if defined XOPEN2K8 || defined POSIX2008 diff --git a/conform/data/wchar.h-data b/conform/data/wchar.h-data index e414651a33..424c59c819 100644 --- a/conform/data/wchar.h-data +++ b/conform/data/wchar.h-data @@ -59,17 +59,17 @@ function wint_t towlower (wint_t) function wint_t towupper (wint_t) # endif function wint_t ungetwc (wint_t, FILE*) -function int vfwprintf (FILE*, const wchar_t*, __gnuc_va_list) +function int vfwprintf (FILE*, const wchar_t*, __va_list) # ifndef UNIX98 -function int vfwscanf (FILE*, const wchar_t*, __gnuc_va_list) +function int vfwscanf (FILE*, const wchar_t*, __va_list) # endif -function int vwprintf (const wchar_t*, __gnuc_va_list) +function int vwprintf (const wchar_t*, __va_list) # ifndef UNIX98 -function int vwscanf (const wchar_t*, __gnuc_va_list) +function int vwscanf (const wchar_t*, __va_list) # endif -function int vswprintf (wchar_t*, size_t, const wchar_t*, __gnuc_va_list) +function int vswprintf (wchar_t*, size_t, const wchar_t*, __va_list) # ifndef UNIX98 -function int vswscanf (const wchar_t*, const wchar_t*, __gnuc_va_list) +function int vswscanf (const wchar_t*, const wchar_t*, __va_list) # endif # if defined XOPEN2K8 || defined POSIX2008 function {wchar_t*} wcpcpy (wchar_t*, const wchar_t*) diff --git a/include/err.h b/include/err.h index 7c05cd1dbb..573a0f8ef2 100644 --- a/include/err.h +++ b/include/err.h @@ -3,12 +3,10 @@ /* Prototypes for internal err.h functions. */ void -__vwarnx_internal (const char *format, __gnuc_va_list ap, - unsigned int mode_flags); +__vwarnx_internal (const char *format, __va_list ap, unsigned int mode_flags); void -__vwarn_internal (const char *format, __gnuc_va_list ap, - unsigned int mode_flags); +__vwarn_internal (const char *format, __va_list ap, unsigned int mode_flags); # ifndef _ISOMAC diff --git a/include/stdio.h b/include/stdio.h index c72d410013..b25ab6293a 100644 --- a/include/stdio.h +++ b/include/stdio.h @@ -16,40 +16,39 @@ extern int __snprintf (char *__restrict __s, size_t __maxlen, libc_hidden_proto (__snprintf) extern int __vfscanf (FILE *__restrict __s, const char *__restrict __format, - __gnuc_va_list __arg) + __va_list __arg) __attribute__ ((__format__ (__scanf__, 2, 0))); libc_hidden_proto (__vfscanf) -extern int __vscanf (const char *__restrict __format, - __gnuc_va_list __arg) +extern int __vscanf (const char *__restrict __format, __va_list __arg) __attribute__ ((__format__ (__scanf__, 1, 0))); extern __ssize_t __getline (char **__lineptr, size_t *__n, FILE *__stream) attribute_hidden; extern int __vsscanf (const char *__restrict __s, const char *__restrict __format, - __gnuc_va_list __arg) + __va_list __arg) __attribute__ ((__format__ (__scanf__, 2, 0))); extern int __sprintf_chk (char *, int, size_t, const char *, ...) __THROW; extern int __snprintf_chk (char *, size_t, int, size_t, const char *, ...) __THROW; extern int __vsprintf_chk (char *, int, size_t, const char *, - __gnuc_va_list) __THROW; + __va_list) __THROW; extern int __vsnprintf_chk (char *, size_t, int, size_t, const char *, - __gnuc_va_list) __THROW; + __va_list) __THROW; extern int __printf_chk (int, const char *, ...); extern int __fprintf_chk (FILE *, int, const char *, ...); -extern int __vprintf_chk (int, const char *, __gnuc_va_list); -extern int __vfprintf_chk (FILE *, int, const char *, __gnuc_va_list); +extern int __vprintf_chk (int, const char *, __va_list); +extern int __vfprintf_chk (FILE *, int, const char *, __va_list); extern char *__fgets_unlocked_chk (char *buf, size_t size, int n, FILE *fp); extern char *__fgets_chk (char *buf, size_t size, int n, FILE *fp); extern int __asprintf_chk (char **, int, const char *, ...) __THROW; -extern int __vasprintf_chk (char **, int, const char *, __gnuc_va_list) __THROW; +extern int __vasprintf_chk (char **, int, const char *, __va_list) __THROW; extern int __dprintf_chk (int, int, const char *, ...); -extern int __vdprintf_chk (int, int, const char *, __gnuc_va_list); +extern int __vdprintf_chk (int, int, const char *, __va_list); extern int __obstack_printf_chk (struct obstack *, int, const char *, ...) __THROW; extern int __obstack_vprintf_chk (struct obstack *, int, const char *, - __gnuc_va_list) __THROW; + __va_list) __THROW; extern int __isoc99_fscanf (FILE *__restrict __stream, const char *__restrict __format, ...) __wur; @@ -58,12 +57,12 @@ extern int __isoc99_sscanf (const char *__restrict __s, const char *__restrict __format, ...) __THROW; extern int __isoc99_vfscanf (FILE *__restrict __s, const char *__restrict __format, - __gnuc_va_list __arg) __wur; + __va_list __arg) __wur; extern int __isoc99_vscanf (const char *__restrict __format, - __gnuc_va_list __arg) __wur; + __va_list __arg) __wur; extern int __isoc99_vsscanf (const char *__restrict __s, const char *__restrict __format, - __gnuc_va_list __arg) __THROW; + __va_list __arg) __THROW; libc_hidden_proto (__isoc99_sscanf) libc_hidden_proto (__isoc99_vsscanf) libc_hidden_proto (__isoc99_vfscanf) @@ -132,8 +131,7 @@ extern int __fxprintf (FILE *__fp, const char *__fmt, ...) __attribute__ ((__format__ (__printf__, 2, 3))) attribute_hidden; extern int __fxprintf_nocancel (FILE *__fp, const char *__fmt, ...) __attribute__ ((__format__ (__printf__, 2, 3))) attribute_hidden; -int __vfxprintf (FILE *__fp, const char *__fmt, __gnuc_va_list, - unsigned int) +int __vfxprintf (FILE *__fp, const char *__fmt, __va_list, unsigned int) attribute_hidden; /* Read the next line from FP into BUFFER, of LENGTH bytes. LINE will diff --git a/include/syslog.h b/include/syslog.h index 5dc6e76b7e..cd8b6b876b 100644 --- a/include/syslog.h +++ b/include/syslog.h @@ -6,7 +6,7 @@ libc_hidden_proto (syslog) /* __vsyslog_internal uses the same mode_flags bits as __v*printf_internal; see libio/libioP.h. */ -extern void __vsyslog_internal (int pri, const char *fmt, __gnuc_va_list ap, +extern void __vsyslog_internal (int pri, const char *fmt, __va_list ap, unsigned int mode_flags) attribute_hidden __attribute__ ((__format__ (__printf__, 2, 0))); diff --git a/include/wchar.h b/include/wchar.h index 2cb44954fc..823685326e 100644 --- a/include/wchar.h +++ b/include/wchar.h @@ -206,7 +206,7 @@ extern wchar_t *__wmemset_chk (wchar_t *__s, wchar_t __c, size_t __n, extern int __vfwscanf (__FILE *__restrict __s, const wchar_t *__restrict __format, - __gnuc_va_list __arg) + __va_list __arg) attribute_hidden /* __attribute__ ((__format__ (__wscanf__, 2, 0)) */; extern int __fwprintf (__FILE *__restrict __s, @@ -215,12 +215,12 @@ extern int __fwprintf (__FILE *__restrict __s, /* __attribute__ ((__format__ (__wprintf__, 2, 3))) */; extern int __vfwprintf_chk (FILE *__restrict __s, int __flag, const wchar_t *__restrict __format, - __gnuc_va_list __arg) + __va_list __arg) /* __attribute__ ((__format__ (__wprintf__, 3, 0))) */; extern int __vswprintf_chk (wchar_t *__restrict __s, size_t __n, int __flag, size_t __s_len, const wchar_t *__restrict __format, - __gnuc_va_list __arg) + __va_list __arg) /* __attribute__ ((__format__ (__wprintf__, 5, 0))) */; extern int __isoc99_fwscanf (__FILE *__restrict __stream, @@ -231,15 +231,15 @@ extern int __isoc99_swscanf (const wchar_t *__restrict __s, __THROW; extern int __isoc99_vfwscanf (__FILE *__restrict __s, const wchar_t *__restrict __format, - __gnuc_va_list __arg); + __va_list __arg); extern int __isoc99_vwscanf (const wchar_t *__restrict __format, - __gnuc_va_list __arg); + __va_list __arg); extern int __isoc99_vswscanf (const wchar_t *__restrict __s, const wchar_t *__restrict __format, - __gnuc_va_list __arg) __THROW; + __va_list __arg) __THROW; extern int __vswscanf (const wchar_t *__restrict __s, const wchar_t *__restrict __format, - __gnuc_va_list __arg) __THROW; + __va_list __arg) __THROW; libc_hidden_proto (__isoc99_vswscanf) libc_hidden_proto (__vswscanf) libc_hidden_proto (__isoc99_vfwscanf) diff --git a/libio/bits/stdio.h b/libio/bits/stdio.h index 2efa0c5c6b..cdefaf9804 100644 --- a/libio/bits/stdio.h +++ b/libio/bits/stdio.h @@ -36,7 +36,7 @@ # if !(__USE_FORTIFY_LEVEL > 0 && defined __fortify_function) /* Write formatted output to stdout from argument list ARG. */ __STDIO_INLINE int -vprintf (const char *__restrict __fmt, __gnuc_va_list __arg) +vprintf (const char *__restrict __fmt, __va_list __arg) { return vfprintf (stdout, __fmt, __arg); } diff --git a/libio/bits/stdio2.h b/libio/bits/stdio2.h index d1456f9927..6068f67f5c 100644 --- a/libio/bits/stdio2.h +++ b/libio/bits/stdio2.h @@ -27,7 +27,7 @@ extern int __sprintf_chk (char *__restrict __s, int __flag, size_t __slen, const char *__restrict __format, ...) __THROW; extern int __vsprintf_chk (char *__restrict __s, int __flag, size_t __slen, const char *__restrict __format, - __gnuc_va_list __ap) __THROW; + __va_list __ap) __THROW; #ifdef __va_arg_pack __fortify_function int @@ -44,7 +44,7 @@ __NTH (sprintf (char *__restrict __s, const char *__restrict __fmt, ...)) __fortify_function int __NTH (vsprintf (char *__restrict __s, const char *__restrict __fmt, - __gnuc_va_list __ap)) + __va_list __ap)) { return __builtin___vsprintf_chk (__s, __USE_FORTIFY_LEVEL - 1, __bos (__s), __fmt, __ap); @@ -57,7 +57,7 @@ extern int __snprintf_chk (char *__restrict __s, size_t __n, int __flag, ...) __THROW; extern int __vsnprintf_chk (char *__restrict __s, size_t __n, int __flag, size_t __slen, const char *__restrict __format, - __gnuc_va_list __ap) __THROW; + __va_list __ap) __THROW; # ifdef __va_arg_pack __fortify_function int @@ -75,7 +75,7 @@ __NTH (snprintf (char *__restrict __s, size_t __n, __fortify_function int __NTH (vsnprintf (char *__restrict __s, size_t __n, - const char *__restrict __fmt, __gnuc_va_list __ap)) + const char *__restrict __fmt, __va_list __ap)) { return __builtin___vsnprintf_chk (__s, __n, __USE_FORTIFY_LEVEL - 1, __bos (__s), __fmt, __ap); @@ -89,9 +89,9 @@ extern int __fprintf_chk (FILE *__restrict __stream, int __flag, const char *__restrict __format, ...); extern int __printf_chk (int __flag, const char *__restrict __format, ...); extern int __vfprintf_chk (FILE *__restrict __stream, int __flag, - const char *__restrict __format, __gnuc_va_list __ap); + const char *__restrict __format, __va_list __ap); extern int __vprintf_chk (int __flag, const char *__restrict __format, - __gnuc_va_list __ap); + __va_list __ap); # ifdef __va_arg_pack __fortify_function int @@ -114,7 +114,7 @@ printf (const char *__restrict __fmt, ...) # endif __fortify_function int -vprintf (const char *__restrict __fmt, __gnuc_va_list __ap) +vprintf (const char *__restrict __fmt, __va_list __ap) { #ifdef __USE_EXTERN_INLINES return __vfprintf_chk (stdout, __USE_FORTIFY_LEVEL - 1, __fmt, __ap); @@ -125,7 +125,7 @@ vprintf (const char *__restrict __fmt, __gnuc_va_list __ap) __fortify_function int vfprintf (FILE *__restrict __stream, - const char *__restrict __fmt, __gnuc_va_list __ap) + const char *__restrict __fmt, __va_list __ap) { return __vfprintf_chk (__stream, __USE_FORTIFY_LEVEL - 1, __fmt, __ap); } @@ -134,7 +134,7 @@ vfprintf (FILE *__restrict __stream, extern int __dprintf_chk (int __fd, int __flag, const char *__restrict __fmt, ...) __attribute__ ((__format__ (__printf__, 3, 4))); extern int __vdprintf_chk (int __fd, int __flag, - const char *__restrict __fmt, __gnuc_va_list __arg) + const char *__restrict __fmt, __va_list __arg) __attribute__ ((__format__ (__printf__, 3, 0))); # ifdef __va_arg_pack @@ -150,7 +150,7 @@ dprintf (int __fd, const char *__restrict __fmt, ...) # endif __fortify_function int -vdprintf (int __fd, const char *__restrict __fmt, __gnuc_va_list __ap) +vdprintf (int __fd, const char *__restrict __fmt, __va_list __ap) { return __vdprintf_chk (__fd, __USE_FORTIFY_LEVEL - 1, __fmt, __ap); } @@ -162,7 +162,7 @@ extern int __asprintf_chk (char **__restrict __ptr, int __flag, const char *__restrict __fmt, ...) __THROW __attribute__ ((__format__ (__printf__, 3, 4))) __wur; extern int __vasprintf_chk (char **__restrict __ptr, int __flag, - const char *__restrict __fmt, __gnuc_va_list __arg) + const char *__restrict __fmt, __va_list __arg) __THROW __attribute__ ((__format__ (__printf__, 3, 0))) __wur; extern int __obstack_printf_chk (struct obstack *__restrict __obstack, int __flag, const char *__restrict __format, @@ -171,7 +171,7 @@ extern int __obstack_printf_chk (struct obstack *__restrict __obstack, extern int __obstack_vprintf_chk (struct obstack *__restrict __obstack, int __flag, const char *__restrict __format, - __gnuc_va_list __args) + __va_list __args) __THROW __attribute__ ((__format__ (__printf__, 3, 0))); # ifdef __va_arg_pack @@ -208,14 +208,14 @@ __NTH (obstack_printf (struct obstack *__restrict __obstack, __fortify_function int __NTH (vasprintf (char **__restrict __ptr, const char *__restrict __fmt, - __gnuc_va_list __ap)) + __va_list __ap)) { return __vasprintf_chk (__ptr, __USE_FORTIFY_LEVEL - 1, __fmt, __ap); } __fortify_function int __NTH (obstack_vprintf (struct obstack *__restrict __obstack, - const char *__restrict __fmt, __gnuc_va_list __ap)) + const char *__restrict __fmt, __va_list __ap)) { return __obstack_vprintf_chk (__obstack, __USE_FORTIFY_LEVEL - 1, __fmt, __ap); diff --git a/libio/iolibio.h b/libio/iolibio.h index 9561833655..d956c01630 100644 --- a/libio/iolibio.h +++ b/libio/iolibio.h @@ -50,7 +50,7 @@ libc_hidden_proto (_IO_setvbuf) extern int _IO_sscanf (const char*, const char*, ...) __THROW; extern int _IO_sprintf (char *, const char*, ...) __THROW; extern int _IO_ungetc (int, FILE*) __THROW; -extern int _IO_vsscanf (const char *, const char *, __gnuc_va_list) __THROW; +extern int _IO_vsscanf (const char *, const char *, __va_list) __THROW; #define _IO_clearerr(FP) ((FP)->_flags &= ~(_IO_ERR_SEEN|_IO_EOF_SEEN)) #define _IO_fseek(__fp, __offset, __whence) \ diff --git a/libio/libio.h b/libio/libio.h index 96fa1062f2..3903097448 100644 --- a/libio/libio.h +++ b/libio/libio.h @@ -216,7 +216,7 @@ extern int _IO_ftrylockfile (FILE *) __THROW; (((_fp)->_flags2 & _IO_FLAGS2_NEED_LOCK) != 0) extern int _IO_vfscanf (FILE * __restrict, const char * __restrict, - __gnuc_va_list, int *__restrict); + __va_list, int *__restrict); extern __ssize_t _IO_padn (FILE *, int, __ssize_t); extern size_t _IO_sgetn (FILE *, void *, size_t); @@ -257,7 +257,7 @@ weak_extern (_IO_stdin_used); __result; }) extern int _IO_vfwscanf (FILE * __restrict, const wchar_t * __restrict, - __gnuc_va_list, int *__restrict); + __va_list, int *__restrict); extern __ssize_t _IO_wpadn (FILE *, wint_t, __ssize_t); extern void _IO_free_wbackup_area (FILE *) __THROW; diff --git a/libio/stdio.h b/libio/stdio.h index 275091e416..734fa07008 100644 --- a/libio/stdio.h +++ b/libio/stdio.h @@ -317,15 +317,15 @@ extern int sprintf (char *__restrict __s, This function is a possible cancellation point and therefore not marked with __THROW. */ extern int vfprintf (FILE *__restrict __s, const char *__restrict __format, - __gnuc_va_list __arg); + __va_list __arg); /* Write formatted output to stdout from argument list ARG. This function is a possible cancellation point and therefore not marked with __THROW. */ -extern int vprintf (const char *__restrict __format, __gnuc_va_list __arg); +extern int vprintf (const char *__restrict __format, __va_list __arg); /* Write formatted output to S from argument list ARG. */ extern int vsprintf (char *__restrict __s, const char *__restrict __format, - __gnuc_va_list __arg) __THROWNL; + __va_list __arg) __THROWNL; #if defined __USE_ISOC99 || defined __USE_UNIX98 /* Maximum chars of output to write in MAXLEN. */ @@ -334,7 +334,7 @@ extern int snprintf (char *__restrict __s, size_t __maxlen, __THROWNL __attribute__ ((__format__ (__printf__, 3, 4))); extern int vsnprintf (char *__restrict __s, size_t __maxlen, - const char *__restrict __format, __gnuc_va_list __arg) + const char *__restrict __format, __va_list __arg) __THROWNL __attribute__ ((__format__ (__printf__, 3, 0))); #endif @@ -342,7 +342,7 @@ extern int vsnprintf (char *__restrict __s, size_t __maxlen, /* Write formatted output to a string dynamically allocated with `malloc'. Store the address of the string in *PTR. */ extern int vasprintf (char **__restrict __ptr, const char *__restrict __f, - __gnuc_va_list __arg) + __va_list __arg) __THROWNL __attribute__ ((__format__ (__printf__, 2, 0))) __wur; extern int __asprintf (char **__restrict __ptr, const char *__restrict __fmt, ...) @@ -354,8 +354,7 @@ extern int asprintf (char **__restrict __ptr, #ifdef __USE_XOPEN2K8 /* Write formatted output to a file descriptor. */ -extern int vdprintf (int __fd, const char *__restrict __fmt, - __gnuc_va_list __arg) +extern int vdprintf (int __fd, const char *__restrict __fmt, __va_list __arg) __attribute__ ((__format__ (__printf__, 2, 0))); extern int dprintf (int __fd, const char *__restrict __fmt, ...) __attribute__ ((__format__ (__printf__, 2, 3))); @@ -408,19 +407,19 @@ extern int __isoc99_sscanf (const char *__restrict __s, This function is a possible cancellation point and therefore not marked with __THROW. */ extern int vfscanf (FILE *__restrict __s, const char *__restrict __format, - __gnuc_va_list __arg) + __va_list __arg) __attribute__ ((__format__ (__scanf__, 2, 0))) __wur; /* Read formatted input from stdin into argument list ARG. This function is a possible cancellation point and therefore not marked with __THROW. */ -extern int vscanf (const char *__restrict __format, __gnuc_va_list __arg) +extern int vscanf (const char *__restrict __format, __va_list __arg) __attribute__ ((__format__ (__scanf__, 1, 0))) __wur; /* Read formatted input from S into argument list ARG. */ extern int vsscanf (const char *__restrict __s, - const char *__restrict __format, __gnuc_va_list __arg) + const char *__restrict __format, __va_list __arg) __THROW __attribute__ ((__format__ (__scanf__, 2, 0))); /* Same redirection as above for the v*scanf family. */ @@ -428,26 +427,26 @@ extern int vsscanf (const char *__restrict __s, # if defined __REDIRECT && !defined __LDBL_COMPAT extern int __REDIRECT (vfscanf, (FILE *__restrict __s, - const char *__restrict __format, __gnuc_va_list __arg), + const char *__restrict __format, __va_list __arg), __isoc99_vfscanf) __attribute__ ((__format__ (__scanf__, 2, 0))) __wur; extern int __REDIRECT (vscanf, (const char *__restrict __format, - __gnuc_va_list __arg), __isoc99_vscanf) + __va_list __arg), __isoc99_vscanf) __attribute__ ((__format__ (__scanf__, 1, 0))) __wur; extern int __REDIRECT_NTH (vsscanf, (const char *__restrict __s, const char *__restrict __format, - __gnuc_va_list __arg), __isoc99_vsscanf) + __va_list __arg), __isoc99_vsscanf) __attribute__ ((__format__ (__scanf__, 2, 0))); # elif !defined __REDIRECT extern int __isoc99_vfscanf (FILE *__restrict __s, const char *__restrict __format, - __gnuc_va_list __arg) __wur; + __va_list __arg) __wur; extern int __isoc99_vscanf (const char *__restrict __format, - __gnuc_va_list __arg) __wur; + __va_list __arg) __wur; extern int __isoc99_vsscanf (const char *__restrict __s, const char *__restrict __format, - __gnuc_va_list __arg) __THROW; + __va_list __arg) __THROW; # define vfscanf __isoc99_vfscanf # define vscanf __isoc99_vscanf # define vsscanf __isoc99_vsscanf @@ -806,7 +805,7 @@ extern int obstack_printf (struct obstack *__restrict __obstack, __THROWNL __attribute__ ((__format__ (__printf__, 2, 3))); extern int obstack_vprintf (struct obstack *__restrict __obstack, const char *__restrict __format, - __gnuc_va_list __args) + __va_list __args) __THROWNL __attribute__ ((__format__ (__printf__, 2, 0))); #endif /* Use GNU. */ diff --git a/libio/vwprintf.c b/libio/vwprintf.c index 96c597de02..35e5ca6a23 100644 --- a/libio/vwprintf.c +++ b/libio/vwprintf.c @@ -23,7 +23,7 @@ /* Write formatted output to stdout according to the format string FORMAT, using the argument list in ARG. */ int -__vwprintf (const wchar_t *format, __gnuc_va_list arg) +__vwprintf (const wchar_t *format, __va_list arg) { return __vfwprintf_internal (stdout, format, arg, 0); } diff --git a/misc/bits/syslog.h b/misc/bits/syslog.h index e796955c1c..67e50cd4d0 100644 --- a/misc/bits/syslog.h +++ b/misc/bits/syslog.h @@ -41,11 +41,11 @@ syslog (int __pri, const char *__fmt, ...) #ifdef __USE_MISC extern void __vsyslog_chk (int __pri, int __flag, const char *__fmt, - __gnuc_va_list __ap) + __va_list __ap) __attribute__ ((__format__ (__printf__, 3, 0))); __fortify_function void -vsyslog (int __pri, const char *__fmt, __gnuc_va_list __ap) +vsyslog (int __pri, const char *__fmt, __va_list __ap) { __vsyslog_chk (__pri, __USE_FORTIFY_LEVEL - 1, __fmt, __ap); } diff --git a/misc/err.c b/misc/err.c index 988ec8f3ee..b9eabb7285 100644 --- a/misc/err.c +++ b/misc/err.c @@ -38,7 +38,7 @@ extern char *__progname; } void -__vwarnx_internal (const char *format, __gnuc_va_list ap, +__vwarnx_internal (const char *format, __va_list ap, unsigned int mode_flags) { flockfile (stderr); @@ -50,7 +50,7 @@ __vwarnx_internal (const char *format, __gnuc_va_list ap, } void -__vwarn_internal (const char *format, __gnuc_va_list ap, +__vwarn_internal (const char *format, __va_list ap, unsigned int mode_flags) { int error = errno; @@ -72,14 +72,14 @@ __vwarn_internal (const char *format, __gnuc_va_list ap, } void -vwarn (const char *format, __gnuc_va_list ap) +vwarn (const char *format, __va_list ap) { __vwarn_internal (format, ap, 0); } libc_hidden_def (vwarn) void -vwarnx (const char *format, __gnuc_va_list ap) +vwarnx (const char *format, __va_list ap) { __vwarnx_internal (format, ap, 0); } @@ -100,7 +100,7 @@ warnx (const char *format, ...) libc_hidden_def (warnx) void -verr (int status, const char *format, __gnuc_va_list ap) +verr (int status, const char *format, __va_list ap) { vwarn (format, ap); exit (status); @@ -108,7 +108,7 @@ verr (int status, const char *format, __gnuc_va_list ap) libc_hidden_def (verr) void -verrx (int status, const char *format, __gnuc_va_list ap) +verrx (int status, const char *format, __va_list ap) { vwarnx (format, ap); exit (status); diff --git a/misc/err.h b/misc/err.h index 2d12cbe68c..153bc112d9 100644 --- a/misc/err.h +++ b/misc/err.h @@ -29,23 +29,23 @@ __BEGIN_DECLS and a newline, on stderr. */ extern void warn (const char *__format, ...) __attribute__ ((__format__ (__printf__, 1, 2))); -extern void vwarn (const char *__format, __gnuc_va_list) +extern void vwarn (const char *__format, __va_list) __attribute__ ((__format__ (__printf__, 1, 0))); /* Likewise, but without ": " and the standard error string. */ extern void warnx (const char *__format, ...) __attribute__ ((__format__ (__printf__, 1, 2))); -extern void vwarnx (const char *__format, __gnuc_va_list) +extern void vwarnx (const char *__format, __va_list) __attribute__ ((__format__ (__printf__, 1, 0))); /* Likewise, and then exit with STATUS. */ extern void err (int __status, const char *__format, ...) __attribute__ ((__noreturn__, __format__ (__printf__, 2, 3))); -extern void verr (int __status, const char *__format, __gnuc_va_list) +extern void verr (int __status, const char *__format, __va_list) __attribute__ ((__noreturn__, __format__ (__printf__, 2, 0))); extern void errx (int __status, const char *__format, ...) __attribute__ ((__noreturn__, __format__ (__printf__, 2, 3))); -extern void verrx (int __status, const char *, __gnuc_va_list) +extern void verrx (int __status, const char *, __va_list) __attribute__ ((__noreturn__, __format__ (__printf__, 2, 0))); #ifdef __LDBL_COMPAT diff --git a/misc/syslog.h b/misc/syslog.h index f7b7a6743f..f7a980bd74 100644 --- a/misc/syslog.h +++ b/misc/syslog.h @@ -196,7 +196,7 @@ extern void syslog (int __pri, const char *__fmt, ...) cancellation point. But due to similarity with an POSIX interface or due to the implementation it is a cancellation point and therefore not marked with __THROW. */ -extern void vsyslog (int __pri, const char *__fmt, __gnuc_va_list __ap) +extern void vsyslog (int __pri, const char *__fmt, __va_list __ap) __attribute__ ((__format__ (__printf__, 2, 0))); #endif diff --git a/scripts/check-obsolete-constructs.py b/scripts/check-obsolete-constructs.py index 5cd3867be1..e95e587d3e 100755 --- a/scripts/check-obsolete-constructs.py +++ b/scripts/check-obsolete-constructs.py @@ -692,7 +692,6 @@ HEADER_ALLOWED_INCLUDES = { "bits/types/ptrdiff_t.h": [ "stddef.h" ], "bits/types/size_t.h": [ "stddef.h" ], "bits/types/wchar_t.h": [ "stddef.h" ], - "bits/NULL.h": [ "stddef.h" ], } # As above, but each group of whitelist entries is only used for diff --git a/stdio-common/printf.h b/stdio-common/printf.h index 69c9691720..5e0d30dee9 100644 --- a/stdio-common/printf.h +++ b/stdio-common/printf.h @@ -86,7 +86,7 @@ typedef int printf_arginfo_function (const struct printf_info *__info, /* Type of a function to get a value of a user-defined from the variable argument list. */ -typedef void printf_va_arg_function (void *__mem, __gnuc_va_list *__ap); +typedef void printf_va_arg_function (void *__mem, __va_list *__ap); /* Register FUNC to be called to format SPEC specifiers; ARGINFO must be diff --git a/stdlib/bits/NULL.h b/stdlib/bits/NULL.h dissimilarity index 93% index 79285bd7b2..96b75565a1 100644 --- a/stdlib/bits/NULL.h +++ b/stdlib/bits/NULL.h @@ -?,? +1,47 @@ +/* Copyright (C) 2019 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +/* There is no consensus among compilers as to the proper guard macro + for having defined NULL specifically ... except NULL itself. */ +#ifndef NULL + +/* In C, ((void *)0) is the preferred choice for the expansion of + NULL, as it cannot be misinterpreted as an integer zero. */ +#ifndef __cplusplus +# define NULL ((void *)0) + +/* ((void *)0) cannot be used in C++. In C++2011 and later, nullptr + is the preferred alternative, but programs are to be encouraged to + migrate away from both bare 0 and NULL to nullptr, so we do not + define NULL as nullptr. Some compilers support an extension + keyword __null that will trigger diagnostics when used in a context + that expects an integer, but will also be treated as 0 for purposes + of diagnostics encouraging migration to nullptr. + + The complexity of this #if is because clang++ always pretends to be + G++ and may also pretend to be one of several different Windows + compilers. */ +#elif (defined __GNUG__ || defined __clang__) \ + && !defined _MSC_VER && !defined __MINGW32__ +# define NULL __null + +/* Otherwise a bare 0 will have to do. */ +#else +# define NULL 0 +#endif + +#endif diff --git a/stdlib/bits/types/__va_list.h b/stdlib/bits/types/__va_list.h index e3c53c3e05..ac5ab40fd3 100644 --- a/stdlib/bits/types/__va_list.h +++ b/stdlib/bits/types/__va_list.h @@ -1,9 +1,47 @@ +/* Copyright (C) 2019 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + #ifndef ____va_list_defined -#define ____va_list_defined 1 -/* We rely on the compiler's stdarg.h to define __gnuc_va_list for us. */ -#define __need___va_list -#include -#undef __need___va_list +/* If __builtin_va_list is available, use it. There is no predefined + macro advertising the availability of this type. It is known to be + available in GCC 3.0 and later. It is also known to be available + in all released versions of clang. */ +#if defined __clang__ || (defined __GNUC__ && __GNUC__ >= 3) +typedef __builtin_va_list __va_list; + +#else + +/* Depending on the compiler, we may be able to persuade its stdarg.h + to define an implementation-namespace alias for va_list and nothing + else. If this feature is not available, exposing everything + defined by stdarg.h is better than not defining __va_list at all. */ +# define __need___va_list +# include +# undef __need___va_list + +# ifdef __GNUC_VA_LIST +typedef __gnuc_va_list __va_list; +# else +typedef va_list __va_list; +# endif +#endif + +/* This must not be defined until _after_ possibly including stdarg.h. */ +#define ____va_list_defined 1 #endif diff --git a/stdlib/bits/types/ptrdiff_t.h b/stdlib/bits/types/ptrdiff_t.h dissimilarity index 92% index 23a8b986d5..a1cb9d985a 100644 --- a/stdlib/bits/types/ptrdiff_t.h +++ b/stdlib/bits/types/ptrdiff_t.h @@ -?,? +1,45 @@ +/* Copyright (C) 2019 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +/* The guard macro for this header must match the guard macro used by + the compiler's stddef.h for ptrdiff_t specifically. + GCC's stddef.h checks a long list of other macros as well as this + one, in order to accommodate many different C libraries, but clang's + stddef.h only looks for this macro. Other compilers can reasonably + be expected to look for this macro as well. */ +#ifndef _PTRDIFF_T + +#ifdef __PTRDIFF_TYPE__ + +/* If the predefined macro __PTRDIFF_TYPE__ is available, use it. */ +typedef __PTRDIFF_TYPE__ ptrdiff_t; + +#else + +/* Depending on the compiler, we may be able to persuade its stddef.h + to define ptrdiff_t and nothing else. If this feature is not + available, exposing everything defined by stddef.h is better than + not defining ptrdiff_t at all. */ +# define __need_ptrdiff_t +# include +# undef __need_ptrdiff_t + +#endif + +/* This must not be defined until _after_ possibly including stddef.h. */ +#define _PTRDIFF_T +#endif diff --git a/stdlib/bits/types/size_t.h b/stdlib/bits/types/size_t.h dissimilarity index 93% index e151458eb3..827ede397c 100644 --- a/stdlib/bits/types/size_t.h +++ b/stdlib/bits/types/size_t.h @@ -?,? +1,45 @@ +/* Copyright (C) 2019 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +/* The guard macro for this header must match the guard macro used by + the compiler's stddef.h for size_t specifically. + GCC's stddef.h checks a long list of other macros as well as this + one, in order to accommodate many different C libraries, but clang's + stddef.h only looks for this macro. Other compilers can reasonably + be expected to look for this macro as well. */ +#ifndef _SIZE_T + +#ifdef __SIZE_TYPE__ + +/* If the predefined macro __SIZE_TYPE__ is available, use it. */ +typedef __SIZE_TYPE__ size_t; + +#else + +/* Depending on the compiler, we may be able to persuade its stddef.h + to define size_t and nothing else. If this feature is not + available, exposing everything defined by stddef.h is better than + not defining size_t at all. */ +# define __need_size_t +# include +# undef __need_size_t + +#endif + +/* This must not be defined until _after_ possibly including stddef.h. */ +#define _SIZE_T +#endif diff --git a/stdlib/bits/types/va_list.h b/stdlib/bits/types/va_list.h index 6f3acac379..6e1db79280 100644 --- a/stdlib/bits/types/va_list.h +++ b/stdlib/bits/types/va_list.h @@ -1,6 +1,26 @@ -/* This guard macro needs to match the one used by at least gcc and - clang's stdarg.h to indicate that va_list, specifically, has been - defined. */ +/* Copyright (C) 2019 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +/* The guard macro for this header must match the guard macro used by + the compiler's stdarg.h for va_list specifically. + GCC's stdarg.h checks several other macros as well as this one, in + order to accommodate many different C libraries, but clang's + stdarg.h only looks for this macro. Other compilers can reasonably + be expected to look for this macro as well. */ #ifndef _VA_LIST #include @@ -8,8 +28,9 @@ /* Check again, __va_list.h may not have been able to avoid including all of stdarg.h. */ # ifndef _VA_LIST -typedef __gnuc_va_list va_list; +typedef __va_list va_list; # endif -# define _VA_LIST +/* This must not be defined until _after_ possibly including stdarg.h. */ +# define _VA_LIST #endif diff --git a/stdlib/bits/types/wchar_t.h b/stdlib/bits/types/wchar_t.h dissimilarity index 93% index 1e44e157cc..ba0f94f803 100644 --- a/stdlib/bits/types/wchar_t.h +++ b/stdlib/bits/types/wchar_t.h @@ -?,? +1,50 @@ +/* Copyright (C) 2019 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +/* The guard macro for this header must match the guard macro used by + the compiler's stddef.h for wchar_t specifically. + GCC's stddef.h checks a long list of other macros as well as this + one, in order to accommodate many different C libraries, but clang's + stddef.h only looks for this macro. Other compilers can reasonably + be expected to look for this macro as well. */ +#ifndef _WCHAR_T + +#ifdef __cplusplus +/* Do nothing; wchar_t is a built-in type and reserved word in C++. */ +#else + +# ifdef __WCHAR_TYPE__ + +/* If the predefined macro __WCHAR_TYPE__ is available, use it. */ +typedef __WCHAR_TYPE__ wchar_t; + +# else + +/* Depending on the compiler, we may be able to persuade its stddef.h + to define wchar_t and nothing else. If this feature is not + available, exposing everything defined by stddef.h is better than + not defining wchar_t at all. */ +# define __need_wchar_t +# include +# undef __need_wchar_t + +# endif /* not __WCHAR_TYPE__ */ +#endif /* not __cplusplus */ + +/* This must not be defined until _after_ possibly including stddef.h. */ +#define _WCHAR_T +#endif diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-compat.c b/sysdeps/ieee754/ldbl-opt/nldbl-compat.c index 86ac418007..cbe533a685 100644 --- a/sysdeps/ieee754/ldbl-opt/nldbl-compat.c +++ b/sysdeps/ieee754/ldbl-opt/nldbl-compat.c @@ -1036,14 +1036,14 @@ __nldbl_errx (int status, const char *format, ...) } void -__nldbl_verr (int status, const char *format, __gnuc_va_list ap) +__nldbl_verr (int status, const char *format, __va_list ap) { __vwarn_internal (format, ap, PRINTF_LDBL_IS_DBL); exit (status); } void -__nldbl_verrx (int status, const char *format, __gnuc_va_list ap) +__nldbl_verrx (int status, const char *format, __va_list ap) { __vwarnx_internal (format, ap, PRINTF_LDBL_IS_DBL); exit (status); @@ -1062,13 +1062,13 @@ __nldbl_warnx (const char *format, ...) } void -__nldbl_vwarn (const char *format, __gnuc_va_list ap) +__nldbl_vwarn (const char *format, __va_list ap) { __vwarn_internal (format, ap, PRINTF_LDBL_IS_DBL); } void -__nldbl_vwarnx (const char *format, __gnuc_va_list ap) +__nldbl_vwarnx (const char *format, __va_list ap) { __vwarnx_internal (format, ap, PRINTF_LDBL_IS_DBL); } diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-compat.h b/sysdeps/ieee754/ldbl-opt/nldbl-compat.h index aed1cc1497..3413c4287a 100644 --- a/sysdeps/ieee754/ldbl-opt/nldbl-compat.h +++ b/sysdeps/ieee754/ldbl-opt/nldbl-compat.h @@ -103,23 +103,23 @@ extern ssize_t __nldbl___vstrfmon_l (char *, size_t, locale_t, const char *, /* These don't use __typeof because they were not declared by the headers, since we don't compile with _FORTIFY_SOURCE. */ extern int __nldbl___vfprintf_chk (FILE *__restrict, int, - const char *__restrict, __gnuc_va_list); + const char *__restrict, __va_list); extern int __nldbl___vfwprintf_chk (FILE *__restrict, int, - const wchar_t *__restrict, __gnuc_va_list); + const wchar_t *__restrict, __va_list); extern int __nldbl___vsprintf_chk (char *__restrict, int, size_t, - const char *__restrict, __gnuc_va_list) + const char *__restrict, __va_list) __THROW; extern int __nldbl___vsnprintf_chk (char *__restrict, size_t, int, size_t, - const char *__restrict, __gnuc_va_list) + const char *__restrict, __va_list) __THROW; extern int __nldbl___vswprintf_chk (wchar_t *__restrict, size_t, int, size_t, - const wchar_t *__restrict, __gnuc_va_list) + const wchar_t *__restrict, __va_list) __THROW; -extern int __nldbl___vasprintf_chk (char **, int, const char *, __gnuc_va_list) +extern int __nldbl___vasprintf_chk (char **, int, const char *, __va_list) __THROW; -extern int __nldbl___vdprintf_chk (int, int, const char *, __gnuc_va_list); +extern int __nldbl___vdprintf_chk (int, int, const char *, __va_list); extern int __nldbl___obstack_vprintf_chk (struct obstack *, int, const char *, - __gnuc_va_list) __THROW; + __va_list) __THROW; extern void __nldbl___vsyslog_chk (int, int, const char *, va_list); /* The original declarations of these were hidden by the including diff --git a/wcsmbs/bits/wchar2.h b/wcsmbs/bits/wchar2.h index 81603d560b..4b6b614481 100644 --- a/wcsmbs/bits/wchar2.h +++ b/wcsmbs/bits/wchar2.h @@ -303,17 +303,17 @@ __NTH (swprintf (wchar_t *__restrict __s, size_t __n, extern int __vswprintf_chk (wchar_t *__restrict __s, size_t __n, int __flag, size_t __s_len, const wchar_t *__restrict __format, - __gnuc_va_list __arg) + __va_list __arg) __THROW /* __attribute__ ((__format__ (__wprintf__, 5, 0))) */; extern int __REDIRECT_NTH_LDBL (__vswprintf_alias, (wchar_t *__restrict __s, size_t __n, const wchar_t *__restrict __fmt, - __gnuc_va_list __ap), vswprintf); + __va_list __ap), vswprintf); __fortify_function int __NTH (vswprintf (wchar_t *__restrict __s, size_t __n, - const wchar_t *__restrict __fmt, __gnuc_va_list __ap)) + const wchar_t *__restrict __fmt, __va_list __ap)) { if (__bos (__s) != (size_t) -1 || __USE_FORTIFY_LEVEL > 1) return __vswprintf_chk (__s, __n, __USE_FORTIFY_LEVEL - 1, @@ -330,9 +330,9 @@ extern int __wprintf_chk (int __flag, const wchar_t *__restrict __format, ...); extern int __vfwprintf_chk (__FILE *__restrict __stream, int __flag, const wchar_t *__restrict __format, - __gnuc_va_list __ap); + __va_list __ap); extern int __vwprintf_chk (int __flag, const wchar_t *__restrict __format, - __gnuc_va_list __ap); + __va_list __ap); # ifdef __va_arg_pack __fortify_function int @@ -355,14 +355,14 @@ fwprintf (__FILE *__restrict __stream, const wchar_t *__restrict __fmt, ...) # endif __fortify_function int -vwprintf (const wchar_t *__restrict __fmt, __gnuc_va_list __ap) +vwprintf (const wchar_t *__restrict __fmt, __va_list __ap) { return __vwprintf_chk (__USE_FORTIFY_LEVEL - 1, __fmt, __ap); } __fortify_function int vfwprintf (__FILE *__restrict __stream, - const wchar_t *__restrict __fmt, __gnuc_va_list __ap) + const wchar_t *__restrict __fmt, __va_list __ap) { return __vfwprintf_chk (__stream, __USE_FORTIFY_LEVEL - 1, __fmt, __ap); } diff --git a/wcsmbs/wchar.h b/wcsmbs/wchar.h index ceb72b340c..75d0dde675 100644 --- a/wcsmbs/wchar.h +++ b/wcsmbs/wchar.h @@ -593,20 +593,20 @@ extern int swprintf (wchar_t *__restrict __s, size_t __n, marked with __THROW. */ extern int vfwprintf (__FILE *__restrict __s, const wchar_t *__restrict __format, - __gnuc_va_list __arg) + __va_list __arg) /* __attribute__ ((__format__ (__wprintf__, 2, 0))) */; /* Write formatted output to stdout from argument list ARG. This function is a possible cancellation point and therefore not marked with __THROW. */ extern int vwprintf (const wchar_t *__restrict __format, - __gnuc_va_list __arg) + __va_list __arg) /* __attribute__ ((__format__ (__wprintf__, 1, 0))) */; /* Write formatted output of at most N character to S from argument list ARG. */ extern int vswprintf (wchar_t *__restrict __s, size_t __n, const wchar_t *__restrict __format, - __gnuc_va_list __arg) + __va_list __arg) __THROW /* __attribute__ ((__format__ (__wprintf__, 3, 0))) */; @@ -666,19 +666,19 @@ extern int __isoc99_swscanf (const wchar_t *__restrict __s, marked with __THROW. */ extern int vfwscanf (__FILE *__restrict __s, const wchar_t *__restrict __format, - __gnuc_va_list __arg) + __va_list __arg) /* __attribute__ ((__format__ (__wscanf__, 2, 0))) */; /* Read formatted input from stdin into argument list ARG. This function is a possible cancellation point and therefore not marked with __THROW. */ extern int vwscanf (const wchar_t *__restrict __format, - __gnuc_va_list __arg) + __va_list __arg) /* __attribute__ ((__format__ (__wscanf__, 1, 0))) */; /* Read formatted input from S into argument list ARG. */ extern int vswscanf (const wchar_t *__restrict __s, const wchar_t *__restrict __format, - __gnuc_va_list __arg) + __va_list __arg) __THROW /* __attribute__ ((__format__ (__wscanf__, 2, 0))) */; # if !defined __USE_GNU \ @@ -687,24 +687,24 @@ extern int vswscanf (const wchar_t *__restrict __s, # ifdef __REDIRECT extern int __REDIRECT (vfwscanf, (__FILE *__restrict __s, const wchar_t *__restrict __format, - __gnuc_va_list __arg), __isoc99_vfwscanf) + __va_list __arg), __isoc99_vfwscanf) /* __attribute__ ((__format__ (__wscanf__, 2, 0))) */; extern int __REDIRECT (vwscanf, (const wchar_t *__restrict __format, - __gnuc_va_list __arg), __isoc99_vwscanf) + __va_list __arg), __isoc99_vwscanf) /* __attribute__ ((__format__ (__wscanf__, 1, 0))) */; extern int __REDIRECT_NTH (vswscanf, (const wchar_t *__restrict __s, const wchar_t *__restrict __format, - __gnuc_va_list __arg), __isoc99_vswscanf) + __va_list __arg), __isoc99_vswscanf) /* __attribute__ ((__format__ (__wscanf__, 2, 0))) */; # else extern int __isoc99_vfwscanf (__FILE *__restrict __s, const wchar_t *__restrict __format, - __gnuc_va_list __arg); + __va_list __arg); extern int __isoc99_vwscanf (const wchar_t *__restrict __format, - __gnuc_va_list __arg); + __va_list __arg); extern int __isoc99_vswscanf (const wchar_t *__restrict __s, const wchar_t *__restrict __format, - __gnuc_va_list __arg) __THROW; + __va_list __arg) __THROW; # define vfwscanf __isoc99_vfwscanf # define vwscanf __isoc99_vwscanf # define vswscanf __isoc99_vswscanf From patchwork Wed Jun 26 17:50:20 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Zack Weinberg X-Patchwork-Id: 1122950 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-103174-incoming=patchwork.ozlabs.org@sourceware.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=panix.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.b="sSErs2hW"; 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 45YrG019BRz9s4V for ; Thu, 27 Jun 2019 03:52:23 +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:in-reply-to :references:mime-version:content-type:content-transfer-encoding; q=dns; s=default; b=pRuVOp6IemPy2AFGs4j+cDzF8uvMWbE+7bAsl7GX8zN 7MyY5cxq8i0UJRm8WrJt4dlRe4Hzr5dWdXnaHARjODyOv4Tw/acQoZ+ZfPVlc2lw UdScT/zbBk2SijZiDaDS3I/b6CdFUx01ma52EINfQR/1sF9WJBDqXAVBK8yPRGeg = 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:in-reply-to :references:mime-version:content-type:content-transfer-encoding; s=default; bh=jbxD5Ed1F3GAzEnMRYp/sR65JfQ=; b=sSErs2hWaxBe2pJnc l8V03cAaYRVpP98sPREBoKbG0NSe65eZITJe0eUVq53gAFCMRgyuYRK4el5flaBE o+K0sF5P2mhLTiHnLMm3sUm+pF8LthJViSpCkd/d5byF6VxFFk7QyzPgqvOk7ODj tL1jIT7O5XLO3WKd/tNG9hSfeU= Received: (qmail 12479 invoked by alias); 26 Jun 2019 17:50:41 -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 12352 invoked by uid 89); 26 Jun 2019 17:50:40 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-15.8 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_SHORT, KAM_STOCKGEN, SPF_HELO_PASS, SPF_PASS autolearn=ham version=3.3.1 spammy= X-HELO: l2mail1.panix.com From: Zack Weinberg To: libc-alpha@sourceware.org Cc: joseph@codesourcery.com, carlos@redhat.com Subject: [PATCH 16/25] Limit the set of strings.h functions also exposed in string.h. Date: Wed, 26 Jun 2019 13:50:20 -0400 Message-Id: <20190626175029.4699-7-zackw@panix.com> In-Reply-To: <20190626175029.4699-1-zackw@panix.com> References: <20190626175029.4699-1-zackw@panix.com> MIME-Version: 1.0 As someone who can remember when you might not be able to include both string.h and strings.h at the same time, it annoys me that strings.h still exists and is the only standard source for str(n)casecmp(_l) and ffs. I think it’s right that we expose those functions from string.h. However, there’s no reason we need to keep exposing the other obsolete functions that strings.h declares from string.h. This patch creates , which declares the non-obsolete functions whose official home is strings.h. strings.h includes it unconditionally, and string.h includes it under __USE_MISC, instead of strings.h. Two tests of the obsolete strings.h functions had to be adjusted. * string/strings.h (strcasecmp, strncasecmp, strcasecmp_l) (strncasecmp_l, ffs, ffsl, ffsll): Move declarations to... * string/bits/strings_x2k8.h: ... this new file. * string/Makefile: Install bits/strings_x2k8.h. * include/bits/strings_x2k8h: New wrapper. * string/string.h: Include bits/strings_x2k8.h instead of strings.h. * debug/tst-chk1.c, string/test-string.h: Include strings.h. * scripts/check-obsolete-constructs.py: string.h is no longer expected to include strings.h. * sysdeps/i386/i686/multiarch/bcopy.c * sysdeps/i386/i686/multiarch/bzero.c * sysdeps/i386/i686/multiarch/ifunc-impl-list.c * sysdeps/powerpc/powerpc32/power4/multiarch/ifunc-impl-list.c * sysdeps/powerpc/powerpc64/multiarch/bcopy-ppc64.c * sysdeps/powerpc/powerpc64/multiarch/bcopy.c * sysdeps/powerpc/powerpc64/multiarch/ifunc-impl-list.c * sysdeps/s390/bzero.c * sysdeps/s390/multiarch/ifunc-impl-list.c * sysdeps/sparc/sparc64/multiarch/bzero.c * sysdeps/sparc/sparc64/multiarch/ifunc-impl-list.c: Include strings.h. --- NEWS | 3 + debug/tst-chk1.c | 1 + include/bits/strings_x2k8.h | 1 + scripts/check-obsolete-constructs.py | 1 - string/Makefile | 2 +- string/bits/strings_x2k8.h | 70 +++++++++++++++++++ string/string.h | 2 +- string/strings.h | 39 +---------- string/test-string.h | 1 + sysdeps/i386/i686/multiarch/bcopy.c | 1 + sysdeps/i386/i686/multiarch/bzero.c | 1 + sysdeps/i386/i686/multiarch/ifunc-impl-list.c | 1 + .../power4/multiarch/ifunc-impl-list.c | 1 + .../powerpc/powerpc64/multiarch/bcopy-ppc64.c | 1 + sysdeps/powerpc/powerpc64/multiarch/bcopy.c | 1 + .../powerpc64/multiarch/ifunc-impl-list.c | 1 + sysdeps/s390/bzero.c | 1 + sysdeps/s390/multiarch/ifunc-impl-list.c | 1 + sysdeps/sparc/sparc64/multiarch/bzero.c | 1 + .../sparc/sparc64/multiarch/ifunc-impl-list.c | 1 + 20 files changed, 91 insertions(+), 40 deletions(-) create mode 100644 include/bits/strings_x2k8.h create mode 100644 string/bits/strings_x2k8.h diff --git a/NEWS b/NEWS index edf7739293..974ed39e4d 100644 --- a/NEWS +++ b/NEWS @@ -45,6 +45,9 @@ Deprecated and removed features, and other changes affecting compatibility: * The obsolete and never-implemented XSI STREAMS header files and have been removed. +* The obsolete functions bcmp, bcopy, bzero, index, and rindex are no + longer declared in , only . + * The typedefs u_int8_t, u_int16_t, u_int32_t, u_int64_t, and register_t are no longer defined by in strict conformance modes. These types were historically provided by on BSD systems, diff --git a/debug/tst-chk1.c b/debug/tst-chk1.c index c6f11af1ff..014b08fab7 100644 --- a/debug/tst-chk1.c +++ b/debug/tst-chk1.c @@ -30,6 +30,7 @@ #include #include #include +#include #include #include #include diff --git a/include/bits/strings_x2k8.h b/include/bits/strings_x2k8.h new file mode 100644 index 0000000000..7eddd92d93 --- /dev/null +++ b/include/bits/strings_x2k8.h @@ -0,0 +1 @@ +#include diff --git a/scripts/check-obsolete-constructs.py b/scripts/check-obsolete-constructs.py index e95e587d3e..bd5a97f76b 100755 --- a/scripts/check-obsolete-constructs.py +++ b/scripts/check-obsolete-constructs.py @@ -506,7 +506,6 @@ HEADER_ALLOWED_INCLUDES = { "inttypes.h": [ "stdint.h" ], "signal.h": [ "sys/ucontext.h" ], "stdlib.h": [ "alloca.h", "sys/types.h" ], - "string.h": [ "strings.h" ], "tgmath.h": [ "complex.h", "math.h" ], "threads.h": [ "time.h" ], diff --git a/string/Makefile b/string/Makefile index 3e5721e0f4..c9ebede768 100644 --- a/string/Makefile +++ b/string/Makefile @@ -23,7 +23,7 @@ subdir := string include ../Makeconfig headers := string.h bits/string_fortified.h \ - strings.h bits/strings_fortified.h \ + strings.h bits/strings_x2k8.h bits/strings_fortified.h \ byteswap.h bits/byteswap.h \ endian.h bits/endian.h bits/endianness.h \ bits/uintn-identity.h \ diff --git a/string/bits/strings_x2k8.h b/string/bits/strings_x2k8.h new file mode 100644 index 0000000000..dbcb0b2c31 --- /dev/null +++ b/string/bits/strings_x2k8.h @@ -0,0 +1,70 @@ +/* Copyright (C) 2019 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#ifndef _BITS_STRINGS_X2K8_H +#define _BITS_STRINGS_X2K8_H 1 + +/* This header file declares all of the strings.h functions that are + not marked as "obsolete" in POSIX.1-2008. As a GNU extension, + these functions are also made available via string.h. */ + +#if !defined _STRING_H && !defined _STRINGS_H +# error "Never include directly, use ." +#endif + +__BEGIN_DECLS + +/* Compare S1 and S2, ignoring case. */ +extern int strcasecmp (const char *__s1, const char *__s2) + __THROW __attribute_pure__ __nonnull ((1, 2)); + +/* Compare no more than N chars of S1 and S2, ignoring case. */ +extern int strncasecmp (const char *__s1, const char *__s2, size_t __n) + __THROW __attribute_pure__ __nonnull ((1, 2)); + +#ifdef __USE_XOPEN2K8 +/* POSIX.1-2008 extended locale interface (see locale.h). */ +# include + +/* Compare S1 and S2, ignoring case, using collation rules from LOC. */ +extern int strcasecmp_l (const char *__s1, const char *__s2, locale_t __loc) + __THROW __attribute_pure__ __nonnull ((1, 2, 3)); + +/* Compare no more than N chars of S1 and S2, ignoring case, using + collation rules from LOC. */ +extern int strncasecmp_l (const char *__s1, const char *__s2, + size_t __n, locale_t __loc) + __THROW __attribute_pure__ __nonnull ((1, 2, 4)); +#endif + +#if defined __USE_MISC || !defined __USE_XOPEN2K8 || defined __USE_XOPEN2K8XSI +/* Return the position of the first bit set in I, or 0 if none are set. + The least-significant bit is position 1, the most-significant 32. */ +extern int ffs (int __i) __THROW __attribute_const__; +#endif + +/* The following two functions are non-standard but necessary for non-32 bit + platforms. */ +#ifdef __USE_MISC +extern int ffsl (long int __l) __THROW __attribute_const__; +__extension__ extern int ffsll (long long int __ll) + __THROW __attribute_const__; +#endif + +__END_DECLS + +#endif /* bits/strings_x2k8.h */ diff --git a/string/string.h b/string/string.h index 2cc4f50090..6c9cdc0780 100644 --- a/string/string.h +++ b/string/string.h @@ -426,7 +426,7 @@ extern char *strerror_l (int __errnum, locale_t __l) __THROW; #endif #ifdef __USE_MISC -# include +# include /* Set N bytes of S to 0. The compiler will not delete a call to this function, even if S is dead after the call. */ diff --git a/string/strings.h b/string/strings.h index 17e1bf737f..bec458f1d7 100644 --- a/string/strings.h +++ b/string/strings.h @@ -21,6 +21,8 @@ #include #include +#include + /* Tell the caller that we provide correct C++ prototypes. */ #if defined __cplusplus && __GNUC_PREREQ (4, 4) # define __CORRECT_ISO_CPP_STRINGS_H_PROTO @@ -97,43 +99,6 @@ extern char *rindex (const char *__s, int __c) # endif #endif -#if defined __USE_MISC || !defined __USE_XOPEN2K8 || defined __USE_XOPEN2K8XSI -/* Return the position of the first bit set in I, or 0 if none are set. - The least-significant bit is position 1, the most-significant 32. */ -extern int ffs (int __i) __THROW __attribute_const__; -#endif - -/* The following two functions are non-standard but necessary for non-32 bit - platforms. */ -# ifdef __USE_MISC -extern int ffsl (long int __l) __THROW __attribute_const__; -__extension__ extern int ffsll (long long int __ll) - __THROW __attribute_const__; -# endif - -/* Compare S1 and S2, ignoring case. */ -extern int strcasecmp (const char *__s1, const char *__s2) - __THROW __attribute_pure__ __nonnull ((1, 2)); - -/* Compare no more than N chars of S1 and S2, ignoring case. */ -extern int strncasecmp (const char *__s1, const char *__s2, size_t __n) - __THROW __attribute_pure__ __nonnull ((1, 2)); - -#ifdef __USE_XOPEN2K8 -/* POSIX.1-2008 extended locale interface (see locale.h). */ -# include - -/* Compare S1 and S2, ignoring case, using collation rules from LOC. */ -extern int strcasecmp_l (const char *__s1, const char *__s2, locale_t __loc) - __THROW __attribute_pure__ __nonnull ((1, 2, 3)); - -/* Compare no more than N chars of S1 and S2, ignoring case, using - collation rules from LOC. */ -extern int strncasecmp_l (const char *__s1, const char *__s2, - size_t __n, locale_t __loc) - __THROW __attribute_pure__ __nonnull ((1, 2, 4)); -#endif - __END_DECLS #if __GNUC_PREREQ (3,4) && __USE_FORTIFY_LEVEL > 0 \ diff --git a/string/test-string.h b/string/test-string.h index befd3e9931..2c1c01699c 100644 --- a/string/test-string.h +++ b/string/test-string.h @@ -55,6 +55,7 @@ extern impl_t __start_impls[], __stop_impls[]; #include #include #include +#include #include #include #include diff --git a/sysdeps/i386/i686/multiarch/bcopy.c b/sysdeps/i386/i686/multiarch/bcopy.c index c2d1d25710..e1cd57c6e9 100644 --- a/sysdeps/i386/i686/multiarch/bcopy.c +++ b/sysdeps/i386/i686/multiarch/bcopy.c @@ -21,6 +21,7 @@ #if IS_IN (libc) # define bcopy __redirect_bcopy # include +# include # undef bcopy # define SYMBOL_NAME bcopy diff --git a/sysdeps/i386/i686/multiarch/bzero.c b/sysdeps/i386/i686/multiarch/bzero.c index 6b4834e9de..182a496af6 100644 --- a/sysdeps/i386/i686/multiarch/bzero.c +++ b/sysdeps/i386/i686/multiarch/bzero.c @@ -21,6 +21,7 @@ #if IS_IN (libc) # define bzero __redirect_bzero # include +# include # undef bzero # define SYMBOL_NAME bzero diff --git a/sysdeps/i386/i686/multiarch/ifunc-impl-list.c b/sysdeps/i386/i686/multiarch/ifunc-impl-list.c index e2428e0b11..5408aec908 100644 --- a/sysdeps/i386/i686/multiarch/ifunc-impl-list.c +++ b/sysdeps/i386/i686/multiarch/ifunc-impl-list.c @@ -18,6 +18,7 @@ #include #include +#include #include #include #include "init-arch.h" diff --git a/sysdeps/powerpc/powerpc32/power4/multiarch/ifunc-impl-list.c b/sysdeps/powerpc/powerpc32/power4/multiarch/ifunc-impl-list.c index 16a64beb33..ac6784a61b 100644 --- a/sysdeps/powerpc/powerpc32/power4/multiarch/ifunc-impl-list.c +++ b/sysdeps/powerpc/powerpc32/power4/multiarch/ifunc-impl-list.c @@ -18,6 +18,7 @@ #include #include +#include #include #include #include diff --git a/sysdeps/powerpc/powerpc64/multiarch/bcopy-ppc64.c b/sysdeps/powerpc/powerpc64/multiarch/bcopy-ppc64.c index 6772e0a867..9ba96f7d45 100644 --- a/sysdeps/powerpc/powerpc64/multiarch/bcopy-ppc64.c +++ b/sysdeps/powerpc/powerpc64/multiarch/bcopy-ppc64.c @@ -17,6 +17,7 @@ . */ #include +#include extern __typeof (bcopy) __bcopy_ppc attribute_hidden; extern __typeof (memmove) __memmove_ppc attribute_hidden; diff --git a/sysdeps/powerpc/powerpc64/multiarch/bcopy.c b/sysdeps/powerpc/powerpc64/multiarch/bcopy.c index 8c6f2fbf8e..b402117cb3 100644 --- a/sysdeps/powerpc/powerpc64/multiarch/bcopy.c +++ b/sysdeps/powerpc/powerpc64/multiarch/bcopy.c @@ -17,6 +17,7 @@ . */ #include +#include #include "init-arch.h" extern __typeof (bcopy) __bcopy_ppc attribute_hidden; diff --git a/sysdeps/powerpc/powerpc64/multiarch/ifunc-impl-list.c b/sysdeps/powerpc/powerpc64/multiarch/ifunc-impl-list.c index c0a927d73e..c6a227f0e1 100644 --- a/sysdeps/powerpc/powerpc64/multiarch/ifunc-impl-list.c +++ b/sysdeps/powerpc/powerpc64/multiarch/ifunc-impl-list.c @@ -18,6 +18,7 @@ #include #include +#include #include #include #include diff --git a/sysdeps/s390/bzero.c b/sysdeps/s390/bzero.c index 5477ed4aad..18f7eb8932 100644 --- a/sysdeps/s390/bzero.c +++ b/sysdeps/s390/bzero.c @@ -19,6 +19,7 @@ #include #if HAVE_MEMSET_IFUNC # include +# include # include # if HAVE_MEMSET_Z900_G5 diff --git a/sysdeps/s390/multiarch/ifunc-impl-list.c b/sysdeps/s390/multiarch/ifunc-impl-list.c index 1948436417..bede348ee5 100644 --- a/sysdeps/s390/multiarch/ifunc-impl-list.c +++ b/sysdeps/s390/multiarch/ifunc-impl-list.c @@ -18,6 +18,7 @@ #include #include +#include #include #include #include diff --git a/sysdeps/sparc/sparc64/multiarch/bzero.c b/sysdeps/sparc/sparc64/multiarch/bzero.c index 2d7c06b325..3801d8d0ef 100644 --- a/sysdeps/sparc/sparc64/multiarch/bzero.c +++ b/sysdeps/sparc/sparc64/multiarch/bzero.c @@ -20,6 +20,7 @@ #if IS_IN (libc) # define bzero __redirect_bzero # include +# include # undef bzero # include diff --git a/sysdeps/sparc/sparc64/multiarch/ifunc-impl-list.c b/sysdeps/sparc/sparc64/multiarch/ifunc-impl-list.c index 00ed640fbf..8326a7b421 100644 --- a/sysdeps/sparc/sparc64/multiarch/ifunc-impl-list.c +++ b/sysdeps/sparc/sparc64/multiarch/ifunc-impl-list.c @@ -18,6 +18,7 @@ #include #include +#include #include #include #include From patchwork Wed Jun 26 17:50:21 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Zack Weinberg X-Patchwork-Id: 1122964 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-103185-incoming=patchwork.ozlabs.org@sourceware.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=panix.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.b="hpd6R9Fb"; 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 45Ys1W6RYwz9s9h for ; Thu, 27 Jun 2019 04:26:39 +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:in-reply-to :references:mime-version:content-type:content-transfer-encoding; q=dns; s=default; b=VzMezrQJDBZDYhivv4cVpIz++5J9fMTceUPGt14QV36 5plPRl/NFY27knWQqrv0lCENfvwZ+eyl+RVno/5brA4bsORkAILpGjAQcC7CKrti W4LyM9XxPJew4ZczDe0wXWWvUV82gsFEYti2hFEmGX+/WFIiZcsjGAD1CC2iEgFo = 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:in-reply-to :references:mime-version:content-type:content-transfer-encoding; s=default; bh=Gj7oQxwswpUcd7p5l/7Ui8AhGPo=; b=hpd6R9FbOrRGV3jax r88zlXVYjTb67Pa+pX5rz40gqwJPO13VOgfyRRIhpH7sac6GGH1eKuf9Ea8w+Df6 E41YGtdXTzZQgo7isPS7cAwpygtq6uWPQ9V+5wr9OwQ1H0X0TW51o+p4OOpemPc3 Ggmzo4toX3qW5SRSzyt30HwNaE= Received: (qmail 1806 invoked by alias); 26 Jun 2019 18:26:32 -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 1797 invoked by uid 89); 26 Jun 2019 18:26:32 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-17.0 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_SHORT, SPF_HELO_PASS, SPF_PASS autolearn=ham version=3.3.1 spammy= X-HELO: l2mail1.panix.com From: Zack Weinberg To: libc-alpha@sourceware.org Cc: joseph@codesourcery.com, carlos@redhat.com Subject: [PATCH 17/25] =?utf-8?q?Don=E2=80=99t_include_sys/select=2Eh_from?= =?utf-8?q?_sys/types=2Eh=2E?= Date: Wed, 26 Jun 2019 13:50:21 -0400 Message-Id: <20190626175029.4699-8-zackw@panix.com> In-Reply-To: <20190626175029.4699-1-zackw@panix.com> References: <20190626175029.4699-1-zackw@panix.com> MIME-Version: 1.0 This is supposedly present for BSD compatibility, but the current generation of BSDs is not consistent about it: FreeBSD does, OpenBSD doesn’t, NetBSD exposes only fd_set and the FD_* macros. Programs that need to wait for any of multiple I/O events have several alternatives to select nowadays, so I think it makes sense to expose select only to programs that specifically want it. Only a few places within our own code are affected. A few test programs need to include sys/select.h explicitly, as does rpc/svc.h. sysdeps/nptl/thread_db.h needs to declare sigset_t, and sysdeps/unix/sysv/linux/pselect.c was including sys/poll.h instead of sys/select.h, which is probably a copy-and-paste error. sys/socket.h needs to forward-declare struct timespec under __USE_GNU, because recvmmsg has a struct timespec * argument; I’m open to the possibility of having it fully declare struct timespec. I considered taking sys/select.h out of sys/time.h as well, but POSIX not only explicitly allows this inclusion, it requires sys/time.h to declare almost everything that sys/select.h declares. It doesn’t seem worth creating another bits header just to prevent sys/time.h from declaring pselect, sigset_t, and struct timespec. Not including sys/select.h from sys/types.h means that sys/types.h also no longer defines anything from sys/time.h, and a couple of files were relying on that. (pthread_join_common.c should be using clock_gettime instead of gettimeofday, but that's out of scope for this patch series.) * posix/sys/types.h: Don’t include sys/select.h. * scripts/check-obsolete-constructs.py: Remove whitelist entry for sys/types.h -> sys/select.h. Adjust commentary re sys/time.h -> sys/select.h. * socket/sys/socket.h: When __USE_GNU, forward-declare struct timespec. * misc/tst-fdset.c, nptl/tst-cancel4.c, scripts/check-c++-types.sh * sunrpc/rpc/svc.h: Include sys/select.h. * sysdeps/nptl/thread_db.h: Include bits/types/sigset_t.h. * sysdeps/unix/sysv/linux/pselect.c: Include sys/select.h, not sys/poll.h. * nptl/pthread_join_common.c, sysdeps/unix/sysv/linux/dl-vdso.h: Include sys/time.h. --- misc/tst-fdset.c | 2 +- nptl/pthread_join_common.c | 2 ++ nptl/tst-cancel4.c | 1 + posix/sys/types.h | 3 --- scripts/check-c++-types.sh | 1 + scripts/check-obsolete-constructs.py | 6 +++--- socket/sys/socket.h | 4 ++++ sunrpc/rpc/svc.h | 1 + sysdeps/nptl/thread_db.h | 2 +- sysdeps/unix/sysv/linux/dl-vdso.h | 6 ++++++ sysdeps/unix/sysv/linux/pselect.c | 2 +- 11 files changed, 21 insertions(+), 9 deletions(-) diff --git a/misc/tst-fdset.c b/misc/tst-fdset.c index 70b7028dad..956e371746 100644 --- a/misc/tst-fdset.c +++ b/misc/tst-fdset.c @@ -18,7 +18,7 @@ . */ #include -#include +#include static int do_test (void) diff --git a/nptl/pthread_join_common.c b/nptl/pthread_join_common.c index 5224ee2110..b8b016ccb7 100644 --- a/nptl/pthread_join_common.c +++ b/nptl/pthread_join_common.c @@ -20,6 +20,8 @@ #include #include +#include + static void cleanup (void *arg) { diff --git a/nptl/tst-cancel4.c b/nptl/tst-cancel4.c index 60a965d23a..dce93dc03a 100644 --- a/nptl/tst-cancel4.c +++ b/nptl/tst-cancel4.c @@ -24,6 +24,7 @@ #include #include #include +#include #include #include #include diff --git a/posix/sys/types.h b/posix/sys/types.h index 08305cf812..9381695548 100644 --- a/posix/sys/types.h +++ b/posix/sys/types.h @@ -93,9 +93,6 @@ __BEGIN_DECLS /* In BSD is expected to define BYTE_ORDER. */ # include - -/* It also defines `fd_set' and the FD_* macros for `select'. */ -# include #endif /* Use misc. */ __END_DECLS diff --git a/scripts/check-c++-types.sh b/scripts/check-c++-types.sh index a8f3cfff7b..141ddf7440 100755 --- a/scripts/check-c++-types.sh +++ b/scripts/check-c++-types.sh @@ -46,6 +46,7 @@ while read t; do #include #include #include +#include #include void foo ($t) { } EOF diff --git a/scripts/check-obsolete-constructs.py b/scripts/check-obsolete-constructs.py index bd5a97f76b..a051d4e845 100755 --- a/scripts/check-obsolete-constructs.py +++ b/scripts/check-obsolete-constructs.py @@ -530,13 +530,13 @@ HEADER_ALLOWED_INCLUDES = { # mandated: sys/msg.h -> sys/ipc.h # sys/sem.h -> sys/ipc.h # sys/shm.h -> sys/ipc.h - # allowed: sys/time.h -> sys/select.h - # sys/wait.h -> signal.h + # sys/time.h -> sys/select.h (effectively) + # allowed: sys/wait.h -> signal.h "sys/msg.h": [ "sys/ipc.h" ], "sys/sem.h": [ "sys/ipc.h" ], "sys/shm.h": [ "sys/ipc.h" ], "sys/time.h": [ "sys/select.h" ], - "sys/types.h": [ "endian.h", "sys/select.h" ], + "sys/types.h": [ "endian.h" ], "sys/uio.h": [ "sys/types.h" ], "sys/un.h": [ "string.h" ], "sys/wait.h": [ "signal.h" ], diff --git a/socket/sys/socket.h b/socket/sys/socket.h index 1bb90ed67c..ce793dc3e2 100644 --- a/socket/sys/socket.h +++ b/socket/sys/socket.h @@ -35,6 +35,10 @@ __BEGIN_DECLS # include #endif +#ifdef __USE_GNU +struct timespec; +#endif + /* The following constants should be used for the second parameter of `shutdown'. */ enum diff --git a/sunrpc/rpc/svc.h b/sunrpc/rpc/svc.h index 85d0183d48..c77dcf0c4a 100644 --- a/sunrpc/rpc/svc.h +++ b/sunrpc/rpc/svc.h @@ -53,6 +53,7 @@ #include #include +#include __BEGIN_DECLS diff --git a/sysdeps/nptl/thread_db.h b/sysdeps/nptl/thread_db.h index d134acaa24..4d949b0c37 100644 --- a/sysdeps/nptl/thread_db.h +++ b/sysdeps/nptl/thread_db.h @@ -26,7 +26,7 @@ #include #include #include - +#include /* Error codes of the library. */ typedef enum diff --git a/sysdeps/unix/sysv/linux/dl-vdso.h b/sysdeps/unix/sysv/linux/dl-vdso.h index 9e61ca7423..edecf5faf4 100644 --- a/sysdeps/unix/sysv/linux/dl-vdso.h +++ b/sysdeps/unix/sysv/linux/dl-vdso.h @@ -23,6 +23,12 @@ #include #include +/* This header must declare all functions that might be looked up + in the vDSO by code fragments generated by make-syscalls.sh. + At present the only such function that isn't covered by the above + headers is gettimeofday. */ +#include + /* Create version number record for lookup. */ #define PREPARE_VERSION(var, vname, vhash) \ struct r_found_version var; \ diff --git a/sysdeps/unix/sysv/linux/pselect.c b/sysdeps/unix/sysv/linux/pselect.c index c9406cac09..d1106e9b18 100644 --- a/sysdeps/unix/sysv/linux/pselect.c +++ b/sysdeps/unix/sysv/linux/pselect.c @@ -19,7 +19,7 @@ #include #include #include -#include +#include #include #include From patchwork Wed Jun 26 17:50:22 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Zack Weinberg X-Patchwork-Id: 1122965 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-103186-incoming=patchwork.ozlabs.org@sourceware.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=panix.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.b="bNqPSVMV"; 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 45Ys1j2xCfz9s7h for ; Thu, 27 Jun 2019 04:26:49 +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:in-reply-to :references:mime-version:content-type:content-transfer-encoding; q=dns; s=default; b=Z1v5nQxA+oYHkoqt9U9etuoYG7fWhXnlb84TW0yd0OZ AsJF3yyCTzCHCwFk2eIFqSnoUS0gyyBsnpBHsT3ALrzIwXGvUVjFoNRFMIR6sQG1 8N5izoMKPSQQTQd9W6gG2OnPPcYU8gHWexGrmLuJzggvbzyeDxrgeReyah2T19/I = 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:in-reply-to :references:mime-version:content-type:content-transfer-encoding; s=default; bh=jfMLnm4rc/vsSN0unQih2Aq9A58=; b=bNqPSVMVxU/U4wv3G 4aPc0kSHHKWXVj/xw32Ive4kJjSoH+tTfKi3BEcHdtHedSms135WY5W3awXKORYP Oglkqt+P7ZAlHVsAquEIS53SBuZMS4ElsXqi5mEVT+eK4XBAke/XThvN4jehEw0+ aMdixkqnNrEfFQf3YWf7Rnz8xE= Received: (qmail 2092 invoked by alias); 26 Jun 2019 18:26:34 -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 2027 invoked by uid 89); 26 Jun 2019 18:26:34 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-17.1 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_SHORT, SPF_HELO_PASS, SPF_PASS autolearn=ham version=3.3.1 spammy=california, California X-HELO: l2mail1.panix.com From: Zack Weinberg To: libc-alpha@sourceware.org Cc: joseph@codesourcery.com, carlos@redhat.com Subject: [PATCH 18/25] =?utf-8?q?Don=E2=80=99t_include_signal=2Eh_from_sys?= =?utf-8?q?/wait=2Eh_or_sys/param=2Eh=2E?= Date: Wed, 26 Jun 2019 13:50:22 -0400 Message-Id: <20190626175029.4699-9-zackw@panix.com> In-Reply-To: <20190626175029.4699-1-zackw@panix.com> References: <20190626175029.4699-1-zackw@panix.com> MIME-Version: 1.0 Besides the snarl of debugger/ucontext interfaces, these are the only public headers that include signal.h. sys/wait.h includes signal.h only for the definition of siginfo_t. We already have a single-type header for that, so use it. siginfo_t contains a field whose type is uid_t, but sys/wait.h is not specified to define uid_t, so, as is already done for pid_t, the conformance test is modified to expect that field to have type __uid_t instead. It is not clear what subset of the definitions from signal.h are actually expected by historical users of sys/param.h; I’ve chosen to take the comment at face value and cut it down to bits/signum.h, which supplies _NSIG and all of the SIG* constants. This requires adjusting every copy of bits/signum.h to permit inclusion by sys/param.h as well as signal.h. While I was at it I moved the comment about sys/param.h being obsolete from sysdeps/mach/hurd/bits/param.h, where it’s not likely to be seen, to the top-level sys/param.h, and edited it to give more useful advice. This patch partially fixes Hurd-specific bug 23088; sys/wait.h is now conformant. * posix/sys/wait.h: Include bits/types/siginfo_t.h, not signal.h. * conform/data/sys/wait.h-data: Do not expect a definition of uid_t. * malloc/tst-mallocfork.c, nptl/tst-fork4.c, nptl/tst-getpid3.c * nptl/tst-mutex9.c, nptl/tst-rwlock12.c * resolv/tst-resolv-res_init-skeleton.c * sysdeps/unix/sysv/linux/s390/tst-ptrace-singleblock.c: Include signal.h. * nptl/tst-cancel4.c, rt/tst-mqueue1.c * support/tst-support_capture_subprocess.c * sysdeps/unix/sysv/linux/tst-align-clone.c: Include signal.h. Sort includes. * misc/sys/param.h: Include bits/signum.h, not signal.h. Add comment explaining that this header is obsolete, based on a similar comment in Hurd bits/param.h. * bits/param.h: Add multiple inclusion guard and defensive #error. * sysdeps/mach/hurd/bits/param.h: Add multiple inclusion guard. Remove comment explaining that this header is obsolete (see above). * sysdeps/mach/i386/bits/mach/param.h: Add multiple inclusion guard. * sysdeps/unix/sysv/linux/bits/param.h: Add multiple inclusion guard. * bits/signum-generic.h, bits/signum.h * sysdeps/unix/bsd/bits/signum.h * sysdeps/unix/sysv/linux/alpha/bits/signum.h * sysdeps/unix/sysv/linux/bits/signum.h * sysdeps/unix/sysv/linux/hppa/bits/signum.h * sysdeps/unix/sysv/linux/mips/bits/signum.h: Allow inclusion by sys/param.h as well as signal.h. * scripts/check-obsolete-constructs.py (HEADER_ALLOWED_INCLUDES): Update. * sysdeps/mach/hurd/i386/Makefile: Remove XFAILs for sys/wait.h. --- bits/param.h | 7 +++++ bits/signum-generic.h | 2 +- bits/signum.h | 2 +- conform/data/sys/wait.h-data | 1 + malloc/tst-mallocfork.c | 1 + misc/sys/param.h | 8 +++++- nptl/tst-cancel4.c | 27 ++++++++++--------- nptl/tst-fork4.c | 1 + nptl/tst-getpid3.c | 1 + nptl/tst-mutex9.c | 1 + nptl/tst-rwlock12.c | 1 + posix/sys/wait.h | 2 +- resolv/tst-resolv-res_init-skeleton.c | 1 + rt/tst-mqueue1.c | 5 ++-- scripts/check-obsolete-constructs.py | 7 +++-- support/tst-support_capture_subprocess.c | 19 +++++++------ sysdeps/mach/hurd/bits/param.h | 13 +++++---- sysdeps/mach/hurd/i386/Makefile | 4 --- sysdeps/mach/i386/bits/mach/param.h | 5 ++++ sysdeps/unix/bsd/bits/signum.h | 2 +- sysdeps/unix/sysv/linux/alpha/bits/signum.h | 2 +- sysdeps/unix/sysv/linux/bits/param.h | 5 ++++ sysdeps/unix/sysv/linux/bits/signum.h | 2 +- sysdeps/unix/sysv/linux/hppa/bits/signum.h | 2 +- sysdeps/unix/sysv/linux/mips/bits/signum.h | 2 +- .../sysv/linux/s390/tst-ptrace-singleblock.c | 1 + sysdeps/unix/sysv/linux/sparc/bits/signum.h | 2 +- sysdeps/unix/sysv/linux/tst-align-clone.c | 5 ++-- 28 files changed, 81 insertions(+), 50 deletions(-) diff --git a/bits/param.h b/bits/param.h index e83f60f0b5..44c8505ad0 100644 --- a/bits/param.h +++ b/bits/param.h @@ -16,6 +16,9 @@ License along with the GNU C Library; if not, see . */ +#ifndef _BITS_PARAM_H +#define _BITS_PARAM_H 1 + #ifndef _SYS_PARAM_H # error "Never use directly; include instead." #endif @@ -31,3 +34,7 @@ EXEC_PAGESIZE */ + +#error "Generic bits/param.h should not have been used." + +#endif diff --git a/bits/signum-generic.h b/bits/signum-generic.h index 6fbbf20a31..71308d635d 100644 --- a/bits/signum-generic.h +++ b/bits/signum-generic.h @@ -19,7 +19,7 @@ #ifndef _BITS_SIGNUM_GENERIC_H #define _BITS_SIGNUM_GENERIC_H 1 -#ifndef _SIGNAL_H +#if !defined _SIGNAL_H && !defined _SYS_PARAM_H #error "Never include directly; use instead." #endif diff --git a/bits/signum.h b/bits/signum.h index 8c788c8e7e..90e13c9824 100644 --- a/bits/signum.h +++ b/bits/signum.h @@ -19,7 +19,7 @@ #ifndef _BITS_SIGNUM_H #define _BITS_SIGNUM_H 1 -#ifndef _SIGNAL_H +#if !defined _SIGNAL_H && !defined _SYS_PARAM_H #error "Never include directly; use instead." #endif diff --git a/conform/data/sys/wait.h-data b/conform/data/sys/wait.h-data index c0761424da..aa3a87ea15 100644 --- a/conform/data/sys/wait.h-data +++ b/conform/data/sys/wait.h-data @@ -2,6 +2,7 @@ #ifdef POSIX # define pid_t __pid_t #endif +#define uid_t __uid_t constant WNOHANG constant WUNTRACED diff --git a/malloc/tst-mallocfork.c b/malloc/tst-mallocfork.c index 00851a16c3..d1d973c28b 100644 --- a/malloc/tst-mallocfork.c +++ b/malloc/tst-mallocfork.c @@ -2,6 +2,7 @@ https://sourceware.org/bugzilla/show_bug.cgi?id=838. */ #include #include +#include #include #include #include diff --git a/misc/sys/param.h b/misc/sys/param.h index bb6478f79b..1dedc699a4 100644 --- a/misc/sys/param.h +++ b/misc/sys/param.h @@ -16,6 +16,12 @@ License along with the GNU C Library; if not, see . */ +/* This header is provided only for compatibility with historic Unix + systems. New programs should use some combination of , + , , , , and + instead, and the names defined in those headers. The utility + macros at the end of this header should not be used at all. */ + #ifndef _SYS_PARAM_H #define _SYS_PARAM_H 1 @@ -24,7 +30,7 @@ #include #include #include /* Define BYTE_ORDER et al. */ -#include /* Define NSIG. */ +#include /* Define NSIG. */ #include /* This file defines some things in system-specific ways. */ diff --git a/nptl/tst-cancel4.c b/nptl/tst-cancel4.c index dce93dc03a..575c09d53f 100644 --- a/nptl/tst-cancel4.c +++ b/nptl/tst-cancel4.c @@ -19,27 +19,28 @@ /* NOTE: this tests functionality beyond POSIX. POSIX does not allow exit to be called more than once. */ +#include +#include +#include +#include +#include #include #include #include #include -#include +#include +#include +#include +#include +#include +#include #include #include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include #include +#include #include +#include +#include /* Since STREAMS are not supported in the standard Linux kernel and diff --git a/nptl/tst-fork4.c b/nptl/tst-fork4.c index b491d3eec8..4deaf2476c 100644 --- a/nptl/tst-fork4.c +++ b/nptl/tst-fork4.c @@ -18,6 +18,7 @@ #include #include +#include #include #include #include diff --git a/nptl/tst-getpid3.c b/nptl/tst-getpid3.c index f1e77f6b10..3883a471ed 100644 --- a/nptl/tst-getpid3.c +++ b/nptl/tst-getpid3.c @@ -1,5 +1,6 @@ #include #include +#include #include #include #include diff --git a/nptl/tst-mutex9.c b/nptl/tst-mutex9.c index e9fd8e2859..4efd97bb45 100644 --- a/nptl/tst-mutex9.c +++ b/nptl/tst-mutex9.c @@ -18,6 +18,7 @@ #include #include +#include #include #include #include diff --git a/nptl/tst-rwlock12.c b/nptl/tst-rwlock12.c index 2d28a5b1d3..70a678f9eb 100644 --- a/nptl/tst-rwlock12.c +++ b/nptl/tst-rwlock12.c @@ -18,6 +18,7 @@ #include #include +#include #include #include #include diff --git a/posix/sys/wait.h b/posix/sys/wait.h index 691be2759c..7f8e0693dc 100644 --- a/posix/sys/wait.h +++ b/posix/sys/wait.h @@ -30,7 +30,7 @@ __BEGIN_DECLS #include #if defined __USE_XOPEN_EXTENDED || defined __USE_XOPEN2K8 -# include +# include #endif #if defined __USE_XOPEN_EXTENDED && !defined __USE_XOPEN2K8 diff --git a/resolv/tst-resolv-res_init-skeleton.c b/resolv/tst-resolv-res_init-skeleton.c index 678f396c4c..32a790774f 100644 --- a/resolv/tst-resolv-res_init-skeleton.c +++ b/resolv/tst-resolv-res_init-skeleton.c @@ -25,6 +25,7 @@ #include #include #include +#include #include #include #include diff --git a/rt/tst-mqueue1.c b/rt/tst-mqueue1.c index fb8d2e2ff0..5e5039a14b 100644 --- a/rt/tst-mqueue1.c +++ b/rt/tst-mqueue1.c @@ -20,13 +20,14 @@ #include #include #include +#include +#include #include #include #include -#include #include #include -#include +#include #include "tst-mqueue.h" static int diff --git a/scripts/check-obsolete-constructs.py b/scripts/check-obsolete-constructs.py index a051d4e845..bca0f12c18 100755 --- a/scripts/check-obsolete-constructs.py +++ b/scripts/check-obsolete-constructs.py @@ -531,15 +531,15 @@ HEADER_ALLOWED_INCLUDES = { # sys/sem.h -> sys/ipc.h # sys/shm.h -> sys/ipc.h # sys/time.h -> sys/select.h (effectively) - # allowed: sys/wait.h -> signal.h "sys/msg.h": [ "sys/ipc.h" ], "sys/sem.h": [ "sys/ipc.h" ], "sys/shm.h": [ "sys/ipc.h" ], "sys/time.h": [ "sys/select.h" ], + # necessary for backward compatibility with BSD "sys/types.h": [ "endian.h" ], + "sys/uio.h": [ "sys/types.h" ], "sys/un.h": [ "string.h" ], - "sys/wait.h": [ "signal.h" ], # POSIX networking headers # allowed: netdb.h -> netinet/in.h @@ -593,8 +593,7 @@ HEADER_ALLOWED_INCLUDES = { "sys/ioctl.h": [ "sys/ttydefaults.h" ], "sys/mount.h": [ "sys/ioctl.h" ], "sys/mtio.h": [ "sys/ioctl.h", "sys/types.h" ], - "sys/param.h": [ "endian.h", "limits.h", "signal.h", - "sys/types.h" ], + "sys/param.h": [ "endian.h", "limits.h", "sys/types.h" ], "sys/platform/ppc.h": [ "stdint.h" ], "sys/procfs.h": [ "sys/time.h", "sys/types.h", "sys/user.h" ], diff --git a/support/tst-support_capture_subprocess.c b/support/tst-support_capture_subprocess.c index ab363e41ac..11e8cb7282 100644 --- a/support/tst-support_capture_subprocess.c +++ b/support/tst-support_capture_subprocess.c @@ -16,21 +16,23 @@ License along with the GNU C Library; if not, see . */ +#include +#include +#include +#include +#include #include #include #include #include +#include +#include + +#include #include #include #include #include -#include -#include -#include -#include -#include -#include -#include /* Nonzero if the program gets called via 'exec'. */ static int restart; @@ -273,7 +275,8 @@ do_multiple_tests (enum test_type type) .out = random_string (lengths[length_idx_stdout]), .err = random_string (lengths[length_idx_stderr]), .write_mode = write_mode, - .signal = signal * SIGTERM, /* 0 or SIGTERM. */ + .signal = signal * + SIGTERM, /* 0 or SIGTERM. */ .status = status * 3, /* 0 or 3. */ }; TEST_VERIFY (strlen (test.out) == lengths[length_idx_stdout]); diff --git a/sysdeps/mach/hurd/bits/param.h b/sysdeps/mach/hurd/bits/param.h index a0162e9ac8..09485f1d3e 100644 --- a/sysdeps/mach/hurd/bits/param.h +++ b/sysdeps/mach/hurd/bits/param.h @@ -16,19 +16,16 @@ License along with the GNU C Library; if not, see . */ +#ifndef _BITS_PARAM_H +#define _BITS_PARAM_H 1 + #ifndef _SYS_PARAM_H # error "Never use directly; include instead." #endif #include -/* This file is deprecated and is provided only for compatibility with - Unix systems. It is unwise to include this file on programs which - are intended only for GNU systems. - - Parts from: - - * Copyright (c) 1982, 1986, 1989 The Regents of the University of California. +/* Copyright (c) 1982, 1986, 1989 The Regents of the University of California. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -85,3 +82,5 @@ #define FSHIFT 11 /* Bits to right of fixed binary point. */ #define FSCALE (1<. */ +#ifndef _BITS_MACH_PARAM_H +#define _BITS_MACH_PARAM_H 1 + #ifndef _SYS_PARAM_H # error "Never use directly; include instead." #endif @@ -23,3 +26,5 @@ #ifndef EXEC_PAGESIZE #define EXEC_PAGESIZE 4096 #endif + +#endif diff --git a/sysdeps/unix/bsd/bits/signum.h b/sysdeps/unix/bsd/bits/signum.h index 7e3df3273b..e0178e9390 100644 --- a/sysdeps/unix/bsd/bits/signum.h +++ b/sysdeps/unix/bsd/bits/signum.h @@ -19,7 +19,7 @@ #ifndef _BITS_SIGNUM_H #define _BITS_SIGNUM_H 1 -#ifndef _SIGNAL_H +#if !defined _SIGNAL_H && !defined _SYS_PARAM_H #error "Never include directly; use instead." #endif diff --git a/sysdeps/unix/sysv/linux/alpha/bits/signum.h b/sysdeps/unix/sysv/linux/alpha/bits/signum.h index da4ff93c9c..4355d35ab9 100644 --- a/sysdeps/unix/sysv/linux/alpha/bits/signum.h +++ b/sysdeps/unix/sysv/linux/alpha/bits/signum.h @@ -19,7 +19,7 @@ #ifndef _BITS_SIGNUM_H #define _BITS_SIGNUM_H 1 -#ifndef _SIGNAL_H +#if !defined _SIGNAL_H && !defined _SYS_PARAM_H #error "Never include directly; use instead." #endif diff --git a/sysdeps/unix/sysv/linux/bits/param.h b/sysdeps/unix/sysv/linux/bits/param.h index 53c0f9f136..f847c51031 100644 --- a/sysdeps/unix/sysv/linux/bits/param.h +++ b/sysdeps/unix/sysv/linux/bits/param.h @@ -16,6 +16,9 @@ License along with the GNU C Library; if not, see . */ +#ifndef _BITS_PARAM_H +#define _BITS_PARAM_H 1 + #ifndef _SYS_PARAM_H # error "Never use directly; include instead." #endif @@ -40,3 +43,5 @@ and NCARGS anyway. */ #define NOFILE 256 #define NCARGS 131072 + +#endif /* bits/param.h */ diff --git a/sysdeps/unix/sysv/linux/bits/signum.h b/sysdeps/unix/sysv/linux/bits/signum.h index 25b0d2a6cf..86fde6a7d1 100644 --- a/sysdeps/unix/sysv/linux/bits/signum.h +++ b/sysdeps/unix/sysv/linux/bits/signum.h @@ -19,7 +19,7 @@ #ifndef _BITS_SIGNUM_H #define _BITS_SIGNUM_H 1 -#ifndef _SIGNAL_H +#if !defined _SIGNAL_H && !defined _SYS_PARAM_H #error "Never include directly; use instead." #endif diff --git a/sysdeps/unix/sysv/linux/hppa/bits/signum.h b/sysdeps/unix/sysv/linux/hppa/bits/signum.h index c643626f99..59599668cf 100644 --- a/sysdeps/unix/sysv/linux/hppa/bits/signum.h +++ b/sysdeps/unix/sysv/linux/hppa/bits/signum.h @@ -19,7 +19,7 @@ #ifndef _BITS_SIGNUM_H #define _BITS_SIGNUM_H 1 -#ifndef _SIGNAL_H +#if !defined _SIGNAL_H && !defined _SYS_PARAM_H #error "Never include directly; use instead." #endif diff --git a/sysdeps/unix/sysv/linux/mips/bits/signum.h b/sysdeps/unix/sysv/linux/mips/bits/signum.h index 89a63e4a03..1a430c16ba 100644 --- a/sysdeps/unix/sysv/linux/mips/bits/signum.h +++ b/sysdeps/unix/sysv/linux/mips/bits/signum.h @@ -19,7 +19,7 @@ #ifndef _BITS_SIGNUM_H #define _BITS_SIGNUM_H 1 -#ifndef _SIGNAL_H +#if !defined _SIGNAL_H && !defined _SYS_PARAM_H #error "Never include directly; use instead." #endif diff --git a/sysdeps/unix/sysv/linux/s390/tst-ptrace-singleblock.c b/sysdeps/unix/sysv/linux/s390/tst-ptrace-singleblock.c index 89e86ad923..e7d36d2d75 100644 --- a/sysdeps/unix/sysv/linux/s390/tst-ptrace-singleblock.c +++ b/sysdeps/unix/sysv/linux/s390/tst-ptrace-singleblock.c @@ -16,6 +16,7 @@ License along with the GNU C Library; if not, see . */ +#include #include #include #include diff --git a/sysdeps/unix/sysv/linux/sparc/bits/signum.h b/sysdeps/unix/sysv/linux/sparc/bits/signum.h index ec746fee99..866a1c3d9d 100644 --- a/sysdeps/unix/sysv/linux/sparc/bits/signum.h +++ b/sysdeps/unix/sysv/linux/sparc/bits/signum.h @@ -19,7 +19,7 @@ #ifndef _BITS_SIGNUM_H #define _BITS_SIGNUM_H 1 -#ifndef _SIGNAL_H +#if !defined _SIGNAL_H && !defined _SYS_PARAM_H #error "Never include directly; use instead." #endif diff --git a/sysdeps/unix/sysv/linux/tst-align-clone.c b/sysdeps/unix/sysv/linux/tst-align-clone.c index 82ecf7ba32..100eacfbfe 100644 --- a/sysdeps/unix/sysv/linux/tst-align-clone.c +++ b/sysdeps/unix/sysv/linux/tst-align-clone.c @@ -16,14 +16,15 @@ . */ #include +#include +#include #include #include #include #include -#include #include +#include #include -#include static int f (void *arg) From patchwork Wed Jun 26 17:50:23 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Zack Weinberg X-Patchwork-Id: 1122955 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-103180-incoming=patchwork.ozlabs.org@sourceware.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=panix.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.b="VmmJvVt4"; 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 45YrZN2LH5z9s4Y for ; Thu, 27 Jun 2019 04:06:36 +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:in-reply-to :references:mime-version:content-type:content-transfer-encoding; q=dns; s=default; b=jOnJvZw/y7eXzW1RLezVxQBdGQeRTZiwhnmVRpTgjTH iu8whz2EF3fuH57XJ8K0BN+FufKMLt8PeoyO70cPdO/lj6QivR5ktiopCwJmdIlG lxPkTFrLI/CKi/hATCR3sxsTuU4R1RIVQQ3Ol2Jqm3ncyGZ7WEqoCIygVgdYGdxQ = 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:in-reply-to :references:mime-version:content-type:content-transfer-encoding; s=default; bh=8GH9J2iLHysIoFDypoWFNBmkyiY=; b=VmmJvVt4bo1EOVcD5 pqvRpIi9jDryyk+iYyPCllmMvhxMlOCNtTVqBGPs7+GXbtpUkSZ61YdkpkctTTd/ fpa3Q2d0KiXEScyyBl/rTKR9by9eSu/I6v6gngeZtSp1SZ/5hZJZNgl9q2qNBgiI XAQp9/3YcNzVImvP6lZzkOXC1w= Received: (qmail 54409 invoked by alias); 26 Jun 2019 18:06:21 -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 54353 invoked by uid 89); 26 Jun 2019 18:06:20 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-16.8 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_SHORT, SPF_HELO_PASS, SPF_PASS autolearn=ham version=3.3.1 spammy=resistance X-HELO: l2mail1.panix.com From: Zack Weinberg To: libc-alpha@sourceware.org Cc: joseph@codesourcery.com, carlos@redhat.com Subject: [PATCH 19/25] =?utf-8?q?Don=E2=80=99t_include_string=2Eh_from_sys?= =?utf-8?b?L3VuLmgu?= Date: Wed, 26 Jun 2019 13:50:23 -0400 Message-Id: <20190626175029.4699-10-zackw@panix.com> In-Reply-To: <20190626175029.4699-1-zackw@panix.com> References: <20190626175029.4699-1-zackw@panix.com> MIME-Version: 1.0 sys/un.h needs strlen in order to define SUN_LEN, but does not need any of the other things declared by string.h; the path of least resistance is to prototype strlen locally. Also, the construct being used to get the size of everything up to the sun_path member contains a formal dereference of a null pointer and therefore has undefined behavior. Replace with __SOCKADDR_COMMON_SIZE. Some old RPC code was relying on sys/un.h to provide all of string.h. * sys/un.h [__USE_MISC]: Don’t include string.h. Include bits/types/size_t.h. Prototype strlen locally. Use __SOCKADDR_COMMON_SIZE for size of leading members of struct sockaddr_un. * nis/nis_domain_of.c, nis/yp_xdr.c, sunrpc/svc.c: Include string.h. * scripts/check-obsolete-constructs.py (HEADER_ALLOWED_INCLUDES): Update. --- nis/nis_domain_of.c | 1 + nis/yp_xdr.c | 1 + scripts/check-obsolete-constructs.py | 1 - socket/sys/un.h | 8 +++++--- sunrpc/svc.c | 1 + 5 files changed, 8 insertions(+), 4 deletions(-) diff --git a/nis/nis_domain_of.c b/nis/nis_domain_of.c index 44c5b04c8c..da26df36c7 100644 --- a/nis/nis_domain_of.c +++ b/nis/nis_domain_of.c @@ -17,6 +17,7 @@ . */ #include +#include #include nis_name diff --git a/nis/yp_xdr.c b/nis/yp_xdr.c index 3b576731da..4c9f1d22a0 100644 --- a/nis/yp_xdr.c +++ b/nis/yp_xdr.c @@ -31,6 +31,7 @@ #include #include +#include #include /* The NIS v2 protocol suggests 1024 bytes as a maximum length of all fields. diff --git a/scripts/check-obsolete-constructs.py b/scripts/check-obsolete-constructs.py index bca0f12c18..d230fcf892 100755 --- a/scripts/check-obsolete-constructs.py +++ b/scripts/check-obsolete-constructs.py @@ -539,7 +539,6 @@ HEADER_ALLOWED_INCLUDES = { "sys/types.h": [ "endian.h" ], "sys/uio.h": [ "sys/types.h" ], - "sys/un.h": [ "string.h" ], # POSIX networking headers # allowed: netdb.h -> netinet/in.h diff --git a/socket/sys/un.h b/socket/sys/un.h index 8c7433a3dc..540560e256 100644 --- a/socket/sys/un.h +++ b/socket/sys/un.h @@ -34,11 +34,13 @@ struct sockaddr_un #ifdef __USE_MISC -# include /* For prototype of `strlen'. */ +#include + +extern size_t strlen (const char *__s) + __THROW __attribute_pure__ __nonnull ((1)); /* Evaluate to actual length of the `sockaddr_un' structure. */ -# define SUN_LEN(ptr) ((size_t) (((struct sockaddr_un *) 0)->sun_path) \ - + strlen ((ptr)->sun_path)) +# define SUN_LEN(ptr) (__SOCKADDR_COMMON_SIZE + strlen ((ptr)->sun_path)) #endif __END_DECLS diff --git a/sunrpc/svc.c b/sunrpc/svc.c index 95ecfbb2d1..8042019ce9 100644 --- a/sunrpc/svc.c +++ b/sunrpc/svc.c @@ -53,6 +53,7 @@ */ #include +#include #include #include #include From patchwork Wed Jun 26 17:50:24 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Zack Weinberg X-Patchwork-Id: 1122949 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-103173-incoming=patchwork.ozlabs.org@sourceware.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=panix.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.b="auiTgEqV"; 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 45YrFp1dhZz9sN6 for ; Thu, 27 Jun 2019 03:52: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:in-reply-to :references:mime-version:content-type:content-transfer-encoding; q=dns; s=default; b=FVM+di/LUrZCCsh7KLHyG7pp19vHuZsjAyGNM3kpJfG pMeVRWfA9lEhWeKMtTTVpJ03grMgs736EfyMoJLLNedfNgQcvoSx1fmdFMx5SrMS GC+94vmkUwO3XuQAn2ClOpT2Lqud3EGJYE1TfAlux8njEre7vnBMy7TWJrqKHjVI = 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:in-reply-to :references:mime-version:content-type:content-transfer-encoding; s=default; bh=rsFepXlhp9cebQnYUlrYJqwInpM=; b=auiTgEqV3FFwt5p0O xrRSqUfdor0aHYvLfmFj8JyxjDyeJ8YDywBlghlbHhSchPcXrCYtaJnbirLaQqHW XpMSEI2Ispa4enOKv5e9dG7tbrlas4G4p9i8JKVTX9wJ23+kVTutoQ313YjVuMRN ukJKd/bKy7NHJcNwngmNs8qcVc= Received: (qmail 12292 invoked by alias); 26 Jun 2019 17:50:40 -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 12240 invoked by uid 89); 26 Jun 2019 17:50:39 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-16.4 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, SPF_HELO_PASS, SPF_PASS autolearn=ham version=3.3.1 spammy=6056, old-fashioned, leap, oldfashioned X-HELO: l2mail1.panix.com From: Zack Weinberg To: libc-alpha@sourceware.org Cc: joseph@codesourcery.com, carlos@redhat.com Subject: [PATCH 20/25] =?utf-8?q?Don=E2=80=99t_include_sys/time=2Eh_from_s?= =?utf-8?q?ys/timex=2Eh=2E?= Date: Wed, 26 Jun 2019 13:50:24 -0400 Message-Id: <20190626175029.4699-11-zackw@panix.com> In-Reply-To: <20190626175029.4699-1-zackw@panix.com> References: <20190626175029.4699-1-zackw@panix.com> MIME-Version: 1.0 The interfaces defined in sys/timex.h only need struct timeval, not any of the other things defined in sys/time.h. While I was at it I moved stuff around so that sysdeps/…/linux/bits/timex.h defines everything that uapi linux/timex.h defines (as of version 5.0; alas, we still cannot use linux/timex.h directly) plus the MOD_CLKA and MOD_CLKB constants. In particular, the TIME_* constants are relevant to users of clock_adjtime as well as adjtimex (I presume— clock_adjtime is not very well documented) so they should be visible from time.h as well as sys/timex.h. Conversely, as far as I can tell, struct ntptimeval was never a kernel interface on Linux, and MAXTC is not part of the exposed API and also has the wrong value for current kernels. Also I removed a thoroughly obsolete bug workaround from ntp_gettime.c and ntp_gettimex.c. * sysdeps/unix/sysv/linux/sys/timex.h: Don’t include sys/time.h. Update commentary. Don’t define MAXTC. Move definition of NTP_API and the TIME_* constants... * sysdeps/unix/sysv/linux/bits/timex.h: ...here. Allow inclusion only by sys/timex.h and bits/time.h. Update commentary. * sysdeps/unix/sysv/linux/ntp_gettime.c * sysdeps/unix/sysv/linux/ntp_gettimex.c: Remove obsolete check for MOD_OFFSET not being defined. * scripts/check-obsolete-constructs.py (HEADER_ALLOWED_INCLUDES): Update. --- scripts/check-obsolete-constructs.py | 1 - sysdeps/unix/sysv/linux/bits/timex.h | 20 ++++++++++++++++++-- sysdeps/unix/sysv/linux/ntp_gettime.c | 4 ---- sysdeps/unix/sysv/linux/ntp_gettimex.c | 4 ---- sysdeps/unix/sysv/linux/sys/timex.h | 18 ++---------------- 5 files changed, 20 insertions(+), 27 deletions(-) diff --git a/scripts/check-obsolete-constructs.py b/scripts/check-obsolete-constructs.py index d230fcf892..f456c98def 100755 --- a/scripts/check-obsolete-constructs.py +++ b/scripts/check-obsolete-constructs.py @@ -605,7 +605,6 @@ HEADER_ALLOWED_INCLUDES = { "sys/signalfd.h": [ "stdint.h" ], "sys/socketvar.h": [ "sys/socket.h" ], "sys/timerfd.h": [ "time.h" ], - "sys/timex.h": [ "sys/time.h" ], "sys/ttychars.h": [ "sys/ttydefaults.h" ], "sys/ucontext.h": [ "sys/procfs.h" ], "sys/vfs.h": [ "sys/statfs.h" ], diff --git a/sysdeps/unix/sysv/linux/bits/timex.h b/sysdeps/unix/sysv/linux/bits/timex.h index bb272e8b19..db36759fba 100644 --- a/sysdeps/unix/sysv/linux/bits/timex.h +++ b/sysdeps/unix/sysv/linux/bits/timex.h @@ -18,10 +18,16 @@ #ifndef _BITS_TIMEX_H #define _BITS_TIMEX_H 1 +#if !defined _SYS_TIMEX_H && !defined _BITS_TIME_H +# error "Never include directly; use instead." +#endif + #include #include -/* These definitions from linux/timex.h as of 3.18. */ +/* These definitions match linux/timex.h as of 5.0. */ + +#define NTP_API 4 /* NTP API version */ struct timex { @@ -47,7 +53,7 @@ struct timex int tai; /* TAI offset (ro) */ - /* ??? */ + /* room for future expansion */ int :32; int :32; int :32; int :32; int :32; int :32; int :32; int :32; int :32; int :32; int :32; @@ -65,6 +71,7 @@ struct timex #define ADJ_MICRO 0x1000 /* select microsecond resolution */ #define ADJ_NANO 0x2000 /* select nanosecond resolution */ #define ADJ_TICK 0x4000 /* tick value */ + #define ADJ_OFFSET_SINGLESHOT 0x8001 /* old-fashioned adjtime */ #define ADJ_OFFSET_SS_READ 0xa001 /* read-only adjtime */ @@ -107,4 +114,13 @@ struct timex #define STA_RONLY (STA_PPSSIGNAL | STA_PPSJITTER | STA_PPSWANDER \ | STA_PPSERROR | STA_CLOCKERR | STA_NANO | STA_MODE | STA_CLK) +/* Clock states (codes returned by adjtimex) */ +#define TIME_OK 0 /* clock synchronized, no leap second */ +#define TIME_INS 1 /* insert leap second */ +#define TIME_DEL 2 /* delete leap second */ +#define TIME_OOP 3 /* leap second in progress */ +#define TIME_WAIT 4 /* leap second has occurred */ +#define TIME_ERROR 5 /* clock not synchronized */ +#define TIME_BAD TIME_ERROR /* bw compat */ + #endif /* bits/timex.h */ diff --git a/sysdeps/unix/sysv/linux/ntp_gettime.c b/sysdeps/unix/sysv/linux/ntp_gettime.c index cff9b603e0..571339f5d7 100644 --- a/sysdeps/unix/sysv/linux/ntp_gettime.c +++ b/sysdeps/unix/sysv/linux/ntp_gettime.c @@ -21,10 +21,6 @@ #undef ntp_gettime -#ifndef MOD_OFFSET -# define modes mode -#endif - int ntp_gettime (struct ntptimeval *ntv) diff --git a/sysdeps/unix/sysv/linux/ntp_gettimex.c b/sysdeps/unix/sysv/linux/ntp_gettimex.c index 044122bfd0..c83aa1e718 100644 --- a/sysdeps/unix/sysv/linux/ntp_gettimex.c +++ b/sysdeps/unix/sysv/linux/ntp_gettimex.c @@ -17,10 +17,6 @@ #include -#ifndef MOD_OFFSET -# define modes mode -#endif - int ntp_gettimex (struct ntptimeval *ntv) diff --git a/sysdeps/unix/sysv/linux/sys/timex.h b/sysdeps/unix/sysv/linux/sys/timex.h index c71ace1d3d..ee579466d1 100644 --- a/sysdeps/unix/sysv/linux/sys/timex.h +++ b/sysdeps/unix/sysv/linux/sys/timex.h @@ -19,14 +19,11 @@ #define _SYS_TIMEX_H 1 #include -#include - -/* These definitions from linux/timex.h as of 2.6.30. */ +/* Get struct timex and related constants. */ #include -#define NTP_API 4 /* NTP API version */ - +/* Parameter structure used by ntp_gettime(x). */ struct ntptimeval { struct timeval time; /* current time (ro) */ @@ -40,17 +37,6 @@ struct ntptimeval long int __glibc_reserved4; }; -/* Clock states (time_state) */ -#define TIME_OK 0 /* clock synchronized, no leap second */ -#define TIME_INS 1 /* insert leap second */ -#define TIME_DEL 2 /* delete leap second */ -#define TIME_OOP 3 /* leap second in progress */ -#define TIME_WAIT 4 /* leap second has occurred */ -#define TIME_ERROR 5 /* clock not synchronized */ -#define TIME_BAD TIME_ERROR /* bw compat */ - -/* Maximum time constant of the PLL. */ -#define MAXTC 6 __BEGIN_DECLS From patchwork Wed Jun 26 17:50:25 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Zack Weinberg X-Patchwork-Id: 1122967 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-103188-incoming=patchwork.ozlabs.org@sourceware.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=panix.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.b="KKogQgpC"; 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 45Ys2H1wZrz9s7h for ; Thu, 27 Jun 2019 04:27:19 +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:in-reply-to :references:mime-version:content-type:content-transfer-encoding; q=dns; s=default; b=Oyb62Iv9bPCjEpEg8LrFFrXyG2CGrDL+2XEKkfoskY7 i1dRXqaE0Nk6aHeVx1k5qlLj1aEG7FWjIBgYiFxFwR6T1mIwOy5wqXa/9zYe5lYL 89iKp11TybdyGTtvW3H8s7UFKmAsZy5YJVVUC1qCU6wQevXu7AoIt3tpvWRS+jsg = 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:in-reply-to :references:mime-version:content-type:content-transfer-encoding; s=default; bh=GflVMkoJtIi4tFCDA8GW1VIDlT0=; b=KKogQgpCnXLzr69qv 17nNX07yxWmsdA7VefvJYJilgNyCYHm33zANQCRyj142G3VoaAYNzMqvRIuPDRCd KpRtWs0T+l4h2gQVJZqA5RhDl919ueQSxof8WIc1lsrP6p0QTbG3pntk7raE3PmI /mh/SPfD9bwhrp+5wHmEDB3AQE= Received: (qmail 3262 invoked by alias); 26 Jun 2019 18:26:44 -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 3169 invoked by uid 89); 26 Jun 2019 18:26:43 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-16.2 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_SHORT, SPF_HELO_PASS, SPF_PASS, UNSUBSCRIBE_BODY autolearn=ham version=3.3.1 spammy=username, Watch, involve X-HELO: l2mail1.panix.com From: Zack Weinberg To: libc-alpha@sourceware.org Cc: joseph@codesourcery.com, carlos@redhat.com Subject: [PATCH 21/25] =?utf-8?q?Don=E2=80=99t_include_sys/types=2Eh_or_st?= =?utf-8?q?dint=2Eh_from_most_public_headers=2E?= Date: Wed, 26 Jun 2019 13:50:25 -0400 Message-Id: <20190626175029.4699-12-zackw@panix.com> In-Reply-To: <20190626175029.4699-1-zackw@panix.com> References: <20190626175029.4699-1-zackw@panix.com> MIME-Version: 1.0 Many public headers include sys/types.h and/or stdint.h when they only need and/or are supposed to define a small number of types from that header. This patch changes as many of them as practical to include only the single-type headers for the types they are actually specified to define, and use the impl-namespace aliases for any types they need but are not specified to define. In most cases, where a header has historically used uintN_t types, I changed it to use __uintN_t types; in a few cases I chose to have it continue to define the complete set of those types (using ). After this patch, the public headers that still include sys/types.h are: stdlib.h and sys/param.h, where removal would risk breaking far too much; the inclusion of sys/types.h; regex.h, which is taken verbatim from gnulib and can't include features.h directly (I'm open to better ideas); sys/bitypes.h, which is an alternative name for sys/types.h; and the networking headers, which will be dealt with separately. The headers that still include stdint.h are: inttypes.h, as required by ISO C; elf.h and thread_db.h, see discussion of debugger interface headers below; and, again, the networking headers will be dealt with separately. While I was at it, I moved headers out of sysdeps where possible: If we have only a sysdeps/generic/something.h or sysdeps/gnu/something.h, no other sysdeps variants, it is not really system-dependent and can be moved to the directory that installs it. If we have both sysdeps/generic/ and gnu/something.h, the generic version is never used (since we support only GNUish systems these days) and can be deleted, and the gnu-version can be moved to the directory that installs it. If the only copy of a bits header is in the top-level bits directory, it is not system-dependent. For utmp.h and utmpx.h, I think we might be able to fold their respective bits headers into the primary headers and make them not system-dependent at all. The remaining variation is between s390*-*-linux* and everything else, and it appears to me that the s390 versions of the bits headers are actually the headers that everyone should be using. The only difference is that the s390 headers unconditionally use 64-bit quantities for lastlog.ll_time, utmp{,x}.ut_tv, and utmp{,x}.ut_session, whereas the generic headers use either 64- or 32-bit quantities depending on __WORDSIZE_TIME64_COMPAT32. I could be wrong, but I don’t think it makes sense for programs with 64-bit and 32-bit time_t to have different ideas of the layout of a structures that are copied directly to and from a shared file on disk. But fixing that doesn’t belong in this patch series. The conform tests expect utmpx.h to define time_t and suseconds_t. These are the public names for the types of the fields of struct timeval, and utmpx.h is required to define struct timeval, so this is a reasonable expectation even though POSIX doesn't _explicitly_ say it's also required to define time_t and suseconds_t. utmp.h is not a standard header but it makes sense for it to be as consistent with utmpx.h as possible, especially in our implementation where /var/log/utmp and /var/log/utmpx have the same format. I thought I was going to need to change all of the arch-specific bits/epoll.h headers as well as sys/epoll.h, but it turned out not to be necessary. I still took the opportunity to give them all multiple inclusion guards. I suspect we do not need as many copies of bits/fcntl.h and bits/sem.h as we have, but that’s complicated enough that it deserves its own patchset. The debugger interface headers are a mess and I only have so much patience for them. This does the bare minimum required for thread_db.h, sys/procfs.h, and sys/user.h, which are at least nominally cross-platform interfaces, to avoid including sys/types.h, sys/time.h, and/or signal.h. Exposure of sys/ucontext.h is reduced but not eliminated. Cross-architecture consistency should be improved. It would be desirable to stop including stdint.h from elf.h and thread_db.h as well, but that would involve touching dozens more bits headers and I ran out of patience. Git does not understand “remove file X and then rename file Y over the top of it” very well, so the diff looks bigger than it should. This is another partial fix for Hurd-specific bug 23088. The headers that are still affected by that bug are aio.h, mqueue.h, regex.h, signal.h, stdlib.h, and sys/types.h. * io/ftw.h: Don't include sys/types.h. * misc/sys/uio.h: Don't include sys/types.h. Include bits/types.h, bits/types/size_t.h, and bits/types/ssize_t.h. * posix/spawn.h: Don't include sys/types.h. Include bits/types.h, bits/types/mode_t.h, and bits/types/pid_t.h. * rt/aio.h: Don't include sys/types.h. Include bits/types.h, bits/pthreadtypes.h, bits/types/size_t.h, and bits/types/ssize_t.h. * sysdeps/pthread/semaphore.h: Don't include sys/types.h. * sysdeps/unix/sysv/linux/bits/uio-ext.h: Use __pid_t, not pid_t. * sysdeps/generic/netinet/in_systm.h: Rename to inet/netinet/in_systm.h. Include bits/stdint-uintn.h, not sys/types.h or stdint.h. * sysdeps/generic/netinet/ip.h: Rename to inet/netinet/ip.h. Include bits/stdint-uintn.h and bits/endian.h, not sys/types.h. * sysdeps/gnu/netinet/tcp.h: Rename to inet/netinet/tcp.h. Include bits/stdint-uintn.h and bits/endian.h, not sys/types.h or stdint.h. * sydeps/gnu/net/if.h: Rename to socket/net/if.h. Don’t include sys/types.h. * include/net/if.h: Include socket/net/if.h, rather than whatever the next net/if.h on the include path is. * include/netinet/in_systm.h, include/netinet/ip.h * include/netinet/tcp.h: New trivial wrappers. * sysdeps/generic/net/if.h: Delete, never used. * sysdeps/generic/netinet/tcp.h: Delete, never used. * bits/utmp.h: Delete file. * sysdeps/gnu/bits/utmp.h: Move to bits/utmp.h. Add multiple include guard. Don’t include paths.h, sys/time.h, or sys/types.h. Don’t use struct timeval. Use __intN_t for consistency with bits/utmpx.h. * sysdeps/unix/sysv/linux/s390/bits/utmp.h: Add multiple include guard. Don’t include paths.h, sys/time.h, sys/types.h, or bits/wordsize.h. Don’t use struct timeval. Use __intN_t for consistency with bits/utmpx.h. Use __time64_t unconditionally for lastlog.ll_time. Use __int64_t unconditionally for utmp.ut_session. Adjust indentation and blank lines to match bits/utmp.h. * sysdeps/gnu/bits/utmpx.h: Move to bits/utmpx.h. Add multiple include guard. Don’t include paths.h, sys/time.h, bits/types.h, or bits/wordsize.h. Don’t define _PATH_UTMPX or _PATH_WTMPX. Don’t use struct timeval. Use pid_t for consistency with bits/utmp.h. * sysdeps/unix/sysv/linux/s390/bits/utmpx.h: Add multiple include guard. Don’t define _PATH_UTMPX or _PATH_WTMPX. Don’t include paths.h, sys/time.h, bits/types.h, or bits/wordsize.h. Don’t define _PATH_UTMPX or _PATH_WTMPX. Don’t use struct timeval. Use pid_t for consistency with bits/utmp.h. Use __int64_t unconditionally for utmpx.ut_session. * login/utmp.h: Don’t include sys/types.h. Do include paths.h, bits/types.h, bits/types/pid_t.h, bits/types/suseconds_t, bits/types/time_t.h, and bits/types/struct_timeval.h. Move __BEGIN_DECLS to enclose only prototypes. * sysdeps/gnu/utmpx.h: Move to login/utmpx.h. Don’t include sys/time.h. Do include bits/types.h, bits/types/suseconds_t, bits/types/time_t.h, and bits/types/struct_timeval.h. When __USE_GNU, include paths.h and define _PATH_UTMPX and _PATH_WTMPX. * login/Makefile (headers): Add utmpx.h and bits/utmpx.h. (routines): Add endutxent, getutmp, getutmpx, getutxent, getutxid, getutxline, pututxline, setutxent, updwtmpx, and utmpxname. Reorganize. * sysdeps/gnu/Makefile: Do not add anything to sysdep_routines or sysdep_headers when subdir == login. * sysdeps/gnu/sys/mtio.h: Move to misc/sys/mtio.h. Don't include sys/types.h. * sysdeps/gnu/Makefile: Don't add anything to sysdep_headers for the misc directory. * misc/Makefile (headers): Add sys/mtio.h. * include/sys/mtio.h: New wrapper. * elf/link.h, inet/aliases.h, misc/sys/xattr.h: Don't include sys/types.h. Include bits/types/size_t.h. * gmon/sys/gmon.h: Don't include sys/types.h. * gmon/sys/profil.h: Don't include sys/types.h. Include bits/types/size_t.h and bits/types/struct_timeval.h. * io/fts.h: Don't include sys/types.h. Include bits/types/dev_t.h, bits/types/ino_t.h, bits/types/ino64_t.h, and bits/types/nlink_t.h. * io/sys/sendfile.h: Don't include sys/types.h. Include bits/types.h, bits/types/off_t.h, bits/types/size_t.h, and bits/types/ssize_t.h. * stdlib/sys/random.h: Don't include sys/types.h. Include bits/types/size_t.h and bits/types/ssize_t.h. * gmon/tst-sprofil.h: Include sys/time.h. * sysdeps/mach/hurd/sendfile.c: Include sys/types.h. * sysdeps/unix/sysv/linux/sys/epoll.h: Don’t include stdint.h or sys/types.h. Do include features.h and bits/types.h. (union epoll_data, struct epoll_event): Use __uint32_t and __uint64_t for field types. * sysdeps/unix/sysv/linux/alpha/bits/epoll.h * sysdeps/unix/sysv/linux/bits/epoll.h * sysdeps/unix/sysv/linux/hppa/bits/epoll.h * sysdeps/unix/sysv/linux/mips/bits/epoll.h * sysdeps/unix/sysv/linux/sparc/bits/epoll.h * sysdeps/unix/sysv/linux/x86/bits/epoll.h: Add multiple inclusion guard. * sysdeps/unix/sysv/linux/alpha/sys/acct.h: Style fix. * sysdeps/unix/sysv/linux/sys/acct.h: Include features.h and bits/stdint-uintn.h. Don't include sys/types.h, stdint.h, or bits/types/time_t.h. * sysdeps/unix/sysv/linux/sys/fsuid.h * sysdeps/unix/sysv/linux/sys/quota.h Include bits/types.h, not sys/types.h. * sysdeps/nptl/sys/procfs.h: Include features.h and bits/types.h, not sys/types.h. * sysdeps/nptl/thread_db.h: Don’t include sys/types.h. * sysdeps/nptl/proc_service.h: Include bits/types/pid_t.h and bits/types/size_t.h. * sysdeps/unix/sysv/linux/sys/procfs.h: Include bits/types.h and bits/types/struct_timeval.h, not sys/time.h or sys/types.h. * sysdeps/unix/sysv/linux/aarch64/bits/procfs.h: Add multiple inclusion guard. Include bits/types.h. Correct a comment. * sysdeps/unix/sysv/linux/alpha/bits/procfs-prregset.h: Add multiple inclusion guard. Include sys/ucontext.h. * sysdeps/unix/sysv/linux/alpha/bits/procfs.h * sysdeps/unix/sysv/linux/sparc/bits/procfs.h Add multiple inclusion guard. Don’t include signal.h or sys/ucontext.h. * sysdeps/unix/sysv/linux/ia64/bits/procfs.h: Add multiple inclusion guard. Include sys/ucontext.h, not signal.h. * sysdeps/unix/sysv/linux/powerpc/bits/procfs.h: Add multiple inclusion guard. Don’t include signal.h or sys/ucontext.h. Include bits/wordsize.h and asm/elf.h. Adjust conditional for whether to provide various fallback definitions. * sysdeps/unix/sysv/linux/arm/bits/procfs.h * sysdeps/unix/sysv/linux/csky/bits/procfs.h * sysdeps/unix/sysv/linux/hppa/bits/procfs.h * sysdeps/unix/sysv/linux/m68k/bits/procfs.h * sysdeps/unix/sysv/linux/microblaze/bits/procfs.h * sysdeps/unix/sysv/linux/mips/bits/procfs.h * sysdeps/unix/sysv/linux/nios2/bits/procfs.h * sysdeps/unix/sysv/linux/riscv/bits/procfs.h * sysdeps/unix/sysv/linux/s390/bits/procfs.h * sysdeps/unix/sysv/linux/sh/bits/procfs.h * sysdeps/unix/sysv/linux/x86/bits/procfs.h: Add multiple inclusion guard. Improve commentary. * sysdeps/posix/dl-fileid.h (r_file_id): Use __dev_t and __ino64_t for field types. * nss/nss.h * sysdeps/powerpc/sys/platform/ppc.h * sysdeps/unix/sysv/linux/sys/eventfd.h * sysdeps/unix/sysv/linux/sys/fanotify.h * sysdeps/unix/sysv/linux/sys/inotify.h * sysdeps/unix/sysv/linux/sys/raw.h * sysdeps/unix/sysv/linux/sys/signalfd.h: Include bits/types.h, not stdint.h. Include features.h where not already doing so. Use __(u)intN_t types instead of (u)intN_t types in all declarations. * sysdeps/unix/sysv/linux/powerpc/bits/powerpc.h: Use __uint64_t instead of uint64_t. * nss/tst-nss-test4.c: Include stdint.h. * bits/fcntl.h: Add multiple include guard. Hoist inclusion of bits/types.h to top of file. * sysdeps/mach/hurd/bits/fcntl.h: Add multiple include guard. Include bits/types.h, not sys/types.h; remove redundant inclusion of bits/types.h in middle of file. * bits/sem.h: Add multiple include guard. Include bits/types.h, not sys/types.h. * sysdeps/gnu/bits/sem.h: Likewise. * sysdeps/unix/sysv/linux/bits/sem.h: Likewise. * sysdeps/unix/sysv/linux/ia64/bits/ipc.h: Likewise. * sysvipc/sys/sem.h: Include bits/types/pid_t.h and bits/types/time_t.h. * resolv/bits/types/res_state.h: Include bits/types.h, not sys/types.h. Use __uint32_t and __uint16_t, not uint32_t and uint16_t. * sysdeps/mach/hurd/bits/socket.h: Include bits/types.h, not sys/types.h. * sysdeps/unix/sysv/linux/bits/socket.h: Likewise. Use __pid_t, __uid_t, and __gid_t, not pid_t, uid_t, and gid_t. * socket/sys/socket.h: Include bits/types.h, bits/types/ssize_t.h, and bits/types/socklen_t.h. * inet/htonl.c, include/htons.c: Include endian.h. * include/netinet/ether.h: Include bits/types/size_t.h. * scripts/check-obsolete-constructs.py (HEADER_ALLOWED_INCLUDES, SYSDEP_ALLOWED_INCLUDES): Update. * sysdeps/mach/hurd/i386/Makefile: Update list of xfails for bug 23088. --- bits/fcntl.h | 9 +- bits/sem.h | 7 +- {sysdeps/gnu/bits => bits}/utmp.h | 32 ++++-- {sysdeps/gnu/bits => bits}/utmpx.h | 35 +++--- elf/link.h | 2 +- gmon/sys/gmon.h | 2 - gmon/sys/profil.h | 4 +- gmon/tst-sprofil.c | 1 + include/net/if.h | 2 +- include/netinet/ether.h | 1 + include/netinet/in_systm.h | 1 + include/netinet/ip.h | 1 + include/netinet/tcp.h | 1 + include/sys/mtio.h | 1 + include/utmpx.h | 1 + inet/aliases.h | 4 +- inet/htonl.c | 3 +- inet/htons.c | 2 + {sysdeps/generic => inet}/netinet/in_systm.h | 3 +- {sysdeps/generic => inet}/netinet/ip.h | 3 +- {sysdeps/gnu => inet}/netinet/tcp.h | 4 +- io/fts.h | 5 +- io/ftw.h | 1 - io/sys/sendfile.h | 6 +- login/Makefile | 13 ++- login/utmp.h | 15 ++- {sysdeps/gnu => login}/utmpx.h | 9 +- misc/Makefile | 6 +- {sysdeps/gnu => misc}/sys/mtio.h | 3 - misc/sys/uio.h | 5 +- misc/sys/xattr.h | 3 +- nss/nss.h | 6 +- nss/tst-nss-test4.c | 1 + posix/spawn.h | 5 +- resolv/bits/types/res_state.h | 12 +- rt/aio.h | 7 +- rt/mqueue.h | 8 +- scripts/check-obsolete-constructs.py | 62 +++------- {sysdeps/gnu => socket}/net/if.h | 8 +- socket/sys/socket.h | 3 + stdlib/sys/random.h | 4 +- sysdeps/generic/net/if.h | 49 -------- sysdeps/generic/netinet/tcp.h | 107 ------------------ sysdeps/gnu/Makefile | 12 -- sysdeps/gnu/bits/sem.h | 7 +- sysdeps/mach/hurd/bits/fcntl.h | 11 +- sysdeps/mach/hurd/bits/socket.h | 2 +- sysdeps/mach/hurd/i386/Makefile | 35 ------ sysdeps/mach/hurd/sendfile.c | 1 + sysdeps/nptl/proc_service.h | 3 + sysdeps/nptl/sys/procfs.h | 3 +- sysdeps/nptl/thread_db.h | 1 - sysdeps/posix/dl-fileid.h | 4 +- sysdeps/powerpc/sys/platform/ppc.h | 10 +- sysdeps/pthread/semaphore.h | 2 +- sysdeps/unix/sysv/linux/aarch64/bits/procfs.h | 13 ++- sysdeps/unix/sysv/linux/alpha/bits/epoll.h | 5 + .../sysv/linux/alpha/bits/procfs-prregset.h | 9 ++ sysdeps/unix/sysv/linux/alpha/bits/procfs.h | 8 +- sysdeps/unix/sysv/linux/alpha/sys/acct.h | 2 +- sysdeps/unix/sysv/linux/arm/bits/procfs.h | 9 +- sysdeps/unix/sysv/linux/bits/epoll.h | 5 + sysdeps/unix/sysv/linux/bits/sem.h | 7 +- sysdeps/unix/sysv/linux/bits/socket.h | 8 +- sysdeps/unix/sysv/linux/bits/uio-ext.h | 4 +- sysdeps/unix/sysv/linux/csky/bits/procfs.h | 5 + sysdeps/unix/sysv/linux/hppa/bits/epoll.h | 5 + sysdeps/unix/sysv/linux/hppa/bits/procfs.h | 5 + sysdeps/unix/sysv/linux/ia64/bits/ipc.h | 2 +- sysdeps/unix/sysv/linux/ia64/bits/procfs.h | 8 +- sysdeps/unix/sysv/linux/m68k/bits/procfs.h | 9 +- .../unix/sysv/linux/microblaze/bits/procfs.h | 9 +- sysdeps/unix/sysv/linux/microblaze/sys/user.h | 4 +- sysdeps/unix/sysv/linux/mips/bits/epoll.h | 5 + sysdeps/unix/sysv/linux/mips/bits/procfs.h | 5 + sysdeps/unix/sysv/linux/nios2/bits/procfs.h | 5 + sysdeps/unix/sysv/linux/powerpc/bits/ppc.h | 2 +- sysdeps/unix/sysv/linux/powerpc/bits/procfs.h | 20 ++-- sysdeps/unix/sysv/linux/powerpc/sys/user.h | 1 + sysdeps/unix/sysv/linux/riscv/bits/procfs.h | 8 ++ sysdeps/unix/sysv/linux/s390/bits/procfs.h | 7 ++ .../{gnu => unix/sysv/linux/s390}/bits/utmp.h | 37 +++--- sysdeps/unix/sysv/linux/s390/bits/utmpx.h | 34 ++---- sysdeps/unix/sysv/linux/sh/bits/procfs.h | 5 + sysdeps/unix/sysv/linux/sparc/bits/epoll.h | 5 + sysdeps/unix/sysv/linux/sparc/bits/procfs.h | 7 +- sysdeps/unix/sysv/linux/sys/acct.h | 6 +- sysdeps/unix/sysv/linux/sys/epoll.h | 10 +- sysdeps/unix/sysv/linux/sys/eventfd.h | 5 +- sysdeps/unix/sysv/linux/sys/fanotify.h | 6 +- sysdeps/unix/sysv/linux/sys/fsuid.h | 2 +- sysdeps/unix/sysv/linux/sys/inotify.h | 11 +- sysdeps/unix/sysv/linux/sys/procfs.h | 6 +- sysdeps/unix/sysv/linux/sys/quota.h | 2 +- sysdeps/unix/sysv/linux/sys/raw.h | 7 +- sysdeps/unix/sysv/linux/sys/signalfd.h | 47 ++++---- sysdeps/unix/sysv/linux/x86/bits/epoll.h | 5 + sysdeps/unix/sysv/linux/x86/bits/procfs.h | 5 + sysvipc/sys/sem.h | 2 + 99 files changed, 443 insertions(+), 477 deletions(-) copy {sysdeps/gnu/bits => bits}/utmp.h (83%) rename {sysdeps/gnu/bits => bits}/utmpx.h (82%) create mode 100644 include/netinet/in_systm.h create mode 100644 include/netinet/ip.h create mode 100644 include/netinet/tcp.h create mode 100644 include/sys/mtio.h create mode 100644 include/utmpx.h rename {sysdeps/generic => inet}/netinet/in_systm.h (97%) rename {sysdeps/generic => inet}/netinet/ip.h (99%) rename {sysdeps/gnu => inet}/netinet/tcp.h (99%) rename {sysdeps/gnu => login}/utmpx.h (94%) rename {sysdeps/gnu => misc}/sys/mtio.h (99%) rename {sysdeps/gnu => socket}/net/if.h (98%) delete mode 100644 sysdeps/generic/net/if.h delete mode 100644 sysdeps/generic/netinet/tcp.h rename sysdeps/{gnu => unix/sysv/linux/s390}/bits/utmp.h (83%) diff --git a/bits/fcntl.h b/bits/fcntl.h index 8bb1357684..c69869f1c4 100644 --- a/bits/fcntl.h +++ b/bits/fcntl.h @@ -16,10 +16,14 @@ License along with the GNU C Library; if not, see . */ +#ifndef _BITS_FCNTL_H +#define _BITS_FCNTL_H 1 + #ifndef _FCNTL_H #error "Never use directly; include instead." #endif +#include /* File access modes for `open' and `fcntl'. */ #define O_RDONLY 0 /* Open read-only. */ @@ -104,9 +108,6 @@ /* File descriptor flags used with F_GETFD and F_SETFD. */ #define FD_CLOEXEC 1 /* Close on exec. */ - -#include - /* The structure describing an advisory lock. This is the type of the third argument to `fcntl' for the F_GETLK, F_SETLK, and F_SETLKW requests. */ struct flock @@ -144,3 +145,5 @@ struct flock64 # define POSIX_FADV_DONTNEED 4 /* Don't need these pages. */ # define POSIX_FADV_NOREUSE 5 /* Data will be accessed once. */ #endif + +#endif diff --git a/bits/sem.h b/bits/sem.h index 02754c7e58..6eed74c12e 100644 --- a/bits/sem.h +++ b/bits/sem.h @@ -15,11 +15,14 @@ License along with the GNU C Library; if not, see . */ +#ifndef _BITS_SEM_H +#define _BITS_SEM_H 1 + #ifndef _SYS_SEM_H # error "Never include directly; use instead." #endif -#include +#include /* Flags for `semop'. */ #define SEM_UNDO 0x1000 /* undo the operation on exit */ @@ -58,3 +61,5 @@ struct semid_ds incorrect. One can test the macro _SEM_SEMUN_UNDEFINED to see whether one must define the union or not. */ #define _SEM_SEMUN_UNDEFINED 1 + +#endif /* bits/sem.h */ diff --git a/sysdeps/gnu/bits/utmp.h b/bits/utmp.h similarity index 83% copy from sysdeps/gnu/bits/utmp.h copy to bits/utmp.h index 7357034cb6..3d593e0c0a 100644 --- a/sysdeps/gnu/bits/utmp.h +++ b/bits/utmp.h @@ -16,13 +16,13 @@ License along with the GNU C Library; if not, see . */ +#ifndef _BITS_UTMP_H +#define _BITS_UTMP_H 1 + #ifndef _UTMP_H # error "Never include directly; use instead." #endif -#include -#include -#include #include @@ -36,7 +36,7 @@ struct lastlog { #if __WORDSIZE_TIME64_COMPAT32 - int32_t ll_time; + __int32_t ll_time; #else __time_t ll_time; #endif @@ -68,23 +68,29 @@ struct utmp __attribute_nonstring__; /* Hostname for remote login. */ struct exit_status ut_exit; /* Exit status of a process marked as DEAD_PROCESS. */ + /* The ut_session and ut_tv fields must be the same size when compiled 32- and 64-bit. This allows data files and shared memory to be - shared between 32- and 64-bit applications. */ + shared between 32- and 64-bit applications. Even on 64-bit systems, + struct timeval is not guaranteed to have both fields be 64 bits. */ #if __WORDSIZE_TIME64_COMPAT32 - int32_t ut_session; /* Session ID, used for windowing. */ + __int32_t ut_session; /* Session ID, used for windowing. */ struct { - int32_t tv_sec; /* Seconds. */ - int32_t tv_usec; /* Microseconds. */ + __int32_t tv_sec; /* Seconds. */ + __int32_t tv_usec; /* Microseconds. */ } ut_tv; /* Time entry was made. */ #else - long int ut_session; /* Session ID, used for windowing. */ - struct timeval ut_tv; /* Time entry was made. */ + __int64_t ut_session; /* Session ID, used for windowing. */ + struct + { + __int64_t tv_sec; /* Seconds. */ + __int64_t tv_usec; /* Microseconds. */ + } ut_tv; /* Time entry was made. */ #endif - int32_t ut_addr_v6[4]; /* Internet address of remote host. */ - char __glibc_reserved[20]; /* Reserved for future use. */ + __int32_t ut_addr_v6[4]; /* Internet address of remote host. */ + char __glibc_reserved[20]; /* Reserved for future use. */ }; /* Backwards compatibility hacks. */ @@ -124,3 +130,5 @@ struct utmp #define _HAVE_UT_ID 1 #define _HAVE_UT_TV 1 #define _HAVE_UT_HOST 1 + +#endif /* bits/utmp.h */ diff --git a/sysdeps/gnu/bits/utmpx.h b/bits/utmpx.h similarity index 82% rename from sysdeps/gnu/bits/utmpx.h rename to bits/utmpx.h index 472a7d57d3..ac4a5323fd 100644 --- a/sysdeps/gnu/bits/utmpx.h +++ b/bits/utmpx.h @@ -16,22 +16,13 @@ License along with the GNU C Library; if not, see . */ +#ifndef _BITS_UTMPX_H +#define _BITS_UTMPX_H 1 + #ifndef _UTMPX_H # error "Never include directly; use instead." #endif -#include -#include -#include - - -#ifdef __USE_GNU -# include -# define _PATH_UTMPX _PATH_UTMP -# define _PATH_WTMPX _PATH_WTMP -#endif - - #define __UT_LINESIZE 32 #define __UT_NAMESIZE 32 #define __UT_HOSTSIZE 256 @@ -55,7 +46,7 @@ struct __exit_status struct utmpx { short int ut_type; /* Type of login. */ - __pid_t ut_pid; /* Process ID of login process. */ + pid_t ut_pid; /* Process ID of login process. */ char ut_line[__UT_LINESIZE]; /* Devicename. */ char ut_id[4]; /* Inittab ID. */ char ut_user[__UT_NAMESIZE]; /* Username. */ @@ -63,9 +54,10 @@ struct utmpx struct __exit_status ut_exit; /* Exit status of a process marked as DEAD_PROCESS. */ -/* The fields ut_session and ut_tv must be the same size when compiled - 32- and 64-bit. This allows files and shared memory to be shared - between 32- and 64-bit applications. */ +/* The ut_session and ut_tv fields must be the same size when compiled + 32- and 64-bit. This allows data files and shared memory to be + shared between 32- and 64-bit applications. Even on 64-bit systems, + struct timeval is not guaranteed to have both fields be 64 bits. */ #if __WORDSIZE_TIME64_COMPAT32 __int32_t ut_session; /* Session ID, used for windowing. */ struct @@ -74,9 +66,14 @@ struct utmpx __int32_t tv_usec; /* Microseconds. */ } ut_tv; /* Time entry was made. */ #else - long int ut_session; /* Session ID, used for windowing. */ - struct timeval ut_tv; /* Time entry was made. */ + __int64_t ut_session; /* Session ID, used for windowing. */ + struct + { + __int64_t tv_sec; /* Seconds. */ + __int64_t tv_usec; /* Microseconds. */ + } ut_tv; /* Time entry was made. */ #endif + __int32_t ut_addr_v6[4]; /* Internet address of remote host. */ char __glibc_reserved[20]; /* Reserved for future use. */ }; @@ -100,3 +97,5 @@ struct utmpx #ifdef __USE_GNU # define ACCOUNTING 9 /* System accounting. */ #endif + +#endif /* bits/utmpx.h */ diff --git a/elf/link.h b/elf/link.h index 7a463bc2bf..7871b9aef8 100644 --- a/elf/link.h +++ b/elf/link.h @@ -23,7 +23,6 @@ #include #include #include -#include /* We use this macro to refer to ELF types independent of the native wordsize. `ElfW(TYPE)' is used in place of `Elf32_TYPE' or `Elf64_TYPE'. */ @@ -31,6 +30,7 @@ #define _ElfW(e,w,t) _ElfW_1 (e, w, _##t) #define _ElfW_1(e,w,t) e##w##t +#include #include /* Defines __ELF_NATIVE_CLASS. */ #include diff --git a/gmon/sys/gmon.h b/gmon/sys/gmon.h index b4cc3b043a..5d7de0fe9b 100644 --- a/gmon/sys/gmon.h +++ b/gmon/sys/gmon.h @@ -34,8 +34,6 @@ #include -#include - /* * See gmon_out.h for gmon.out format. */ diff --git a/gmon/sys/profil.h b/gmon/sys/profil.h index ba99ac8634..1122590213 100644 --- a/gmon/sys/profil.h +++ b/gmon/sys/profil.h @@ -20,8 +20,8 @@ #include -#include -#include +#include +#include /* This interface is intended to follow the sprofil() system calls as described by the sprofil(2) man page of Irix v6.5, except that: diff --git a/gmon/tst-sprofil.c b/gmon/tst-sprofil.c index 3f7f909cba..53de7a624d 100644 --- a/gmon/tst-sprofil.c +++ b/gmon/tst-sprofil.c @@ -20,6 +20,7 @@ #include #include #include +#include #include diff --git a/include/net/if.h b/include/net/if.h index 6c4cbc96c3..2e7af05ed2 100644 --- a/include/net/if.h +++ b/include/net/if.h @@ -1,6 +1,6 @@ #ifndef _NET_IF_H -# include_next +#include #ifndef _ISOMAC libc_hidden_proto (if_nametoindex) diff --git a/include/netinet/ether.h b/include/netinet/ether.h index 8bfe7e03ad..a60aa27240 100644 --- a/include/netinet/ether.h +++ b/include/netinet/ether.h @@ -2,6 +2,7 @@ #include # ifndef _ISOMAC +# include libc_hidden_proto (ether_aton_r) libc_hidden_proto (ether_ntoa_r) diff --git a/include/netinet/in_systm.h b/include/netinet/in_systm.h new file mode 100644 index 0000000000..7634c9b5a0 --- /dev/null +++ b/include/netinet/in_systm.h @@ -0,0 +1 @@ +#include diff --git a/include/netinet/ip.h b/include/netinet/ip.h new file mode 100644 index 0000000000..da55733e90 --- /dev/null +++ b/include/netinet/ip.h @@ -0,0 +1 @@ +#include diff --git a/include/netinet/tcp.h b/include/netinet/tcp.h new file mode 100644 index 0000000000..edba529813 --- /dev/null +++ b/include/netinet/tcp.h @@ -0,0 +1 @@ +#include diff --git a/include/sys/mtio.h b/include/sys/mtio.h new file mode 100644 index 0000000000..f4861bda70 --- /dev/null +++ b/include/sys/mtio.h @@ -0,0 +1 @@ +#include diff --git a/include/utmpx.h b/include/utmpx.h new file mode 100644 index 0000000000..cfe9b7c054 --- /dev/null +++ b/include/utmpx.h @@ -0,0 +1 @@ +#include diff --git a/inet/aliases.h b/inet/aliases.h index 67828ca7b6..eebbbc46f2 100644 --- a/inet/aliases.h +++ b/inet/aliases.h @@ -19,9 +19,7 @@ #define _ALIASES_H 1 #include - -#include - +#include __BEGIN_DECLS diff --git a/inet/htonl.c b/inet/htonl.c index 39acfa6557..bb6b4f5899 100644 --- a/inet/htonl.c +++ b/inet/htonl.c @@ -15,8 +15,9 @@ License along with the GNU C Library; if not, see . */ -#include #include +#include +#include #undef htonl #undef ntohl diff --git a/inet/htons.c b/inet/htons.c index 500ca50f49..2b22ca123c 100644 --- a/inet/htons.c +++ b/inet/htons.c @@ -16,6 +16,8 @@ . */ #include +#include +#include #undef htons #undef ntohs diff --git a/sysdeps/generic/netinet/in_systm.h b/inet/netinet/in_systm.h similarity index 97% rename from sysdeps/generic/netinet/in_systm.h rename to inet/netinet/in_systm.h index 2b3c74281b..6964aca21a 100644 --- a/sysdeps/generic/netinet/in_systm.h +++ b/inet/netinet/in_systm.h @@ -19,8 +19,7 @@ #ifndef _NETINET_IN_SYSTM_H #define _NETINET_IN_SYSTM_H 1 -#include -#include +#include __BEGIN_DECLS diff --git a/sysdeps/generic/netinet/ip.h b/inet/netinet/ip.h similarity index 99% rename from sysdeps/generic/netinet/ip.h rename to inet/netinet/ip.h index 13b03ff79f..35f61d1694 100644 --- a/sysdeps/generic/netinet/ip.h +++ b/inet/netinet/ip.h @@ -19,9 +19,10 @@ #define __NETINET_IP_H 1 #include -#include #include +#include +#include __BEGIN_DECLS diff --git a/sysdeps/gnu/netinet/tcp.h b/inet/netinet/tcp.h similarity index 99% rename from sysdeps/gnu/netinet/tcp.h rename to inet/netinet/tcp.h index 1a164a9649..7b07accce7 100644 --- a/sysdeps/gnu/netinet/tcp.h +++ b/inet/netinet/tcp.h @@ -85,9 +85,9 @@ #define TCP_REPAIR_OFF_NO_WP -1 #ifdef __USE_MISC -# include +# include +# include # include -# include typedef uint32_t tcp_seq; /* diff --git a/io/fts.h b/io/fts.h index acfa260f07..0e43b35236 100644 --- a/io/fts.h +++ b/io/fts.h @@ -51,8 +51,11 @@ #define _FTS_H 1 #include -#include +#include +#include +#include +#include typedef struct { struct _ftsent *fts_cur; /* current node */ diff --git a/io/ftw.h b/io/ftw.h index 1ef67f7f3c..ea1d1ee48b 100644 --- a/io/ftw.h +++ b/io/ftw.h @@ -24,7 +24,6 @@ #include -#include #include diff --git a/io/sys/sendfile.h b/io/sys/sendfile.h index b21c0857be..d0e8a6777e 100644 --- a/io/sys/sendfile.h +++ b/io/sys/sendfile.h @@ -20,7 +20,11 @@ #define _SYS_SENDFILE_H 1 #include -#include + +#include +#include +#include +#include __BEGIN_DECLS diff --git a/login/Makefile b/login/Makefile index 92535f0aec..e9bdd1ad15 100644 --- a/login/Makefile +++ b/login/Makefile @@ -23,12 +23,15 @@ subdir := login include ../Makeconfig -headers := utmp.h bits/utmp.h lastlog.h pty.h +headers := utmp.h bits/utmp.h utmpx.h bits/utmpx.h lastlog.h pty.h -routines := getlogin getlogin_r setlogin getlogin_r_chk \ - getutent getutent_r getutid getutline getutid_r getutline_r \ - utmp_file utmpname updwtmp getpt grantpt unlockpt ptsname \ - ptsname_r_chk +routines := \ + getlogin getlogin_r getlogin_r_chk setlogin \ + getpt grantpt ptsname ptsname_r_chk unlockpt \ + getutent getutent_r getutid getutid_r getutline getutline_r \ + getutmp updwtmp utmp_file utmpname \ + endutxent getutmpx getutxent getutxid getutxline pututxline \ + setutxent updwtmpx utmpxname CFLAGS-grantpt.c += -DLIBEXECDIR='"$(libexecdir)"' diff --git a/login/utmp.h b/login/utmp.h index 168c159b7b..9c12e3c915 100644 --- a/login/utmp.h +++ b/login/utmp.h @@ -20,21 +20,26 @@ #include -#include - - -__BEGIN_DECLS +/* utmp.h is not standardized; utmpx.h is, and is required to define + pid_t and struct timeval. It makes sense for utmp.h to be + consistent. */ +#include +#include +#include +#include +#include /* Get system dependent values and data structures. */ #include /* Compatibility names for the strings of the canonical file names. */ +#include #define UTMP_FILE _PATH_UTMP #define UTMP_FILENAME _PATH_UTMP #define WTMP_FILE _PATH_WTMP #define WTMP_FILENAME _PATH_WTMP - +__BEGIN_DECLS /* Make FD be the controlling terminal, stdin, stdout, and stderr; then close FD. Returns 0 on success, nonzero on error. */ diff --git a/sysdeps/gnu/utmpx.h b/login/utmpx.h similarity index 94% rename from sysdeps/gnu/utmpx.h rename to login/utmpx.h index 41c122d970..de18f58e9e 100644 --- a/sysdeps/gnu/utmpx.h +++ b/login/utmpx.h @@ -19,15 +19,22 @@ #define _UTMPX_H 1 #include -#include /* Required according to Unix98. */ +#include #include +#include +#include +#include /* Get system dependent values and data structures. */ #include #ifdef __USE_GNU +# include +# define _PATH_UTMPX _PATH_UTMP +# define _PATH_WTMPX _PATH_WTMP + /* Compatibility names for the strings of the canonical file names. */ # define UTMPX_FILE _PATH_UTMPX # define UTMPX_FILENAME _PATH_UTMPX diff --git a/misc/Makefile b/misc/Makefile index e6c73896cd..106ce57776 100644 --- a/misc/Makefile +++ b/misc/Makefile @@ -36,9 +36,9 @@ headers := \ bits/uio-ext.h bits/uio_lim.h bits/xopen_lim.h \ gnu/libc-version.h \ sys/auxv.h sys/cdefs.h sys/dir.h sys/file.h sys/ioctl.h \ - sys/mman.h sys/param.h sys/ptrace.h sys/queue.h sys/reboot.h \ - sys/select.h sys/swap.h sys/syscall.h sys/sysinfo.h \ - sys/syslog.h sys/sysmacros.h sys/uio.h sys/xattr.h + sys/mman.h sys/mtio.h sys/param.h sys/ptrace.h sys/queue.h \ + sys/reboot.h sys/select.h sys/swap.h sys/syscall.h \ + sys/sysinfo.h sys/syslog.h sys/sysmacros.h sys/uio.h sys/xattr.h routines := brk sbrk sstk ioctl \ readv writev preadv preadv64 pwritev pwritev64 \ diff --git a/sysdeps/gnu/sys/mtio.h b/misc/sys/mtio.h similarity index 99% rename from sysdeps/gnu/sys/mtio.h rename to misc/sys/mtio.h index 0ce41c58df..1387b13fac 100644 --- a/sysdeps/gnu/sys/mtio.h +++ b/misc/sys/mtio.h @@ -21,11 +21,8 @@ #ifndef _SYS_MTIO_H #define _SYS_MTIO_H 1 -/* Get necessary definitions from system and kernel headers. */ -#include #include - /* Structure for MTIOCTOP - magnetic tape operation command. */ struct mtop { diff --git a/misc/sys/uio.h b/misc/sys/uio.h index ec1ca4af82..40bedd079a 100644 --- a/misc/sys/uio.h +++ b/misc/sys/uio.h @@ -19,7 +19,10 @@ #define _SYS_UIO_H 1 #include -#include + +#include +#include +#include #include #include #ifdef __IOV_MAX diff --git a/misc/sys/xattr.h b/misc/sys/xattr.h index f1143f892c..03c7dec9aa 100644 --- a/misc/sys/xattr.h +++ b/misc/sys/xattr.h @@ -19,8 +19,9 @@ #define _SYS_XATTR_H 1 #include -#include +#include +#include __BEGIN_DECLS diff --git a/nss/nss.h b/nss/nss.h index 9d4f33e999..0be375259f 100644 --- a/nss/nss.h +++ b/nss/nss.h @@ -22,7 +22,7 @@ #define _NSS_H 1 #include -#include +#include __BEGIN_DECLS @@ -44,8 +44,8 @@ struct gaih_addrtuple struct gaih_addrtuple *next; char *name; int family; - uint32_t addr[4]; - uint32_t scopeid; + __uint32_t addr[4]; + __uint32_t scopeid; }; diff --git a/nss/tst-nss-test4.c b/nss/tst-nss-test4.c index cf6ef46b01..14bea82cb6 100644 --- a/nss/tst-nss-test4.c +++ b/nss/tst-nss-test4.c @@ -20,6 +20,7 @@ #include #include #include +#include #include diff --git a/posix/spawn.h b/posix/spawn.h index 471dbea022..2dd75439cb 100644 --- a/posix/spawn.h +++ b/posix/spawn.h @@ -21,7 +21,10 @@ #include #include -#include + +#include +#include +#include #include diff --git a/resolv/bits/types/res_state.h b/resolv/bits/types/res_state.h index 2544a627f6..81febe13b0 100644 --- a/resolv/bits/types/res_state.h +++ b/resolv/bits/types/res_state.h @@ -1,7 +1,7 @@ #ifndef __res_state_defined #define __res_state_defined 1 -#include +#include #include /* res_state: the global state used by the resolver stub. */ @@ -28,7 +28,7 @@ struct __res_state { unsigned unused:23; struct { struct in_addr addr; - uint32_t mask; + __uint32_t mask; } sort_list[MAXRESOLVSORT]; /* 4 byte hole here on 64-bit architectures. */ void * __glibc_unused_qhook; @@ -40,11 +40,11 @@ struct __res_state { union { char pad[52]; /* On an i386 this means 512b total. */ struct { - uint16_t nscount; - uint16_t nsmap[MAXNS]; + __uint16_t nscount; + __uint16_t nsmap[MAXNS]; int nssocks[MAXNS]; - uint16_t nscount6; - uint16_t nsinit; + __uint16_t nscount6; + __uint16_t nsinit; struct sockaddr_in6 *nsaddrs[MAXNS]; #ifdef _LIBC unsigned long long int __glibc_extension_index diff --git a/rt/aio.h b/rt/aio.h index d1b97bf0e4..a874e45ac9 100644 --- a/rt/aio.h +++ b/rt/aio.h @@ -23,7 +23,12 @@ #define _AIO_H 1 #include -#include + +#include +#include +#include +#include +#include #include #include #include diff --git a/rt/mqueue.h b/rt/mqueue.h index 308a52c1bc..dcc786d12d 100644 --- a/rt/mqueue.h +++ b/rt/mqueue.h @@ -19,13 +19,19 @@ #define _MQUEUE_H 1 #include -#include #include + +#include +#include #include +#include +#include #include + /* Get the definition of mqd_t and struct mq_attr. */ #include + __BEGIN_DECLS /* Establish connection between a process and a message queue NAME and diff --git a/scripts/check-obsolete-constructs.py b/scripts/check-obsolete-constructs.py index f456c98def..1ecb7c9823 100755 --- a/scripts/check-obsolete-constructs.py +++ b/scripts/check-obsolete-constructs.py @@ -515,16 +515,15 @@ HEADER_ALLOWED_INCLUDES = { # mqueue.h -> fcntl.h # sched.h -> time.h # spawn.h -> sched.h - "aio.h": [ "sys/types.h" ], - "ftw.h": [ "sys/stat.h", "sys/types.h" ], + "ftw.h": [ "sys/stat.h" ], "langinfo.h": [ "nl_types.h" ], - "mqueue.h": [ "fcntl.h", "sys/types.h" ], + "mqueue.h": [ "fcntl.h" ], "pthread.h": [ "sched.h", "time.h" ], "regex.h": [ "limits.h", "sys/types.h" ], "sched.h": [ "time.h" ], - "semaphore.h": [ "sys/types.h" ], - "spawn.h": [ "sched.h", "sys/types.h" ], + "spawn.h": [ "sched.h" ], "termios.h": [ "sys/ttydefaults.h" ], + "utmpx.h": [ "paths.h" ], # POSIX sys/ headers # mandated: sys/msg.h -> sys/ipc.h @@ -538,77 +537,54 @@ HEADER_ALLOWED_INCLUDES = { # necessary for backward compatibility with BSD "sys/types.h": [ "endian.h" ], - "sys/uio.h": [ "sys/types.h" ], - # POSIX networking headers # allowed: netdb.h -> netinet/in.h # arpa/inet.h -> netinet/in.h "netdb.h": [ "netinet/in.h", "rpc/netdb.h" ], "arpa/inet.h": [ "netinet/in.h" ], - "net/if.h": [ "sys/socket.h", "sys/types.h" ], + "net/if.h": [ "sys/socket.h" ], "netinet/in.h": [ "sys/socket.h" ], - "netinet/tcp.h": [ "stdint.h", "sys/socket.h", - "sys/types.h" ], + "netinet/tcp.h": [ "sys/socket.h" ], # Nonstandardized top-level headers - "aliases.h": [ "sys/types.h" ], "argp.h": [ "ctype.h", "errno.h", "getopt.h", "limits.h", "stdio.h" ], "argz.h": [ "errno.h", "string.h" ], "elf.h": [ "stdint.h" ], "envz.h": [ "argz.h", "errno.h" ], - "fts.h": [ "sys/types.h" ], "gshadow.h": [ "paths.h" ], "ieee754.h": [ "float.h" ], "lastlog.h": [ "utmp.h" ], "libintl.h": [ "locale.h" ], - "link.h": [ "dlfcn.h", "elf.h", "sys/types.h" ], + "link.h": [ "dlfcn.h", "elf.h" ], "mntent.h": [ "paths.h" ], - "nss.h": [ "stdint.h" ], "obstack.h": [ "stddef.h", "string.h" ], "proc_service.h": [ "sys/procfs.h" ], "pty.h": [ "sys/ioctl.h", "termios.h" ], "sgtty.h": [ "sys/ioctl.h" ], "shadow.h": [ "paths.h" ], "stdio_ext.h": [ "stdio.h" ], - "thread_db.h": [ "pthread.h", "stdint.h", "sys/procfs.h", - "sys/types.h" ], + "thread_db.h": [ "pthread.h", "stdint.h", "sys/procfs.h" ], "ucontext.h": [ "sys/ucontext.h" ], - "utmp.h": [ "sys/types.h" ], - "utmpx.h": [ "sys/time.h" ], + "utmp.h": [ "paths.h" ], "values.h": [ "float.h", "limits.h" ], # Nonstandardized sys/ headers - "sys/acct.h": [ "endian.h", "stdint.h", "sys/types.h" ], "sys/auxv.h": [ "elf.h" ], "sys/elf.h": [ "sys/procfs.h" ], - "sys/epoll.h": [ "stdint.h", "sys/types.h" ], - "sys/eventfd.h": [ "stdint.h" ], - "sys/fanotify.h": [ "stdint.h" ], "sys/file.h": [ "fcntl.h" ], - "sys/fsuid.h": [ "sys/types.h" ], - "sys/gmon.h": [ "sys/types.h" ], - "sys/inotify.h": [ "stdint.h" ], "sys/ioctl.h": [ "sys/ttydefaults.h" ], "sys/mount.h": [ "sys/ioctl.h" ], - "sys/mtio.h": [ "sys/ioctl.h", "sys/types.h" ], + "sys/mtio.h": [ "sys/ioctl.h" ], "sys/param.h": [ "endian.h", "limits.h", "sys/types.h" ], - "sys/platform/ppc.h": [ "stdint.h" ], - "sys/procfs.h": [ "sys/time.h", "sys/types.h", - "sys/user.h" ], - "sys/profil.h": [ "sys/time.h", "sys/types.h" ], + "sys/procfs.h": [ "sys/ucontext.h", "sys/user.h" ], "sys/ptrace.h": [ "sys/ucontext.h" ], - "sys/quota.h": [ "sys/types.h" ], - "sys/random.h": [ "sys/types.h" ], - "sys/raw.h": [ "stdint.h", "sys/ioctl.h" ], - "sys/sendfile.h": [ "sys/types.h" ], - "sys/signalfd.h": [ "stdint.h" ], + "sys/raw.h": [ "sys/ioctl.h" ], "sys/socketvar.h": [ "sys/socket.h" ], "sys/timerfd.h": [ "time.h" ], "sys/ttychars.h": [ "sys/ttydefaults.h" ], "sys/ucontext.h": [ "sys/procfs.h" ], "sys/vfs.h": [ "sys/statfs.h" ], - "sys/xattr.h": [ "sys/types.h" ], # Nonstandardized headers that do nothing but include some other # header(s). These exist for compatibility with old systems where @@ -656,8 +632,7 @@ HEADER_ALLOWED_INCLUDES = { "netinet/if_fddi.h": [ "stdint.h", "sys/types.h" ], "netinet/if_tr.h": [ "stdint.h", "sys/types.h" ], "netinet/igmp.h": [ "netinet/in.h", "sys/types.h" ], - "netinet/in_systm.h": [ "stdint.h", "sys/types.h" ], - "netinet/ip.h": [ "netinet/in.h", "sys/types.h" ], + "netinet/ip.h": [ "netinet/in.h" ], "netinet/ip6.h": [ "inttypes.h", "netinet/in.h" ], "netinet/ip_icmp.h": [ "netinet/in.h", "netinet/ip.h", "stdint.h", "sys/types.h" ], @@ -675,14 +650,8 @@ HEADER_ALLOWED_INCLUDES = { "features.h": [ "gnu/stubs.h", "stdc-predef.h", "sys/cdefs.h" ], - "bits/fcntl.h": [ "sys/types.h" ], - "bits/ipc.h": [ "sys/types.h" ], "bits/procfs.h": [ "signal.h", "sys/ucontext.h" ], - "bits/sem.h": [ "sys/types.h" ], - "bits/socket.h": [ "sys/types.h" ], - "bits/types/res_state.h": [ "netinet/in.h", "sys/types.h" ], - "bits/utmp.h": [ "paths.h", "sys/time.h", "sys/types.h" ], - "bits/utmpx.h": [ "paths.h", "sys/time.h" ], + "bits/types/res_state.h": [ "netinet/in.h" ], "bits/types/__va_list.h": [ "stdarg.h" ], "bits/types/ptrdiff_t.h": [ "stddef.h" ], @@ -730,7 +699,8 @@ SYSDEP_ALLOWED_INCLUDES = { "bits/ioctls.h": [ "asm/ioctls.h", "linux/sockios.h" ], "bits/local_lim.h": [ "linux/limits.h" ], "bits/param.h": [ "linux/limits.h", "linux/param.h" ], - "bits/procfs.h": [ "asm/ptrace.h" ], + "bits/procfs.h": [ "asm/elf.h", "asm/ptrace.h" ], + "bits/procfs-prregset.h": [ "sys/ucontext.h" ], "bits/sigcontext.h": [ "asm/sigcontext.h" ], "bits/socket.h": [ "asm/socket.h" ], }, diff --git a/sysdeps/gnu/net/if.h b/socket/net/if.h similarity index 98% rename from sysdeps/gnu/net/if.h rename to socket/net/if.h index e94ed67c21..b2fdbf7be0 100644 --- a/sysdeps/gnu/net/if.h +++ b/socket/net/if.h @@ -21,12 +21,6 @@ #include -#ifdef __USE_MISC -# include -# include -#endif - - /* Length of interface name. */ #define IF_NAMESIZE 16 @@ -38,6 +32,8 @@ struct if_nameindex #ifdef __USE_MISC +# include /* for struct sockaddr */ + /* Standard interface flags. */ enum { diff --git a/socket/sys/socket.h b/socket/sys/socket.h index ce793dc3e2..9770d90d2a 100644 --- a/socket/sys/socket.h +++ b/socket/sys/socket.h @@ -23,7 +23,10 @@ __BEGIN_DECLS +#include #include +#include +#include #include /* This operating system-specific header file defines the SOCK_*, PF_*, diff --git a/stdlib/sys/random.h b/stdlib/sys/random.h index 2297edf2f2..1da7f6bea0 100644 --- a/stdlib/sys/random.h +++ b/stdlib/sys/random.h @@ -20,7 +20,9 @@ #define _SYS_RANDOM_H 1 #include -#include + +#include +#include /* Flags for use with getrandom. */ #define GRND_NONBLOCK 0x01 diff --git a/sysdeps/generic/net/if.h b/sysdeps/generic/net/if.h deleted file mode 100644 index 4af66511e7..0000000000 diff --git a/sysdeps/generic/netinet/tcp.h b/sysdeps/generic/netinet/tcp.h deleted file mode 100644 index 3b59e949d8..0000000000 diff --git a/sysdeps/gnu/Makefile b/sysdeps/gnu/Makefile index a03d40e4ca..fdfbfc45d8 100644 --- a/sysdeps/gnu/Makefile +++ b/sysdeps/gnu/Makefile @@ -58,24 +58,12 @@ $(foreach o,$(object-suffixes) $(object-suffixes:=.d),\ $(objpfx)errlist$o): $(objpfx)errlist-compat.h endif -ifeq ($(subdir),login) -sysdep_routines += setutxent getutxent endutxent getutxid getutxline \ - pututxline utmpxname updwtmpx getutmpx getutmp - -sysdep_headers += utmpx.h bits/utmpx.h -endif - ifeq ($(subdir),inet) sysdep_headers += netinet/udp.h netinet/ip_icmp.h endif -ifeq ($(subdir),misc) -sysdep_headers += sys/mtio.h -endif - - ifeq ($(subdir),csu) routines += unwind-resume shared-only-routines += unwind-resume diff --git a/sysdeps/gnu/bits/sem.h b/sysdeps/gnu/bits/sem.h index 12ec4e61b1..2eeb12af0c 100644 --- a/sysdeps/gnu/bits/sem.h +++ b/sysdeps/gnu/bits/sem.h @@ -15,11 +15,14 @@ License along with the GNU C Library; if not, see . */ +#ifndef _BITS_SEM_H +#define _BITS_SEM_H 1 + #ifndef _SYS_SEM_H # error "Never include directly; use instead." #endif -#include +#include /* Flags for `semop'. */ #define SEM_UNDO 0x1000 /* undo the operation on exit */ @@ -85,3 +88,5 @@ struct seminfo }; #endif /* __USE_MISC */ + +#endif /* bits/sem.h */ diff --git a/sysdeps/mach/hurd/bits/fcntl.h b/sysdeps/mach/hurd/bits/fcntl.h index 9da4f8a145..b666a71ac2 100644 --- a/sysdeps/mach/hurd/bits/fcntl.h +++ b/sysdeps/mach/hurd/bits/fcntl.h @@ -16,11 +16,14 @@ License along with the GNU C Library; if not, see . */ +#ifndef _BITS_FCNTL_H +#define _BITS_FCNTL_H 1 + #ifndef _FCNTL_H # error "Never use directly; include instead." #endif -#include +#include /* File access modes. These are understood by io servers; they can be passed in `dir_lookup', and are returned by `io_get_openmodes'. @@ -180,13 +183,9 @@ # define F_DUPFD_CLOEXEC 1030 /* Duplicate, set FD_CLOEXEC on new one. */ #endif - /* File descriptor flags used with F_GETFD and F_SETFD. */ #define FD_CLOEXEC 1 /* Close on exec. */ - -#include - /* The structure describing an advisory lock. This is the type of the third argument to `fcntl' for the F_GETLK, F_SETLK, and F_SETLKW requests. */ struct flock @@ -228,3 +227,5 @@ struct flock64 # define POSIX_FADV_DONTNEED 4 /* Don't need these pages. */ # define POSIX_FADV_NOREUSE 5 /* Data will be accessed once. */ #endif + +#endif /* bits/fcntl.h */ diff --git a/sysdeps/mach/hurd/bits/socket.h b/sysdeps/mach/hurd/bits/socket.h index ad590af3f6..77498ca43e 100644 --- a/sysdeps/mach/hurd/bits/socket.h +++ b/sysdeps/mach/hurd/bits/socket.h @@ -25,7 +25,7 @@ #endif -#include +#include #include #include #include diff --git a/sysdeps/mach/hurd/i386/Makefile b/sysdeps/mach/hurd/i386/Makefile index bf62a5fc67..88747c684a 100644 --- a/sysdeps/mach/hurd/i386/Makefile +++ b/sysdeps/mach/hurd/i386/Makefile @@ -20,69 +20,34 @@ ifeq ($(subdir),conform) conformtest-xfail-conds += i386-gnu # For bug 23088 -test-xfail-POSIX/fcntl.h/conform = yes test-xfail-POSIX/signal.h/conform = yes -test-xfail-POSIX/semaphore.h/conform = yes test-xfail-POSIX/regex.h/conform = yes test-xfail-POSIX/aio.h/conform = yes test-xfail-POSIX/mqueue.h/conform = yes test-xfail-POSIX/sys/types.h/conform = yes -test-xfail-UNIX98/fcntl.h/conform = yes -test-xfail-UNIX98/netdb.h/conform = yes test-xfail-UNIX98/signal.h/conform = yes -test-xfail-UNIX98/semaphore.h/conform = yes test-xfail-UNIX98/regex.h/conform = yes test-xfail-UNIX98/aio.h/conform = yes -test-xfail-UNIX98/ftw.h/conform = yes test-xfail-UNIX98/mqueue.h/conform = yes -test-xfail-UNIX98/netinet/in.h/conform = yes -test-xfail-UNIX98/sys/sem.h/conform = yes -test-xfail-UNIX98/sys/uio.h/conform = yes -test-xfail-UNIX98/sys/socket.h/conform = yes test-xfail-UNIX98/sys/types.h/conform = yes test-xfail-UNIX98/stdlib.h/conform = yes -test-xfail-UNIX98/arpa/inet.h/conform = yes -test-xfail-POSIX2008/fcntl.h/conform = yes -test-xfail-POSIX2008/netdb.h/conform = yes test-xfail-POSIX2008/signal.h/conform = yes -test-xfail-POSIX2008/semaphore.h/conform = yes test-xfail-POSIX2008/regex.h/conform = yes test-xfail-POSIX2008/aio.h/conform = yes test-xfail-POSIX2008/mqueue.h/conform = yes -test-xfail-POSIX2008/netinet/in.h/conform = yes -test-xfail-POSIX2008/sys/socket.h/conform = yes test-xfail-POSIX2008/sys/types.h/conform = yes -test-xfail-POSIX2008/arpa/inet.h/conform = yes -test-xfail-XOPEN2K/fcntl.h/conform = yes -test-xfail-XOPEN2K/netdb.h/conform = yes test-xfail-XOPEN2K/signal.h/conform = yes -test-xfail-XOPEN2K/semaphore.h/conform = yes test-xfail-XOPEN2K/regex.h/conform = yes test-xfail-XOPEN2K/aio.h/conform = yes -test-xfail-XOPEN2K/ftw.h/conform = yes test-xfail-XOPEN2K/mqueue.h/conform = yes -test-xfail-XOPEN2K/netinet/in.h/conform = yes -test-xfail-XOPEN2K/sys/sem.h/conform = yes -test-xfail-XOPEN2K/sys/uio.h/conform = yes -test-xfail-XOPEN2K/sys/socket.h/conform = yes test-xfail-XOPEN2K/sys/types.h/conform = yes test-xfail-XOPEN2K/stdlib.h/conform = yes -test-xfail-XOPEN2K/arpa/inet.h/conform = yes -test-xfail-XOPEN2K8/fcntl.h/conform = yes -test-xfail-XOPEN2K8/netdb.h/conform = yes test-xfail-XOPEN2K8/signal.h/conform = yes -test-xfail-XOPEN2K8/semaphore.h/conform = yes test-xfail-XOPEN2K8/regex.h/conform = yes test-xfail-XOPEN2K8/aio.h/conform = yes -test-xfail-XOPEN2K8/ftw.h/conform = yes test-xfail-XOPEN2K8/mqueue.h/conform = yes -test-xfail-XOPEN2K8/netinet/in.h/conform = yes -test-xfail-XOPEN2K8/sys/sem.h/conform = yes -test-xfail-XOPEN2K8/sys/uio.h/conform = yes -test-xfail-XOPEN2K8/sys/socket.h/conform = yes test-xfail-XOPEN2K8/sys/types.h/conform = yes test-xfail-XOPEN2K8/stdlib.h/conform = yes -test-xfail-XOPEN2K8/arpa/inet.h/conform = yes # For bug 23819 test-xfail-ISO11/threads.h/linknamespace = yes diff --git a/sysdeps/mach/hurd/sendfile.c b/sysdeps/mach/hurd/sendfile.c index 4857396cf7..dbb1ab8730 100644 --- a/sysdeps/mach/hurd/sendfile.c +++ b/sysdeps/mach/hurd/sendfile.c @@ -17,6 +17,7 @@ . */ #include +#include #include /* Send COUNT bytes from file associated with IN_FD starting at OFFSET to diff --git a/sysdeps/nptl/proc_service.h b/sysdeps/nptl/proc_service.h index 4aa52c6390..600cbd132e 100644 --- a/sysdeps/nptl/proc_service.h +++ b/sysdeps/nptl/proc_service.h @@ -22,6 +22,9 @@ /* The definitions in this file must correspond to those in the debugger. */ #include +#include +#include + __BEGIN_DECLS /* Functions in this interface return one of these status codes. */ diff --git a/sysdeps/nptl/sys/procfs.h b/sysdeps/nptl/sys/procfs.h index 6ade66dfb6..0f886746e2 100644 --- a/sysdeps/nptl/sys/procfs.h +++ b/sysdeps/nptl/sys/procfs.h @@ -19,7 +19,8 @@ #ifndef _SYS_PROCFS_H #define _SYS_PROCFS_H 1 -#include +#include +#include /* The rest of this file provides the types for emulation of the Solaris interfaces that should be implemented by diff --git a/sysdeps/nptl/thread_db.h b/sysdeps/nptl/thread_db.h index 4d949b0c37..3d6cb3a891 100644 --- a/sysdeps/nptl/thread_db.h +++ b/sysdeps/nptl/thread_db.h @@ -24,7 +24,6 @@ with the goal to share the same code in the debugger. */ #include #include -#include #include #include diff --git a/sysdeps/posix/dl-fileid.h b/sysdeps/posix/dl-fileid.h index 1ed7c2c57b..6a5dfc7446 100644 --- a/sysdeps/posix/dl-fileid.h +++ b/sysdeps/posix/dl-fileid.h @@ -23,8 +23,8 @@ a unique identifier for a file. */ struct r_file_id { - dev_t dev; - ino64_t ino; + __dev_t dev; + __ino64_t ino; }; /* Sample FD to fill in *ID. Returns true on success. diff --git a/sysdeps/powerpc/sys/platform/ppc.h b/sysdeps/powerpc/sys/platform/ppc.h index 40ac0a5245..fe4d445dd4 100644 --- a/sysdeps/powerpc/sys/platform/ppc.h +++ b/sysdeps/powerpc/sys/platform/ppc.h @@ -20,24 +20,24 @@ #define _SYS_PLATFORM_PPC_H 1 #include -#include +#include #include /* Read the Time Base Register. */ -static __inline__ uint64_t +static __inline__ __uint64_t __ppc_get_timebase (void) { #if __GNUC_PREREQ (4, 8) return __builtin_ppc_get_timebase (); #else # ifdef __powerpc64__ - uint64_t __tb; + __uint64_t __tb; /* "volatile" is necessary here, because the user expects this assembly isn't moved after an optimization. */ __asm__ volatile ("mfspr %0, 268" : "=r" (__tb)); return __tb; # else /* not __powerpc64__ */ - uint32_t __tbu, __tbl, __tmp; \ + __uint32_t __tbu, __tbl, __tmp; __asm__ volatile ("0:\n\t" "mftbu %0\n\t" "mftbl %1\n\t" @@ -45,7 +45,7 @@ __ppc_get_timebase (void) "cmpw %0, %2\n\t" "bne- 0b" : "=r" (__tbu), "=r" (__tbl), "=r" (__tmp)); - return (((uint64_t) __tbu << 32) | __tbl); + return (((__uint64_t) __tbu << 32) | __tbl); # endif /* not __powerpc64__ */ #endif } diff --git a/sysdeps/pthread/semaphore.h b/sysdeps/pthread/semaphore.h index 87c054392c..075b0be175 100644 --- a/sysdeps/pthread/semaphore.h +++ b/sysdeps/pthread/semaphore.h @@ -19,7 +19,7 @@ #define _SEMAPHORE_H 1 #include -#include + #ifdef __USE_XOPEN2K # include #endif diff --git a/sysdeps/unix/sysv/linux/aarch64/bits/procfs.h b/sysdeps/unix/sysv/linux/aarch64/bits/procfs.h index ea91de06bd..fec2f6a266 100644 --- a/sysdeps/unix/sysv/linux/aarch64/bits/procfs.h +++ b/sysdeps/unix/sysv/linux/aarch64/bits/procfs.h @@ -17,19 +17,28 @@ License along with the GNU C Library; if not, see . */ +#ifndef _BITS_PROCFS_H +#define _BITS_PROCFS_H 1 + #ifndef _SYS_PROCFS_H # error "Never include directly; use instead." #endif +#include + /* Type for a general-purpose register. */ typedef __uint64_t elf_greg_t; /* And the whole bunch of them. We could have used `struct - pt_regs' directly in the typedef, but tradition says that + user_regs_struct' directly in the typedef, but tradition says that the register set is an array, which does have some peculiar - semantics, so leave it that way. */ + semantics, so leave it that way. + + struct user_regs_struct is defined in sys/user.h. */ #define ELF_NGREG (sizeof (struct user_regs_struct) / sizeof (elf_greg_t)) typedef elf_greg_t elf_gregset_t[ELF_NGREG]; /* Register set for the floating-point registers. */ typedef struct user_fpsimd_struct elf_fpregset_t; + +#endif /* bits/procfs.h */ diff --git a/sysdeps/unix/sysv/linux/alpha/bits/epoll.h b/sysdeps/unix/sysv/linux/alpha/bits/epoll.h index 3bf1853cd8..41dd9c51c4 100644 --- a/sysdeps/unix/sysv/linux/alpha/bits/epoll.h +++ b/sysdeps/unix/sysv/linux/alpha/bits/epoll.h @@ -15,6 +15,9 @@ License along with the GNU C Library; if not, see . */ +#ifndef _BITS_EPOLL_H +#define _BITS_EPOLL_H 1 + #ifndef _SYS_EPOLL_H # error "Never use directly; include instead." #endif @@ -25,3 +28,5 @@ enum EPOLL_CLOEXEC = 010000000 #define EPOLL_CLOEXEC EPOLL_CLOEXEC }; + +#endif /* bits/epoll.h */ diff --git a/sysdeps/unix/sysv/linux/alpha/bits/procfs-prregset.h b/sysdeps/unix/sysv/linux/alpha/bits/procfs-prregset.h index a5fffc0005..58b015fbc6 100644 --- a/sysdeps/unix/sysv/linux/alpha/bits/procfs-prregset.h +++ b/sysdeps/unix/sysv/linux/alpha/bits/procfs-prregset.h @@ -17,9 +17,18 @@ License along with the GNU C Library; if not, see . */ +#ifndef _BITS_PROCFS_PRREGSET_H +#define _BITS_PROCFS_PRREGSET_H 1 + #ifndef _SYS_PROCFS_H # error "Never include directly; use instead." #endif +/* For gregset_t and fpregset_t. FIXME: sys/procfs.h should not + expose all of sys/ucontext.h. */ +#include + typedef gregset_t __prgregset_t; typedef fpregset_t __prfpregset_t; + +#endif diff --git a/sysdeps/unix/sysv/linux/alpha/bits/procfs.h b/sysdeps/unix/sysv/linux/alpha/bits/procfs.h index d0fd280821..f04a453bd5 100644 --- a/sysdeps/unix/sysv/linux/alpha/bits/procfs.h +++ b/sysdeps/unix/sysv/linux/alpha/bits/procfs.h @@ -16,13 +16,13 @@ License along with the GNU C Library. If not, see . */ +#ifndef _BITS_PROCFS_H +#define _BITS_PROCFS_H 1 + #ifndef _SYS_PROCFS_H # error "Never include directly; use instead." #endif -#include -#include - /* * The OSF/1 version of makes gregset_t 46 entries long. * I have no idea why that is so. For now, we just leave it at 33 @@ -36,3 +36,5 @@ typedef elf_greg_t elf_gregset_t[ELF_NGREG]; typedef double elf_fpreg_t; typedef elf_fpreg_t elf_fpregset_t[ELF_NFPREG]; + +#endif /* bits/procfs.h */ diff --git a/sysdeps/unix/sysv/linux/alpha/sys/acct.h b/sysdeps/unix/sysv/linux/alpha/sys/acct.h index 95e5b86e2f..98c92edc0d 100644 --- a/sysdeps/unix/sysv/linux/alpha/sys/acct.h +++ b/sysdeps/unix/sysv/linux/alpha/sys/acct.h @@ -16,8 +16,8 @@ . */ #ifndef _SYS_ACCT_H - #define _SYS_ACCT_H 1 + #include #include diff --git a/sysdeps/unix/sysv/linux/arm/bits/procfs.h b/sysdeps/unix/sysv/linux/arm/bits/procfs.h index f168b3af20..333fff661b 100644 --- a/sysdeps/unix/sysv/linux/arm/bits/procfs.h +++ b/sysdeps/unix/sysv/linux/arm/bits/procfs.h @@ -16,6 +16,9 @@ License along with the GNU C Library. If not, see . */ +#ifndef _BITS_PROCFS_H +#define _BITS_PROCFS_H 1 + #ifndef _SYS_PROCFS_H # error "Never include directly; use instead." #endif @@ -26,9 +29,13 @@ typedef unsigned long elf_greg_t; /* And the whole bunch of them. We could have used `struct user_regs' directly in the typedef, but tradition says that the register set is an array, which does have some peculiar - semantics, so leave it that way. */ + semantics, so leave it that way. + + struct user_regs is defined in sys/user.h. */ #define ELF_NGREG (sizeof (struct user_regs) / sizeof (elf_greg_t)) typedef elf_greg_t elf_gregset_t[ELF_NGREG]; /* Register set for the floating-point registers. */ typedef struct user_fpregs elf_fpregset_t; + +#endif /* bits/procfs.h */ diff --git a/sysdeps/unix/sysv/linux/bits/epoll.h b/sysdeps/unix/sysv/linux/bits/epoll.h index eaba990c23..a00f3d9431 100644 --- a/sysdeps/unix/sysv/linux/bits/epoll.h +++ b/sysdeps/unix/sysv/linux/bits/epoll.h @@ -15,6 +15,9 @@ License along with the GNU C Library; if not, see . */ +#ifndef _BITS_EPOLL_H +#define _BITS_EPOLL_H 1 + #ifndef _SYS_EPOLL_H # error "Never use directly; include instead." #endif @@ -25,3 +28,5 @@ enum EPOLL_CLOEXEC = 02000000 #define EPOLL_CLOEXEC EPOLL_CLOEXEC }; + +#endif /* bits/epoll.h */ diff --git a/sysdeps/unix/sysv/linux/bits/sem.h b/sysdeps/unix/sysv/linux/bits/sem.h index a216459010..68600e3917 100644 --- a/sysdeps/unix/sysv/linux/bits/sem.h +++ b/sysdeps/unix/sysv/linux/bits/sem.h @@ -15,11 +15,14 @@ License along with the GNU C Library; if not, see . */ +#ifndef _BITS_SEM_H +#define _BITS_SEM_H 1 + #ifndef _SYS_SEM_H # error "Never include directly; use instead." #endif -#include +#include #include /* Flags for `semop'. */ @@ -95,3 +98,5 @@ struct seminfo }; #endif /* __USE_MISC */ + +#endif /* bits/sem.h */ diff --git a/sysdeps/unix/sysv/linux/bits/socket.h b/sysdeps/unix/sysv/linux/bits/socket.h index 19e664842f..ef3d6f9fc5 100644 --- a/sysdeps/unix/sysv/linux/bits/socket.h +++ b/sysdeps/unix/sysv/linux/bits/socket.h @@ -24,7 +24,7 @@ #endif -#include +#include #include #include @@ -337,9 +337,9 @@ enum /* User visible structure for SCM_CREDENTIALS message */ struct ucred { - pid_t pid; /* PID of sending process. */ - uid_t uid; /* UID of sending process. */ - gid_t gid; /* GID of sending process. */ + __pid_t pid; /* PID of sending process. */ + __uid_t uid; /* UID of sending process. */ + __gid_t gid; /* GID of sending process. */ }; #endif diff --git a/sysdeps/unix/sysv/linux/bits/uio-ext.h b/sysdeps/unix/sysv/linux/bits/uio-ext.h index c4ea63df0b..a39080691b 100644 --- a/sysdeps/unix/sysv/linux/bits/uio-ext.h +++ b/sysdeps/unix/sysv/linux/bits/uio-ext.h @@ -26,7 +26,7 @@ __BEGIN_DECLS /* Read from another process' address space. */ -extern ssize_t process_vm_readv (pid_t __pid, const struct iovec *__lvec, +extern ssize_t process_vm_readv (__pid_t __pid, const struct iovec *__lvec, unsigned long int __liovcnt, const struct iovec *__rvec, unsigned long int __riovcnt, @@ -34,7 +34,7 @@ extern ssize_t process_vm_readv (pid_t __pid, const struct iovec *__lvec, __THROW; /* Write to another process' address space. */ -extern ssize_t process_vm_writev (pid_t __pid, const struct iovec *__lvec, +extern ssize_t process_vm_writev (__pid_t __pid, const struct iovec *__lvec, unsigned long int __liovcnt, const struct iovec *__rvec, unsigned long int __riovcnt, diff --git a/sysdeps/unix/sysv/linux/csky/bits/procfs.h b/sysdeps/unix/sysv/linux/csky/bits/procfs.h index 4ec0c5e759..97982b65bd 100644 --- a/sysdeps/unix/sysv/linux/csky/bits/procfs.h +++ b/sysdeps/unix/sysv/linux/csky/bits/procfs.h @@ -16,6 +16,9 @@ License along with the GNU C Library. If not, see . */ +#ifndef _BITS_PROCFS_H +#define _BITS_PROCFS_H 1 + #ifndef _SYS_PROCFS_H # error "Never include directly; use instead." #endif @@ -35,3 +38,5 @@ typedef elf_greg_t elf_gregset_t[ELF_NGREG]; #define ELF_NFPREG (sizeof (struct user_fp) / sizeof (elf_fpreg_t)) typedef elf_fpreg_t elf_fpregset_t[ELF_NFPREG]; + +#endif /* bits/procfs.h */ diff --git a/sysdeps/unix/sysv/linux/hppa/bits/epoll.h b/sysdeps/unix/sysv/linux/hppa/bits/epoll.h index 156bda0f3c..77722144f0 100644 --- a/sysdeps/unix/sysv/linux/hppa/bits/epoll.h +++ b/sysdeps/unix/sysv/linux/hppa/bits/epoll.h @@ -15,6 +15,9 @@ License along with the GNU C Library; if not, see . */ +#ifndef _BITS_EPOLL_H +#define _BITS_EPOLL_H 1 + #ifndef _SYS_EPOLL_H # error "Never use directly; include instead." #endif @@ -25,3 +28,5 @@ enum EPOLL_CLOEXEC = 010000000 #define EPOLL_CLOEXEC EPOLL_CLOEXEC }; + +#endif /* bits/epoll.h */ diff --git a/sysdeps/unix/sysv/linux/hppa/bits/procfs.h b/sysdeps/unix/sysv/linux/hppa/bits/procfs.h index 9d57472b5e..5bbdb2bc2e 100644 --- a/sysdeps/unix/sysv/linux/hppa/bits/procfs.h +++ b/sysdeps/unix/sysv/linux/hppa/bits/procfs.h @@ -16,6 +16,9 @@ License along with the GNU C Library. If not, see . */ +#ifndef _BITS_PROCFS_H +#define _BITS_PROCFS_H 1 + #ifndef _SYS_PROCFS_H # error "Never include directly; use instead." #endif @@ -28,3 +31,5 @@ typedef elf_greg_t elf_gregset_t[ELF_NGREG]; #define ELF_NFPREG 32 typedef double elf_fpreg_t; typedef elf_fpreg_t elf_fpregset_t[ELF_NFPREG]; + +#endif /* bits/procfs.h */ diff --git a/sysdeps/unix/sysv/linux/ia64/bits/ipc.h b/sysdeps/unix/sysv/linux/ia64/bits/ipc.h index 6f9705e28a..a6fbabec64 100644 --- a/sysdeps/unix/sysv/linux/ia64/bits/ipc.h +++ b/sysdeps/unix/sysv/linux/ia64/bits/ipc.h @@ -20,7 +20,7 @@ # error "Never use directly; include instead." #endif -#include +#include /* Mode bits for `msgget', `semget', and `shmget'. */ #define IPC_CREAT 01000 /* Create key if key does not exist. */ diff --git a/sysdeps/unix/sysv/linux/ia64/bits/procfs.h b/sysdeps/unix/sysv/linux/ia64/bits/procfs.h index 8918975e1d..754e9690c9 100644 --- a/sysdeps/unix/sysv/linux/ia64/bits/procfs.h +++ b/sysdeps/unix/sysv/linux/ia64/bits/procfs.h @@ -16,11 +16,15 @@ License along with the GNU C Library; if not, see . */ +#ifndef _BITS_PROCFS_H +#define _BITS_PROCFS_H 1 + #ifndef _SYS_PROCFS_H # error "Never include directly; use instead." #endif -#include +/* For struct __ia64_fpreg. FIXME: sys/procfs.h should not expose all + of sys/ucontext.h. */ #include #include @@ -39,3 +43,5 @@ typedef elf_greg_t greg_t; typedef elf_gregset_t gregset_t; typedef elf_fpregset_t fpregset_t; #define NGREG ELF_NGREG + +#endif /* bits/procfs.h */ diff --git a/sysdeps/unix/sysv/linux/m68k/bits/procfs.h b/sysdeps/unix/sysv/linux/m68k/bits/procfs.h index 4a9d4aa3cc..401ac2354a 100644 --- a/sysdeps/unix/sysv/linux/m68k/bits/procfs.h +++ b/sysdeps/unix/sysv/linux/m68k/bits/procfs.h @@ -16,6 +16,9 @@ License along with the GNU C Library. If not, see . */ +#ifndef _BITS_PROCFS_H +#define _BITS_PROCFS_H 1 + #ifndef _SYS_PROCFS_H # error "Never include directly; use instead." #endif @@ -26,9 +29,13 @@ typedef unsigned long elf_greg_t; /* And the whole bunch of them. We could have used `struct user_regs_struct' directly in the typedef, but tradition says that the register set is an array, which does have some peculiar - semantics, so leave it that way. */ + semantics, so leave it that way. + + struct user_regs_struct is defined by sys/user.h. */ #define ELF_NGREG (sizeof (struct user_regs_struct) / sizeof (elf_greg_t)) typedef elf_greg_t elf_gregset_t[ELF_NGREG]; /* Register set for the floating-point registers. */ typedef struct user_m68kfp_struct elf_fpregset_t; + +#endif /* bits/procfs.h */ diff --git a/sysdeps/unix/sysv/linux/microblaze/bits/procfs.h b/sysdeps/unix/sysv/linux/microblaze/bits/procfs.h index 7da4b7385b..0f425272a3 100644 --- a/sysdeps/unix/sysv/linux/microblaze/bits/procfs.h +++ b/sysdeps/unix/sysv/linux/microblaze/bits/procfs.h @@ -17,6 +17,9 @@ License along with the GNU C Library; if not, see . */ +#ifndef _BITS_PROCFS_H +#define _BITS_PROCFS_H 1 + #ifndef _SYS_PROCFS_H # error "Never include directly; use instead." #endif @@ -27,9 +30,13 @@ typedef unsigned long elf_greg_t; /* And the whole bunch of them. We could have used `struct user_regs_struct' directly in the typedef, but tradition says that the register set is an array, which does have some peculiar - semantics, so leave it that way. */ + semantics, so leave it that way. + + struct user_regs_struct is defined by sys/user.h. */ #define ELF_NGREG (sizeof (struct user_regs_struct) / sizeof (elf_greg_t)) typedef elf_greg_t elf_gregset_t[ELF_NGREG]; /* Register set for the floating-point registers. */ typedef struct user_fpregs_struct elf_fpregset_t; + +#endif /* bits/procfs.h */ diff --git a/sysdeps/unix/sysv/linux/microblaze/sys/user.h b/sysdeps/unix/sysv/linux/microblaze/sys/user.h index baf6a28247..e6542ecd1b 100644 --- a/sysdeps/unix/sysv/linux/microblaze/sys/user.h +++ b/sysdeps/unix/sysv/linux/microblaze/sys/user.h @@ -17,7 +17,9 @@ . */ #ifndef _SYS_USER_H -# define _SYS_USER_H 1 +#define _SYS_USER_H 1 + +#include #include diff --git a/sysdeps/unix/sysv/linux/mips/bits/epoll.h b/sysdeps/unix/sysv/linux/mips/bits/epoll.h index eaba990c23..a00f3d9431 100644 --- a/sysdeps/unix/sysv/linux/mips/bits/epoll.h +++ b/sysdeps/unix/sysv/linux/mips/bits/epoll.h @@ -15,6 +15,9 @@ License along with the GNU C Library; if not, see . */ +#ifndef _BITS_EPOLL_H +#define _BITS_EPOLL_H 1 + #ifndef _SYS_EPOLL_H # error "Never use directly; include instead." #endif @@ -25,3 +28,5 @@ enum EPOLL_CLOEXEC = 02000000 #define EPOLL_CLOEXEC EPOLL_CLOEXEC }; + +#endif /* bits/epoll.h */ diff --git a/sysdeps/unix/sysv/linux/mips/bits/procfs.h b/sysdeps/unix/sysv/linux/mips/bits/procfs.h index 7df96af52d..6543713624 100644 --- a/sysdeps/unix/sysv/linux/mips/bits/procfs.h +++ b/sysdeps/unix/sysv/linux/mips/bits/procfs.h @@ -16,6 +16,9 @@ License along with the GNU C Library. If not, see . */ +#ifndef _BITS_PROCFS_H +#define _BITS_PROCFS_H 1 + #ifndef _SYS_PROCFS_H # error "Never include directly; use instead." #endif @@ -35,3 +38,5 @@ typedef elf_greg_t elf_gregset_t[ELF_NGREG]; typedef double elf_fpreg_t; typedef elf_fpreg_t elf_fpregset_t[ELF_NFPREG]; + +#endif /* bits/procfs.h */ diff --git a/sysdeps/unix/sysv/linux/nios2/bits/procfs.h b/sysdeps/unix/sysv/linux/nios2/bits/procfs.h index a8431229ff..0c401edadc 100644 --- a/sysdeps/unix/sysv/linux/nios2/bits/procfs.h +++ b/sysdeps/unix/sysv/linux/nios2/bits/procfs.h @@ -16,6 +16,9 @@ License along with the GNU C Library; if not, see . */ +#ifndef _BITS_PROCFS_H +#define _BITS_PROCFS_H 1 + #ifndef _SYS_PROCFS_H # error "Never include directly; use instead." #endif @@ -32,3 +35,5 @@ typedef elf_greg_t elf_gregset_t[ELF_NGREG]; /* Register set for the floating-point registers. */ typedef struct user_fpregs elf_fpregset_t; + +#endif /* bits/procfs.h */ diff --git a/sysdeps/unix/sysv/linux/powerpc/bits/ppc.h b/sysdeps/unix/sysv/linux/powerpc/bits/ppc.h index 4b5667a68e..77436a93f7 100644 --- a/sysdeps/unix/sysv/linux/powerpc/bits/ppc.h +++ b/sysdeps/unix/sysv/linux/powerpc/bits/ppc.h @@ -26,7 +26,7 @@ __BEGIN_DECLS /* Read the time base frequency. */ -extern uint64_t __ppc_get_timebase_freq (void); +extern __uint64_t __ppc_get_timebase_freq (void); __END_DECLS diff --git a/sysdeps/unix/sysv/linux/powerpc/bits/procfs.h b/sysdeps/unix/sysv/linux/powerpc/bits/procfs.h index cf67771a9d..18c6870977 100644 --- a/sysdeps/unix/sysv/linux/powerpc/bits/procfs.h +++ b/sysdeps/unix/sysv/linux/powerpc/bits/procfs.h @@ -16,17 +16,20 @@ License along with the GNU C Library; if not, see . */ +#ifndef _BITS_PROCFS_H +#define _BITS_PROCFS_H 1 + #ifndef _SYS_PROCFS_H # error "Never include directly; use instead." #endif -#include -#include +#include +#include + +/* These definitions may have been provided by asm/elf.h. Otherwise + we define them here. */ +#ifndef ELF_NGREG -/* These definitions are normally provided by ucontext.h via - asm/sigcontext.h, asm/ptrace.h, and asm/elf.h. Otherwise we define - them here. */ -#if !defined __PPC64_ELF_H && !defined _ASM_POWERPC_ELF_H #define ELF_NGREG 48 /* includes nip, msr, lr, etc. */ #define ELF_NFPREG 33 /* includes fpscr */ #if __WORDSIZE == 32 @@ -46,4 +49,7 @@ typedef struct { unsigned int u[4]; } __attribute__ ((__aligned__ (16))) elf_vrreg_t; typedef elf_vrreg_t elf_vrregset_t[ELF_NVRREG]; -#endif + +#endif /* ifndef ELF_NGREG */ + +#endif /* bits/procfs.h */ diff --git a/sysdeps/unix/sysv/linux/powerpc/sys/user.h b/sysdeps/unix/sysv/linux/powerpc/sys/user.h index 2d90235a14..3c928cef37 100644 --- a/sysdeps/unix/sysv/linux/powerpc/sys/user.h +++ b/sysdeps/unix/sysv/linux/powerpc/sys/user.h @@ -22,6 +22,7 @@ #include #include +#include struct user { struct pt_regs regs; /* entire machine state */ diff --git a/sysdeps/unix/sysv/linux/riscv/bits/procfs.h b/sysdeps/unix/sysv/linux/riscv/bits/procfs.h index f2e4503d5d..6ab26013a6 100644 --- a/sysdeps/unix/sysv/linux/riscv/bits/procfs.h +++ b/sysdeps/unix/sysv/linux/riscv/bits/procfs.h @@ -16,10 +16,16 @@ License along with the GNU C Library. If not, see . */ +#ifndef _BITS_PROCFS_H +#define _BITS_PROCFS_H 1 + #ifndef _SYS_PROCFS_H # error "Never include directly; use instead." #endif +/* FIXME: sys/ucontext.h does not define NGREG or NFPREG unless + __USE_MISC is active, and sys/procfs.h should not expose all of + sys/ucontext.h. */ #include /* ELF register definitions */ @@ -29,3 +35,5 @@ typedef unsigned long int elf_greg_t; typedef unsigned long int elf_gregset_t[32]; typedef union __riscv_mc_fp_state elf_fpregset_t; + +#endif /* bits/procfs.h */ diff --git a/sysdeps/unix/sysv/linux/s390/bits/procfs.h b/sysdeps/unix/sysv/linux/s390/bits/procfs.h index 364051c1c7..597ccdb754 100644 --- a/sysdeps/unix/sysv/linux/s390/bits/procfs.h +++ b/sysdeps/unix/sysv/linux/s390/bits/procfs.h @@ -16,10 +16,15 @@ License along with the GNU C Library; if not, see . */ +#ifndef _BITS_PROCFS_H +#define _BITS_PROCFS_H 1 + #ifndef _SYS_PROCFS_H # error "Never include directly; use instead." #endif +/* FIXME: sys/ucontext.h does not define NGREG unless __USE_MISC is + active, and sys/procfs.h should not expose all of sys/ucontext.h. */ #include typedef greg_t elf_greg_t; @@ -27,3 +32,5 @@ typedef greg_t elf_greg_t; typedef gregset_t elf_gregset_t; typedef fpreg_t elf_fpreg_t; typedef fpregset_t elf_fpregset_t; + +#endif /* bits/procfs.h */ diff --git a/sysdeps/gnu/bits/utmp.h b/sysdeps/unix/sysv/linux/s390/bits/utmp.h similarity index 83% rename from sysdeps/gnu/bits/utmp.h rename to sysdeps/unix/sysv/linux/s390/bits/utmp.h index 7357034cb6..553fb30fb5 100644 --- a/sysdeps/gnu/bits/utmp.h +++ b/sysdeps/unix/sysv/linux/s390/bits/utmp.h @@ -1,4 +1,4 @@ -/* The `struct utmp' type, describing entries in the utmp file. GNU version. +/* The `struct utmp' type, describing entries in the utmp file. S/390 version. Copyright (C) 1993-2019 Free Software Foundation, Inc. This file is part of the GNU C Library. @@ -16,15 +16,13 @@ License along with the GNU C Library; if not, see . */ +#ifndef _BITS_UTMP_H +#define _BITS_UTMP_H 1 + #ifndef _UTMP_H # error "Never include directly; use instead." #endif -#include -#include -#include -#include - #define UT_LINESIZE 32 #define UT_NAMESIZE 32 @@ -35,11 +33,7 @@ previous logins. */ struct lastlog { -#if __WORDSIZE_TIME64_COMPAT32 - int32_t ll_time; -#else - __time_t ll_time; -#endif + __time64_t ll_time; char ll_line[UT_LINESIZE]; char ll_host[UT_HOSTSIZE]; }; @@ -68,23 +62,20 @@ struct utmp __attribute_nonstring__; /* Hostname for remote login. */ struct exit_status ut_exit; /* Exit status of a process marked as DEAD_PROCESS. */ + /* The ut_session and ut_tv fields must be the same size when compiled 32- and 64-bit. This allows data files and shared memory to be - shared between 32- and 64-bit applications. */ -#if __WORDSIZE_TIME64_COMPAT32 - int32_t ut_session; /* Session ID, used for windowing. */ + shared between 32- and 64-bit applications. Even on 64-bit systems, + struct timeval is not guaranteed to have both fields be 64 bits. */ + __int64_t ut_session; /* Session ID, used for windowing. */ struct { - int32_t tv_sec; /* Seconds. */ - int32_t tv_usec; /* Microseconds. */ + __int64_t tv_sec; /* Seconds. */ + __int64_t tv_usec; /* Microseconds. */ } ut_tv; /* Time entry was made. */ -#else - long int ut_session; /* Session ID, used for windowing. */ - struct timeval ut_tv; /* Time entry was made. */ -#endif - int32_t ut_addr_v6[4]; /* Internet address of remote host. */ - char __glibc_reserved[20]; /* Reserved for future use. */ + __int32_t ut_addr_v6[4]; /* Internet address of remote host. */ + char __glibc_reserved[20]; /* Reserved for future use. */ }; /* Backwards compatibility hacks. */ @@ -124,3 +115,5 @@ struct utmp #define _HAVE_UT_ID 1 #define _HAVE_UT_TV 1 #define _HAVE_UT_HOST 1 + +#endif /* bits/utmp.h */ diff --git a/sysdeps/unix/sysv/linux/s390/bits/utmpx.h b/sysdeps/unix/sysv/linux/s390/bits/utmpx.h index ea3e860a2d..e498e72cff 100644 --- a/sysdeps/unix/sysv/linux/s390/bits/utmpx.h +++ b/sysdeps/unix/sysv/linux/s390/bits/utmpx.h @@ -1,4 +1,4 @@ -/* Structures and definitions for the user accounting database. GNU version. +/* Structures and definitions for the user accounting database. S/390 version. Copyright (C) 1997-2019 Free Software Foundation, Inc. This file is part of the GNU C Library. @@ -16,22 +16,13 @@ License along with the GNU C Library; if not, see . */ +#ifndef _BITS_UTMPX_H +#define _BITS_UTMPX_H 1 + #ifndef _UTMPX_H # error "Never include directly; use instead." #endif -#include -#include -#include - - -#ifdef __USE_GNU -# include -# define _PATH_UTMPX _PATH_UTMP -# define _PATH_WTMPX _PATH_WTMP -#endif - - #define __UT_LINESIZE 32 #define __UT_NAMESIZE 32 #define __UT_HOSTSIZE 256 @@ -55,7 +46,7 @@ struct __exit_status struct utmpx { short int ut_type; /* Type of login. */ - __pid_t ut_pid; /* Process ID of login process. */ + pid_t ut_pid; /* Process ID of login process. */ char ut_line[__UT_LINESIZE]; /* Devicename. */ char ut_id[4]; /* Inittab ID. */ char ut_user[__UT_NAMESIZE]; /* Username. */ @@ -63,20 +54,17 @@ struct utmpx struct __exit_status ut_exit; /* Exit status of a process marked as DEAD_PROCESS. */ -/* The fields ut_session and ut_tv must be the same size when compiled - 32- and 64-bit. This allows files and shared memory to be shared - between 32- and 64-bit applications. */ -#if __WORDSIZE == 32 +/* The ut_session and ut_tv fields must be the same size when compiled + 32- and 64-bit. This allows data files and shared memory to be + shared between 32- and 64-bit applications. Even on 64-bit systems, + struct timeval is not guaranteed to have both fields be 64 bits. */ __int64_t ut_session; /* Session ID, used for windowing. */ struct { __int64_t tv_sec; /* Seconds. */ __int64_t tv_usec; /* Microseconds. */ } ut_tv; /* Time entry was made. */ -#else - long int ut_session; /* Session ID, used for windowing. */ - struct timeval ut_tv; /* Time entry was made. */ -#endif + __int32_t ut_addr_v6[4]; /* Internet address of remote host. */ char __glibc_reserved[20]; /* Reserved for future use. */ }; @@ -100,3 +88,5 @@ struct utmpx #ifdef __USE_GNU # define ACCOUNTING 9 /* System accounting. */ #endif + +#endif /* bits/utmpx.h */ diff --git a/sysdeps/unix/sysv/linux/sh/bits/procfs.h b/sysdeps/unix/sysv/linux/sh/bits/procfs.h index 5e33070aac..1825874736 100644 --- a/sysdeps/unix/sysv/linux/sh/bits/procfs.h +++ b/sysdeps/unix/sysv/linux/sh/bits/procfs.h @@ -16,9 +16,14 @@ License along with the GNU C Library; if not, see . */ +#ifndef _BITS_PROCFS_H +#define _BITS_PROCFS_H 1 + #ifndef _SYS_PROCFS_H # error "Never include directly; use instead." #endif /* elf_gregset_t and elf_fpregset_t are defined by sys/user.h for SH. */ + +#endif /* bits/procfs.h */ diff --git a/sysdeps/unix/sysv/linux/sparc/bits/epoll.h b/sysdeps/unix/sysv/linux/sparc/bits/epoll.h index 29e00522b3..2ddfe7b5ee 100644 --- a/sysdeps/unix/sysv/linux/sparc/bits/epoll.h +++ b/sysdeps/unix/sysv/linux/sparc/bits/epoll.h @@ -15,6 +15,9 @@ License along with the GNU C Library; if not, see . */ +#ifndef _BITS_EPOLL_H +#define _BITS_EPOLL_H 1 + #ifndef _SYS_EPOLL_H # error "Never use directly; include instead." #endif @@ -25,3 +28,5 @@ enum EPOLL_CLOEXEC = 0x400000 #define EPOLL_CLOEXEC EPOLL_CLOEXEC }; + +#endif /* bits/epoll.h */ diff --git a/sysdeps/unix/sysv/linux/sparc/bits/procfs.h b/sysdeps/unix/sysv/linux/sparc/bits/procfs.h index cc7ca46f4a..9aa9c6d72c 100644 --- a/sysdeps/unix/sysv/linux/sparc/bits/procfs.h +++ b/sysdeps/unix/sysv/linux/sparc/bits/procfs.h @@ -16,12 +16,13 @@ License along with the GNU C Library; if not, see . */ +#ifndef _BITS_PROCFS_H +#define _BITS_PROCFS_H 1 + #ifndef _SYS_PROCFS_H # error "Never include directly; use instead." #endif -#include -#include #include #if __WORDSIZE == 64 @@ -59,3 +60,5 @@ typedef struct typedef unsigned long elf_greg_t; typedef elf_greg_t elf_gregset_t[ELF_NGREG]; + +#endif /* bits/procfs.h */ diff --git a/sysdeps/unix/sysv/linux/sys/acct.h b/sysdeps/unix/sysv/linux/sys/acct.h index 4c119dafd2..515045b275 100644 --- a/sysdeps/unix/sysv/linux/sys/acct.h +++ b/sysdeps/unix/sysv/linux/sys/acct.h @@ -18,10 +18,10 @@ #ifndef _SYS_ACCT_H #define _SYS_ACCT_H 1 -#include -#include +#include + #include -#include +#include __BEGIN_DECLS diff --git a/sysdeps/unix/sysv/linux/sys/epoll.h b/sysdeps/unix/sysv/linux/sys/epoll.h index 51ec53dbca..3a16323328 100644 --- a/sysdeps/unix/sysv/linux/sys/epoll.h +++ b/sysdeps/unix/sysv/linux/sys/epoll.h @@ -18,9 +18,9 @@ #ifndef _SYS_EPOLL_H #define _SYS_EPOLL_H 1 -#include -#include +#include +#include #include /* Get the platform-dependent flags. */ @@ -76,13 +76,13 @@ typedef union epoll_data { void *ptr; int fd; - uint32_t u32; - uint64_t u64; + __uint32_t u32; + __uint64_t u64; } epoll_data_t; struct epoll_event { - uint32_t events; /* Epoll events */ + __uint32_t events; /* Epoll events */ epoll_data_t data; /* User data variable */ } __EPOLL_PACKED; diff --git a/sysdeps/unix/sysv/linux/sys/eventfd.h b/sysdeps/unix/sysv/linux/sys/eventfd.h index d0a9d4c4a8..b6a6c18157 100644 --- a/sysdeps/unix/sysv/linux/sys/eventfd.h +++ b/sysdeps/unix/sysv/linux/sys/eventfd.h @@ -18,13 +18,14 @@ #ifndef _SYS_EVENTFD_H #define _SYS_EVENTFD_H 1 -#include +#include +#include /* Get the platform-dependent flags. */ #include /* Type for event counter. */ -typedef uint64_t eventfd_t; +typedef __uint64_t eventfd_t; __BEGIN_DECLS diff --git a/sysdeps/unix/sysv/linux/sys/fanotify.h b/sysdeps/unix/sysv/linux/sys/fanotify.h index a37b9b6eb3..c024f6a32a 100644 --- a/sysdeps/unix/sysv/linux/sys/fanotify.h +++ b/sysdeps/unix/sysv/linux/sys/fanotify.h @@ -18,10 +18,10 @@ #ifndef _SYS_FANOTIFY_H #define _SYS_FANOTIFY_H 1 -#include +#include +#include #include - __BEGIN_DECLS /* Create and initialize fanotify group. */ @@ -30,7 +30,7 @@ extern int fanotify_init (unsigned int __flags, unsigned int __event_f_flags) /* Add, remove, or modify an fanotify mark on a filesystem object. */ extern int fanotify_mark (int __fanotify_fd, unsigned int __flags, - uint64_t __mask, int __dfd, const char *__pathname) + __uint64_t __mask, int __dfd, const char *__pathname) __THROW; __END_DECLS diff --git a/sysdeps/unix/sysv/linux/sys/fsuid.h b/sysdeps/unix/sysv/linux/sys/fsuid.h index 54bd2d9c60..054d20c9e6 100644 --- a/sysdeps/unix/sysv/linux/sys/fsuid.h +++ b/sysdeps/unix/sysv/linux/sys/fsuid.h @@ -19,7 +19,7 @@ #define _SYS_FSUID_H 1 #include -#include +#include __BEGIN_DECLS diff --git a/sysdeps/unix/sysv/linux/sys/inotify.h b/sysdeps/unix/sysv/linux/sys/inotify.h index 4b59b8e376..4dc7fc208f 100644 --- a/sysdeps/unix/sysv/linux/sys/inotify.h +++ b/sysdeps/unix/sysv/linux/sys/inotify.h @@ -18,7 +18,8 @@ #ifndef _SYS_INOTIFY_H #define _SYS_INOTIFY_H 1 -#include +#include +#include /* Get the platform-dependent flags. */ #include @@ -28,9 +29,9 @@ struct inotify_event { int wd; /* Watch descriptor. */ - uint32_t mask; /* Watch mask. */ - uint32_t cookie; /* Cookie to synchronize two events. */ - uint32_t len; /* Length (including NULs) of name. */ + __uint32_t mask; /* Watch mask. */ + __uint32_t cookie; /* Cookie to synchronize two events. */ + __uint32_t len; /* Length (including NULs) of name. */ char name __flexarr; /* Name. */ }; @@ -89,7 +90,7 @@ extern int inotify_init1 (int __flags) __THROW; /* Add watch of object NAME to inotify instance FD. Notify about events specified by MASK. */ -extern int inotify_add_watch (int __fd, const char *__name, uint32_t __mask) +extern int inotify_add_watch (int __fd, const char *__name, __uint32_t __mask) __THROW; /* Remove the watch specified by WD from the inotify instance FD. */ diff --git a/sysdeps/unix/sysv/linux/sys/procfs.h b/sysdeps/unix/sysv/linux/sys/procfs.h index d24c19138a..c9ef13ff6e 100644 --- a/sysdeps/unix/sysv/linux/sys/procfs.h +++ b/sysdeps/unix/sysv/linux/sys/procfs.h @@ -30,8 +30,10 @@ GDB unless you know what you are doing. */ #include -#include -#include + +#include +#include + #include /* bits/procfs.h, provided by each architecture, must define diff --git a/sysdeps/unix/sysv/linux/sys/quota.h b/sysdeps/unix/sysv/linux/sys/quota.h index 8c3a5a1da6..cf55f48ae5 100644 --- a/sysdeps/unix/sysv/linux/sys/quota.h +++ b/sysdeps/unix/sysv/linux/sys/quota.h @@ -52,8 +52,8 @@ #define _SYS_QUOTA_H 1 #include -#include +#include #include /* diff --git a/sysdeps/unix/sysv/linux/sys/raw.h b/sysdeps/unix/sysv/linux/sys/raw.h index b4e5a82b6e..fbdefe0221 100644 --- a/sysdeps/unix/sysv/linux/sys/raw.h +++ b/sysdeps/unix/sysv/linux/sys/raw.h @@ -18,7 +18,8 @@ #ifndef _SYS_RAW_H #define _SYS_RAW_H 1 -#include +#include +#include #include /* The major device number for raw devices. */ @@ -31,8 +32,8 @@ struct raw_config_request { int raw_minor; - uint64_t block_major; - uint64_t block_minor; + __uint64_t block_major; + __uint64_t block_minor; }; #endif /* sys/raw.h */ diff --git a/sysdeps/unix/sysv/linux/sys/signalfd.h b/sysdeps/unix/sysv/linux/sys/signalfd.h index 13fd8b43fc..5a8f035301 100644 --- a/sysdeps/unix/sysv/linux/sys/signalfd.h +++ b/sysdeps/unix/sysv/linux/sys/signalfd.h @@ -18,7 +18,8 @@ #ifndef _SYS_SIGNALFD_H #define _SYS_SIGNALFD_H 1 -#include +#include +#include #include /* Get the platform-dependent flags. */ @@ -26,28 +27,28 @@ struct signalfd_siginfo { - uint32_t ssi_signo; - int32_t ssi_errno; - int32_t ssi_code; - uint32_t ssi_pid; - uint32_t ssi_uid; - int32_t ssi_fd; - uint32_t ssi_tid; - uint32_t ssi_band; - uint32_t ssi_overrun; - uint32_t ssi_trapno; - int32_t ssi_status; - int32_t ssi_int; - uint64_t ssi_ptr; - uint64_t ssi_utime; - uint64_t ssi_stime; - uint64_t ssi_addr; - uint16_t ssi_addr_lsb; - uint16_t __pad2; - int32_t ssi_syscall; - uint64_t ssi_call_addr; - uint32_t ssi_arch; - uint8_t __pad[28]; + __uint32_t ssi_signo; + __int32_t ssi_errno; + __int32_t ssi_code; + __uint32_t ssi_pid; + __uint32_t ssi_uid; + __int32_t ssi_fd; + __uint32_t ssi_tid; + __uint32_t ssi_band; + __uint32_t ssi_overrun; + __uint32_t ssi_trapno; + __int32_t ssi_status; + __int32_t ssi_int; + __uint64_t ssi_ptr; + __uint64_t ssi_utime; + __uint64_t ssi_stime; + __uint64_t ssi_addr; + __uint16_t ssi_addr_lsb; + __uint16_t __pad2; + __int32_t ssi_syscall; + __uint64_t ssi_call_addr; + __uint32_t ssi_arch; + __uint8_t __pad[28]; }; __BEGIN_DECLS diff --git a/sysdeps/unix/sysv/linux/x86/bits/epoll.h b/sysdeps/unix/sysv/linux/x86/bits/epoll.h index 162874aba3..c8c8737f44 100644 --- a/sysdeps/unix/sysv/linux/x86/bits/epoll.h +++ b/sysdeps/unix/sysv/linux/x86/bits/epoll.h @@ -15,6 +15,9 @@ License along with the GNU C Library; if not, see . */ +#ifndef _BITS_EPOLL_H +#define _BITS_EPOLL_H 1 + #ifndef _SYS_EPOLL_H # error "Never use directly; include instead." #endif @@ -27,3 +30,5 @@ enum }; #define __EPOLL_PACKED __attribute__ ((__packed__)) + +#endif /* bits/epoll.h */ diff --git a/sysdeps/unix/sysv/linux/x86/bits/procfs.h b/sysdeps/unix/sysv/linux/x86/bits/procfs.h index 55ea4c9f48..6feb88c26c 100644 --- a/sysdeps/unix/sysv/linux/x86/bits/procfs.h +++ b/sysdeps/unix/sysv/linux/x86/bits/procfs.h @@ -16,6 +16,9 @@ License along with the GNU C Library; if not, see . */ +#ifndef _BITS_PROCFS_H +#define _BITS_PROCFS_H 1 + #ifndef _SYS_PROCFS_H # error "Never include directly; use instead." #endif @@ -48,3 +51,5 @@ typedef struct user_fpxregs_struct elf_fpxregset_t; floating-point stuff. */ typedef struct user_fpregs_struct elf_fpregset_t; #endif + +#endif /* bits/procfs.h */ diff --git a/sysvipc/sys/sem.h b/sysvipc/sys/sem.h index 6b5d43d71c..09e633592d 100644 --- a/sysvipc/sys/sem.h +++ b/sysvipc/sys/sem.h @@ -25,6 +25,8 @@ /* Define types required by the standard. */ #include +#include +#include #ifdef __USE_GNU # include #endif From patchwork Wed Jun 26 17:50:26 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Zack Weinberg X-Patchwork-Id: 1122956 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-103181-incoming=patchwork.ozlabs.org@sourceware.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=panix.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.b="aPU5ww+O"; 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 45YrZc6s5Tz9s4Y for ; Thu, 27 Jun 2019 04:06:48 +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:in-reply-to :references:mime-version:content-type:content-transfer-encoding; q=dns; s=default; b=ftV6/4g00ZpZk7cjLyDuETuCuQImjxHXFtHmYJo59nW RplqwK3pgX0a7HPWBJjGNhKa0oSQCptJyHErS5cEjJuDeG2v3rZE652eBWrSU1HU 4E9YKwSuUMwbDEZQ+LMg4OOxVklo1pSuyIF7a3DabKR3WHT3YGLq9bZYCdaxgHPI = 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:in-reply-to :references:mime-version:content-type:content-transfer-encoding; s=default; bh=D1YQMd36f+kMlOqlTXB4AiHvsvk=; b=aPU5ww+OHu9//yzfN naKj482j5YI6aeJ58RdrRVG1/TEYUb+YL+ZC0GTRnB9PKdTWmIWqLlVzudxi6stN aZ78O4LaBZ7U40YEE4YCaBnXnEA/KD0Ul0laDlELMGrNFHPfmqupLTcyLEJ3GM3P Vjih9EBR9u2/gWFVl3XG7VdyFE= Received: (qmail 55113 invoked by alias); 26 Jun 2019 18:06:27 -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 55021 invoked by uid 89); 26 Jun 2019 18:06:27 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-16.8 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_SHORT, SPF_HELO_PASS, SPF_PASS autolearn=ham version=3.3.1 spammy=alert, rose, Alert, advertisement X-HELO: l2mail1.panix.com From: Zack Weinberg To: libc-alpha@sourceware.org Cc: joseph@codesourcery.com, carlos@redhat.com Subject: [PATCH 22/25] Minimize includes of unrelated public headers by networking headers. Date: Wed, 26 Jun 2019 13:50:26 -0400 Message-Id: <20190626175029.4699-13-zackw@panix.com> In-Reply-To: <20190626175029.4699-1-zackw@panix.com> References: <20190626175029.4699-1-zackw@panix.com> MIME-Version: 1.0 Stop including sys/param.h, sys/types.h, stdint.h, inttypes.h, stdio.h, and string.h from network-related headers. This is done separately from earlier patches because the network headers are extra messy, and are also more likely to contain quirks inherited verbatim from 4.xBSD than the bulk of our public headers. Rose and NetROM are based on AX.25 so it makes practical sense for netrose/rose.h and netrom/netrom.h to continue including netax25/ax25.h. The only copies of ip_icmp.h and udp.h in the source tree are moved from sysdeps/gnu to inet (after which there are no longer any netinet/ headers in sysdeps/gnu). Much as sys/un.h needs to duplicate the prototype for strlen, netinet/icmp6.h needs to duplicate the prototype for memset. I am open to better ideas on that front. * resolv/resolv.h: Include bits/types.h, bits/types/FILE.h, and bits/types/size_t.h; don’t include sys/param.h, sys/types.h, or stdio.h. Use __uint16_t and __uint32_t instead of uint16_t and uint32_t. * resolv/arpa/nameser.h: Include features.h, bits/types.h, and bits/types/size_t.h; don’t include sys/param.h, sys/types.h, or stdint.h. Use __uint16_t and __uint32_t instead of uint16_t and uint32_t. * resolv/arpa/nameser_compat.h: Include features.h. * sysdeps/mach/hurd/net/ethernet.h: Include bits/types.h; don’t include sys/types.h or stdint.h. Use __uint8_t and __uint16_t instead of uint8_t and uint16_t. * sysdeps/unix/sysv/linux/net/ethernet.h: Include features.h and bits/types.h; don’t include sys/types.h or stdint.h. Use __uint8_t and __uint16_t instead of uint8_t and uint16_t. * sysdeps/unix/sysv/linux/netinet/if_ether.h: Include features.h and bits/types.h. Use __uint8_t instead of uint8_t. * sysdeps/mach/hurd/net/if_arp.h: Don’t include sys/types.h or stdint.h. Use __uint32_t instead of uint32_t. * sysdeps/unix/sysv/linux/net/if_arp.h: Include features.h. Don’t include sys/types.h or stdint.h. Use __uint32_t instead of uint32_t. * sysdeps/mach/hurd/net/route.h: Don’t include sys/types.h. * sysdeps/unix/sysv/linux/net/route.h: Don’t include sys/types.h. * sysdeps/unix/sysv/linux/net/if_ppp.h: Include features.h and bits/types.h. Don’t include sys/types.h or stdint.h. Use __uint8_t and __uint32_t instead of uint8_t and uint32_t. * sysdeps/unix/sysv/linux/net/if_shaper.h: Include features.h and bits/types.h. Don’t include sys/types.h or stdint.h. Use __uint16_t and __uint32_t instead of uint16_t and uint32_t. * sysdeps/unix/sysv/linux/netatalk/at.h: Include features.h, bits/types.h, and sys/ioctl.h. Don’t include asm/types.h or linux/atalk.h. Copy over all user-appropriate definitions from linux/atalk.h with adjustments for glibc context. * grp/initgroups.c, nscd/initgrcache.c, nss/nss_db/db-XXX.c * resolv/ns_print.c, resolv/tst-ns_name_compress.c * resolv/tst-res_hnok.c, support/resolv_test.c: Include stdio.h. * nscd/initgrcache.c, nscd/netgroupcache.c * nss/nss_compat/compat-grp.c, nss/nss_compat/compat-pwd.c * nss/nss_compat/compat-spwd.c, resolv/ns_print.c: Include sys/param.h for MIN and/or MAX. * resolv/tst-resolv-res_init-skeleton.c: Include signal.h. * inet/protocols/rwhod.h: Include features.h and bits/types.h. Don’t include sys/types.h. Use __int32_t instead of int32_t. * inet/protocols/talkd.h: Include features.h and bits/types.h. Don’t include sys/types.h, sys/socket.h, or stdint.h. Use __int32_t and __uint32_t instead of int32_t and uint32_t. * inet/protocols/timed.h: Include features.h, bits/types.h, and bits/types/struct_timeval.h. Don’t include sys/types.h or sys/time.h. * sysdeps/unix/sysv/linux/netipx/ipx.h: Include features.h and bits/types.h. Don’t include sys/types.h or stdint.h. Use __uint16_t and __uint32_t instead of uint16_t and uint32_t. * sysdeps/unix/sysv/linux/netrose/rose.h: Include features.h. Don’t include sys/socket.h. * inet/netinet/icmp6.h: Include features.h, bits/endian.h, bits/types.h, and bits/types/size_t.h. Don’t include inttypes.h, string.h, or sys/types.h. Duplicate prototype of memset here. Use __uintN_t instead of uintN_t types. * inet/netinet/igmp.h: Include bits/types.h. Don’t include sys/types.h. Use __uintN_t instead of uintN_t types. * inet/netinet/ip.h: Include bits/types.h. Don’t include bits/stdint-uintn.h. Use __uintN_t instead of uintN_t types. * inet/netinet/ip6.h: Include features.h, bits/endian.h, and bits/types.h. Don’t include inttypes.h. Use __uintN_t instead of uintN_t types. * inet/netinet/ip_icmp.h: Include features.h and bits/types.h. Don’t include sys/types.h or stdint.h. Use __uintN_t instead of uintN_t types. * inet/netinet/udp.h: Likewise. * sysdeps/generic/netinet/if_ether.h: Likewise. * sysdeps/unix/sysv/linux/netinet/if_ether.h: Likewise. * sysdeps/unix/sysv/linux/netinet/if_fddi.h: Likewise. * sysdeps/unix/sysv/linux/netinet/if_tr.h: Likewise. * sysdeps/gnu/netinet/ip_icmp.h: Move to inet/netinet/ip_icmp.h. * sysdeps/gnu/netinet/udp.h: Move to inet/netinet/udp.h. * include/netinet/ip_icmp.h, include/netinet/udp.h: New wrappers. * sysdeps/gnu/Makefile: Remove $(subdir)==inet stanza. * inet/Makefile (headers): Add netinet/ip_icmp.h and netinet/udp.h. Don’t use $(wildcard *.h) for arpa and protocols headers. Sort list. * scripts/check-obsolete-constructs.py (HEADER_ALLOWED_INCLUDES, SYSDEP_ALLOWED_INCLUDES): Update. --- grp/initgroups.c | 1 + include/netinet/ip_icmp.h | 1 + include/netinet/udp.h | 1 + inet/Makefile | 11 +- inet/netinet/icmp6.h | 123 +++++++++++---------- inet/netinet/igmp.h | 9 +- inet/netinet/ip.h | 40 +++---- inet/netinet/ip6.h | 86 +++++++------- {sysdeps/gnu => inet}/netinet/ip_icmp.h | 56 +++++----- {sysdeps/gnu => inet}/netinet/udp.h | 20 ++-- inet/protocols/rwhod.h | 5 +- inet/protocols/talkd.h | 11 +- inet/protocols/timed.h | 5 +- nscd/initgrcache.c | 2 + nscd/netgroupcache.c | 1 + nss/nss_compat/compat-grp.c | 1 + nss/nss_compat/compat-pwd.c | 1 + nss/nss_compat/compat-spwd.c | 1 + nss/nss_db/db-XXX.c | 1 + resolv/arpa/nameser.h | 34 +++--- resolv/arpa/nameser_compat.h | 1 + resolv/ns_print.c | 2 + resolv/resolv.h | 13 ++- resolv/tst-ns_name_compress.c | 1 + resolv/tst-res_hnok.c | 1 + scripts/check-obsolete-constructs.py | 53 ++++----- support/resolv_test.c | 1 + sysdeps/generic/netinet/if_ether.h | 6 +- sysdeps/gnu/Makefile | 5 - sysdeps/mach/hurd/net/ethernet.h | 12 +- sysdeps/mach/hurd/net/if_arp.h | 5 +- sysdeps/mach/hurd/net/route.h | 3 +- sysdeps/unix/sysv/linux/net/ethernet.h | 12 +- sysdeps/unix/sysv/linux/net/if_arp.h | 5 +- sysdeps/unix/sysv/linux/net/if_ppp.h | 10 +- sysdeps/unix/sysv/linux/net/if_shaper.h | 8 +- sysdeps/unix/sysv/linux/net/route.h | 2 +- sysdeps/unix/sysv/linux/netatalk/at.h | 41 ++++++- sysdeps/unix/sysv/linux/netinet/if_ether.h | 21 ++-- sysdeps/unix/sysv/linux/netinet/if_fddi.h | 14 ++- sysdeps/unix/sysv/linux/netinet/if_tr.h | 68 ++++++------ sysdeps/unix/sysv/linux/netipx/ipx.h | 10 +- sysdeps/unix/sysv/linux/netrose/rose.h | 2 +- 43 files changed, 370 insertions(+), 336 deletions(-) create mode 100644 include/netinet/ip_icmp.h create mode 100644 include/netinet/udp.h rename {sysdeps/gnu => inet}/netinet/ip_icmp.h (91%) rename {sysdeps/gnu => inet}/netinet/udp.h (91%) diff --git a/grp/initgroups.c b/grp/initgroups.c index a22f33c934..6edfb0a678 100644 --- a/grp/initgroups.c +++ b/grp/initgroups.c @@ -19,6 +19,7 @@ #include #include #include +#include #include #include #include diff --git a/include/netinet/ip_icmp.h b/include/netinet/ip_icmp.h new file mode 100644 index 0000000000..f8d0080f68 --- /dev/null +++ b/include/netinet/ip_icmp.h @@ -0,0 +1 @@ +#include diff --git a/include/netinet/udp.h b/include/netinet/udp.h new file mode 100644 index 0000000000..c45cb0bedd --- /dev/null +++ b/include/netinet/udp.h @@ -0,0 +1 @@ +#include diff --git a/inet/Makefile b/inet/Makefile index e2371033a7..a58278a1e1 100644 --- a/inet/Makefile +++ b/inet/Makefile @@ -22,10 +22,13 @@ subdir := inet include ../Makeconfig -headers := netinet/ether.h netinet/in.h netinet/in_systm.h \ - netinet/if_ether.h netinet/igmp.h \ - netinet/tcp.h netinet/ip.h $(wildcard arpa/*.h protocols/*.h) \ - aliases.h ifaddrs.h netinet/ip6.h netinet/icmp6.h bits/in.h +headers := aliases.h ifaddrs.h bits/in.h \ + netinet/ether.h netinet/icmp6.h netinet/if_ether.h netinet/igmp.h \ + netinet/in.h netinet/in_systm.h netinet/ip.h netinet/ip6.h \ + netinet/ip_icmp.h netinet/tcp.h netinet/udp.h \ + arpa/ftp.h arpa/inet.h arpa/telnet.h arpa/tftp.h \ + protocols/routed.h protocols/rwhod.h protocols/talkd.h \ + protocols/timed.h routines := htonl htons \ inet_lnaof inet_mkadr \ diff --git a/inet/netinet/icmp6.h b/inet/netinet/icmp6.h index 92e84cfd21..5119085391 100644 --- a/inet/netinet/icmp6.h +++ b/inet/netinet/icmp6.h @@ -18,9 +18,10 @@ #ifndef _NETINET_ICMP6_H #define _NETINET_ICMP6_H 1 -#include -#include -#include +#include +#include +#include +#include #include #define ICMP6_FILTER 1 @@ -32,19 +33,19 @@ struct icmp6_filter { - uint32_t icmp6_filt[8]; + __uint32_t icmp6_filt[8]; }; struct icmp6_hdr { - uint8_t icmp6_type; /* type field */ - uint8_t icmp6_code; /* code field */ - uint16_t icmp6_cksum; /* checksum field */ + __uint8_t icmp6_type; /* type field */ + __uint8_t icmp6_code; /* code field */ + __uint16_t icmp6_cksum; /* checksum field */ union { - uint32_t icmp6_un_data32[1]; /* type-specific field */ - uint16_t icmp6_un_data16[2]; /* type-specific field */ - uint8_t icmp6_un_data8[4]; /* type-specific field */ + __uint32_t icmp6_un_data32[1]; /* type-specific field */ + __uint16_t icmp6_un_data16[2]; /* type-specific field */ + __uint8_t icmp6_un_data8[4]; /* type-specific field */ } icmp6_dataun; }; @@ -96,6 +97,8 @@ struct icmp6_hdr #define ICMP6_FILTER_SETBLOCK(type, filterp) \ ((((filterp)->icmp6_filt[(type) >> 5]) |= (1 << ((type) & 31)))) +extern void *memset (void *__s, int __c, size_t __n) __THROW __nonnull ((1)); + #define ICMP6_FILTER_SETPASSALL(filterp) \ memset (filterp, 0, sizeof (struct icmp6_filter)); @@ -122,8 +125,8 @@ struct nd_router_solicit /* router solicitation */ struct nd_router_advert /* router advertisement */ { struct icmp6_hdr nd_ra_hdr; - uint32_t nd_ra_reachable; /* reachable time */ - uint32_t nd_ra_retransmit; /* retransmit timer */ + __uint32_t nd_ra_reachable; /* reachable time */ + __uint32_t nd_ra_retransmit; /* retransmit timer */ /* could be followed by options */ }; @@ -185,8 +188,8 @@ struct nd_redirect /* redirect */ struct nd_opt_hdr /* Neighbor discovery option header */ { - uint8_t nd_opt_type; - uint8_t nd_opt_len; /* in units of 8 octets */ + __uint8_t nd_opt_type; + __uint8_t nd_opt_len; /* in units of 8 octets */ /* followed by option specific data */ }; @@ -200,13 +203,13 @@ struct nd_opt_hdr /* Neighbor discovery option header */ struct nd_opt_prefix_info /* prefix information */ { - uint8_t nd_opt_pi_type; - uint8_t nd_opt_pi_len; - uint8_t nd_opt_pi_prefix_len; - uint8_t nd_opt_pi_flags_reserved; - uint32_t nd_opt_pi_valid_time; - uint32_t nd_opt_pi_preferred_time; - uint32_t nd_opt_pi_reserved2; + __uint8_t nd_opt_pi_type; + __uint8_t nd_opt_pi_len; + __uint8_t nd_opt_pi_prefix_len; + __uint8_t nd_opt_pi_flags_reserved; + __uint32_t nd_opt_pi_valid_time; + __uint32_t nd_opt_pi_preferred_time; + __uint32_t nd_opt_pi_reserved2; struct in6_addr nd_opt_pi_prefix; }; @@ -216,19 +219,19 @@ struct nd_opt_prefix_info /* prefix information */ struct nd_opt_rd_hdr /* redirected header */ { - uint8_t nd_opt_rh_type; - uint8_t nd_opt_rh_len; - uint16_t nd_opt_rh_reserved1; - uint32_t nd_opt_rh_reserved2; + __uint8_t nd_opt_rh_type; + __uint8_t nd_opt_rh_len; + __uint16_t nd_opt_rh_reserved1; + __uint32_t nd_opt_rh_reserved2; /* followed by IP header and data */ }; struct nd_opt_mtu /* MTU option */ { - uint8_t nd_opt_mtu_type; - uint8_t nd_opt_mtu_len; - uint16_t nd_opt_mtu_reserved; - uint32_t nd_opt_mtu_mtu; + __uint8_t nd_opt_mtu_type; + __uint8_t nd_opt_mtu_len; + __uint16_t nd_opt_mtu_reserved; + __uint32_t nd_opt_mtu_mtu; }; struct mld_hdr @@ -248,10 +251,10 @@ struct mld_hdr struct icmp6_router_renum /* router renumbering header */ { struct icmp6_hdr rr_hdr; - uint8_t rr_segnum; - uint8_t rr_flags; - uint16_t rr_maxdelay; - uint32_t rr_reserved; + __uint8_t rr_segnum; + __uint8_t rr_flags; + __uint16_t rr_maxdelay; + __uint32_t rr_reserved; }; #define rr_type rr_hdr.icmp6_type @@ -268,13 +271,13 @@ struct icmp6_router_renum /* router renumbering header */ struct rr_pco_match /* match prefix part */ { - uint8_t rpm_code; - uint8_t rpm_len; - uint8_t rpm_ordinal; - uint8_t rpm_matchlen; - uint8_t rpm_minlen; - uint8_t rpm_maxlen; - uint16_t rpm_reserved; + __uint8_t rpm_code; + __uint8_t rpm_len; + __uint8_t rpm_ordinal; + __uint8_t rpm_matchlen; + __uint8_t rpm_minlen; + __uint8_t rpm_maxlen; + __uint16_t rpm_reserved; struct in6_addr rpm_prefix; }; @@ -285,13 +288,13 @@ struct rr_pco_match /* match prefix part */ struct rr_pco_use /* use prefix part */ { - uint8_t rpu_uselen; - uint8_t rpu_keeplen; - uint8_t rpu_ramask; - uint8_t rpu_raflags; - uint32_t rpu_vltime; - uint32_t rpu_pltime; - uint32_t rpu_flags; + __uint8_t rpu_uselen; + __uint8_t rpu_keeplen; + __uint8_t rpu_ramask; + __uint8_t rpu_raflags; + __uint32_t rpu_vltime; + __uint32_t rpu_pltime; + __uint32_t rpu_flags; struct in6_addr rpu_prefix; }; @@ -308,10 +311,10 @@ struct rr_pco_use /* use prefix part */ struct rr_result /* router renumbering result message */ { - uint16_t rrr_flags; - uint8_t rrr_ordinal; - uint8_t rrr_matchedlen; - uint32_t rrr_ifid; + __uint16_t rrr_flags; + __uint8_t rrr_ordinal; + __uint8_t rrr_matchedlen; + __uint32_t rrr_ifid; struct in6_addr rrr_prefix; }; @@ -326,20 +329,20 @@ struct rr_result /* router renumbering result message */ /* Mobile IPv6 extension: Advertisement Interval. */ struct nd_opt_adv_interval { - uint8_t nd_opt_adv_interval_type; - uint8_t nd_opt_adv_interval_len; - uint16_t nd_opt_adv_interval_reserved; - uint32_t nd_opt_adv_interval_ival; + __uint8_t nd_opt_adv_interval_type; + __uint8_t nd_opt_adv_interval_len; + __uint16_t nd_opt_adv_interval_reserved; + __uint32_t nd_opt_adv_interval_ival; }; /* Mobile IPv6 extension: Home Agent Info. */ struct nd_opt_home_agent_info { - uint8_t nd_opt_home_agent_info_type; - uint8_t nd_opt_home_agent_info_len; - uint16_t nd_opt_home_agent_info_reserved; - uint16_t nd_opt_home_agent_info_preference; - uint16_t nd_opt_home_agent_info_lifetime; + __uint8_t nd_opt_home_agent_info_type; + __uint8_t nd_opt_home_agent_info_len; + __uint16_t nd_opt_home_agent_info_reserved; + __uint16_t nd_opt_home_agent_info_preference; + __uint16_t nd_opt_home_agent_info_lifetime; }; #endif /* netinet/icmpv6.h */ diff --git a/inet/netinet/igmp.h b/inet/netinet/igmp.h index 2884db59df..6eafc19a73 100644 --- a/inet/netinet/igmp.h +++ b/inet/netinet/igmp.h @@ -20,11 +20,10 @@ #include -#include - #ifdef __USE_MISC #include +#include __BEGIN_DECLS @@ -65,9 +64,9 @@ __BEGIN_DECLS */ struct igmp { - uint8_t igmp_type; /* IGMP type */ - uint8_t igmp_code; /* routing code */ - uint16_t igmp_cksum; /* checksum */ + __uint8_t igmp_type; /* IGMP type */ + __uint8_t igmp_code; /* routing code */ + __uint16_t igmp_cksum; /* checksum */ struct in_addr igmp_group; /* group address */ }; diff --git a/inet/netinet/ip.h b/inet/netinet/ip.h index 35f61d1694..fa6b588c42 100644 --- a/inet/netinet/ip.h +++ b/inet/netinet/ip.h @@ -22,14 +22,14 @@ #include #include -#include +#include __BEGIN_DECLS struct timestamp { - uint8_t len; - uint8_t ptr; + __uint8_t len; + __uint8_t ptr; #if __BYTE_ORDER == __LITTLE_ENDIAN unsigned int flags:4; unsigned int overflow:4; @@ -39,7 +39,7 @@ struct timestamp #else # error "Please fix " #endif - uint32_t data[9]; + __uint32_t data[9]; }; struct iphdr @@ -53,15 +53,15 @@ struct iphdr #else # error "Please fix " #endif - uint8_t tos; - uint16_t tot_len; - uint16_t id; - uint16_t frag_off; - uint8_t ttl; - uint8_t protocol; - uint16_t check; - uint32_t saddr; - uint32_t daddr; + __uint8_t tos; + __uint16_t tot_len; + __uint16_t id; + __uint16_t frag_off; + __uint8_t ttl; + __uint8_t protocol; + __uint16_t check; + __uint32_t saddr; + __uint32_t daddr; /*The options start here. */ }; @@ -115,7 +115,7 @@ struct ip unsigned int ip_v:4; /* version */ unsigned int ip_hl:4; /* header length */ #endif - uint8_t ip_tos; /* type of service */ + __uint8_t ip_tos; /* type of service */ unsigned short ip_len; /* total length */ unsigned short ip_id; /* identification */ unsigned short ip_off; /* fragment offset field */ @@ -123,8 +123,8 @@ struct ip #define IP_DF 0x4000 /* dont fragment flag */ #define IP_MF 0x2000 /* more fragments flag */ #define IP_OFFMASK 0x1fff /* mask for fragmenting bits */ - uint8_t ip_ttl; /* time to live */ - uint8_t ip_p; /* protocol */ + __uint8_t ip_ttl; /* time to live */ + __uint8_t ip_p; /* protocol */ unsigned short ip_sum; /* checksum */ struct in_addr ip_src, ip_dst; /* source and dest address */ }; @@ -134,9 +134,9 @@ struct ip */ struct ip_timestamp { - uint8_t ipt_code; /* IPOPT_TS */ - uint8_t ipt_len; /* size of structure (variable) */ - uint8_t ipt_ptr; /* index of current entry */ + __uint8_t ipt_code; /* IPOPT_TS */ + __uint8_t ipt_len; /* size of structure (variable) */ + __uint8_t ipt_ptr; /* index of current entry */ #if __BYTE_ORDER == __LITTLE_ENDIAN unsigned int ipt_flg:4; /* flags, see below */ unsigned int ipt_oflw:4; /* overflow counter */ @@ -145,7 +145,7 @@ struct ip_timestamp unsigned int ipt_oflw:4; /* overflow counter */ unsigned int ipt_flg:4; /* flags, see below */ #endif - uint32_t data[9]; + __uint32_t data[9]; }; #endif /* __USE_MISC */ diff --git a/inet/netinet/ip6.h b/inet/netinet/ip6.h index 157a27d2df..e2a8d2b356 100644 --- a/inet/netinet/ip6.h +++ b/inet/netinet/ip6.h @@ -18,8 +18,10 @@ #ifndef _NETINET_IP6_H #define _NETINET_IP6_H 1 -#include +#include #include +#include +#include struct ip6_hdr { @@ -27,13 +29,13 @@ struct ip6_hdr { struct ip6_hdrctl { - uint32_t ip6_un1_flow; /* 4 bits version, 8 bits TC, - 20 bits flow-ID */ - uint16_t ip6_un1_plen; /* payload length */ - uint8_t ip6_un1_nxt; /* next header */ - uint8_t ip6_un1_hlim; /* hop limit */ + __uint32_t ip6_un1_flow; /* 4 bits version, 8 bits TC, + 20 bits flow-ID */ + __uint16_t ip6_un1_plen; /* payload length */ + __uint8_t ip6_un1_nxt; /* next header */ + __uint8_t ip6_un1_hlim; /* hop limit */ } ip6_un1; - uint8_t ip6_un2_vfc; /* 4 bits version, top 4 bits tclass */ + __uint8_t ip6_un2_vfc; /* 4 bits version, top 4 bits tclass */ } ip6_ctlun; struct in6_addr ip6_src; /* source address */ struct in6_addr ip6_dst; /* destination address */ @@ -49,45 +51,45 @@ struct ip6_hdr /* Generic extension header. */ struct ip6_ext { - uint8_t ip6e_nxt; /* next header. */ - uint8_t ip6e_len; /* length in units of 8 octets. */ + __uint8_t ip6e_nxt; /* next header. */ + __uint8_t ip6e_len; /* length in units of 8 octets. */ }; /* Hop-by-Hop options header. */ struct ip6_hbh { - uint8_t ip6h_nxt; /* next header. */ - uint8_t ip6h_len; /* length in units of 8 octets. */ + __uint8_t ip6h_nxt; /* next header. */ + __uint8_t ip6h_len; /* length in units of 8 octets. */ /* followed by options */ }; /* Destination options header */ struct ip6_dest { - uint8_t ip6d_nxt; /* next header */ - uint8_t ip6d_len; /* length in units of 8 octets */ + __uint8_t ip6d_nxt; /* next header */ + __uint8_t ip6d_len; /* length in units of 8 octets */ /* followed by options */ }; /* Routing header */ struct ip6_rthdr { - uint8_t ip6r_nxt; /* next header */ - uint8_t ip6r_len; /* length in units of 8 octets */ - uint8_t ip6r_type; /* routing type */ - uint8_t ip6r_segleft; /* segments left */ + __uint8_t ip6r_nxt; /* next header */ + __uint8_t ip6r_len; /* length in units of 8 octets */ + __uint8_t ip6r_type; /* routing type */ + __uint8_t ip6r_segleft; /* segments left */ /* followed by routing type specific data */ }; /* Type 0 Routing header */ struct ip6_rthdr0 { - uint8_t ip6r0_nxt; /* next header */ - uint8_t ip6r0_len; /* length in units of 8 octets */ - uint8_t ip6r0_type; /* always zero */ - uint8_t ip6r0_segleft; /* segments left */ - uint8_t ip6r0_reserved; /* reserved field */ - uint8_t ip6r0_slmap[3]; /* strict/loose bit map */ + __uint8_t ip6r0_nxt; /* next header */ + __uint8_t ip6r0_len; /* length in units of 8 octets */ + __uint8_t ip6r0_type; /* always zero */ + __uint8_t ip6r0_segleft; /* segments left */ + __uint8_t ip6r0_reserved; /* reserved field */ + __uint8_t ip6r0_slmap[3]; /* strict/loose bit map */ /* followed by up to 127 struct in6_addr */ struct in6_addr ip6r0_addr[0]; }; @@ -95,10 +97,10 @@ struct ip6_rthdr0 /* Fragment header */ struct ip6_frag { - uint8_t ip6f_nxt; /* next header */ - uint8_t ip6f_reserved; /* reserved field */ - uint16_t ip6f_offlg; /* offset, reserved, and flag */ - uint32_t ip6f_ident; /* identification */ + __uint8_t ip6f_nxt; /* next header */ + __uint8_t ip6f_reserved; /* reserved field */ + __uint16_t ip6f_offlg; /* offset, reserved, and flag */ + __uint32_t ip6f_ident; /* identification */ }; #if __BYTE_ORDER == __BIG_ENDIAN @@ -114,8 +116,8 @@ struct ip6_frag /* IPv6 options */ struct ip6_opt { - uint8_t ip6o_type; - uint8_t ip6o_len; + __uint8_t ip6o_type; + __uint8_t ip6o_len; }; /* The high-order 3 bits of the option type define the behavior @@ -141,19 +143,19 @@ struct ip6_opt /* Jumbo Payload Option */ struct ip6_opt_jumbo { - uint8_t ip6oj_type; - uint8_t ip6oj_len; - uint8_t ip6oj_jumbo_len[4]; + __uint8_t ip6oj_type; + __uint8_t ip6oj_len; + __uint8_t ip6oj_jumbo_len[4]; }; #define IP6OPT_JUMBO_LEN 6 /* NSAP Address Option */ struct ip6_opt_nsap { - uint8_t ip6on_type; - uint8_t ip6on_len; - uint8_t ip6on_src_nsap_len; - uint8_t ip6on_dst_nsap_len; + __uint8_t ip6on_type; + __uint8_t ip6on_len; + __uint8_t ip6on_src_nsap_len; + __uint8_t ip6on_dst_nsap_len; /* followed by source NSAP */ /* followed by destination NSAP */ }; @@ -161,17 +163,17 @@ struct ip6_opt_nsap /* Tunnel Limit Option */ struct ip6_opt_tunnel { - uint8_t ip6ot_type; - uint8_t ip6ot_len; - uint8_t ip6ot_encap_limit; + __uint8_t ip6ot_type; + __uint8_t ip6ot_len; + __uint8_t ip6ot_encap_limit; }; /* Router Alert Option */ struct ip6_opt_router { - uint8_t ip6or_type; - uint8_t ip6or_len; - uint8_t ip6or_value[2]; + __uint8_t ip6or_type; + __uint8_t ip6or_len; + __uint8_t ip6or_value[2]; }; /* Router alert values (in network byte order) */ diff --git a/sysdeps/gnu/netinet/ip_icmp.h b/inet/netinet/ip_icmp.h similarity index 91% rename from sysdeps/gnu/netinet/ip_icmp.h rename to inet/netinet/ip_icmp.h index 2e2bfe9ff6..da7ff3b81b 100644 --- a/sysdeps/gnu/netinet/ip_icmp.h +++ b/inet/netinet/ip_icmp.h @@ -18,28 +18,28 @@ #ifndef __NETINET_IP_ICMP_H #define __NETINET_IP_ICMP_H 1 -#include -#include +#include +#include __BEGIN_DECLS struct icmphdr { - uint8_t type; /* message type */ - uint8_t code; /* type sub-code */ - uint16_t checksum; + __uint8_t type; /* message type */ + __uint8_t code; /* type sub-code */ + __uint16_t checksum; union { struct { - uint16_t id; - uint16_t sequence; + __uint16_t id; + __uint16_t sequence; } echo; /* echo datagram */ - uint32_t gateway; /* gateway address */ + __uint32_t gateway; /* gateway address */ struct { - uint16_t __glibc_reserved; - uint16_t mtu; + __uint16_t __glibc_reserved; + __uint16_t mtu; } frag; /* path mtu discovery */ } un; }; @@ -130,38 +130,38 @@ struct icmphdr */ struct icmp_ra_addr { - uint32_t ira_addr; - uint32_t ira_preference; + __uint32_t ira_addr; + __uint32_t ira_preference; }; struct icmp { - uint8_t icmp_type; /* type of message, see below */ - uint8_t icmp_code; /* type sub code */ - uint16_t icmp_cksum; /* ones complement checksum of struct */ + __uint8_t icmp_type; /* type of message, see below */ + __uint8_t icmp_code; /* type sub code */ + __uint16_t icmp_cksum; /* ones complement checksum of struct */ union { unsigned char ih_pptr; /* ICMP_PARAMPROB */ struct in_addr ih_gwaddr; /* gateway address */ struct ih_idseq /* echo datagram */ { - uint16_t icd_id; - uint16_t icd_seq; + __uint16_t icd_id; + __uint16_t icd_seq; } ih_idseq; - uint32_t ih_void; + __uint32_t ih_void; /* ICMP_UNREACH_NEEDFRAG -- Path MTU Discovery (RFC1191) */ struct ih_pmtu { - uint16_t ipm_void; - uint16_t ipm_nextmtu; + __uint16_t ipm_void; + __uint16_t ipm_nextmtu; } ih_pmtu; struct ih_rtradv { - uint8_t irt_num_addrs; - uint8_t irt_wpa; - uint16_t irt_lifetime; + __uint8_t irt_num_addrs; + __uint8_t irt_wpa; + __uint16_t irt_lifetime; } ih_rtradv; } icmp_hun; #define icmp_pptr icmp_hun.ih_pptr @@ -178,9 +178,9 @@ struct icmp { struct { - uint32_t its_otime; - uint32_t its_rtime; - uint32_t its_ttime; + __uint32_t its_otime; + __uint32_t its_rtime; + __uint32_t its_ttime; } id_ts; struct { @@ -188,8 +188,8 @@ struct icmp /* options and then 64 bits of data */ } id_ip; struct icmp_ra_addr id_radv; - uint32_t id_mask; - uint8_t id_data[1]; + __uint32_t id_mask; + __uint8_t id_data[1]; } icmp_dun; #define icmp_otime icmp_dun.id_ts.its_otime #define icmp_rtime icmp_dun.id_ts.its_rtime diff --git a/sysdeps/gnu/netinet/udp.h b/inet/netinet/udp.h similarity index 91% rename from sysdeps/gnu/netinet/udp.h rename to inet/netinet/udp.h index b6822cb3e2..481cbeae60 100644 --- a/sysdeps/gnu/netinet/udp.h +++ b/inet/netinet/udp.h @@ -47,8 +47,8 @@ #ifndef __NETINET_UDP_H #define __NETINET_UDP_H 1 -#include -#include +#include +#include /* UDP header as specified by RFC 768, August 1980. */ @@ -58,17 +58,17 @@ struct udphdr { struct { - uint16_t uh_sport; /* source port */ - uint16_t uh_dport; /* destination port */ - uint16_t uh_ulen; /* udp length */ - uint16_t uh_sum; /* udp checksum */ + __uint16_t uh_sport; /* source port */ + __uint16_t uh_dport; /* destination port */ + __uint16_t uh_ulen; /* udp length */ + __uint16_t uh_sum; /* udp checksum */ }; struct { - uint16_t source; - uint16_t dest; - uint16_t len; - uint16_t check; + __uint16_t source; + __uint16_t dest; + __uint16_t len; + __uint16_t check; }; }; }; diff --git a/inet/protocols/rwhod.h b/inet/protocols/rwhod.h index 446d6f97b8..74fe1f926c 100644 --- a/inet/protocols/rwhod.h +++ b/inet/protocols/rwhod.h @@ -32,7 +32,8 @@ #ifndef _PROTOCOLS_RWHOD_H #define _PROTOCOLS_RWHOD_H 1 -#include +#include +#include /* * rwho protocol packet format. @@ -40,7 +41,7 @@ struct outmp { char out_line[8]; /* tty name */ char out_name[8]; /* user id */ - int32_t out_time; /* time on */ + __int32_t out_time; /* time on */ }; struct whod { diff --git a/inet/protocols/talkd.h b/inet/protocols/talkd.h index 09bd8a90ba..5068e981b7 100644 --- a/inet/protocols/talkd.h +++ b/inet/protocols/talkd.h @@ -50,9 +50,8 @@ * stream connection through which the conversation takes place. */ -#include -#include -#include +#include +#include #include /* @@ -63,10 +62,10 @@ typedef struct { unsigned char type; /* request type, see below */ unsigned char answer; /* not used */ unsigned char pad; - uint32_t id_num; /* message id */ + __uint32_t id_num; /* message id */ struct osockaddr addr; /* old (4.3) style */ struct osockaddr ctl_addr; /* old (4.3) style */ - int32_t pid; /* caller's process id */ + __int32_t pid; /* caller's process id */ #define NAME_SIZE 12 char l_name[NAME_SIZE];/* caller's name */ char r_name[NAME_SIZE];/* callee's name */ @@ -82,7 +81,7 @@ typedef struct { unsigned char type; /* type of request message, see below */ unsigned char answer; /* response to request message, see below */ unsigned char pad; - uint32_t id_num; /* message id */ + __uint32_t id_num; /* message id */ struct osockaddr addr; /* address for establishing conversation */ } CTL_RESPONSE; diff --git a/inet/protocols/timed.h b/inet/protocols/timed.h index cabdce44a6..5ec9de87a7 100644 --- a/inet/protocols/timed.h +++ b/inet/protocols/timed.h @@ -32,8 +32,9 @@ #ifndef _PROTOCOLS_TIMED_H #define _PROTOCOLS_TIMED_H 1 -#include -#include +#include +#include +#include /* * Time Synchronization Protocol diff --git a/nscd/initgrcache.c b/nscd/initgrcache.c index cf38c59b8e..678666563d 100644 --- a/nscd/initgrcache.c +++ b/nscd/initgrcache.c @@ -20,10 +20,12 @@ #include #include #include +#include #include #include #include #include +#include #include #include diff --git a/nscd/netgroupcache.c b/nscd/netgroupcache.c index cda276eade..8fcb092657 100644 --- a/nscd/netgroupcache.c +++ b/nscd/netgroupcache.c @@ -24,6 +24,7 @@ #include #include #include +#include #include "../inet/netgroup.h" #include "nscd.h" diff --git a/nss/nss_compat/compat-grp.c b/nss/nss_compat/compat-grp.c index 8f01e44a72..c46a0dc186 100644 --- a/nss/nss_compat/compat-grp.c +++ b/nss/nss_compat/compat-grp.c @@ -24,6 +24,7 @@ #include #include #include +#include #include #include diff --git a/nss/nss_compat/compat-pwd.c b/nss/nss_compat/compat-pwd.c index 37f883f35a..4b6734acae 100644 --- a/nss/nss_compat/compat-pwd.c +++ b/nss/nss_compat/compat-pwd.c @@ -25,6 +25,7 @@ #include #include #include +#include #include #include diff --git a/nss/nss_compat/compat-spwd.c b/nss/nss_compat/compat-spwd.c index bd310ab9aa..3eaa6e866b 100644 --- a/nss/nss_compat/compat-spwd.c +++ b/nss/nss_compat/compat-spwd.c @@ -25,6 +25,7 @@ #include #include #include +#include #include #include diff --git a/nss/nss_db/db-XXX.c b/nss/nss_db/db-XXX.c index e17bbff52b..ac3586ec67 100644 --- a/nss/nss_db/db-XXX.c +++ b/nss/nss_db/db-XXX.c @@ -18,6 +18,7 @@ #include #include +#include #include #include #include diff --git a/resolv/arpa/nameser.h b/resolv/arpa/nameser.h index a99d5ec508..4ce57bd3f9 100644 --- a/resolv/arpa/nameser.h +++ b/resolv/arpa/nameser.h @@ -48,9 +48,9 @@ #ifndef _ARPA_NAMESER_H_ #define _ARPA_NAMESER_H_ -#include -#include -#include +#include +#include +#include /* * Define constants based on RFC 883, RFC 1034, RFC 1035 @@ -92,7 +92,7 @@ typedef enum __ns_sect { */ typedef struct __ns_msg { const unsigned char *_msg, *_eom; - uint16_t _id, _flags, _counts[ns_s_max]; + __uint16_t _id, _flags, _counts[ns_s_max]; const unsigned char *_sections[ns_s_max]; ns_sect _sect; int _rrnum; @@ -116,10 +116,10 @@ extern const struct _ns_flagdata _ns_flagdata[]; */ typedef struct __ns_rr { char name[NS_MAXDNAME]; - uint16_t type; - uint16_t rr_class; - uint32_t ttl; - uint16_t rdlength; + __uint16_t type; + __uint16_t rr_class; + __uint32_t ttl; + __uint16_t rdlength; const unsigned char * rdata; } ns_rr; @@ -355,24 +355,24 @@ typedef enum __ns_cert_types { */ #define NS_GET16(s, cp) do { \ const unsigned char *t_cp = (const unsigned char *)(cp); \ - (s) = ((uint16_t)t_cp[0] << 8) \ - | ((uint16_t)t_cp[1]) \ + (s) = ((__uint16_t)t_cp[0] << 8) \ + | ((__uint16_t)t_cp[1]) \ ; \ (cp) += NS_INT16SZ; \ } while (0) #define NS_GET32(l, cp) do { \ const unsigned char *t_cp = (const unsigned char *)(cp); \ - (l) = ((uint32_t)t_cp[0] << 24) \ - | ((uint32_t)t_cp[1] << 16) \ - | ((uint32_t)t_cp[2] << 8) \ - | ((uint32_t)t_cp[3]) \ + (l) = ((__uint32_t)t_cp[0] << 24) \ + | ((__uint32_t)t_cp[1] << 16) \ + | ((__uint32_t)t_cp[2] << 8) \ + | ((__uint32_t)t_cp[3]) \ ; \ (cp) += NS_INT32SZ; \ } while (0) #define NS_PUT16(s, cp) do { \ - uint16_t t_s = (uint16_t)(s); \ + __uint16_t t_s = (__uint16_t)(s); \ unsigned char *t_cp = (unsigned char *)(cp); \ *t_cp++ = t_s >> 8; \ *t_cp = t_s; \ @@ -380,7 +380,7 @@ typedef enum __ns_cert_types { } while (0) #define NS_PUT32(l, cp) do { \ - uint32_t t_l = (uint32_t)(l); \ + __uint32_t t_l = (__uint32_t)(l); \ unsigned char *t_cp = (unsigned char *)(cp); \ *t_cp++ = t_l >> 24; \ *t_cp++ = t_l >> 16; \ @@ -408,7 +408,7 @@ int ns_sprintrrf (const unsigned char *, size_t, const char *, const char *, char *, size_t) __THROW; int ns_format_ttl (unsigned long, char *, size_t) __THROW; int ns_parse_ttl (const char *, unsigned long *) __THROW; -uint32_t ns_datetosecs (const char *, int *) __THROW; +__uint32_t ns_datetosecs (const char *, int *) __THROW; int ns_name_ntol (const unsigned char *, unsigned char *, size_t) __THROW; int ns_name_ntop (const unsigned char *, char *, size_t) __THROW; diff --git a/resolv/arpa/nameser_compat.h b/resolv/arpa/nameser_compat.h index 37c178b524..8996d376da 100644 --- a/resolv/arpa/nameser_compat.h +++ b/resolv/arpa/nameser_compat.h @@ -29,6 +29,7 @@ #ifndef _ARPA_NAMESER_COMPAT_ #define _ARPA_NAMESER_COMPAT_ +#include #include /*% diff --git a/resolv/ns_print.c b/resolv/ns_print.c index d61f5044b1..1dbcfb8910 100644 --- a/resolv/ns_print.c +++ b/resolv/ns_print.c @@ -19,6 +19,7 @@ /* Import. */ #include +#include #include #include @@ -28,6 +29,7 @@ #include #include #include +#include #include #include diff --git a/resolv/resolv.h b/resolv/resolv.h index b4ef66fdfa..5783de697d 100644 --- a/resolv/resolv.h +++ b/resolv/resolv.h @@ -54,11 +54,12 @@ #include -#include -#include -#include #include #include + +#include +#include +#include #include /* @@ -248,10 +249,10 @@ int loc_aton (const char *__ascii, unsigned char *__binary) __THROW; const char * loc_ntoa (const unsigned char *__binary, char *__ascii) __THROW; int dn_skipname (const unsigned char *, const unsigned char *) __THROW; -void putlong (uint32_t, unsigned char *) __THROW; -void putshort (uint16_t, unsigned char *) __THROW; +void putlong (__uint32_t, unsigned char *) __THROW; +void putshort (__uint16_t, unsigned char *) __THROW; const char * p_class (int) __THROW; -const char * p_time (uint32_t) __THROW; +const char * p_time (__uint32_t) __THROW; const char * p_type (int) __THROW; const char * p_rcode (int) __THROW; const unsigned char * p_cdnname (const unsigned char *, diff --git a/resolv/tst-ns_name_compress.c b/resolv/tst-ns_name_compress.c index 00b6e811b8..019edf722d 100644 --- a/resolv/tst-ns_name_compress.c +++ b/resolv/tst-ns_name_compress.c @@ -17,6 +17,7 @@ . */ #include +#include #include #include #include diff --git a/resolv/tst-res_hnok.c b/resolv/tst-res_hnok.c index a85449d284..3bc18163c4 100644 --- a/resolv/tst-res_hnok.c +++ b/resolv/tst-res_hnok.c @@ -18,6 +18,7 @@ #include #include +#include #include #include #include diff --git a/scripts/check-obsolete-constructs.py b/scripts/check-obsolete-constructs.py index 1ecb7c9823..db367e61ae 100755 --- a/scripts/check-obsolete-constructs.py +++ b/scripts/check-obsolete-constructs.py @@ -607,44 +607,30 @@ HEADER_ALLOWED_INCLUDES = { # Nonstandardized networking headers "ifaddrs.h": [ "sys/socket.h" ], - "resolv.h": [ "arpa/nameser.h", "netinet/in.h", - "stdio.h", "sys/param.h", - "sys/types.h" ], - "arpa/nameser.h": [ "arpa/nameser_compat.h", "stdint.h", - "sys/param.h", "sys/types.h" ], - "net/ethernet.h": [ "stdint.h", "sys/types.h", - "net/if_ether.h" ], - "net/if_arp.h": [ "stdint.h", "sys/socket.h", - "sys/types.h" ], - "net/if_ppp.h": [ "net/if.h", "net/ppp_defs.h", "stdint.h", - "sys/ioctl.h", "sys/types.h" ], - "net/if_shaper.h": [ "net/if.h", "stdint.h", "sys/ioctl.h", - "sys/types.h" ], - "net/route.h": [ "netinet/in.h", "sys/socket.h", - "sys/types.h" ], - "netatalk/at.h": [ "sys/socket.h" ], + "resolv.h": [ "arpa/nameser.h", "netinet/in.h" ], + "arpa/nameser.h": [ "arpa/nameser_compat.h" ], + + "net/ethernet.h": [ "net/if_ether.h" ], + "net/if_arp.h": [ "sys/socket.h" ], + "net/if_ppp.h": [ "net/if.h", "net/ppp_defs.h", + "sys/ioctl.h" ], + "net/if_shaper.h": [ "net/if.h", "sys/ioctl.h" ], + "net/route.h": [ "netinet/in.h", "sys/socket.h" ], + "netatalk/at.h": [ "sys/socket.h", "sys/ioctl.h" ], + "netinet/ether.h": [ "netinet/if_ether.h" ], - "netinet/icmp6.h": [ "inttypes.h", "netinet/in.h", "string.h", - "sys/types.h" ], - "netinet/if_ether.h": [ "net/ethernet.h", "net/if_arp.h", - "sys/types.h", "stdint.h" ], - "netinet/if_fddi.h": [ "stdint.h", "sys/types.h" ], - "netinet/if_tr.h": [ "stdint.h", "sys/types.h" ], - "netinet/igmp.h": [ "netinet/in.h", "sys/types.h" ], + "netinet/icmp6.h": [ "netinet/in.h" ], + "netinet/if_ether.h": [ "net/ethernet.h", "net/if_arp.h" ], + "netinet/igmp.h": [ "netinet/in.h" ], "netinet/ip.h": [ "netinet/in.h" ], - "netinet/ip6.h": [ "inttypes.h", "netinet/in.h" ], - "netinet/ip_icmp.h": [ "netinet/in.h", "netinet/ip.h", - "stdint.h", "sys/types.h" ], - "netinet/udp.h": [ "stdint.h", "sys/types.h" ], - "netipx/ipx.h": [ "stdint.h", "sys/types.h" ], + "netinet/ip6.h": [ "netinet/in.h" ], + "netinet/ip_icmp.h": [ "netinet/in.h", "netinet/ip.h" ], + "netrom/netrom.h": [ "netax25/ax25.h" ], - "netrose/rose.h": [ "netax25/ax25.h", "sys/socket.h" ], + "netrose/rose.h": [ "netax25/ax25.h" ], "protocols/routed.h": [ "sys/socket.h" ], - "protocols/rwhod.h": [ "paths.h", "sys/types.h" ], - "protocols/talkd.h": [ "stdint.h", "sys/socket.h", - "sys/types.h" ], - "protocols/timed.h": [ "sys/time.h", "sys/types.h" ], + "protocols/rwhod.h": [ "paths.h" ], # Internal headers "features.h": [ "gnu/stubs.h", "stdc-predef.h", @@ -682,7 +668,6 @@ SYSDEP_ALLOWED_INCLUDES = { "net/ethernet.h": [ "linux/if_ether.h" ], "net/if_slip.h": [ "linux/if_slip.h" ], "net/ppp_defs.h": [ "asm/types.h", "linux/ppp_defs.h" ], - "netatalk/at.h": [ "asm/types.h", "linux/atalk.h" ], "netinet/if_ether.h": [ "linux/if_ether.h" ], "netinet/if_fddi.h": [ "linux/if_fddi.h" ], diff --git a/support/resolv_test.c b/support/resolv_test.c index 903ab2ac05..45d8ec79ea 100644 --- a/support/resolv_test.c +++ b/support/resolv_test.c @@ -24,6 +24,7 @@ #include #include #include +#include #include #include #include diff --git a/sysdeps/generic/netinet/if_ether.h b/sysdeps/generic/netinet/if_ether.h index 985581732e..f4fd66da65 100644 --- a/sysdeps/generic/netinet/if_ether.h +++ b/sysdeps/generic/netinet/if_ether.h @@ -18,8 +18,8 @@ #ifndef __NETINET_IF_ETHER_H #define __NETINET_IF_ETHER_H 1 -#include -#include +#include +#include #define ETH_ALEN 6 /* Octets in one ethernet address. */ @@ -27,7 +27,7 @@ systems. */ struct ether_addr { - uint8_t ether_addr_octet[ETH_ALEN]; + __uint8_t ether_addr_octet[ETH_ALEN]; } __attribute__ ((__packed__)); #endif /* netinet/if_ether.h */ diff --git a/sysdeps/gnu/Makefile b/sysdeps/gnu/Makefile index fdfbfc45d8..9da12c540d 100644 --- a/sysdeps/gnu/Makefile +++ b/sysdeps/gnu/Makefile @@ -59,11 +59,6 @@ $(foreach o,$(object-suffixes) $(object-suffixes:=.d),\ endif -ifeq ($(subdir),inet) -sysdep_headers += netinet/udp.h netinet/ip_icmp.h -endif - - ifeq ($(subdir),csu) routines += unwind-resume shared-only-routines += unwind-resume diff --git a/sysdeps/mach/hurd/net/ethernet.h b/sysdeps/mach/hurd/net/ethernet.h index 8956694b59..3003523869 100644 --- a/sysdeps/mach/hurd/net/ethernet.h +++ b/sysdeps/mach/hurd/net/ethernet.h @@ -22,9 +22,7 @@ #define __NET_ETHERNET_H 1 #include - -#include -#include +#include #include /* IEEE 802.3 Ethernet constants */ __BEGIN_DECLS @@ -33,15 +31,15 @@ __BEGIN_DECLS systems. */ struct ether_addr { - uint8_t ether_addr_octet[ETH_ALEN]; + __uint8_t ether_addr_octet[ETH_ALEN]; }; /* 10Mb/s ethernet header */ struct ether_header { - uint8_t ether_dhost[ETH_ALEN]; /* destination eth addr */ - uint8_t ether_shost[ETH_ALEN]; /* source ether addr */ - uint16_t ether_type; /* packet type ID field */ + __uint8_t ether_dhost[ETH_ALEN]; /* destination eth addr */ + __uint8_t ether_shost[ETH_ALEN]; /* source ether addr */ + __uint16_t ether_type; /* packet type ID field */ }; /* Ethernet protocol ID's */ diff --git a/sysdeps/mach/hurd/net/if_arp.h b/sysdeps/mach/hurd/net/if_arp.h index 9e1b2233ce..38665feab4 100644 --- a/sysdeps/mach/hurd/net/if_arp.h +++ b/sysdeps/mach/hurd/net/if_arp.h @@ -23,10 +23,7 @@ #define _NET_IF_ARP_H 1 #include - -#include #include -#include __BEGIN_DECLS @@ -133,7 +130,7 @@ struct arpreq struct arpd_request { unsigned short int req; /* Request type. */ - uint32_t ip; /* IP address of entry. */ + __uint32_t ip; /* IP address of entry. */ unsigned long int dev; /* Device entry is tied to. */ unsigned long int stamp; unsigned long int updated; diff --git a/sysdeps/mach/hurd/net/route.h b/sysdeps/mach/hurd/net/route.h index 4924f099b9..fcb79bb33d 100644 --- a/sysdeps/mach/hurd/net/route.h +++ b/sysdeps/mach/hurd/net/route.h @@ -18,12 +18,11 @@ /* Based on the 4.4BSD and Linux version of this file. */ #ifndef _NET_ROUTE_H - #define _NET_ROUTE_H 1 + #include #include -#include #include diff --git a/sysdeps/unix/sysv/linux/net/ethernet.h b/sysdeps/unix/sysv/linux/net/ethernet.h index 7e49297de6..1833511c9a 100644 --- a/sysdeps/unix/sysv/linux/net/ethernet.h +++ b/sysdeps/unix/sysv/linux/net/ethernet.h @@ -21,8 +21,8 @@ #ifndef __NET_ETHERNET_H #define __NET_ETHERNET_H 1 -#include -#include +#include +#include #include /* IEEE 802.3 Ethernet constants */ @@ -32,15 +32,15 @@ __BEGIN_DECLS systems. */ struct ether_addr { - uint8_t ether_addr_octet[ETH_ALEN]; + __uint8_t ether_addr_octet[ETH_ALEN]; } __attribute__ ((__packed__)); /* 10Mb/s ethernet header */ struct ether_header { - uint8_t ether_dhost[ETH_ALEN]; /* destination eth addr */ - uint8_t ether_shost[ETH_ALEN]; /* source ether addr */ - uint16_t ether_type; /* packet type ID field */ + __uint8_t ether_dhost[ETH_ALEN]; /* destination eth addr */ + __uint8_t ether_shost[ETH_ALEN]; /* source ether addr */ + __uint16_t ether_type; /* packet type ID field */ } __attribute__ ((__packed__)); /* Ethernet protocol ID's */ diff --git a/sysdeps/unix/sysv/linux/net/if_arp.h b/sysdeps/unix/sysv/linux/net/if_arp.h index f64dcfd9d8..5013d085a2 100644 --- a/sysdeps/unix/sysv/linux/net/if_arp.h +++ b/sysdeps/unix/sysv/linux/net/if_arp.h @@ -22,9 +22,8 @@ #ifndef _NET_IF_ARP_H #define _NET_IF_ARP_H 1 -#include +#include #include -#include __BEGIN_DECLS @@ -171,7 +170,7 @@ struct arpreq_old struct arpd_request { unsigned short int req; /* Request type. */ - uint32_t ip; /* IP address of entry. */ + __uint32_t ip; /* IP address of entry. */ unsigned long int dev; /* Device entry is tied to. */ unsigned long int stamp; unsigned long int updated; diff --git a/sysdeps/unix/sysv/linux/net/if_ppp.h b/sysdeps/unix/sysv/linux/net/if_ppp.h index 31a20766f0..1fd813ba8e 100644 --- a/sysdeps/unix/sysv/linux/net/if_ppp.h +++ b/sysdeps/unix/sysv/linux/net/if_ppp.h @@ -48,10 +48,10 @@ #ifndef __NET_IF_PPP_H #define __NET_IF_PPP_H 1 -#include -#include -#include +#include +#include #include +#include #include __BEGIN_DECLS @@ -113,8 +113,8 @@ struct npioctl { /* Structure describing a CCP configuration option, for PPPIOCSCOMPRESS */ struct ppp_option_data { - uint8_t *ptr; - uint32_t length; + __uint8_t *ptr; + __uint32_t length; int transmit; }; diff --git a/sysdeps/unix/sysv/linux/net/if_shaper.h b/sysdeps/unix/sysv/linux/net/if_shaper.h index 77ab6306ac..0ccc2a90cf 100644 --- a/sysdeps/unix/sysv/linux/net/if_shaper.h +++ b/sysdeps/unix/sysv/linux/net/if_shaper.h @@ -18,8 +18,8 @@ #ifndef _NET_IF_SHAPER_H #define _NET_IF_SHAPER_H 1 -#include -#include +#include +#include #include #include @@ -43,11 +43,11 @@ __BEGIN_DECLS struct shaperconf { - uint16_t ss_cmd; + __uint16_t ss_cmd; union { char ssu_name[14]; - uint32_t ssu_speed; + __uint32_t ssu_speed; } ss_u; #define ss_speed ss_u.ssu_speed #define ss_name ss_u.ssu_name diff --git a/sysdeps/unix/sysv/linux/net/route.h b/sysdeps/unix/sysv/linux/net/route.h index a6bda2157f..a0d9a74af4 100644 --- a/sysdeps/unix/sysv/linux/net/route.h +++ b/sysdeps/unix/sysv/linux/net/route.h @@ -21,8 +21,8 @@ #define _NET_ROUTE_H 1 #include + #include -#include #include #include diff --git a/sysdeps/unix/sysv/linux/netatalk/at.h b/sysdeps/unix/sysv/linux/netatalk/at.h index 61fb67590c..f78d6b8a07 100644 --- a/sysdeps/unix/sysv/linux/netatalk/at.h +++ b/sysdeps/unix/sysv/linux/netatalk/at.h @@ -18,11 +18,46 @@ #ifndef _NETATALK_AT_H #define _NETATALK_AT_H 1 -#include +#include +#include #include -#include -#include +#include +#include + +/* Constants from linux/atalk.h as of kernel version 5.0. */ + +#define ATPORT_FIRST 1 +#define ATPORT_RESERVED 128 +#define ATPORT_LAST 254 /* 254 is only legal on localtalk */ +#define ATADDR_ANYNET 0 +#define ATADDR_ANYNODE 0 +#define ATADDR_ANYPORT 0 +#define ATADDR_BCAST 255 +#define DDP_MAXSZ 587 +#define DDP_MAXHOPS 15 /* 4 bits of hop counter */ #define SOL_ATALK 258 /* sockopt level for atalk */ +#define SIOCATALKDIFADDR (SIOCPROTOPRIVATE + 0) + +struct atalk_addr +{ + __uint16_t s_net; /* network byte order */ + __uint8_t s_node; +}; + +struct atalk_netrange +{ + __uint8_t nr_phase; + __uint16_t nr_firstnet; /* network byte order */ + __uint16_t nr_lastnet; /* network byte order */ +}; + +struct sockaddr_at +{ + __SOCKADDR_COMMON (sat_); + __uint8_t sat_port; + struct atalk_addr sat_addr; + __uint8_t sat_zero[8]; +}; #endif /* netatalk/at.h */ diff --git a/sysdeps/unix/sysv/linux/netinet/if_ether.h b/sysdeps/unix/sysv/linux/netinet/if_ether.h index 2c0750000f..51acbfd5b7 100644 --- a/sysdeps/unix/sysv/linux/netinet/if_ether.h +++ b/sysdeps/unix/sysv/linux/netinet/if_ether.h @@ -16,10 +16,10 @@ . */ #ifndef __NETINET_IF_ETHER_H - #define __NETINET_IF_ETHER_H 1 + #include -#include +#include /* Get definitions from kernel header file. */ #include @@ -56,7 +56,6 @@ * @(#)if_ether.h 8.3 (Berkeley) 5/2/95 * $FreeBSD$ */ - #include #include @@ -70,10 +69,10 @@ __BEGIN_DECLS */ struct ether_arp { struct arphdr ea_hdr; /* fixed-size header */ - uint8_t arp_sha[ETH_ALEN]; /* sender hardware address */ - uint8_t arp_spa[4]; /* sender protocol address */ - uint8_t arp_tha[ETH_ALEN]; /* target hardware address */ - uint8_t arp_tpa[4]; /* target protocol address */ + __uint8_t arp_sha[ETH_ALEN]; /* sender hardware address */ + __uint8_t arp_spa[4]; /* sender protocol address */ + __uint8_t arp_tha[ETH_ALEN]; /* target hardware address */ + __uint8_t arp_tpa[4]; /* target protocol address */ }; #define arp_hrd ea_hdr.ar_hrd #define arp_pro ea_hdr.ar_pro @@ -88,14 +87,14 @@ struct ether_arp { */ #define ETHER_MAP_IP_MULTICAST(ipaddr, enaddr) \ /* struct in_addr *ipaddr; */ \ - /* uint8_t enaddr[ETH_ALEN]; */ \ + /* __uint8_t enaddr[ETH_ALEN]; */ \ { \ (enaddr)[0] = 0x01; \ (enaddr)[1] = 0x00; \ (enaddr)[2] = 0x5e; \ - (enaddr)[3] = ((uint8_t *)ipaddr)[1] & 0x7f; \ - (enaddr)[4] = ((uint8_t *)ipaddr)[2]; \ - (enaddr)[5] = ((uint8_t *)ipaddr)[3]; \ + (enaddr)[3] = ((__uint8_t *)ipaddr)[1] & 0x7f; \ + (enaddr)[4] = ((__uint8_t *)ipaddr)[2]; \ + (enaddr)[5] = ((__uint8_t *)ipaddr)[3]; \ } __END_DECLS diff --git a/sysdeps/unix/sysv/linux/netinet/if_fddi.h b/sysdeps/unix/sysv/linux/netinet/if_fddi.h index 2e4bb939f2..6a0e0d82d6 100644 --- a/sysdeps/unix/sysv/linux/netinet/if_fddi.h +++ b/sysdeps/unix/sysv/linux/netinet/if_fddi.h @@ -18,16 +18,18 @@ #ifndef _NETINET_IF_FDDI_H #define _NETINET_IF_FDDI_H 1 -#include -#include +#include +#include + #include #ifdef __USE_MISC -struct fddi_header { - uint8_t fddi_fc; /* Frame Control (FC) value */ - uint8_t fddi_dhost[FDDI_K_ALEN]; /* Destination host */ - uint8_t fddi_shost[FDDI_K_ALEN]; /* Source host */ +struct fddi_header +{ + __uint8_t fddi_fc; /* Frame Control (FC) value */ + __uint8_t fddi_dhost[FDDI_K_ALEN]; /* Destination host */ + __uint8_t fddi_shost[FDDI_K_ALEN]; /* Source host */ }; #endif diff --git a/sysdeps/unix/sysv/linux/netinet/if_tr.h b/sysdeps/unix/sysv/linux/netinet/if_tr.h index 9db6b7a6b5..6d6fd4f7cf 100644 --- a/sysdeps/unix/sysv/linux/netinet/if_tr.h +++ b/sysdeps/unix/sysv/linux/netinet/if_tr.h @@ -16,49 +16,49 @@ . */ #ifndef _NETINET_IF_TR_H -#define _NETINET_IF_TR_H 1 +#define _NETINET_IF_TR_H 1 -#include -#include +#include +#include /* IEEE 802.5 Token-Ring magic constants. The frame sizes omit the preamble and FCS/CRC (frame check sequence). */ #define TR_ALEN 6 /* Octets in one token-ring addr */ -#define TR_HLEN (sizeof (struct trh_hdr) + sizeof (struct trllc)) +#define TR_HLEN (sizeof (struct trh_hdr) + sizeof (struct trllc)) #define AC 0x10 -#define LLC_FRAME 0x40 +#define LLC_FRAME 0x40 /* LLC and SNAP constants */ -#define EXTENDED_SAP 0xAA -#define UI_CMD 0x03 +#define EXTENDED_SAP 0xAA +#define UI_CMD 0x03 /* This is an Token-Ring frame header. */ struct trh_hdr { - uint8_t ac; /* access control field */ - uint8_t fc; /* frame control field */ - uint8_t daddr[TR_ALEN]; /* destination address */ - uint8_t saddr[TR_ALEN]; /* source address */ - uint16_t rcf; /* route control field */ - uint16_t rseg[8]; /* routing registers */ + __uint8_t ac; /* access control field */ + __uint8_t fc; /* frame control field */ + __uint8_t daddr[TR_ALEN]; /* destination address */ + __uint8_t saddr[TR_ALEN]; /* source address */ + __uint16_t rcf; /* route control field */ + __uint16_t rseg[8]; /* routing registers */ }; /* This is an Token-Ring LLC structure */ struct trllc { - uint8_t dsap; /* destination SAP */ - uint8_t ssap; /* source SAP */ - uint8_t llc; /* LLC control field */ - uint8_t protid[3]; /* protocol id */ - uint16_t ethertype; /* ether type field */ + __uint8_t dsap; /* destination SAP */ + __uint8_t ssap; /* source SAP */ + __uint8_t llc; /* LLC control field */ + __uint8_t protid[3]; /* protocol id */ + __uint16_t ethertype; /* ether type field */ }; /* Token-Ring statistics collection data. */ struct tr_statistics { - unsigned long rx_packets; /* total packets received */ + unsigned long rx_packets; /* total packets received */ unsigned long tx_packets; /* total packets transmitted */ - unsigned long rx_bytes; /* total bytes received */ + unsigned long rx_bytes; /* total bytes received */ unsigned long tx_bytes; /* total bytes transmitted */ unsigned long rx_errors; /* bad packets received */ unsigned long tx_errors; /* packet transmit problems */ @@ -84,27 +84,27 @@ struct tr_statistics }; /* source routing stuff */ -#define TR_RII 0x80 -#define TR_RCF_DIR_BIT 0x80 -#define TR_RCF_LEN_MASK 0x1f00 -#define TR_RCF_BROADCAST 0x8000 /* all-routes broadcast */ +#define TR_RII 0x80 +#define TR_RCF_DIR_BIT 0x80 +#define TR_RCF_LEN_MASK 0x1f00 +#define TR_RCF_BROADCAST 0x8000 /* all-routes broadcast */ #define TR_RCF_LIMITED_BROADCAST 0xC000 /* single-route broadcast */ -#define TR_RCF_FRAME2K 0x20 -#define TR_RCF_BROADCAST_MASK 0xC000 -#define TR_MAXRIFLEN 18 +#define TR_RCF_FRAME2K 0x20 +#define TR_RCF_BROADCAST_MASK 0xC000 +#define TR_MAXRIFLEN 18 #ifdef __USE_MISC struct trn_hdr { - uint8_t trn_ac; /* access control field */ - uint8_t trn_fc; /* field control field */ - uint8_t trn_dhost[TR_ALEN]; /* destination host */ - uint8_t trn_shost[TR_ALEN]; /* source host */ - uint16_t trn_rcf; /* route control field */ - uint16_t trn_rseg[8]; /* routing registers */ + __uint8_t trn_ac; /* access control field */ + __uint8_t trn_fc; /* field control field */ + __uint8_t trn_dhost[TR_ALEN]; /* destination host */ + __uint8_t trn_shost[TR_ALEN]; /* source host */ + __uint16_t trn_rcf; /* route control field */ + __uint16_t trn_rseg[8]; /* routing registers */ }; #endif -#endif /* netinet/if_tr.h */ +#endif /* netinet/if_tr.h */ diff --git a/sysdeps/unix/sysv/linux/netipx/ipx.h b/sysdeps/unix/sysv/linux/netipx/ipx.h index 6ccbb8846f..fbd3d9f380 100644 --- a/sysdeps/unix/sysv/linux/netipx/ipx.h +++ b/sysdeps/unix/sysv/linux/netipx/ipx.h @@ -18,8 +18,8 @@ #ifndef __NETIPX_IPX_H #define __NETIPX_IPX_H 1 -#include -#include +#include +#include #include __BEGIN_DECLS @@ -33,10 +33,10 @@ __BEGIN_DECLS struct sockaddr_ipx { sa_family_t sipx_family; - uint16_t sipx_port; - uint32_t sipx_network; + __uint16_t sipx_port; + __uint32_t sipx_network; unsigned char sipx_node[IPX_NODE_LEN]; - uint8_t sipx_type; + __uint8_t sipx_type; unsigned char sipx_zero; /* 16 byte fill */ }; diff --git a/sysdeps/unix/sysv/linux/netrose/rose.h b/sysdeps/unix/sysv/linux/netrose/rose.h index ab2afb383e..1c4bd26a8f 100644 --- a/sysdeps/unix/sysv/linux/netrose/rose.h +++ b/sysdeps/unix/sysv/linux/netrose/rose.h @@ -21,7 +21,7 @@ #ifndef _NETROSE_ROSE_H #define _NETROSE_ROSE_H 1 -#include +#include #include /* Socket level values. */ From patchwork Wed Jun 26 17:50:27 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Zack Weinberg X-Patchwork-Id: 1122966 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-103187-incoming=patchwork.ozlabs.org@sourceware.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=panix.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.b="LSutvj0q"; 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 45Ys2039n3z9s7h for ; Thu, 27 Jun 2019 04:27:04 +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:in-reply-to :references:mime-version:content-type:content-transfer-encoding; q=dns; s=default; b=wcOeFfrVA8jqTpxsT1NT61ZnUXHJZ6qK0ArN0wPYzB3 u9QHre25ZqKG5EPg61O9XQV4rUwIYSiSK9ocF+huHFy4arwyXXt9JCHldYHW1en5 kq60xOJz7GqQaOX0oUQ6zaHQ6Zydsh2pgE10HwkmRl7cN8Q1LnYtsYc5xYrcoCQ0 = 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:in-reply-to :references:mime-version:content-type:content-transfer-encoding; s=default; bh=1XeYE4krbLc/RTn9qqYJ1ImhDco=; b=LSutvj0qp/CwABelr D8akDT2GMjMIJAVWfS2HWAfFJIJgCzqGq14D8krcl+H2a1AsG8urrPMBQAQr5EUn Z6GopUMTEDE9DzaoQLm1CgHLgU3a5dtEUVCijLHtIX7rTQmu5ZwuJmJJkHtqvAKt OOgcc9fKRsj4ZqVuf0gB41ytdg= Received: (qmail 2735 invoked by alias); 26 Jun 2019 18:26:40 -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 2661 invoked by uid 89); 26 Jun 2019 18:26:39 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-17.1 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_SHORT, SPF_HELO_PASS, SPF_PASS autolearn=ham version=3.3.1 spammy=September, september X-HELO: l2mail1.panix.com From: Zack Weinberg To: libc-alpha@sourceware.org Cc: joseph@codesourcery.com, carlos@redhat.com Subject: [PATCH 23/25] =?utf-8?q?Don=E2=80=99t_include_sys/socket=2Eh_from?= =?utf-8?q?_public_headers=2E?= Date: Wed, 26 Jun 2019 13:50:27 -0400 Message-Id: <20190626175029.4699-14-zackw@panix.com> In-Reply-To: <20190626175029.4699-1-zackw@panix.com> References: <20190626175029.4699-1-zackw@panix.com> MIME-Version: 1.0 No standard public header is required to include sys/socket.h, although some are allowed to. Several public headers need the definitions of socklen_t, struct sockaddr, and/or struct sockaddr_storage, but nothing else from sys/socket.h. We already have a single-type header for socklen_t, so this patch adds single-type headers for struct sockaddr and struct sockaddr_storage. The definition of struct sockaddr_storage is subtly different on Linux than on the Hurd; in order to not need two copies of bits/types/struct_sockaddr_storage.h, bits/sockaddr.h is now responsible for defining __ss_aligntype if ‘unsigned long int’ is not the correct definition. I also added a single-type header for struct linger, even though only sys/socket.h is expected to define that, just because all three copies of bits/socket.h were defining it exactly the same way. There would also be a case for defining it directly in sys/socket.h but this seemed tidier. I did *not* create single-type headers for struct msghdr and struct cmsghdr, because those and their helper macros are not consistent among the three copies of bits/socket.h, and, again, only sys/socket.h is expected to define them. The large number of .c files that add an `#include ` might make this look like it’s not worth doing. However, after this change, only half of the files in the glibc source tree that include netinet/in.h also need to include sys/socket.h, and only a third of the files that include netdb.h need to include sys/socket.h. Before, all of the files in both groups were getting sys/socket.h. That seems like enough justification to me. While I was at it I noticed that sys/socketvar.h is yet another backward compatibility header that does nothing but include some other header (sys/socket.h, in this case) and also doesn’t need to be system-dependent. * socket/bits/types/struct_linger.h * socket/bits/types/struct_sockaddr.h * socket/bits/types/struct_sockaddr_storage.h: New single-type headers, factored out of the various bits/socket.h headers. * include/bits/types/struct_linger.h * include/bits/types/struct_sockaddr.h * include/bits/types/struct_sockaddr_storage.h: New wrappers. * socket/Makefile (headers): Add bits/types/struct_linger.h, bits/types/struct_sockaddr.h, and bits/types/struct_sockaddr_storage.h. Alphabetize the list. * bits/socket.h, sysdeps/mach/hurd/bits/socket.h * sysdeps/unix/sysv/linux/bits/socket.h: Don’t define struct sockaddr, struct sockaddr_storage, __ss_aligntype, or struct linger here. Minimize inclusions. * sysdeps/unix/bsd/bits/sockaddr.h: Define __ss_aligntype here. * socket/sys/socket.h: Include bits/types/struct_linger.h, bits/sockaddr.h, bits/types/struct_sockaddr.h, and bits/types/struct_sockaddr_storage.h. Move inclusion of bits/socket.h below forward declaration of struct timespec, and update commentary. * inet/ifaddrs.h, socket/net/if.h * sysdeps/mach/hurd/net/if_arp.h * sysdeps/mach/hurd/net/route.h * sysdeps/unix/sysv/linux/errqueue.h * sysdeps/unix/sysv/linux/net/if_arp.h * sysdeps/unix/sysv/linux/net/route.h: Include bits/types/struct_sockaddr.h and possibly also bits/types.h, not sys/socket.h or sys/types.h. * sysdeps/unix/sysv/linux/errqueue.h: * sysdeps/unix/sysv/linux/net/route.h: Use __uint8_t and __uint32_t instead of uint8_t and uint32_t. * inet/arpa/inet.h: Include bits/types/size_t.h. * inet/netinet/in.h: Include bits/sockaddr.h, bits/types/struct_sockaddr.h, and bits/types/struct_sockaddr_storage.h, not sys/socket.h. Use __socklen_t instead of socklen_t. * inet/netinet/tcp.h: Include bits/types.h and bits/types/struct_sockaddr_storage.h, not sys/socket.h or bits/stdint-uintn.h. Use __uint8_t, __uint16_t, and __uint32_t instead of uint8_t, uint16_t and uint32_t. * inet/protocols/routed.h: Include features.h and bits/types/struct_sockaddr.h, not sys/socket.h. * resolv/netdb.h: Include bits/types/socklen_t.h. * sysdeps/unix/sysv/linux/netatalk/at.h: Don’t include sys/socket.h. * include/ifaddrs.h: Include stddef.h for size_t. * include/netdb.h: Use __socklen_t instead of socklen_t. * inet/check_pf.c, inet/gethstbynm.c, inet/gethstbynm_r.c * inet/getsourcefilter.c, inet/inet6_opt.c, inet/inet6_option.c * inet/inet6_rth.c, inet/setsourcefilter.c, inet/test-ifaddrs.c * inet/test-inet6_opt.c, inet/tst-inet6_rth.c * inet/tst-inet6_scopeid_pton.c, nis/nss_nis/nis-hosts.c * nis/nss_nisplus/nisplus-hosts.c, nscd/aicache.c, nscd/cache.c * nscd/hstcache.c, nscd/initgrcache.c, nscd/netgroupcache.c * nscd/nscd_gethst_r.c, nscd/servicescache.c, nss/digits_dots.c * nss/nss_files/files-hosts.c, nss/nss_files/files-network.c * nss/tst-nss-files-hosts-erange.c, nss/tst-nss-files-hosts-getent.c * nss/tst-nss-files-hosts-multi.c, posix/tst-getaddrinfo3.c * resolv/nss_dns/dns-network.c, resolv/resolv_conf.c * resolv/tst-bug18665-tcp.c, resolv/tst-bug18665.c * resolv/tst-inet_ntop.c, resolv/tst-inet_pton.c * resolv/tst-resolv-ai_idn-common.c, resolv/tst-resolv-basic.c * resolv/tst-resolv-edns.c, resolv/tst-resolv-network.c * resolv/tst-resolv-nondecimal.c, resolv/tst-resolv-search.c * resolv/tst-resolv-threads.c, resolv/tst-resolv-trailing.c * sunrpc/rpc_gethostbyname.c * support/support_format_address_family.c * support/support_format_addrinfo.c * support/support_format_dns_packet.c * support/support_format_hostent.c, support/support_format_netent.c * sysdeps/mach/hurd/if_index.c * sysdeps/unix/sysv/linux/check_native.c: Include sys/socket.h. * resolv/tst-resolv-binary.c: Include sys/types.h. * sysdeps/generic/sys/socketvar.h: Move to socket/sys/socketvar.h. * include/sys/socketvar.h: New wrapper. * scripts/check-obsolete-constructs.py (HEADER_ALLOWED_INCLUDES): Update. --- bits/socket.h | 39 ---- include/bits/types/struct_linger.h | 1 + include/bits/types/struct_sockaddr.h | 1 + include/bits/types/struct_sockaddr_storage.h | 1 + include/ifaddrs.h | 1 + include/netdb.h | 8 +- include/sys/socketvar.h | 1 + inet/arpa/inet.h | 1 + inet/check_pf.c | 1 + inet/gethstbynm.c | 1 + inet/gethstbynm_r.c | 1 + inet/getsourcefilter.c | 1 + inet/ifaddrs.h | 2 +- inet/inet6_opt.c | 1 + inet/inet6_option.c | 1 + inet/inet6_rth.c | 1 + inet/netinet/in.h | 35 ++-- inet/netinet/tcp.h | 180 +++++++++---------- inet/protocols/routed.h | 4 +- inet/setsourcefilter.c | 2 +- inet/test-ifaddrs.c | 1 + inet/test-inet6_opt.c | 1 + inet/tst-inet6_rth.c | 1 + inet/tst-inet6_scopeid_pton.c | 1 + nis/nss_nis/nis-hosts.c | 1 + nis/nss_nisplus/nisplus-hosts.c | 1 + nscd/aicache.c | 1 + nscd/cache.c | 1 + nscd/hstcache.c | 1 + nscd/initgrcache.c | 1 + nscd/netgroupcache.c | 1 + nscd/nscd_gethst_r.c | 1 + nscd/servicescache.c | 1 + nss/digits_dots.c | 1 + nss/nss_files/files-hosts.c | 1 + nss/nss_files/files-network.c | 1 + nss/tst-nss-files-hosts-erange.c | 1 + nss/tst-nss-files-hosts-getent.c | 1 + nss/tst-nss-files-hosts-multi.c | 1 + posix/tst-getaddrinfo3.c | 1 + resolv/netdb.h | 1 + resolv/nss_dns/dns-network.c | 1 + resolv/resolv_conf.c | 1 + resolv/tst-bug18665-tcp.c | 1 + resolv/tst-bug18665.c | 1 + resolv/tst-inet_ntop.c | 1 + resolv/tst-inet_pton.c | 1 + resolv/tst-resolv-ai_idn-common.c | 1 + resolv/tst-resolv-basic.c | 1 + resolv/tst-resolv-binary.c | 1 + resolv/tst-resolv-edns.c | 1 + resolv/tst-resolv-network.c | 1 + resolv/tst-resolv-nondecimal.c | 1 + resolv/tst-resolv-search.c | 1 + resolv/tst-resolv-threads.c | 1 + resolv/tst-resolv-trailing.c | 1 + scripts/check-obsolete-constructs.py | 12 +- socket/Makefile | 8 +- socket/bits/types/struct_linger.h | 11 ++ socket/bits/types/struct_sockaddr.h | 15 ++ socket/bits/types/struct_sockaddr_storage.h | 21 +++ socket/net/if.h | 2 +- socket/sys/socket.h | 13 +- {sysdeps/generic => socket}/sys/socketvar.h | 0 sunrpc/rpc_gethostbyname.c | 1 + support/support_format_address_family.c | 1 + support/support_format_addrinfo.c | 1 + support/support_format_dns_packet.c | 1 + support/support_format_hostent.c | 1 + support/support_format_netent.c | 1 + sysdeps/mach/hurd/bits/socket.h | 40 ----- sysdeps/mach/hurd/if_index.c | 1 + sysdeps/mach/hurd/net/if_arp.h | 3 +- sysdeps/mach/hurd/net/route.h | 2 +- sysdeps/unix/bsd/bits/sockaddr.h | 9 + sysdeps/unix/sysv/linux/bits/socket.h | 35 ---- sysdeps/unix/sysv/linux/check_native.c | 1 + sysdeps/unix/sysv/linux/errqueue.h | 19 +- sysdeps/unix/sysv/linux/net/if_arp.h | 3 +- sysdeps/unix/sysv/linux/net/route.h | 17 +- sysdeps/unix/sysv/linux/netatalk/at.h | 3 +- 81 files changed, 273 insertions(+), 267 deletions(-) create mode 100644 include/bits/types/struct_linger.h create mode 100644 include/bits/types/struct_sockaddr.h create mode 100644 include/bits/types/struct_sockaddr_storage.h create mode 100644 include/sys/socketvar.h create mode 100644 socket/bits/types/struct_linger.h create mode 100644 socket/bits/types/struct_sockaddr.h create mode 100644 socket/bits/types/struct_sockaddr_storage.h rename {sysdeps/generic => socket}/sys/socketvar.h (100%) diff --git a/bits/socket.h b/bits/socket.h index 8f5b85fa98..347b900e51 100644 --- a/bits/socket.h +++ b/bits/socket.h @@ -23,10 +23,6 @@ # error "Never include directly; use instead." #endif -#include -#include -#include -#include /* Types of sockets. */ enum __socket_type @@ -137,34 +133,6 @@ enum __socket_type /* Maximum queue length specifiable by listen. */ #define SOMAXCONN 128 /* 5 on the origional 4.4 BSD. */ -/* Get the definition of the macro to define the common sockaddr members. */ -#include - -/* Structure describing a generic socket address. */ -struct sockaddr - { - __SOCKADDR_COMMON (sa_); /* Common data: address family and length. */ - char sa_data[14]; /* Address data. */ - }; - - -/* Structure large enough to hold any socket address (with the historical - exception of AF_UNIX). */ -#if __WORDSIZE == 64 -# define __ss_aligntype __uint64_t -#else -# define __ss_aligntype __uint32_t -#endif -#define _SS_PADSIZE \ - (_SS_SIZE - __SOCKADDR_COMMON_SIZE - sizeof (__ss_aligntype)) - -struct sockaddr_storage - { - __SOCKADDR_COMMON (ss_); /* Address family, etc. */ - char __ss_padding[_SS_PADSIZE]; - __ss_aligntype __ss_align; /* Force desired alignment. */ - }; - /* Bits in the FLAGS argument to `send', `recv', et al. */ enum @@ -347,11 +315,4 @@ enum #define SO_TYPE SO_TYPE }; -/* Structure used to manipulate the SO_LINGER option. */ -struct linger - { - int l_onoff; /* Nonzero to linger on close. */ - int l_linger; /* Time to linger. */ - }; - #endif /* bits/socket.h */ diff --git a/include/bits/types/struct_linger.h b/include/bits/types/struct_linger.h new file mode 100644 index 0000000000..55b2f20dd7 --- /dev/null +++ b/include/bits/types/struct_linger.h @@ -0,0 +1 @@ +#include diff --git a/include/bits/types/struct_sockaddr.h b/include/bits/types/struct_sockaddr.h new file mode 100644 index 0000000000..641fbcd56d --- /dev/null +++ b/include/bits/types/struct_sockaddr.h @@ -0,0 +1 @@ +#include diff --git a/include/bits/types/struct_sockaddr_storage.h b/include/bits/types/struct_sockaddr_storage.h new file mode 100644 index 0000000000..68f3171f0c --- /dev/null +++ b/include/bits/types/struct_sockaddr_storage.h @@ -0,0 +1 @@ +#include diff --git a/include/ifaddrs.h b/include/ifaddrs.h index 416118f1b3..bea810b161 100644 --- a/include/ifaddrs.h +++ b/include/ifaddrs.h @@ -3,6 +3,7 @@ # ifndef _ISOMAC +#include #include #include diff --git a/include/netdb.h b/include/netdb.h index e230b1f4fc..7853769ebe 100644 --- a/include/netdb.h +++ b/include/netdb.h @@ -39,21 +39,21 @@ extern int __old_gethostent_r (struct hostent *__restrict __result_buf, int *__restrict __h_errnop); extern int __gethostbyaddr_r (const void *__restrict __addr, - socklen_t __len, int __type, + __socklen_t __len, int __type, struct hostent *__restrict __result_buf, char *__restrict __buf, size_t __buflen, struct hostent **__restrict __result, int *__restrict __h_errnop) attribute_hidden; extern int __old_gethostbyaddr_r (const void *__restrict __addr, - socklen_t __len, int __type, + __socklen_t __len, int __type, struct hostent *__restrict __result_buf, char *__restrict __buf, size_t __buflen, struct hostent **__restrict __result, int *__restrict __h_errnop); extern int __gethostbyaddr2_r (const void *__restrict __addr, - socklen_t __len, int __type, + __socklen_t __len, int __type, struct hostent *__restrict __result_buf, char *__restrict __buf, size_t __buflen, struct hostent **__restrict __result, @@ -246,7 +246,7 @@ extern enum nss_status _nss_ ## service ## _gethostbyname_r \ (const char *name, struct hostent *host, char *buffer, \ size_t buflen, int *errnop, int *h_errnop); \ extern enum nss_status _nss_ ## service ## _gethostbyaddr_r \ - (const void *addr, socklen_t addrlen, int af, \ + (const void *addr, __socklen_t addrlen, int af, \ struct hostent *host, char *buffer, size_t buflen, \ int *errnop, int *h_errnop); \ extern enum nss_status _nss_ ## service ## _setservent (int); \ diff --git a/include/sys/socketvar.h b/include/sys/socketvar.h new file mode 100644 index 0000000000..658fd10b85 --- /dev/null +++ b/include/sys/socketvar.h @@ -0,0 +1 @@ +#include diff --git a/inet/arpa/inet.h b/inet/arpa/inet.h index facee279a8..616ac1d8fa 100644 --- a/inet/arpa/inet.h +++ b/inet/arpa/inet.h @@ -20,6 +20,7 @@ #include #include /* To define `struct in_addr'. */ +#include #include __BEGIN_DECLS diff --git a/inet/check_pf.c b/inet/check_pf.c index 24183d45fc..ce2545a657 100644 --- a/inet/check_pf.c +++ b/inet/check_pf.c @@ -19,6 +19,7 @@ #include #include #include +#include void attribute_hidden diff --git a/inet/gethstbynm.c b/inet/gethstbynm.c index d05799e4d0..ec0b26ab4c 100644 --- a/inet/gethstbynm.c +++ b/inet/gethstbynm.c @@ -20,6 +20,7 @@ #include #include #include +#include #include #include diff --git a/inet/gethstbynm_r.c b/inet/gethstbynm_r.c index 5508a66c17..d1248db681 100644 --- a/inet/gethstbynm_r.c +++ b/inet/gethstbynm_r.c @@ -20,6 +20,7 @@ #include #include #include +#include #include #include #include diff --git a/inet/getsourcefilter.c b/inet/getsourcefilter.c index e4b1647e0c..32dd94d18c 100644 --- a/inet/getsourcefilter.c +++ b/inet/getsourcefilter.c @@ -20,6 +20,7 @@ #include #include #include +#include int getsourcefilter (int s, uint32_t interface, const struct sockaddr *group, diff --git a/inet/ifaddrs.h b/inet/ifaddrs.h index dd48ff2fdf..57de5a1f68 100644 --- a/inet/ifaddrs.h +++ b/inet/ifaddrs.h @@ -20,7 +20,7 @@ #define _IFADDRS_H 1 #include -#include +#include __BEGIN_DECLS diff --git a/inet/inet6_opt.c b/inet/inet6_opt.c index ed5114e2fb..ac29eb5a8d 100644 --- a/inet/inet6_opt.c +++ b/inet/inet6_opt.c @@ -17,6 +17,7 @@ . */ #include +#include #include #include diff --git a/inet/inet6_option.c b/inet/inet6_option.c index 762149a8b6..49d5a7fc18 100644 --- a/inet/inet6_option.c +++ b/inet/inet6_option.c @@ -18,6 +18,7 @@ #include #include +#include #include #include #include diff --git a/inet/inet6_rth.c b/inet/inet6_rth.c index e79be7ad29..d1a11c33b1 100644 --- a/inet/inet6_rth.c +++ b/inet/inet6_rth.c @@ -17,6 +17,7 @@ . */ #include +#include #include #include diff --git a/inet/netinet/in.h b/inet/netinet/in.h index b411ba939c..b7a1d6a2e8 100644 --- a/inet/netinet/in.h +++ b/inet/netinet/in.h @@ -19,10 +19,11 @@ #define _NETINET_IN_H 1 #include -#include -#include #include - +#include +#include +#include +#include __BEGIN_DECLS @@ -568,27 +569,27 @@ extern int inet6_option_find (const struct cmsghdr *__cmsg, /* Hop-by-Hop and Destination Options Processing (RFC 3542). */ -extern int inet6_opt_init (void *__extbuf, socklen_t __extlen) __THROW; -extern int inet6_opt_append (void *__extbuf, socklen_t __extlen, int __offset, - uint8_t __type, socklen_t __len, uint8_t __align, +extern int inet6_opt_init (void *__extbuf, __socklen_t __extlen) __THROW; +extern int inet6_opt_append (void *__extbuf, __socklen_t __extlen, int __offset, + uint8_t __type, __socklen_t __len, uint8_t __align, void **__databufp) __THROW; -extern int inet6_opt_finish (void *__extbuf, socklen_t __extlen, int __offset) +extern int inet6_opt_finish (void *__extbuf, __socklen_t __extlen, int __offset) __THROW; extern int inet6_opt_set_val (void *__databuf, int __offset, void *__val, - socklen_t __vallen) __THROW; -extern int inet6_opt_next (void *__extbuf, socklen_t __extlen, int __offset, - uint8_t *__typep, socklen_t *__lenp, + __socklen_t __vallen) __THROW; +extern int inet6_opt_next (void *__extbuf, __socklen_t __extlen, int __offset, + uint8_t *__typep, __socklen_t *__lenp, void **__databufp) __THROW; -extern int inet6_opt_find (void *__extbuf, socklen_t __extlen, int __offset, - uint8_t __type, socklen_t *__lenp, +extern int inet6_opt_find (void *__extbuf, __socklen_t __extlen, int __offset, + uint8_t __type, __socklen_t *__lenp, void **__databufp) __THROW; extern int inet6_opt_get_val (void *__databuf, int __offset, void *__val, - socklen_t __vallen) __THROW; + __socklen_t __vallen) __THROW; /* Routing Header Option (RFC 3542). */ -extern socklen_t inet6_rth_space (int __type, int __segments) __THROW; -extern void *inet6_rth_init (void *__bp, socklen_t __bp_len, int __type, +extern __socklen_t inet6_rth_space (int __type, int __segments) __THROW; +extern void *inet6_rth_init (void *__bp, __socklen_t __bp_len, int __type, int __segments) __THROW; extern int inet6_rth_add (void *__bp, const struct in6_addr *__addr) __THROW; extern int inet6_rth_reverse (const void *__in, void *__out) __THROW; @@ -616,14 +617,14 @@ extern int setipv4sourcefilter (int __s, struct in_addr __interface_addr, /* Get source filter. */ extern int getsourcefilter (int __s, uint32_t __interface_addr, const struct sockaddr *__group, - socklen_t __grouplen, uint32_t *__fmode, + __socklen_t __grouplen, uint32_t *__fmode, uint32_t *__numsrc, struct sockaddr_storage *__slist) __THROW; /* Set source filter. */ extern int setsourcefilter (int __s, uint32_t __interface_addr, const struct sockaddr *__group, - socklen_t __grouplen, uint32_t __fmode, + __socklen_t __grouplen, uint32_t __fmode, uint32_t __numsrc, const struct sockaddr_storage *__slist) __THROW; #endif /* use GNU */ diff --git a/inet/netinet/tcp.h b/inet/netinet/tcp.h index 7b07accce7..8fc9c8f641 100644 --- a/inet/netinet/tcp.h +++ b/inet/netinet/tcp.h @@ -85,11 +85,11 @@ #define TCP_REPAIR_OFF_NO_WP -1 #ifdef __USE_MISC -# include # include -# include +# include +# include -typedef uint32_t tcp_seq; +typedef __uint32_t tcp_seq; /* * TCP header. * Per RFC 793, September, 1981. @@ -100,61 +100,61 @@ struct tcphdr { struct { - uint16_t th_sport; /* source port */ - uint16_t th_dport; /* destination port */ + __uint16_t th_sport; /* source port */ + __uint16_t th_dport; /* destination port */ tcp_seq th_seq; /* sequence number */ tcp_seq th_ack; /* acknowledgement number */ # if __BYTE_ORDER == __LITTLE_ENDIAN - uint8_t th_x2:4; /* (unused) */ - uint8_t th_off:4; /* data offset */ + __uint8_t th_x2:4; /* (unused) */ + __uint8_t th_off:4; /* data offset */ # endif # if __BYTE_ORDER == __BIG_ENDIAN - uint8_t th_off:4; /* data offset */ - uint8_t th_x2:4; /* (unused) */ + __uint8_t th_off:4; /* data offset */ + __uint8_t th_x2:4; /* (unused) */ # endif - uint8_t th_flags; + __uint8_t th_flags; # define TH_FIN 0x01 # define TH_SYN 0x02 # define TH_RST 0x04 # define TH_PUSH 0x08 # define TH_ACK 0x10 # define TH_URG 0x20 - uint16_t th_win; /* window */ - uint16_t th_sum; /* checksum */ - uint16_t th_urp; /* urgent pointer */ + __uint16_t th_win; /* window */ + __uint16_t th_sum; /* checksum */ + __uint16_t th_urp; /* urgent pointer */ }; struct { - uint16_t source; - uint16_t dest; - uint32_t seq; - uint32_t ack_seq; + __uint16_t source; + __uint16_t dest; + __uint32_t seq; + __uint32_t ack_seq; # if __BYTE_ORDER == __LITTLE_ENDIAN - uint16_t res1:4; - uint16_t doff:4; - uint16_t fin:1; - uint16_t syn:1; - uint16_t rst:1; - uint16_t psh:1; - uint16_t ack:1; - uint16_t urg:1; - uint16_t res2:2; + __uint16_t res1:4; + __uint16_t doff:4; + __uint16_t fin:1; + __uint16_t syn:1; + __uint16_t rst:1; + __uint16_t psh:1; + __uint16_t ack:1; + __uint16_t urg:1; + __uint16_t res2:2; # elif __BYTE_ORDER == __BIG_ENDIAN - uint16_t doff:4; - uint16_t res1:4; - uint16_t res2:2; - uint16_t urg:1; - uint16_t ack:1; - uint16_t psh:1; - uint16_t rst:1; - uint16_t syn:1; - uint16_t fin:1; + __uint16_t doff:4; + __uint16_t res1:4; + __uint16_t res2:2; + __uint16_t urg:1; + __uint16_t ack:1; + __uint16_t psh:1; + __uint16_t rst:1; + __uint16_t syn:1; + __uint16_t fin:1; # else # error "Adjust your defines" # endif - uint16_t window; - uint16_t check; - uint16_t urg_ptr; + __uint16_t window; + __uint16_t check; + __uint16_t urg_ptr; }; }; }; @@ -224,45 +224,45 @@ enum tcp_ca_state struct tcp_info { - uint8_t tcpi_state; - uint8_t tcpi_ca_state; - uint8_t tcpi_retransmits; - uint8_t tcpi_probes; - uint8_t tcpi_backoff; - uint8_t tcpi_options; - uint8_t tcpi_snd_wscale : 4, tcpi_rcv_wscale : 4; + __uint8_t tcpi_state; + __uint8_t tcpi_ca_state; + __uint8_t tcpi_retransmits; + __uint8_t tcpi_probes; + __uint8_t tcpi_backoff; + __uint8_t tcpi_options; + __uint8_t tcpi_snd_wscale : 4, tcpi_rcv_wscale : 4; - uint32_t tcpi_rto; - uint32_t tcpi_ato; - uint32_t tcpi_snd_mss; - uint32_t tcpi_rcv_mss; + __uint32_t tcpi_rto; + __uint32_t tcpi_ato; + __uint32_t tcpi_snd_mss; + __uint32_t tcpi_rcv_mss; - uint32_t tcpi_unacked; - uint32_t tcpi_sacked; - uint32_t tcpi_lost; - uint32_t tcpi_retrans; - uint32_t tcpi_fackets; + __uint32_t tcpi_unacked; + __uint32_t tcpi_sacked; + __uint32_t tcpi_lost; + __uint32_t tcpi_retrans; + __uint32_t tcpi_fackets; /* Times. */ - uint32_t tcpi_last_data_sent; - uint32_t tcpi_last_ack_sent; /* Not remembered, sorry. */ - uint32_t tcpi_last_data_recv; - uint32_t tcpi_last_ack_recv; + __uint32_t tcpi_last_data_sent; + __uint32_t tcpi_last_ack_sent; /* Not remembered, sorry. */ + __uint32_t tcpi_last_data_recv; + __uint32_t tcpi_last_ack_recv; /* Metrics. */ - uint32_t tcpi_pmtu; - uint32_t tcpi_rcv_ssthresh; - uint32_t tcpi_rtt; - uint32_t tcpi_rttvar; - uint32_t tcpi_snd_ssthresh; - uint32_t tcpi_snd_cwnd; - uint32_t tcpi_advmss; - uint32_t tcpi_reordering; + __uint32_t tcpi_pmtu; + __uint32_t tcpi_rcv_ssthresh; + __uint32_t tcpi_rtt; + __uint32_t tcpi_rttvar; + __uint32_t tcpi_snd_ssthresh; + __uint32_t tcpi_snd_cwnd; + __uint32_t tcpi_advmss; + __uint32_t tcpi_reordering; - uint32_t tcpi_rcv_rtt; - uint32_t tcpi_rcv_space; + __uint32_t tcpi_rcv_rtt; + __uint32_t tcpi_rcv_space; - uint32_t tcpi_total_retrans; + __uint32_t tcpi_total_retrans; }; @@ -275,18 +275,18 @@ struct tcp_info struct tcp_md5sig { struct sockaddr_storage tcpm_addr; /* Address associated. */ - uint8_t tcpm_flags; /* Extension flags. */ - uint8_t tcpm_prefixlen; /* Address prefix. */ - uint16_t tcpm_keylen; /* Key length. */ - uint32_t __tcpm_pad; /* Zero. */ - uint8_t tcpm_key[TCP_MD5SIG_MAXKEYLEN]; /* Key (binary). */ + __uint8_t tcpm_flags; /* Extension flags. */ + __uint8_t tcpm_prefixlen; /* Address prefix. */ + __uint16_t tcpm_keylen; /* Key length. */ + __uint32_t __tcpm_pad; /* Zero. */ + __uint8_t tcpm_key[TCP_MD5SIG_MAXKEYLEN]; /* Key (binary). */ }; /* For socket repair options. */ struct tcp_repair_opt { - uint32_t opt_code; - uint32_t opt_val; + __uint32_t opt_code; + __uint32_t opt_val; }; /* Queue to repair, for TCP_REPAIR_QUEUE. */ @@ -317,30 +317,30 @@ enum struct tcp_cookie_transactions { - uint16_t tcpct_flags; - uint8_t __tcpct_pad1; - uint8_t tcpct_cookie_desired; - uint16_t tcpct_s_data_desired; - uint16_t tcpct_used; - uint8_t tcpct_value[TCP_MSS_DEFAULT]; + __uint16_t tcpct_flags; + __uint8_t __tcpct_pad1; + __uint8_t tcpct_cookie_desired; + __uint16_t tcpct_s_data_desired; + __uint16_t tcpct_used; + __uint8_t tcpct_value[TCP_MSS_DEFAULT]; }; /* For use with TCP_REPAIR_WINDOW. */ struct tcp_repair_window { - uint32_t snd_wl1; - uint32_t snd_wnd; - uint32_t max_window; - uint32_t rcv_wnd; - uint32_t rcv_wup; + __uint32_t snd_wl1; + __uint32_t snd_wnd; + __uint32_t max_window; + __uint32_t rcv_wnd; + __uint32_t rcv_wup; }; /* For use with TCP_ZEROCOPY_RECEIVE. */ struct tcp_zerocopy_receive { - uint64_t address; /* In: address of mapping. */ - uint32_t length; /* In/out: number of bytes to map/mapped. */ - uint32_t recv_skip_hint; /* Out: amount of bytes to skip. */ + __uint64_t address; /* In: address of mapping. */ + __uint32_t length; /* In/out: number of bytes to map/mapped. */ + __uint32_t recv_skip_hint; /* Out: amount of bytes to skip. */ }; #endif /* Misc. */ diff --git a/inet/protocols/routed.h b/inet/protocols/routed.h index adb1767dca..694c436445 100644 --- a/inet/protocols/routed.h +++ b/inet/protocols/routed.h @@ -32,7 +32,9 @@ #ifndef _PROTOCOLS_ROUTED_H #define _PROTOCOLS_ROUTED_H 1 -#include +#include +#include + /* * Routing Information Protocol * diff --git a/inet/setsourcefilter.c b/inet/setsourcefilter.c index 6aa18f48be..6d41e23e5b 100644 --- a/inet/setsourcefilter.c +++ b/inet/setsourcefilter.c @@ -20,7 +20,7 @@ #include #include #include - +#include int setsourcefilter (int s, uint32_t interface, const struct sockaddr *group, diff --git a/inet/test-ifaddrs.c b/inet/test-ifaddrs.c index e96e7c854e..738c05981a 100644 --- a/inet/test-ifaddrs.c +++ b/inet/test-ifaddrs.c @@ -21,6 +21,7 @@ #include #include #include +#include #include #include diff --git a/inet/test-inet6_opt.c b/inet/test-inet6_opt.c index a7ebf006c6..e10680c498 100644 --- a/inet/test-inet6_opt.c +++ b/inet/test-inet6_opt.c @@ -1,3 +1,4 @@ +#include #include #include #include diff --git a/inet/tst-inet6_rth.c b/inet/tst-inet6_rth.c index 549d717c7d..abb85cdf26 100644 --- a/inet/tst-inet6_rth.c +++ b/inet/tst-inet6_rth.c @@ -1,5 +1,6 @@ #include #include +#include #include #include diff --git a/inet/tst-inet6_scopeid_pton.c b/inet/tst-inet6_scopeid_pton.c index b09e7712f4..6a1b859a13 100644 --- a/inet/tst-inet6_scopeid_pton.c +++ b/inet/tst-inet6_scopeid_pton.c @@ -16,6 +16,7 @@ License along with the GNU C Library; if not, see . */ +#include #include #include #include diff --git a/nis/nss_nis/nis-hosts.c b/nis/nss_nis/nis-hosts.c index d70973dcee..2851726376 100644 --- a/nis/nss_nis/nis-hosts.c +++ b/nis/nss_nis/nis-hosts.c @@ -25,6 +25,7 @@ #include #undef _nss_nis_endhostent #include +#include #include #include #include diff --git a/nis/nss_nisplus/nisplus-hosts.c b/nis/nss_nisplus/nisplus-hosts.c index 81ebd9f0d6..d7a9f3c5ea 100644 --- a/nis/nss_nisplus/nisplus-hosts.c +++ b/nis/nss_nisplus/nisplus-hosts.c @@ -23,6 +23,7 @@ #include #include #include +#include #include #include #include diff --git a/nscd/aicache.c b/nscd/aicache.c index 5d8222e3b7..8b883b6c56 100644 --- a/nscd/aicache.c +++ b/nscd/aicache.c @@ -25,6 +25,7 @@ #include #include #include +#include #include #include #include diff --git a/nscd/cache.c b/nscd/cache.c index 85090a1641..c59b734210 100644 --- a/nscd/cache.c +++ b/nscd/cache.c @@ -25,6 +25,7 @@ #include #include #include +#include #include #include #include diff --git a/nscd/hstcache.c b/nscd/hstcache.c index 94a2f6e9af..7dd74f2af3 100644 --- a/nscd/hstcache.c +++ b/nscd/hstcache.c @@ -33,6 +33,7 @@ #include #include #include +#include #include #include diff --git a/nscd/initgrcache.c b/nscd/initgrcache.c index 678666563d..d25a478d07 100644 --- a/nscd/initgrcache.c +++ b/nscd/initgrcache.c @@ -26,6 +26,7 @@ #include #include #include +#include #include #include diff --git a/nscd/netgroupcache.c b/nscd/netgroupcache.c index 8fcb092657..b86010684b 100644 --- a/nscd/netgroupcache.c +++ b/nscd/netgroupcache.c @@ -25,6 +25,7 @@ #include #include #include +#include #include "../inet/netgroup.h" #include "nscd.h" diff --git a/nscd/nscd_gethst_r.c b/nscd/nscd_gethst_r.c index f4c5849862..909608c213 100644 --- a/nscd/nscd_gethst_r.c +++ b/nscd/nscd_gethst_r.c @@ -21,6 +21,7 @@ #include #include #include +#include #include #include diff --git a/nscd/servicescache.c b/nscd/servicescache.c index 5ffc846e98..356e36ef68 100644 --- a/nscd/servicescache.c +++ b/nscd/servicescache.c @@ -23,6 +23,7 @@ #include #include #include +#include #include #include diff --git a/nss/digits_dots.c b/nss/digits_dots.c index 440d9955d2..2b3624760b 100644 --- a/nss/digits_dots.c +++ b/nss/digits_dots.c @@ -25,6 +25,7 @@ #include #include #include +#include #include #include "nsswitch.h" diff --git a/nss/nss_files/files-hosts.c b/nss/nss_files/files-hosts.c index da5967a87d..efcd6b4d4b 100644 --- a/nss/nss_files/files-hosts.c +++ b/nss/nss_files/files-hosts.c @@ -17,6 +17,7 @@ . */ #include +#include #include #include #include diff --git a/nss/nss_files/files-network.c b/nss/nss_files/files-network.c index b63b5bfb79..61ace046b5 100644 --- a/nss/nss_files/files-network.c +++ b/nss/nss_files/files-network.c @@ -16,6 +16,7 @@ License along with the GNU C Library; if not, see . */ +#include #include #include #include diff --git a/nss/tst-nss-files-hosts-erange.c b/nss/tst-nss-files-hosts-erange.c index 9417957c78..bf77e23639 100644 --- a/nss/tst-nss-files-hosts-erange.c +++ b/nss/tst-nss-files-hosts-erange.c @@ -22,6 +22,7 @@ #include #include #include +#include #include #include #include diff --git a/nss/tst-nss-files-hosts-getent.c b/nss/tst-nss-files-hosts-getent.c index dfa6e8d57f..001f6f1ede 100644 --- a/nss/tst-nss-files-hosts-getent.c +++ b/nss/tst-nss-files-hosts-getent.c @@ -24,6 +24,7 @@ #include #include #include +#include #include #include #include diff --git a/nss/tst-nss-files-hosts-multi.c b/nss/tst-nss-files-hosts-multi.c index 6d6ddc6f56..4862e84257 100644 --- a/nss/tst-nss-files-hosts-multi.c +++ b/nss/tst-nss-files-hosts-multi.c @@ -24,6 +24,7 @@ #include #include #include +#include #include #include #include diff --git a/posix/tst-getaddrinfo3.c b/posix/tst-getaddrinfo3.c index 5077f311fc..1d1919971a 100644 --- a/posix/tst-getaddrinfo3.c +++ b/posix/tst-getaddrinfo3.c @@ -2,6 +2,7 @@ #include #include #include +#include #include #include diff --git a/resolv/netdb.h b/resolv/netdb.h index 6c1af6aee1..1158864312 100644 --- a/resolv/netdb.h +++ b/resolv/netdb.h @@ -25,6 +25,7 @@ #include #include +#include #include #ifdef __USE_MISC /* This is necessary to make this include file properly replace the diff --git a/resolv/nss_dns/dns-network.c b/resolv/nss_dns/dns-network.c index 21688c19b2..668cb502b2 100644 --- a/resolv/nss_dns/dns-network.c +++ b/resolv/nss_dns/dns-network.c @@ -65,6 +65,7 @@ #include #include "nsswitch.h" +#include #include #include #include diff --git a/resolv/resolv_conf.c b/resolv/resolv_conf.c index c204625f4a..211a17dfd6 100644 --- a/resolv/resolv_conf.c +++ b/resolv/resolv_conf.c @@ -23,6 +23,7 @@ #include #include #include +#include #include /* _res._u._ext.__glibc_extension_index is used as an index into a diff --git a/resolv/tst-bug18665-tcp.c b/resolv/tst-bug18665-tcp.c index 4595bc34ba..090ae0a86b 100644 --- a/resolv/tst-bug18665-tcp.c +++ b/resolv/tst-bug18665-tcp.c @@ -22,6 +22,7 @@ #include #include #include +#include #include #include #include diff --git a/resolv/tst-bug18665.c b/resolv/tst-bug18665.c index e477777548..2417d67dda 100644 --- a/resolv/tst-bug18665.c +++ b/resolv/tst-bug18665.c @@ -21,6 +21,7 @@ #include #include #include +#include #include #include #include diff --git a/resolv/tst-inet_ntop.c b/resolv/tst-inet_ntop.c index f0de06306c..728fd25d7f 100644 --- a/resolv/tst-inet_ntop.c +++ b/resolv/tst-inet_ntop.c @@ -3,6 +3,7 @@ #include #include #include +#include static int do_test (void) diff --git a/resolv/tst-inet_pton.c b/resolv/tst-inet_pton.c index 87f13d51f5..c137e50c13 100644 --- a/resolv/tst-inet_pton.c +++ b/resolv/tst-inet_pton.c @@ -21,6 +21,7 @@ #include #include #include +#include #include #include #include diff --git a/resolv/tst-resolv-ai_idn-common.c b/resolv/tst-resolv-ai_idn-common.c index 61cc81b71f..f560ccf5cd 100644 --- a/resolv/tst-resolv-ai_idn-common.c +++ b/resolv/tst-resolv-ai_idn-common.c @@ -23,6 +23,7 @@ #include #include #include +#include #include #include #include diff --git a/resolv/tst-resolv-basic.c b/resolv/tst-resolv-basic.c index 3046be24e1..fcc9fc8a84 100644 --- a/resolv/tst-resolv-basic.c +++ b/resolv/tst-resolv-basic.c @@ -20,6 +20,7 @@ #include #include #include +#include #include #include #include diff --git a/resolv/tst-resolv-binary.c b/resolv/tst-resolv-binary.c index eecdb7e0a3..153ce4d9cc 100644 --- a/resolv/tst-resolv-binary.c +++ b/resolv/tst-resolv-binary.c @@ -18,6 +18,7 @@ #include #include +#include #include #include diff --git a/resolv/tst-resolv-edns.c b/resolv/tst-resolv-edns.c index 0aaba73b05..e88463ddff 100644 --- a/resolv/tst-resolv-edns.c +++ b/resolv/tst-resolv-edns.c @@ -22,6 +22,7 @@ #include #include #include +#include #include #include #include diff --git a/resolv/tst-resolv-network.c b/resolv/tst-resolv-network.c index 4f68ce19e0..c4609a4db5 100644 --- a/resolv/tst-resolv-network.c +++ b/resolv/tst-resolv-network.c @@ -19,6 +19,7 @@ #include #include #include +#include #include #include #include diff --git a/resolv/tst-resolv-nondecimal.c b/resolv/tst-resolv-nondecimal.c index a0df6f332a..61888eadd9 100644 --- a/resolv/tst-resolv-nondecimal.c +++ b/resolv/tst-resolv-nondecimal.c @@ -18,6 +18,7 @@ #include #include +#include #include #include #include diff --git a/resolv/tst-resolv-search.c b/resolv/tst-resolv-search.c index d49d2f8459..bca1e1312d 100644 --- a/resolv/tst-resolv-search.c +++ b/resolv/tst-resolv-search.c @@ -19,6 +19,7 @@ #include #include #include +#include #include #include #include diff --git a/resolv/tst-resolv-threads.c b/resolv/tst-resolv-threads.c index 7e87e641cc..c06dd62642 100644 --- a/resolv/tst-resolv-threads.c +++ b/resolv/tst-resolv-threads.c @@ -29,6 +29,7 @@ #include #include #include +#include #include #include #include diff --git a/resolv/tst-resolv-trailing.c b/resolv/tst-resolv-trailing.c index 7504bdae57..a513e56544 100644 --- a/resolv/tst-resolv-trailing.c +++ b/resolv/tst-resolv-trailing.c @@ -18,6 +18,7 @@ #include #include +#include #include #include #include diff --git a/scripts/check-obsolete-constructs.py b/scripts/check-obsolete-constructs.py index db367e61ae..2ca83b90c7 100755 --- a/scripts/check-obsolete-constructs.py +++ b/scripts/check-obsolete-constructs.py @@ -542,9 +542,6 @@ HEADER_ALLOWED_INCLUDES = { # arpa/inet.h -> netinet/in.h "netdb.h": [ "netinet/in.h", "rpc/netdb.h" ], "arpa/inet.h": [ "netinet/in.h" ], - "net/if.h": [ "sys/socket.h" ], - "netinet/in.h": [ "sys/socket.h" ], - "netinet/tcp.h": [ "sys/socket.h" ], # Nonstandardized top-level headers "argp.h": [ "ctype.h", "errno.h", "getopt.h", @@ -580,7 +577,6 @@ HEADER_ALLOWED_INCLUDES = { "sys/procfs.h": [ "sys/ucontext.h", "sys/user.h" ], "sys/ptrace.h": [ "sys/ucontext.h" ], "sys/raw.h": [ "sys/ioctl.h" ], - "sys/socketvar.h": [ "sys/socket.h" ], "sys/timerfd.h": [ "time.h" ], "sys/ttychars.h": [ "sys/ttydefaults.h" ], "sys/ucontext.h": [ "sys/procfs.h" ], @@ -598,6 +594,7 @@ HEADER_ALLOWED_INCLUDES = { "sys/fcntl.h": [ "fcntl.h" ], "sys/poll.h": [ "poll.h" ], "sys/signal.h": [ "signal.h" ], + "sys/socketvar.h": [ "sys/socket.h" ], "sys/syslog.h": [ "syslog.h" ], "sys/termios.h": [ "termios.h" ], "sys/unistd.h": [ "unistd.h" ], @@ -606,18 +603,16 @@ HEADER_ALLOWED_INCLUDES = { "wait.h": [ "sys/wait.h" ], # Nonstandardized networking headers - "ifaddrs.h": [ "sys/socket.h" ], "resolv.h": [ "arpa/nameser.h", "netinet/in.h" ], "arpa/nameser.h": [ "arpa/nameser_compat.h" ], "net/ethernet.h": [ "net/if_ether.h" ], - "net/if_arp.h": [ "sys/socket.h" ], "net/if_ppp.h": [ "net/if.h", "net/ppp_defs.h", "sys/ioctl.h" ], "net/if_shaper.h": [ "net/if.h", "sys/ioctl.h" ], - "net/route.h": [ "netinet/in.h", "sys/socket.h" ], - "netatalk/at.h": [ "sys/socket.h", "sys/ioctl.h" ], + "net/route.h": [ "netinet/in.h" ], + "netatalk/at.h": [ "sys/ioctl.h" ], "netinet/ether.h": [ "netinet/if_ether.h" ], "netinet/icmp6.h": [ "netinet/in.h" ], @@ -629,7 +624,6 @@ HEADER_ALLOWED_INCLUDES = { "netrom/netrom.h": [ "netax25/ax25.h" ], "netrose/rose.h": [ "netax25/ax25.h" ], - "protocols/routed.h": [ "sys/socket.h" ], "protocols/rwhod.h": [ "paths.h" ], # Internal headers diff --git a/socket/Makefile b/socket/Makefile index cac527221c..cd31c3b875 100644 --- a/socket/Makefile +++ b/socket/Makefile @@ -22,9 +22,11 @@ subdir := socket include ../Makeconfig -headers := sys/socket.h sys/un.h bits/sockaddr.h bits/socket.h \ - bits/socket2.h bits/types/struct_osockaddr.h \ - sys/socketvar.h net/if.h +headers := net/if.h sys/socket.h sys/socketvar.h sys/un.h \ + bits/sockaddr.h bits/socket.h bits/socket2.h \ + bits/types/struct_linger.h bits/types/struct_osockaddr.h \ + bits/types/struct_sockaddr.h \ + bits/types/struct_sockaddr_storage.h routines := accept bind connect getpeername getsockname getsockopt \ listen recv recvfrom recvmsg send sendmsg sendto \ diff --git a/socket/bits/types/struct_linger.h b/socket/bits/types/struct_linger.h new file mode 100644 index 0000000000..58708e0204 --- /dev/null +++ b/socket/bits/types/struct_linger.h @@ -0,0 +1,11 @@ +#ifndef _BITS_TYPES_STRUCT_LINGER_H +#define _BITS_TYPES_STRUCT_LINGER_H 1 + +/* Structure used to manipulate the SO_LINGER option. */ +struct linger + { + int l_onoff; /* Nonzero to linger on close. */ + int l_linger; /* Time to linger. */ + }; + +#endif diff --git a/socket/bits/types/struct_sockaddr.h b/socket/bits/types/struct_sockaddr.h new file mode 100644 index 0000000000..86100142ca --- /dev/null +++ b/socket/bits/types/struct_sockaddr.h @@ -0,0 +1,15 @@ +#ifndef __struct_sockaddr_defined +#define __struct_sockaddr_defined 1 + +#include + +/* Structure describing a generic socket address. For historical + reasons this type is smaller than many address families' concrete + socket addresses. You may want struct sockaddr_storage instead. */ +struct sockaddr + { + __SOCKADDR_COMMON (sa_); /* Common data: family and perhaps length. */ + char sa_data[14]; /* Address data. */ + }; + +#endif diff --git a/socket/bits/types/struct_sockaddr_storage.h b/socket/bits/types/struct_sockaddr_storage.h new file mode 100644 index 0000000000..47e0513939 --- /dev/null +++ b/socket/bits/types/struct_sockaddr_storage.h @@ -0,0 +1,21 @@ +#ifndef __struct_sockaddr_storage_defined +#define __struct_sockaddr_storage_defined 1 + +#include + +/* Structure large enough to hold any socket address (with the historical + exception of AF_UNIX). */ +#ifndef __ss_aligntype +# define __ss_aligntype unsigned long int +#endif +#define _SS_PADSIZE \ + (_SS_SIZE - __SOCKADDR_COMMON_SIZE - sizeof (__ss_aligntype)) + +struct sockaddr_storage + { + __SOCKADDR_COMMON (ss_); /* Address family, etc. */ + char __ss_padding[_SS_PADSIZE]; + __ss_aligntype __ss_align; /* Force desired alignment. */ + }; + +#endif /* bits/types/struct_sockaddr_storage.h */ diff --git a/socket/net/if.h b/socket/net/if.h index b2fdbf7be0..f7fb0666cb 100644 --- a/socket/net/if.h +++ b/socket/net/if.h @@ -32,7 +32,7 @@ struct if_nameindex #ifdef __USE_MISC -# include /* for struct sockaddr */ +# include /* Standard interface flags. */ enum diff --git a/socket/sys/socket.h b/socket/sys/socket.h index 9770d90d2a..c8042036e5 100644 --- a/socket/sys/socket.h +++ b/socket/sys/socket.h @@ -28,11 +28,11 @@ __BEGIN_DECLS #include #include #include +#include -/* This operating system-specific header file defines the SOCK_*, PF_*, - AF_*, MSG_*, SOL_*, and SO_* constants, and the `struct sockaddr', - `struct msghdr', and `struct linger' types. */ -#include +#include +#include +#include #ifdef __USE_MISC # include @@ -42,6 +42,11 @@ __BEGIN_DECLS struct timespec; #endif +/* This operating system-specific header file defines the SOCK_*, PF_*, + AF_*, MSG_*, SOL_*, and SO_* constants, and the `struct msghdr' and + `struct cmsghdr' types. */ +#include + /* The following constants should be used for the second parameter of `shutdown'. */ enum diff --git a/sysdeps/generic/sys/socketvar.h b/socket/sys/socketvar.h similarity index 100% rename from sysdeps/generic/sys/socketvar.h rename to socket/sys/socketvar.h diff --git a/sunrpc/rpc_gethostbyname.c b/sunrpc/rpc_gethostbyname.c index c44e2a38a0..eaf96a42df 100644 --- a/sunrpc/rpc_gethostbyname.c +++ b/sunrpc/rpc_gethostbyname.c @@ -18,6 +18,7 @@ #include #include +#include #include #include #include diff --git a/support/support_format_address_family.c b/support/support_format_address_family.c index 8f439d5fc4..b629655ec1 100644 --- a/support/support_format_address_family.c +++ b/support/support_format_address_family.c @@ -18,6 +18,7 @@ #include +#include #include char * diff --git a/support/support_format_addrinfo.c b/support/support_format_addrinfo.c index 6bccb36a48..e7316a6f24 100644 --- a/support/support_format_addrinfo.c +++ b/support/support_format_addrinfo.c @@ -22,6 +22,7 @@ #include #include #include +#include #include #include diff --git a/support/support_format_dns_packet.c b/support/support_format_dns_packet.c index 7ada6a8acc..02e705da25 100644 --- a/support/support_format_dns_packet.c +++ b/support/support_format_dns_packet.c @@ -18,6 +18,7 @@ #include +#include #include #include #include diff --git a/support/support_format_hostent.c b/support/support_format_hostent.c index 604d1c2fed..e07d20d926 100644 --- a/support/support_format_hostent.c +++ b/support/support_format_hostent.c @@ -18,6 +18,7 @@ #include +#include #include #include #include diff --git a/support/support_format_netent.c b/support/support_format_netent.c index d5ab83f2ac..3f524bd0d6 100644 --- a/support/support_format_netent.c +++ b/support/support_format_netent.c @@ -18,6 +18,7 @@ #include +#include #include #include #include diff --git a/sysdeps/mach/hurd/bits/socket.h b/sysdeps/mach/hurd/bits/socket.h index 77498ca43e..43e3cdc8c5 100644 --- a/sysdeps/mach/hurd/bits/socket.h +++ b/sysdeps/mach/hurd/bits/socket.h @@ -25,11 +25,6 @@ #endif -#include -#include -#include -#include - /* Types of sockets. */ enum __socket_type { @@ -142,34 +137,6 @@ enum __socket_type /* Maximum queue length specifiable by listen. */ #define SOMAXCONN 128 /* 5 on the origional 4.4 BSD. */ -/* Get the definition of the macro to define the common sockaddr members. */ -#include - -/* Structure describing a generic socket address. */ -struct sockaddr - { - __SOCKADDR_COMMON (sa_); /* Common data: address family and length. */ - char sa_data[14]; /* Address data. */ - }; - - -/* Structure large enough to hold any socket address (with the historical - exception of AF_UNIX). */ -#if __WORDSIZE == 64 -# define __ss_aligntype __uint64_t -#else -# define __ss_aligntype __uint32_t -#endif -#define _SS_PADSIZE \ - (_SS_SIZE - __SOCKADDR_COMMON_SIZE - sizeof (__ss_aligntype)) - -struct sockaddr_storage - { - __SOCKADDR_COMMON (ss_); /* Address family, etc. */ - char __ss_padding[_SS_PADSIZE]; - __ss_aligntype __ss_align; /* Force desired alignment. */ - }; - /* Bits in the FLAGS argument to `send', `recv', et al. */ enum @@ -352,11 +319,4 @@ enum #define SO_TYPE SO_TYPE }; -/* Structure used to manipulate the SO_LINGER option. */ -struct linger - { - int l_onoff; /* Nonzero to linger on close. */ - int l_linger; /* Time to linger. */ - }; - #endif /* bits/socket.h */ diff --git a/sysdeps/mach/hurd/if_index.c b/sysdeps/mach/hurd/if_index.c index c8ddabb872..b5778f6270 100644 --- a/sysdeps/mach/hurd/if_index.c +++ b/sysdeps/mach/hurd/if_index.c @@ -19,6 +19,7 @@ #include #include #include +#include #include #include diff --git a/sysdeps/mach/hurd/net/if_arp.h b/sysdeps/mach/hurd/net/if_arp.h index 38665feab4..6f0d1bc94d 100644 --- a/sysdeps/mach/hurd/net/if_arp.h +++ b/sysdeps/mach/hurd/net/if_arp.h @@ -23,7 +23,8 @@ #define _NET_IF_ARP_H 1 #include -#include +#include +#include __BEGIN_DECLS diff --git a/sysdeps/mach/hurd/net/route.h b/sysdeps/mach/hurd/net/route.h index fcb79bb33d..d288475426 100644 --- a/sysdeps/mach/hurd/net/route.h +++ b/sysdeps/mach/hurd/net/route.h @@ -22,7 +22,7 @@ #include -#include +#include #include diff --git a/sysdeps/unix/bsd/bits/sockaddr.h b/sysdeps/unix/bsd/bits/sockaddr.h index d85f72b868..723aaf3e3d 100644 --- a/sysdeps/unix/bsd/bits/sockaddr.h +++ b/sysdeps/unix/bsd/bits/sockaddr.h @@ -42,4 +42,13 @@ typedef unsigned char sa_family_t; /* Size of struct sockaddr_storage. */ #define _SS_SIZE 128 +/* Desired alignment for struct sockaddr_storage. */ +#include +#include +#if __WORDSIZE == 64 +# define __ss_aligntype __uint64_t +#else +# define __ss_aligntype __uint32_t +#endif + #endif /* bits/sockaddr.h */ diff --git a/sysdeps/unix/sysv/linux/bits/socket.h b/sysdeps/unix/sysv/linux/bits/socket.h index ef3d6f9fc5..1fb3cbfb90 100644 --- a/sysdeps/unix/sysv/linux/bits/socket.h +++ b/sysdeps/unix/sysv/linux/bits/socket.h @@ -24,10 +24,6 @@ #endif -#include -#include -#include - /* Get the architecture-dependent definition of enum __socket_type. */ #include @@ -165,30 +161,6 @@ /* Maximum queue length specifiable by listen. */ #define SOMAXCONN 128 -/* Get the definition of the macro to define the common sockaddr members. */ -#include - -/* Structure describing a generic socket address. */ -struct sockaddr - { - __SOCKADDR_COMMON (sa_); /* Common data: address family and length. */ - char sa_data[14]; /* Address data. */ - }; - - -/* Structure large enough to hold any socket address (with the historical - exception of AF_UNIX). */ -#define __ss_aligntype unsigned long int -#define _SS_PADSIZE \ - (_SS_SIZE - __SOCKADDR_COMMON_SIZE - sizeof (__ss_aligntype)) - -struct sockaddr_storage - { - __SOCKADDR_COMMON (ss_); /* Address family, etc. */ - char __ss_padding[_SS_PADSIZE]; - __ss_aligntype __ss_align; /* Force desired alignment. */ - }; - /* Bits in the FLAGS argument to `send', `recv', et al. */ enum @@ -437,11 +409,4 @@ struct ucred # undef IOC_OUT #endif -/* Structure used to manipulate the SO_LINGER option. */ -struct linger - { - int l_onoff; /* Nonzero to linger on close. */ - int l_linger; /* Time to linger. */ - }; - #endif /* bits/socket.h */ diff --git a/sysdeps/unix/sysv/linux/check_native.c b/sysdeps/unix/sysv/linux/check_native.c index 6521c9132c..4e346e9a6e 100644 --- a/sysdeps/unix/sysv/linux/check_native.c +++ b/sysdeps/unix/sysv/linux/check_native.c @@ -27,6 +27,7 @@ #include #include #include +#include #include #include diff --git a/sysdeps/unix/sysv/linux/errqueue.h b/sysdeps/unix/sysv/linux/errqueue.h index 6698d94ead..58f24ae6cc 100644 --- a/sysdeps/unix/sysv/linux/errqueue.h +++ b/sysdeps/unix/sysv/linux/errqueue.h @@ -20,18 +20,19 @@ #ifndef _BITS_ERRQUEUE_H #define _BITS_ERRQUEUE_H 1 -#include -#include +#include +#include struct sock_extended_err { - uint32_t ee_errno; - uint8_t ee_origin; - uint8_t ee_type; - uint8_t ee_code; - uint8_t ee_pad; - uint32_t ee_info; - uint32_t ee_data; + __uint32_t ee_errno; + __uint8_t ee_origin; + __uint8_t ee_type; + __uint8_t ee_code; + __uint8_t ee_pad; + __uint32_t ee_info; + __uint32_t ee_data; + /* A socket address immediately follows. */ }; #define SO_EE_ORIGIN_NONE 0 diff --git a/sysdeps/unix/sysv/linux/net/if_arp.h b/sysdeps/unix/sysv/linux/net/if_arp.h index 5013d085a2..767e5b4db3 100644 --- a/sysdeps/unix/sysv/linux/net/if_arp.h +++ b/sysdeps/unix/sysv/linux/net/if_arp.h @@ -23,7 +23,8 @@ #define _NET_IF_ARP_H 1 #include -#include +#include +#include __BEGIN_DECLS diff --git a/sysdeps/unix/sysv/linux/net/route.h b/sysdeps/unix/sysv/linux/net/route.h index a0d9a74af4..edd4afd3b2 100644 --- a/sysdeps/unix/sysv/linux/net/route.h +++ b/sysdeps/unix/sysv/linux/net/route.h @@ -22,10 +22,11 @@ #include -#include -#include +#include +#include #include +#include /* This structure gets passed by the SIOCADDRT and SIOCDELRT calls. */ struct rtentry @@ -59,12 +60,12 @@ struct in6_rtmsg struct in6_addr rtmsg_dst; struct in6_addr rtmsg_src; struct in6_addr rtmsg_gateway; - uint32_t rtmsg_type; - uint16_t rtmsg_dst_len; - uint16_t rtmsg_src_len; - uint32_t rtmsg_metric; + __uint32_t rtmsg_type; + __uint16_t rtmsg_dst_len; + __uint16_t rtmsg_src_len; + __uint32_t rtmsg_metric; unsigned long int rtmsg_info; - uint32_t rtmsg_flags; + __uint32_t rtmsg_flags; int rtmsg_ifindex; }; @@ -113,7 +114,7 @@ struct in6_rtmsg #define RTF_NAT 0x08000000 #define RTF_ADDRCLASSMASK 0xF8000000 -#define RT_ADDRCLASS(flags) ((uint32_t) flags >> 23) +#define RT_ADDRCLASS(flags) ((__uint32_t) flags >> 23) #define RT_TOS(tos) ((tos) & IPTOS_TOS_MASK) diff --git a/sysdeps/unix/sysv/linux/netatalk/at.h b/sysdeps/unix/sysv/linux/netatalk/at.h index f78d6b8a07..1c6fe6391e 100644 --- a/sysdeps/unix/sysv/linux/netatalk/at.h +++ b/sysdeps/unix/sysv/linux/netatalk/at.h @@ -22,8 +22,7 @@ #include #include -#include -#include +#include /* for SIOCPROTOPRIVATE */ /* Constants from linux/atalk.h as of kernel version 5.0. */ From patchwork Wed Jun 26 17:50:28 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Zack Weinberg X-Patchwork-Id: 1122983 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-103191-incoming=patchwork.ozlabs.org@sourceware.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=panix.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.b="L852nXv/"; 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 45YsvY1cN5z9s7h for ; Thu, 27 Jun 2019 05:06:32 +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:in-reply-to :references:mime-version:content-type:content-transfer-encoding; q=dns; s=default; b=Lh4xVzkdhlIouCg4JSPT/PnzAGY4y0ekxidfO5LIZKr ZnvtNZdn9zuBtEu7ZEyijY4mYYYan29P2lEHM6SNGcn0O+pWii7V/LfHapn22YgT 2dBTizurbBCHXs+jpLVy3ExtsZDH+PEs400i7+S+raRuRSFHkoIr+JXyT5L1l6qA = 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:in-reply-to :references:mime-version:content-type:content-transfer-encoding; s=default; bh=QqiAZBK8xrYPKt5Sarl650yaP3k=; b=L852nXv/OyOCS9ZtI xyAGAUwTf8pRyLvPlAFHjSEwbb+QDQR2JpUV1VZquM0Y7tUAYz4/myeg4PWKWO3q Eq437rci/aWp4MC53ylWZWvlO9/jSJGsj55/vz02ViyjyOXYwpbNVaqjEvkZB7di U5q+nED0driCjuSAcOT7dKzlio= Received: (qmail 65207 invoked by alias); 26 Jun 2019 19:06:25 -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 65199 invoked by uid 89); 26 Jun 2019 19:06:25 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-17.2 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_SHORT, SPF_HELO_PASS, SPF_PASS autolearn=ham version=3.3.1 spammy=cooperate X-HELO: l2mail1.panix.com From: Zack Weinberg To: libc-alpha@sourceware.org Cc: joseph@codesourcery.com, carlos@redhat.com Subject: [PATCH 24/25] Minimize inclusion of netinet/in.h from public headers. Date: Wed, 26 Jun 2019 13:50:28 -0400 Message-Id: <20190626175029.4699-15-zackw@panix.com> In-Reply-To: <20190626175029.4699-1-zackw@panix.com> References: <20190626175029.4699-1-zackw@panix.com> MIME-Version: 1.0 As with sys/socket.h and struct sockaddr, most of the files including netinet/in.h just want struct sockaddr_in or a related type, so introduce bits/types headers for these. POSIX specifically allows arpa/inet.h to include netinet/in.h and I think it makes sense to preserve that. The definition of struct sockaddr_in had a dependence on the definition of struct sockaddr; to avoid that, bits/sockaddr.h grows a new macro, __SOCKADDR_DATA_SIZE, which is the declared size of struct sockaddr.sa_data. On Linux, some kernel headers (notably linux/in.h and linux/in6.h) attempt to cooperate with a C library’s headers in defining types such as struct sockaddr_in. There is a set of macros whose names begin with __UAPI_DEF_ that indicate that a type has already been defined. This mechanism doesn’t actually work with the kernel headers as they are in 5.0, as far as I can tell, but it could be made to work with straightforward changes, so it makes sense for us to support it to the extent we can. To do this sensibly I need to introduce a new bits header called bits/uapi-compat.h, with a trivial definition for non-Linux. This replaces the existing __USE_KERNEL_IPV6_DEFS macro. * bits/sockaddr.h (__SOCKADDR_DATA_SIZE): New macro. * sysdeps/unix/bsd/bits/sockaddr.h: Likewise. * sysdeps/unix/sysv/linux/m68k/bits/sockaddr.h: Likewise. * socket/bits/types/struct_sockaddr.h: Use __SOCKADDR_DATA_SIZE as array length of sa_data. * bits/in.h: Add multiple inclusion guard. (__USE_KERNEL_IPV6_DEFS): Don’t define. * sysdeps/unix/sysv/linux/bits/in.h: Similarly. (IPV6_ADD_MEMBERSHIP, IPV6_DROP_MEMBERSHIP): Define when not already defined, not conditional on __USE_KERNEL_IPV6_DEFS. * bits/uapi-compat.h: New file, trivial generic version. * sysdeps/unix/sysv/linux/bits/uapi-compat.h: New file, Linux-specific version which recognizes kernel header guard macros and defines __UAPI_DEF_* macros as appropriate. * misc/Makefile: Install bits/uapi-compat.h. * include/bits/types/in_addr_t.h, include/bits/types/in_port_t.h * include/bits/types/struct_in_addr.h * include/bits/types/struct_in6_addr.h * include/bits/types/struct_sockaddr_in.h * include/bits/types/struct_sockaddr_in6.h: New wrapper headers. * inet/bits/types/in_addr_t.h, inet/bits/types/in_port_t.h * inet/bits/types/struct_in_addr.h * inet/bits/types/struct_in6_addr.h * inet/bits/types/struct_sockaddr_in.h * inet/bits/types/struct_sockaddr_in6.h New single-type headers, factored out of inet/netinet/in.h. Add __UAPI_DEF_* conditionals where appropriate, and verify that all conditionalized definitions agree with the relevant OS-supplied header. Use __SOCKADDR_DATA_SIZE to set size of sin_zero. * inet/Makefile: Install the new single-type headers. * inet/netinet/in.h: Include bits/uapi-compat.h. Define in_addr_t, in_port_t, struct in_addr, struct in6_addr, struct sockaddr_in, and struct sockaddr_in6 by including the above single-type headers, not directly. Replace all __USE_KERNEL_IPV6_DEFS conditionals with appropriate __UAPI_DEF_* conditionals. Add appropriate __UAPI_DEF_* conditionals around the definitions of the IPPROTO_* constants, the IN_CLASS macros, and struct ip_mreq. Import IN_LOOPBACK macro from Linux 5.0 linux/in.h and verify all other conditionalized definitions agree with the relevant linux/ header. Define IPPORT_RESERVED only if not already defined, and make it a macro so we can tell. * inet/netinet/igmp.h, inet/netinet/ip.h, inet/netinet/ip_icmp.h: Include bits/types/struct_in_addr.h, not netinet/in.h. * inet/netinet/ip_icmp.h: Hoist all #includes to the top of the file. * inet/netinet/icmp6.h, inet/netinet/ip6.h * sysdeps/unix/sysv/linux/net/route.h: Include bits/types/struct_in6_addr.h, not netinet/in.h. * sysdeps/mach/hurd/net/route.h: Include bits/types.h and bits/types/struct_in6_addr.h, not netinet/in.h. Use __uint16_t and __uint32_t instead of uint16_t and uint32_t. * resolv/bits/types/res_state.h: Include bits/types/struct_in_addr.h and bits/types/struct_sockaddr_in.h. Forward declare struct sockaddr_in6. Don’t include netinet/in.h. * resolv/netdb.h: Don’t include netinet/in.h. Use socklen_t instead of __socklen_t. Define IPPORT_RESERVED only if not already defined, with definition matching netinet/in.h. When __USE_MISC, include bits/sockaddr.h. * resolv/resolv.h: Don’t include netinet/in.h. * inet/tst-getni1.c, inet/tst-getni2.c * nss/tst-nss-files-hosts-erange.c, nss/tst-nss-files-hosts-getent.c * nss/tst-nss-files-hosts-multi.c, posix/tst-getaddrinfo2.c * resolv/tst-bug18665-tcp.c, resolv/tst-resolv-ai_idn-common.c * resolv/tst-resolv-canonname.c, resolv/tst-resolv-edns.c * resolv/tst-resolv-network.c, resolv/tst-resolv-nondecimal.c * resolv/tst-resolv-search.c, support/tst-support-namespace.c: Include netinet/in.h. * support/resolv_test.h: Include stdint.h, not sys/cdefs.h. * scripts/check-obsolete-constructs.py (HEADER_ALLOWED_INCLUDES): Update. --- bits/in.h | 8 +- bits/sockaddr.h | 3 + bits/uapi-compat.h | 34 +++++ include/bits/types/in_addr_t.h | 1 + include/bits/types/in_port_t.h | 1 + include/bits/types/struct_in6_addr.h | 1 + include/bits/types/struct_in_addr.h | 1 + include/bits/types/struct_sockaddr_in.h | 1 + include/bits/types/struct_sockaddr_in6.h | 1 + inet/Makefile | 5 +- inet/bits/types/in_addr_t.h | 9 ++ inet/bits/types/in_port_t.h | 9 ++ inet/bits/types/struct_in6_addr.h | 30 ++++ inet/bits/types/struct_in_addr.h | 18 +++ inet/bits/types/struct_sockaddr_in.h | 28 ++++ inet/bits/types/struct_sockaddr_in6.h | 25 +++ inet/netinet/icmp6.h | 2 +- inet/netinet/igmp.h | 2 +- inet/netinet/in.h | 102 +++++-------- inet/netinet/ip.h | 2 +- inet/netinet/ip6.h | 2 +- inet/netinet/ip_icmp.h | 7 +- inet/tst-getni1.c | 1 + inet/tst-getni2.c | 1 + misc/Makefile | 2 +- nss/tst-nss-files-hosts-erange.c | 1 + nss/tst-nss-files-hosts-getent.c | 1 + nss/tst-nss-files-hosts-multi.c | 1 + posix/tst-getaddrinfo2.c | 1 + resolv/bits/types/res_state.h | 5 +- resolv/netdb.h | 12 +- resolv/resolv.h | 1 - resolv/tst-bug18665-tcp.c | 1 + resolv/tst-resolv-ai_idn-common.c | 1 + resolv/tst-resolv-canonname.c | 1 + resolv/tst-resolv-edns.c | 1 + resolv/tst-resolv-network.c | 1 + resolv/tst-resolv-nondecimal.c | 1 + resolv/tst-resolv-search.c | 1 + scripts/check-obsolete-constructs.py | 20 +-- socket/bits/types/struct_sockaddr.h | 2 +- support/resolv_test.h | 4 +- support/tst-support-namespace.c | 1 + sysdeps/mach/hurd/net/route.h | 15 +- sysdeps/unix/bsd/bits/sockaddr.h | 3 + sysdeps/unix/sysv/linux/bits/in.h | 33 ++-- sysdeps/unix/sysv/linux/bits/uapi-compat.h | 153 +++++++++++++++++++ sysdeps/unix/sysv/linux/m68k/bits/sockaddr.h | 4 +- sysdeps/unix/sysv/linux/net/route.h | 3 +- 49 files changed, 429 insertions(+), 134 deletions(-) create mode 100644 bits/uapi-compat.h create mode 100644 include/bits/types/in_addr_t.h create mode 100644 include/bits/types/in_port_t.h create mode 100644 include/bits/types/struct_in6_addr.h create mode 100644 include/bits/types/struct_in_addr.h create mode 100644 include/bits/types/struct_sockaddr_in.h create mode 100644 include/bits/types/struct_sockaddr_in6.h create mode 100644 inet/bits/types/in_addr_t.h create mode 100644 inet/bits/types/in_port_t.h create mode 100644 inet/bits/types/struct_in6_addr.h create mode 100644 inet/bits/types/struct_in_addr.h create mode 100644 inet/bits/types/struct_sockaddr_in.h create mode 100644 inet/bits/types/struct_sockaddr_in6.h create mode 100644 sysdeps/unix/sysv/linux/bits/uapi-compat.h diff --git a/bits/in.h b/bits/in.h index 7652bc45d0..cc24174a45 100644 --- a/bits/in.h +++ b/bits/in.h @@ -15,15 +15,15 @@ License along with the GNU C Library; if not, see . */ +#ifndef _BITS_IN_H +#define _BITS_IN_H 1 + /* Generic version. */ #ifndef _NETINET_IN_H # error "Never use directly; include instead." #endif -/* This is the generic version, do not assume a linux-based kernel. */ -#define __USE_KERNEL_IPV6_DEFS 0 - /* To select the IP level. */ #define SOL_IP 0 @@ -115,3 +115,5 @@ struct ip_opts #define IPV6_RTHDR_STRICT 1 /* Hop must be a neighbour. */ #define IPV6_RTHDR_TYPE_0 0 /* IPv6 Routing header type 0. */ + +#endif /* bits/in.h. */ diff --git a/bits/sockaddr.h b/bits/sockaddr.h index 2505246ec5..b3434747b3 100644 --- a/bits/sockaddr.h +++ b/bits/sockaddr.h @@ -39,4 +39,7 @@ typedef unsigned short int sa_family_t; /* Size of struct sockaddr_storage. */ #define _SS_SIZE 128 +/* Size of struct sockaddr.sa_data. */ +#define __SOCKADDR_DATA_SIZE 14 + #endif /* bits/sockaddr.h */ diff --git a/bits/uapi-compat.h b/bits/uapi-compat.h new file mode 100644 index 0000000000..afa9ddd5d3 --- /dev/null +++ b/bits/uapi-compat.h @@ -0,0 +1,34 @@ +/* Copyright (C) 2019 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +/* This header is internal to glibc and should not be included outside + of glibc headers. It is included by each header that needs to make + global declarations that may or may not already have been made by a + header provided by the underlying operating system kernel. All such + declarations are associated with macros named __UAPI_DEF_something, + which have three possible values: + + If __UAPI_DEF_FOO is not defined, nobody has yet declared `foo'. + If __UAPI_DEF_FOO is defined to 0, glibc's headers have declared `foo'. + If __UAPI_DEF_FOO is defined to 1, the kernel's headers have declared `foo`. + + This header cannot have a multiple-inclusion guard, because it needs + to recheck for additional declarations by kernel headers each time + a glibc header that uses it is included. + + This generic version of uapi-compat.h is used on operating systems + where none of the above coordination is necessary. */ diff --git a/include/bits/types/in_addr_t.h b/include/bits/types/in_addr_t.h new file mode 100644 index 0000000000..a894f8bce2 --- /dev/null +++ b/include/bits/types/in_addr_t.h @@ -0,0 +1 @@ +#include diff --git a/include/bits/types/in_port_t.h b/include/bits/types/in_port_t.h new file mode 100644 index 0000000000..bea5710585 --- /dev/null +++ b/include/bits/types/in_port_t.h @@ -0,0 +1 @@ +#include diff --git a/include/bits/types/struct_in6_addr.h b/include/bits/types/struct_in6_addr.h new file mode 100644 index 0000000000..61c35a118d --- /dev/null +++ b/include/bits/types/struct_in6_addr.h @@ -0,0 +1 @@ +#include diff --git a/include/bits/types/struct_in_addr.h b/include/bits/types/struct_in_addr.h new file mode 100644 index 0000000000..c0835d01d0 --- /dev/null +++ b/include/bits/types/struct_in_addr.h @@ -0,0 +1 @@ +#include diff --git a/include/bits/types/struct_sockaddr_in.h b/include/bits/types/struct_sockaddr_in.h new file mode 100644 index 0000000000..3bf048b832 --- /dev/null +++ b/include/bits/types/struct_sockaddr_in.h @@ -0,0 +1 @@ +#include diff --git a/include/bits/types/struct_sockaddr_in6.h b/include/bits/types/struct_sockaddr_in6.h new file mode 100644 index 0000000000..d0c30ec239 --- /dev/null +++ b/include/bits/types/struct_sockaddr_in6.h @@ -0,0 +1 @@ +#include diff --git a/inet/Makefile b/inet/Makefile index a58278a1e1..a4392b6448 100644 --- a/inet/Makefile +++ b/inet/Makefile @@ -22,7 +22,10 @@ subdir := inet include ../Makeconfig -headers := aliases.h ifaddrs.h bits/in.h \ +headers := aliases.h ifaddrs.h bits/in.h \ + bits/types/in_addr_t.h bits/types/in_port_t.h \ + bits/types/struct_in_addr.h bits/types/struct_in6_addr.h \ + bits/types/struct_sockaddr_in.h bits/types/struct_sockaddr_in6.h \ netinet/ether.h netinet/icmp6.h netinet/if_ether.h netinet/igmp.h \ netinet/in.h netinet/in_systm.h netinet/ip.h netinet/ip6.h \ netinet/ip_icmp.h netinet/tcp.h netinet/udp.h \ diff --git a/inet/bits/types/in_addr_t.h b/inet/bits/types/in_addr_t.h new file mode 100644 index 0000000000..63779bbd75 --- /dev/null +++ b/inet/bits/types/in_addr_t.h @@ -0,0 +1,9 @@ +#ifndef __in_addr_t_defined +#define __in_addr_t_defined 1 + +#include + +/* Type to represent an IPv4 address. */ +typedef __uint32_t in_addr_t; + +#endif diff --git a/inet/bits/types/in_port_t.h b/inet/bits/types/in_port_t.h new file mode 100644 index 0000000000..8fa1a02fef --- /dev/null +++ b/inet/bits/types/in_port_t.h @@ -0,0 +1,9 @@ +#ifndef __in_port_t_defined +#define __in_port_t_defined 1 + +#include + +/* Type to represent a TCP or UDP port. */ +typedef __uint16_t in_port_t; + +#endif diff --git a/inet/bits/types/struct_in6_addr.h b/inet/bits/types/struct_in6_addr.h new file mode 100644 index 0000000000..5aaea39701 --- /dev/null +++ b/inet/bits/types/struct_in6_addr.h @@ -0,0 +1,30 @@ +#ifndef __struct_in6_addr_defined +#define __struct_in6_addr_defined 1 + +#include +#include +#include + +/* Kernel headers may already have defined this type. */ +#if !defined __UAPI_DEF_IN6_ADDR || __UAPI_DEF_IN6_ADDR == 0 +#define __UAPI_DEF_IN6_ADDR 0 +#define __UAPI_DEF_IN6_ADDR_ALT 0 + +/* Struct representing an IPv6 address. */ +struct in6_addr +{ + union + { + __uint8_t __u6_addr8[16]; + __uint16_t __u6_addr16[8]; + __uint32_t __u6_addr32[4]; + } __in6_u; +#define s6_addr __in6_u.__u6_addr8 +#ifdef __USE_MISC +# define s6_addr16 __in6_u.__u6_addr16 +# define s6_addr32 __in6_u.__u6_addr32 +#endif +}; + +#endif /* __UAPI_DEF_IN6_ADDR is zero or not defined. */ +#endif /* struct_in6_addr.h. */ diff --git a/inet/bits/types/struct_in_addr.h b/inet/bits/types/struct_in_addr.h new file mode 100644 index 0000000000..0dbe57f0fd --- /dev/null +++ b/inet/bits/types/struct_in_addr.h @@ -0,0 +1,18 @@ +#ifndef __struct_in_addr_defined +#define __struct_in_addr_defined 1 + +#include +#include + +/* Kernel headers may already have defined this type. */ +#if !defined __UAPI_DEF_IN_ADDR || __UAPI_DEF_IN_ADDR == 0 +#define __UAPI_DEF_IN_ADDR 0 + +/* Struct representing an IPv4 address. */ +struct in_addr +{ + in_addr_t s_addr; +}; + +#endif /* __UAPI_DEF_IN_ADDR is zero or not defined. */ +#endif /* struct_in_addr.h. */ diff --git a/inet/bits/types/struct_sockaddr_in.h b/inet/bits/types/struct_sockaddr_in.h new file mode 100644 index 0000000000..f2289eb0c6 --- /dev/null +++ b/inet/bits/types/struct_sockaddr_in.h @@ -0,0 +1,28 @@ +#ifndef __struct_sockaddr_in_defined +#define __struct_sockaddr_in_defined 1 + +#include +#include +#include +#include +#include + +/* Kernel headers may already have defined this type. */ +#if !defined __UAPI_DEF_SOCKADDR_IN || __UAPI_DEF_SOCKADDR_IN == 0 +#define __UAPI_DEF_SOCKADDR_IN 0 + +/* Structure describing an IPv4 socket address. */ +struct sockaddr_in +{ + __SOCKADDR_COMMON (sin_); + in_port_t sin_port; /* Port number. */ + struct in_addr sin_addr; /* IPv4 address. */ + + /* Pad to size of `struct sockaddr'. */ + unsigned char sin_zero[__SOCKADDR_DATA_SIZE + - sizeof (in_port_t) + - sizeof (struct in_addr)]; +}; + +#endif /* __UAPI_DEF_SOCKADDR_IN is zero or not defined. */ +#endif /* struct_sockaddr_in.h. */ diff --git a/inet/bits/types/struct_sockaddr_in6.h b/inet/bits/types/struct_sockaddr_in6.h new file mode 100644 index 0000000000..7af109fc1e --- /dev/null +++ b/inet/bits/types/struct_sockaddr_in6.h @@ -0,0 +1,25 @@ +#ifndef __struct_sockaddr_in6_defined +#define __struct_sockaddr_in6_defined 1 + +#include +#include +#include +#include +#include + +/* Kernel headers may already have defined this type. */ +#if !defined __UAPI_DEF_SOCKADDR_IN6 || __UAPI_DEF_SOCKADDR_IN6 == 0 +#define __UAPI_DEF_SOCKADDR_IN6 0 + +/* Structure describing an IPv6 socket address. */ +struct sockaddr_in6 +{ + __SOCKADDR_COMMON (sin6_); + in_port_t sin6_port; /* Transport layer port # */ + uint32_t sin6_flowinfo; /* IPv6 flow information */ + struct in6_addr sin6_addr; /* IPv6 address */ + uint32_t sin6_scope_id; /* IPv6 scope-id */ +}; + +#endif /* __UAPI_DEF_SOCKADDR_IN6 is zero or not defined. */ +#endif /* struct_sockaddr_in6.h. */ diff --git a/inet/netinet/icmp6.h b/inet/netinet/icmp6.h index 5119085391..4e5da1d9ae 100644 --- a/inet/netinet/icmp6.h +++ b/inet/netinet/icmp6.h @@ -22,7 +22,7 @@ #include #include #include -#include +#include #define ICMP6_FILTER 1 diff --git a/inet/netinet/igmp.h b/inet/netinet/igmp.h index 6eafc19a73..6a599d347d 100644 --- a/inet/netinet/igmp.h +++ b/inet/netinet/igmp.h @@ -22,8 +22,8 @@ #ifdef __USE_MISC -#include #include +#include __BEGIN_DECLS diff --git a/inet/netinet/in.h b/inet/netinet/in.h index b7a1d6a2e8..d691bd31b1 100644 --- a/inet/netinet/in.h +++ b/inet/netinet/in.h @@ -19,24 +19,28 @@ #define _NETINET_IN_H 1 #include + #include #include #include +#include + +#include +#include +#include +#include #include +#include +#include #include -__BEGIN_DECLS - -/* Internet address. */ -typedef uint32_t in_addr_t; -struct in_addr - { - in_addr_t s_addr; - }; - /* Get system-specific definitions. */ #include +__BEGIN_DECLS + +#if !defined __UAPI_DEF_IN_IPPROTO || __UAPI_DEF_IN_IPPROTO == 0 +#define __UAPI_DEF_IN_IPPROTO 0 /* Standard well-defined IP protocols. */ enum { @@ -92,11 +96,10 @@ enum #define IPPROTO_RAW IPPROTO_RAW IPPROTO_MAX }; +#endif -/* If __USE_KERNEL_IPV6_DEFS is 1 then the user has included the kernel - network headers first and we should use those ABI-identical definitions - instead of our own, otherwise 0. */ -#if !__USE_KERNEL_IPV6_DEFS +#if !defined __UAPI_DEF_IPPROTO_V6 || __UAPI_DEF_IPPROTO_V6 == 0 +#define __UAPI_DEF_IPPROTO_V6 0 enum { IPPROTO_HOPOPTS = 0, /* IPv6 Hop-by-Hop options. */ @@ -114,10 +117,7 @@ enum IPPROTO_MH = 135 /* IPv6 mobility header. */ #define IPPROTO_MH IPPROTO_MH }; -#endif /* !__USE_KERNEL_IPV6_DEFS */ - -/* Type to represent a port. */ -typedef uint16_t in_port_t; +#endif /* Standard well-known ports. */ enum @@ -153,7 +153,10 @@ enum IPPORT_ROUTESERVER = 520, /* Ports less than this value are reserved for privileged processes. */ +#ifndef IPPORT_RESERVED /* also defined in netdb.h */ IPPORT_RESERVED = 1024, +#define IPPORT_RESERVED IPPORT_RESERVED +#endif /* Ports greater this value are reserved for (non-privileged) servers. */ IPPORT_USERRESERVED = 5000 @@ -163,6 +166,8 @@ enum On subnets, host and network parts are found according to the subnet mask, not these masks. */ +#if !defined __UAPI_DEF_IN_CLASS || __UAPI_DEF_IN_CLASS == 0 +#define __UAPI_DEF_IN_CLASS 0 #define IN_CLASSA(a) ((((in_addr_t)(a)) & 0x80000000) == 0) #define IN_CLASSA_NET 0xff000000 @@ -200,6 +205,7 @@ enum #ifndef INADDR_LOOPBACK # define INADDR_LOOPBACK ((in_addr_t) 0x7f000001) /* Inet 127.0.0.1. */ #endif +#define IN_LOOPBACK(a) ((((in_addr_t) (a)) & 0xff000000) == 0x7f000000) /* Defines for Multicast INADDR. */ #define INADDR_UNSPEC_GROUP ((in_addr_t) 0xe0000000) /* 224.0.0.0 */ @@ -207,24 +213,7 @@ enum #define INADDR_ALLRTRS_GROUP ((in_addr_t) 0xe0000002) /* 224.0.0.2 */ #define INADDR_ALLSNOOPERS_GROUP ((in_addr_t) 0xe000006a) /* 224.0.0.106 */ #define INADDR_MAX_LOCAL_GROUP ((in_addr_t) 0xe00000ff) /* 224.0.0.255 */ - -#if !__USE_KERNEL_IPV6_DEFS -/* IPv6 address */ -struct in6_addr - { - union - { - uint8_t __u6_addr8[16]; - uint16_t __u6_addr16[8]; - uint32_t __u6_addr32[4]; - } __in6_u; -#define s6_addr __in6_u.__u6_addr8 -#ifdef __USE_MISC -# define s6_addr16 __in6_u.__u6_addr16 -# define s6_addr32 __in6_u.__u6_addr32 -#endif - }; -#endif /* !__USE_KERNEL_IPV6_DEFS */ +#endif /* __UAPI_DEF_IN_CLASS is zero or not defined */ extern const struct in6_addr in6addr_any; /* :: */ extern const struct in6_addr in6addr_loopback; /* ::1 */ @@ -234,34 +223,9 @@ extern const struct in6_addr in6addr_loopback; /* ::1 */ #define INET_ADDRSTRLEN 16 #define INET6_ADDRSTRLEN 46 - -/* Structure describing an Internet socket address. */ -struct sockaddr_in - { - __SOCKADDR_COMMON (sin_); - in_port_t sin_port; /* Port number. */ - struct in_addr sin_addr; /* Internet address. */ - - /* Pad to size of `struct sockaddr'. */ - unsigned char sin_zero[sizeof (struct sockaddr) - - __SOCKADDR_COMMON_SIZE - - sizeof (in_port_t) - - sizeof (struct in_addr)]; - }; - -#if !__USE_KERNEL_IPV6_DEFS -/* Ditto, for IPv6. */ -struct sockaddr_in6 - { - __SOCKADDR_COMMON (sin6_); - in_port_t sin6_port; /* Transport layer port # */ - uint32_t sin6_flowinfo; /* IPv6 flow information */ - struct in6_addr sin6_addr; /* IPv6 address */ - uint32_t sin6_scope_id; /* IPv6 scope-id */ - }; -#endif /* !__USE_KERNEL_IPV6_DEFS */ - #ifdef __USE_MISC +#if !defined __UAPI_DEF_IP_MREQ || __UAPI_DEF_IP_MREQ == 0 +#define __UAPI_DEF_IP_MREQ 0 /* IPv4 multicast request. */ struct ip_mreq { @@ -284,8 +248,10 @@ struct ip_mreq_source struct in_addr imr_sourceaddr; }; #endif +#endif -#if !__USE_KERNEL_IPV6_DEFS +#if !defined __UAPI_DEF_IPV6_MREQ || __UAPI_DEF_IP_MREQ == 0 +#define __UAPI_DEF_IPV6_MREQ 0 /* Likewise, for IPv6. */ struct ipv6_mreq { @@ -295,7 +261,7 @@ struct ipv6_mreq /* local interface */ unsigned int ipv6mr_interface; }; -#endif /* !__USE_KERNEL_IPV6_DEFS */ +#endif #ifdef __USE_MISC /* Multicast group request. */ @@ -533,21 +499,25 @@ extern int bindresvport6 (int __sockfd, struct sockaddr_in6 *__sock_in) #ifdef __USE_GNU struct cmsghdr; /* Forward declaration. */ -#if !__USE_KERNEL_IPV6_DEFS +#if !defined __UAPI_DEF_IN6_PKTINFO || __UAPI_DEF_IN6_PKTINFO == 0 +#define __UAPI_DEF_IN6_PKTINFO 0 /* IPv6 packet information. */ struct in6_pktinfo { struct in6_addr ipi6_addr; /* src/dst IPv6 address */ unsigned int ipi6_ifindex; /* send/recv interface index */ }; +#endif +#if !defined __UAPI_DEF_IN6_MTUINFO || __UAPI_DEF_IN6_MTUINFO == 0 +#define __UAPI_DEF_IN6_MTUINFO 0 /* IPv6 MTU information. */ struct ip6_mtuinfo { struct sockaddr_in6 ip6m_addr; /* dst address including zone ID */ uint32_t ip6m_mtu; /* path MTU in host byte order */ }; -#endif /* !__USE_KERNEL_IPV6_DEFS */ +#endif /* Obsolete hop-by-hop and Destination Options Processing (RFC 2292). */ extern int inet6_option_space (int __nbytes) diff --git a/inet/netinet/ip.h b/inet/netinet/ip.h index fa6b588c42..a3beca86b9 100644 --- a/inet/netinet/ip.h +++ b/inet/netinet/ip.h @@ -20,9 +20,9 @@ #include -#include #include #include +#include __BEGIN_DECLS diff --git a/inet/netinet/ip6.h b/inet/netinet/ip6.h index e2a8d2b356..b16e093394 100644 --- a/inet/netinet/ip6.h +++ b/inet/netinet/ip6.h @@ -19,9 +19,9 @@ #define _NETINET_IP6_H 1 #include -#include #include #include +#include struct ip6_hdr { diff --git a/inet/netinet/ip_icmp.h b/inet/netinet/ip_icmp.h index da7ff3b81b..54660e792b 100644 --- a/inet/netinet/ip_icmp.h +++ b/inet/netinet/ip_icmp.h @@ -20,6 +20,10 @@ #include #include +#ifdef __USE_MISC +#include +#include +#endif __BEGIN_DECLS @@ -122,9 +126,6 @@ struct icmphdr * @(#)ip_icmp.h 8.1 (Berkeley) 6/10/93 */ -#include -#include - /* * Internal of an ICMP Router Advertisement */ diff --git a/inet/tst-getni1.c b/inet/tst-getni1.c index 3960f7112e..154ee200e6 100644 --- a/inet/tst-getni1.c +++ b/inet/tst-getni1.c @@ -1,6 +1,7 @@ #include #include #include +#include static int do_test (void) diff --git a/inet/tst-getni2.c b/inet/tst-getni2.c index 66e78062ba..0811e40a24 100644 --- a/inet/tst-getni2.c +++ b/inet/tst-getni2.c @@ -1,6 +1,7 @@ #include #include #include +#include static int do_test (void) diff --git a/misc/Makefile b/misc/Makefile index 106ce57776..6c0e4b4ede 100644 --- a/misc/Makefile +++ b/misc/Makefile @@ -33,7 +33,7 @@ headers := \ bits/mman.h bits/param.h bits/select.h bits/select2.h \ bits/stab.def bits/syslog-ldbl.h bits/syslog-path.h \ bits/syslog.h bits/sysmacros.h bits/types/struct_iovec.h \ - bits/uio-ext.h bits/uio_lim.h bits/xopen_lim.h \ + bits/uapi-compat.h bits/uio-ext.h bits/uio_lim.h bits/xopen_lim.h \ gnu/libc-version.h \ sys/auxv.h sys/cdefs.h sys/dir.h sys/file.h sys/ioctl.h \ sys/mman.h sys/mtio.h sys/param.h sys/ptrace.h sys/queue.h \ diff --git a/nss/tst-nss-files-hosts-erange.c b/nss/tst-nss-files-hosts-erange.c index bf77e23639..6b500cf617 100644 --- a/nss/tst-nss-files-hosts-erange.c +++ b/nss/tst-nss-files-hosts-erange.c @@ -23,6 +23,7 @@ #include #include #include +#include #include #include #include diff --git a/nss/tst-nss-files-hosts-getent.c b/nss/tst-nss-files-hosts-getent.c index 001f6f1ede..3ba740c397 100644 --- a/nss/tst-nss-files-hosts-getent.c +++ b/nss/tst-nss-files-hosts-getent.c @@ -25,6 +25,7 @@ #include #include #include +#include #include #include #include diff --git a/nss/tst-nss-files-hosts-multi.c b/nss/tst-nss-files-hosts-multi.c index 4862e84257..2467bdd291 100644 --- a/nss/tst-nss-files-hosts-multi.c +++ b/nss/tst-nss-files-hosts-multi.c @@ -25,6 +25,7 @@ #include #include #include +#include #include #include #include diff --git a/posix/tst-getaddrinfo2.c b/posix/tst-getaddrinfo2.c index d8be4a8e8f..d0913790a9 100644 --- a/posix/tst-getaddrinfo2.c +++ b/posix/tst-getaddrinfo2.c @@ -6,6 +6,7 @@ #include #include #include +#include static int do_test (void) diff --git a/resolv/bits/types/res_state.h b/resolv/bits/types/res_state.h index 81febe13b0..274e6a0a01 100644 --- a/resolv/bits/types/res_state.h +++ b/resolv/bits/types/res_state.h @@ -2,7 +2,10 @@ #define __res_state_defined 1 #include -#include +#include +#include + +struct sockaddr_in6; /* res_state: the global state used by the resolver stub. */ #define MAXNS 3 /* max # name servers we'll track */ diff --git a/resolv/netdb.h b/resolv/netdb.h index 1158864312..2be4ff9afa 100644 --- a/resolv/netdb.h +++ b/resolv/netdb.h @@ -24,7 +24,6 @@ #include -#include #include #include #ifdef __USE_MISC @@ -77,7 +76,10 @@ extern int *__h_errno_location (void) __THROW __attribute__ ((__const__)); #if defined __USE_XOPEN2K || defined __USE_XOPEN_EXTENDED /* Highest reserved Internet port number. */ -# define IPPORT_RESERVED 1024 +# ifndef IPPORT_RESERVED /* also defined in netinet/in.h */ +enum { IPPORT_RESERVED = 1024 }; +# define IPPORT_RESERVED IPPORT_RESERVED +# endif #endif #ifdef __USE_GNU @@ -133,7 +135,7 @@ extern struct hostent *gethostent (void); This function is a possible cancellation point and therefore not marked with __THROW. */ -extern struct hostent *gethostbyaddr (const void *__addr, __socklen_t __len, +extern struct hostent *gethostbyaddr (const void *__addr, socklen_t __len, int __type); /* Return entry from host data base for host with NAME. @@ -168,7 +170,7 @@ extern int gethostent_r (struct hostent *__restrict __result_buf, struct hostent **__restrict __result, int *__restrict __h_errnop); -extern int gethostbyaddr_r (const void *__restrict __addr, __socklen_t __len, +extern int gethostbyaddr_r (const void *__restrict __addr, socklen_t __len, int __type, struct hostent *__restrict __result_buf, char *__restrict __buf, size_t __buflen, @@ -436,6 +438,8 @@ extern int getnetgrent_r (char **__restrict __hostp, #ifdef __USE_MISC +#include /* for sa_family_t */ + /* Call `rshd' at port RPORT on remote machine *AHOST to execute CMD. The local user is LOCUSER, on the remote machine the command is executed as REMUSER. In *FD2P the descriptor to the socket for the diff --git a/resolv/resolv.h b/resolv/resolv.h index 5783de697d..c29a92ec8a 100644 --- a/resolv/resolv.h +++ b/resolv/resolv.h @@ -54,7 +54,6 @@ #include -#include #include #include diff --git a/resolv/tst-bug18665-tcp.c b/resolv/tst-bug18665-tcp.c index 090ae0a86b..5760afa837 100644 --- a/resolv/tst-bug18665-tcp.c +++ b/resolv/tst-bug18665-tcp.c @@ -23,6 +23,7 @@ #include #include #include +#include #include #include #include diff --git a/resolv/tst-resolv-ai_idn-common.c b/resolv/tst-resolv-ai_idn-common.c index f560ccf5cd..dcc01852c2 100644 --- a/resolv/tst-resolv-ai_idn-common.c +++ b/resolv/tst-resolv-ai_idn-common.c @@ -24,6 +24,7 @@ #include #include #include +#include #include #include #include diff --git a/resolv/tst-resolv-canonname.c b/resolv/tst-resolv-canonname.c index 7379eee643..7da72a224b 100644 --- a/resolv/tst-resolv-canonname.c +++ b/resolv/tst-resolv-canonname.c @@ -20,6 +20,7 @@ #include #include #include +#include #include #include #include diff --git a/resolv/tst-resolv-edns.c b/resolv/tst-resolv-edns.c index e88463ddff..fff61b063d 100644 --- a/resolv/tst-resolv-edns.c +++ b/resolv/tst-resolv-edns.c @@ -23,6 +23,7 @@ #include #include #include +#include #include #include #include diff --git a/resolv/tst-resolv-network.c b/resolv/tst-resolv-network.c index c4609a4db5..93fa4eeef4 100644 --- a/resolv/tst-resolv-network.c +++ b/resolv/tst-resolv-network.c @@ -20,6 +20,7 @@ #include #include #include +#include #include #include #include diff --git a/resolv/tst-resolv-nondecimal.c b/resolv/tst-resolv-nondecimal.c index 61888eadd9..ffe9bfc00a 100644 --- a/resolv/tst-resolv-nondecimal.c +++ b/resolv/tst-resolv-nondecimal.c @@ -19,6 +19,7 @@ #include #include #include +#include #include #include #include diff --git a/resolv/tst-resolv-search.c b/resolv/tst-resolv-search.c index bca1e1312d..9672012186 100644 --- a/resolv/tst-resolv-search.c +++ b/resolv/tst-resolv-search.c @@ -20,6 +20,7 @@ #include #include #include +#include #include #include #include diff --git a/scripts/check-obsolete-constructs.py b/scripts/check-obsolete-constructs.py index 2ca83b90c7..95360158b5 100755 --- a/scripts/check-obsolete-constructs.py +++ b/scripts/check-obsolete-constructs.py @@ -538,10 +538,10 @@ HEADER_ALLOWED_INCLUDES = { "sys/types.h": [ "endian.h" ], # POSIX networking headers - # allowed: netdb.h -> netinet/in.h - # arpa/inet.h -> netinet/in.h - "netdb.h": [ "netinet/in.h", "rpc/netdb.h" ], + # POSIX allows arpa/inet.h -> netinet/in.h "arpa/inet.h": [ "netinet/in.h" ], + # necessary for backward compatibility with Sun RPC + "netdb.h": [ "rpc/netdb.h" ], # Nonstandardized top-level headers "argp.h": [ "ctype.h", "errno.h", "getopt.h", @@ -603,27 +603,20 @@ HEADER_ALLOWED_INCLUDES = { "wait.h": [ "sys/wait.h" ], # Nonstandardized networking headers - - "resolv.h": [ "arpa/nameser.h", "netinet/in.h" ], + "resolv.h": [ "arpa/nameser.h" ], "arpa/nameser.h": [ "arpa/nameser_compat.h" ], "net/ethernet.h": [ "net/if_ether.h" ], "net/if_ppp.h": [ "net/if.h", "net/ppp_defs.h", "sys/ioctl.h" ], "net/if_shaper.h": [ "net/if.h", "sys/ioctl.h" ], - "net/route.h": [ "netinet/in.h" ], "netatalk/at.h": [ "sys/ioctl.h" ], - "netinet/ether.h": [ "netinet/if_ether.h" ], - "netinet/icmp6.h": [ "netinet/in.h" ], "netinet/if_ether.h": [ "net/ethernet.h", "net/if_arp.h" ], - "netinet/igmp.h": [ "netinet/in.h" ], - "netinet/ip.h": [ "netinet/in.h" ], - "netinet/ip6.h": [ "netinet/in.h" ], - "netinet/ip_icmp.h": [ "netinet/in.h", "netinet/ip.h" ], - + "netinet/ip_icmp.h": [ "netinet/ip.h" ], "netrom/netrom.h": [ "netax25/ax25.h" ], "netrose/rose.h": [ "netax25/ax25.h" ], + "protocols/rwhod.h": [ "paths.h" ], # Internal headers @@ -631,7 +624,6 @@ HEADER_ALLOWED_INCLUDES = { "sys/cdefs.h" ], "bits/procfs.h": [ "signal.h", "sys/ucontext.h" ], - "bits/types/res_state.h": [ "netinet/in.h" ], "bits/types/__va_list.h": [ "stdarg.h" ], "bits/types/ptrdiff_t.h": [ "stddef.h" ], diff --git a/socket/bits/types/struct_sockaddr.h b/socket/bits/types/struct_sockaddr.h index 86100142ca..34863beb05 100644 --- a/socket/bits/types/struct_sockaddr.h +++ b/socket/bits/types/struct_sockaddr.h @@ -9,7 +9,7 @@ struct sockaddr { __SOCKADDR_COMMON (sa_); /* Common data: family and perhaps length. */ - char sa_data[14]; /* Address data. */ + char sa_data[__SOCKADDR_DATA_SIZE]; /* Address data. */ }; #endif diff --git a/support/resolv_test.h b/support/resolv_test.h index c9e48205ab..1557c51ee3 100644 --- a/support/resolv_test.h +++ b/support/resolv_test.h @@ -19,9 +19,9 @@ #ifndef SUPPORT_RESOLV_TEST_H #define SUPPORT_RESOLV_TEST_H -#include #include -#include +#include +#include __BEGIN_DECLS diff --git a/support/tst-support-namespace.c b/support/tst-support-namespace.c index 02d9638e8c..d6338453f5 100644 --- a/support/tst-support-namespace.c +++ b/support/tst-support-namespace.c @@ -23,6 +23,7 @@ #include #include #include +#include /* Check that the loopback interface provides multiple addresses which can be used to run independent servers. */ diff --git a/sysdeps/mach/hurd/net/route.h b/sysdeps/mach/hurd/net/route.h index d288475426..666b7ab0f2 100644 --- a/sysdeps/mach/hurd/net/route.h +++ b/sysdeps/mach/hurd/net/route.h @@ -22,8 +22,9 @@ #include +#include #include -#include +#include /* This structure gets passed by the SIOCADDRT and SIOCDELRT calls. */ @@ -54,12 +55,12 @@ struct in6_rtmsg struct in6_addr rtmsg_dst; struct in6_addr rtmsg_src; struct in6_addr rtmsg_gateway; - uint32_t rtmsg_type; - uint16_t rtmsg_dst_len; - uint16_t rtmsg_src_len; - uint32_t rtmsg_metric; + __uint32_t rtmsg_type; + __uint16_t rtmsg_dst_len; + __uint16_t rtmsg_src_len; + __uint32_t rtmsg_metric; unsigned long int rtmsg_info; - uint32_t rtmsg_flags; + __uint32_t rtmsg_flags; int rtmsg_ifindex; }; @@ -108,7 +109,7 @@ struct in6_rtmsg #define RTF_NAT 0x08000000 #define RTF_ADDRCLASSMASK 0xF8000000 -#define RT_ADDRCLASS(flags) ((uint32_t) flags >> 23) +#define RT_ADDRCLASS(flags) ((__uint32_t) flags >> 23) #define RT_TOS(tos) ((tos) & IPTOS_TOS_MASK) diff --git a/sysdeps/unix/bsd/bits/sockaddr.h b/sysdeps/unix/bsd/bits/sockaddr.h index 723aaf3e3d..c4a3983ea3 100644 --- a/sysdeps/unix/bsd/bits/sockaddr.h +++ b/sysdeps/unix/bsd/bits/sockaddr.h @@ -51,4 +51,7 @@ typedef unsigned char sa_family_t; # define __ss_aligntype __uint32_t #endif +/* Size of struct sockaddr.sa_data. */ +#define __SOCKADDR_DATA_SIZE 14 + #endif /* bits/sockaddr.h */ diff --git a/sysdeps/unix/sysv/linux/bits/in.h b/sysdeps/unix/sysv/linux/bits/in.h index 71300fb81e..66a9f4d39c 100644 --- a/sysdeps/unix/sysv/linux/bits/in.h +++ b/sysdeps/unix/sysv/linux/bits/in.h @@ -15,32 +15,15 @@ License along with the GNU C Library; if not, see . */ +#ifndef _BITS_IN_H +#define _BITS_IN_H 1 + /* Linux version. */ #ifndef _NETINET_IN_H # error "Never use directly; include instead." #endif -/* If the application has already included linux/in6.h from a linux-based - kernel then we will not define the IPv6 IPPROTO_* defines, in6_addr (nor the - defines), sockaddr_in6, or ipv6_mreq. Same for in6_ptkinfo or ip6_mtuinfo - in linux/ipv6.h. The ABI used by the linux-kernel and glibc match exactly. - Neither the linux kernel nor glibc should break this ABI without coordination. - In upstream kernel 56c176c9 the _UAPI prefix was stripped so we need to check - for _LINUX_IN6_H and _IPV6_H now, and keep checking the old versions for - maximum backwards compatibility. */ -#if defined _UAPI_LINUX_IN6_H \ - || defined _UAPI_IPV6_H \ - || defined _LINUX_IN6_H \ - || defined _IPV6_H -/* This is not quite the same API since the kernel always defines s6_addr16 and - s6_addr32. This is not a violation of POSIX since POSIX says "at least the - following member" and that holds true. */ -# define __USE_KERNEL_IPV6_DEFS 1 -#else -# define __USE_KERNEL_IPV6_DEFS 0 -#endif - /* Options for use with `getsockopt' and `setsockopt' at the IP level. The first word in the comment at the right is the data type used; "bool" means a boolean value stored in an `int'. */ @@ -233,9 +216,11 @@ struct in_pktinfo #define IPV6_FREEBIND 78 /* Obsolete synonyms for the above. */ -#if !__USE_KERNEL_IPV6_DEFS -# define IPV6_ADD_MEMBERSHIP IPV6_JOIN_GROUP -# define IPV6_DROP_MEMBERSHIP IPV6_LEAVE_GROUP +#ifndef IPV6_ADD_MEMBERSHIP +#define IPV6_ADD_MEMBERSHIP IPV6_JOIN_GROUP +#endif +#ifndef IPV6_DROP_MEMBERSHIP +#define IPV6_DROP_MEMBERSHIP IPV6_LEAVE_GROUP #endif #define IPV6_RXHOPOPTS IPV6_HOPOPTS #define IPV6_RXDSTOPTS IPV6_DSTOPTS @@ -257,3 +242,5 @@ struct in_pktinfo #define IPV6_RTHDR_STRICT 1 /* Hop must be a neighbour. */ #define IPV6_RTHDR_TYPE_0 0 /* IPv6 Routing header type 0. */ + +#endif /* bits/in.h. */ diff --git a/sysdeps/unix/sysv/linux/bits/uapi-compat.h b/sysdeps/unix/sysv/linux/bits/uapi-compat.h new file mode 100644 index 0000000000..08f85a61e7 --- /dev/null +++ b/sysdeps/unix/sysv/linux/bits/uapi-compat.h @@ -0,0 +1,153 @@ +/* Copyright (C) 2019 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +/* This header is internal to glibc and should not be included outside + of glibc headers. It is included by each header that needs to make + global declarations that may or may not already have been made by a + header provided by the underlying operating system kernel. All such + declarations are associated with macros named __UAPI_DEF_something, + which have three possible values: + + If __UAPI_DEF_FOO is not defined, nobody has yet declared `foo'. + If __UAPI_DEF_FOO is defined to 0, glibc's headers have declared `foo'. + If __UAPI_DEF_FOO is defined to 1, the kernel's headers have declared `foo`. + + This header cannot have a multiple-inclusion guard, because it needs + to recheck for additional declarations by kernel headers each time + a glibc header that uses it is included. + + This version of uapi-compat.h is used for Linux. Sufficiently new + versions of the Linux kernel headers will define the __UAPI_DEF_* + macros themselves; this header's job is to preserve compatibility + with older versions of the headers that don't do this. + + The guard macros on many of Linux's UAPI headers were changed in + kernel rev 56c176c9; we need to check them both with and without a + _UAPI_ prefix. */ + +#if defined _UAPI_LINUX_IF_H || defined _LINUX_IF_H + +#ifndef __UAPI_DEF_IF_IFCONF +#define __UAPI_DEF_IF_IFCONF 1 +#endif +#ifndef __UAPI_DEF_IF_IFMAP +#define __UAPI_DEF_IF_IFMAP 1 +#endif +#ifndef __UAPI_DEF_IF_IFNAMSIZ +#define __UAPI_DEF_IF_IFNAMSIZ 1 +#endif +#ifndef __UAPI_DEF_IF_IFREQ +#define __UAPI_DEF_IF_IFREQ 1 +#endif +#ifndef __UAPI_DEF_IF_NET_DEVICE_FLAGS +#define __UAPI_DEF_IF_NET_DEVICE_FLAGS 1 +#endif +#ifndef __UAPI_DEF_IF_NET_DEVICE_FLAGS_LOWER_UP_DORMANT_ECHO +#define __UAPI_DEF_IF_NET_DEVICE_FLAGS_LOWER_UP_DORMANT_ECHO 1 +#endif + +#endif /* linux/if.h */ + +#if defined _UAPI_LINUX_IN_H || defined _LINUX_IN_H + +#ifndef __UAPI_DEF_IN_ADDR +#define __UAPI_DEF_IN_ADDR 1 +#endif +#ifndef __UAPI_DEF_IN_IPPROTO +#define __UAPI_DEF_IN_IPPROTO 1 +#endif +#ifndef __UAPI_DEF_IN_PKTINFO +#define __UAPI_DEF_IN_PKTINFO 1 +#endif +#ifndef __UAPI_DEF_IP_MREQ +#define __UAPI_DEF_IP_MREQ 1 +#endif +#ifndef __UAPI_DEF_SOCKADDR_IN +#define __UAPI_DEF_SOCKADDR_IN 1 +#endif +#ifndef __UAPI_DEF_IN_CLASS +#define __UAPI_DEF_IN_CLASS 1 +#endif + +#endif /* linux/in.h */ + +#if defined _UAPI_LINUX_IN6_H || defined _LINUX_IN6_H + +#ifndef __UAPI_DEF_IN6_ADDR +#define __UAPI_DEF_IN6_ADDR 1 +#endif +#ifndef __UAPI_DEF_IN6_ADDR_ALT +# if defined __USE_MISC || defined __USE_GNU +# define __UAPI_DEF_IN6_ADDR_ALT 1 +# else +# define __UAPI_DEF_IN6_ADDR_ALT 0 +# endif +#endif +#ifndef __UAPI_DEF_SOCKADDR_IN6 +#define __UAPI_DEF_SOCKADDR_IN6 1 +#endif +#ifndef __UAPI_DEF_IPV6_MREQ +#define __UAPI_DEF_IPV6_MREQ 1 +#endif +#ifndef __UAPI_DEF_IPPROTO_V6 +#define __UAPI_DEF_IPPROTO_V6 1 +#endif +#ifndef __UAPI_DEF_IPV6_OPTIONS +#define __UAPI_DEF_IPV6_OPTIONS 1 +#endif + +#endif /* linux/in6.h */ + +#if defined _UAPI_IPV6_H || defined _IPV6_H + +#ifndef __UAPI_DEF_IN6_PKTINFO +#define __UAPI_DEF_IN6_PKTINFO 1 +#endif +#ifndef __UAPI_DEF_IP6_MTUINFO +#define __UAPI_DEF_IP6_MTUINFO 1 +#endif + +#endif /* linux/ipv6.h */ + +#if defined _UAPI_IPX_H_ || defined _IPX_H_ + +#ifndef __UAPI_DEF_SOCKADDR_IPX +#define __UAPI_DEF_SOCKADDR_IPX 1 +#endif +#ifndef __UAPI_DEF_IPX_ROUTE_DEFINITION +#define __UAPI_DEF_IPX_ROUTE_DEFINITION 1 +#endif +#ifndef __UAPI_DEF_IPX_INTERFACE_DEFINITION +#define __UAPI_DEF_IPX_INTERFACE_DEFINITION 1 +#endif +#ifndef __UAPI_DEF_IPX_CONFIG_DATA +#define __UAPI_DEF_IPX_CONFIG_DATA 1 +#endif +#ifndef __UAPI_DEF_IPX_ROUTE_DEF +#define __UAPI_DEF_IPX_ROUTE_DEF 1 +#endif + +#endif /* linux/ipx.h */ + +#if defined _UAPI_LINUX_XATTR_H || defined _LINUX_XATTR_H \ + || defined __USE_KERNEL_XATTR_DEFS + +#ifndef __UAPI_DEF_XATTR +#define __UAPI_DEF_XATTR 1 +#endif + +#endif /* linux/xattr.h */ diff --git a/sysdeps/unix/sysv/linux/m68k/bits/sockaddr.h b/sysdeps/unix/sysv/linux/m68k/bits/sockaddr.h index 15f5504755..8956ea7a0f 100644 --- a/sysdeps/unix/sysv/linux/m68k/bits/sockaddr.h +++ b/sysdeps/unix/sysv/linux/m68k/bits/sockaddr.h @@ -23,7 +23,6 @@ #ifndef _BITS_SOCKADDR_H #define _BITS_SOCKADDR_H 1 - /* POSIX.1g specifies this type name for the `sa_family' member. */ typedef unsigned short int sa_family_t; @@ -39,4 +38,7 @@ typedef unsigned short int sa_family_t; /* Size of struct sockaddr_storage. */ #define _SS_SIZE 126 +/* Size of struct sockaddr.sa_data. */ +#define __SOCKADDR_DATA_SIZE 14 + #endif /* bits/sockaddr.h */ diff --git a/sysdeps/unix/sysv/linux/net/route.h b/sysdeps/unix/sysv/linux/net/route.h index edd4afd3b2..380f5d3759 100644 --- a/sysdeps/unix/sysv/linux/net/route.h +++ b/sysdeps/unix/sysv/linux/net/route.h @@ -23,11 +23,10 @@ #include #include +#include #include #include -#include - /* This structure gets passed by the SIOCADDRT and SIOCDELRT calls. */ struct rtentry { From patchwork Wed Jun 26 17:50:29 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Zack Weinberg X-Patchwork-Id: 1122958 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-103183-incoming=patchwork.ozlabs.org@sourceware.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=panix.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.b="ErHtdxlw"; 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 45YrbD4GXbz9s4Y for ; Thu, 27 Jun 2019 04:07:20 +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:in-reply-to :references:mime-version:content-type:content-transfer-encoding; q=dns; s=default; b=TwNr+QwVNuFynNTHnx50dbcTJNGcnmjCC26Ie3pJ0TO 79TGvC2QCDDgicLCpPXlX5iTuv9W2D672Wg5CgU63yUy78zW5BkbjFHW7w4cuU0m +NNKQtcfgoYYnEUj1YBnJzVuT0TrEgGUVJVu9xEWqDxlvdeMx6AlHm1XfdI1sLtQ = 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:in-reply-to :references:mime-version:content-type:content-transfer-encoding; s=default; bh=9kQ8h4XMt4dNpZz4qqI6B4xGWVY=; b=ErHtdxlwF8CtIb8rt acPYcPgbZNJ+IbCZJd4Dd9jhaf5uy7yxssTbi48Lhbt7GeeMvF6tPpu9WhWxd2ns OV8oWVCNDtm2zT2iXHVPMpNi0q6JdY5EdoTqGv1yUXCpQfh0PSRQJz6bheKNFP3l +Q9wIc+ueTYk+wUcC3nRch9GCk= Received: (qmail 56595 invoked by alias); 26 Jun 2019 18:06:40 -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 56531 invoked by uid 89); 26 Jun 2019 18:06:39 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-16.9 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_SHORT, SPF_HELO_PASS, SPF_PASS autolearn=ham version=3.3.1 spammy= X-HELO: l2mail1.panix.com From: Zack Weinberg To: libc-alpha@sourceware.org Cc: joseph@codesourcery.com, carlos@redhat.com Subject: [PATCH 25/25] Rename sys/ucontext.h to bits/ucontext.h. Date: Wed, 26 Jun 2019 13:50:29 -0400 Message-Id: <20190626175029.4699-16-zackw@panix.com> In-Reply-To: <20190626175029.4699-1-zackw@panix.com> References: <20190626175029.4699-1-zackw@panix.com> MIME-Version: 1.0 sys/ucontext.h is effectively a bits header. Its contents are extremely system-specific, and it’s strongly associated with a specific public header (ucontext.h) that provides a superset of its definitions, but there are other public headers that also require some of its definitions. This patch therefore moves it into the bits/ namespace and adjusts all the headers that refer to it. In case there are external users, a stub is added that includes ucontext.h. Most of the fallout changes are trivial, but aarch64, ia64 and riscv need a little more work. aarch64 sys/ucontext.h (now bits/ucontext.h) was including sys/procfs.h for the definition of elf_greg_t etc; the simplest fix is to have it include bits/procfs.h instead (and then that needs to include sys/user.h for user_regs_struct). This is not ideal but fixing it properly would require disentangling all of the debugger interface headers which is more than I’m up for at the moment. ia64 bits/ptrace.h and bits/procfs.h were both including bits/sigcontext.h, which is only licensed to be included from signal.h. (I’m not sure how this ever worked, or why it broke with this patch and not some previous one.) This is fixed by creating another single-type header, bits/types/__ia64_fpreg.h, which provides the only thing they need from bits/sigcontext.h. s/u/s/l/riscv/makecontext.c was defining makecontext with a function head that didn’t agree with its official prototype (in ucontext.h); formerly that file did not include ucontext.h, only sys/ucontext.h, so we were getting away with it, but it’s still wrong. Making the function head match the prototype actually simplifies the code. * sysdeps/generic/sys/ucontext.h: Move to top level bits/ucontext.h. Adjust multiple inclusion guard. * sysdeps/arm/sys/ucontext.h: Move to sysdeps/arm/bits/ucontext.h. Adjust multiple inclusion guard. * sysdeps/i386/sys/ucontext.h: Similarly. * sysdeps/m68k/sys/ucontext.h: Similarly. * sysdeps/mips/sys/ucontext.h: Similarly. * sysdeps/unix/sysv/linux/aarch64/sys/ucontext.h: Similarly. * sysdeps/unix/sysv/linux/alpha/sys/ucontext.h: Similarly. * sysdeps/unix/sysv/linux/arm/sys/ucontext.h: Similarly. * sysdeps/unix/sysv/linux/csky/sys/ucontext.h: Similarly. * sysdeps/unix/sysv/linux/hppa/sys/ucontext.h: Similarly. * sysdeps/unix/sysv/linux/ia64/sys/ucontext.h: Similarly. * sysdeps/unix/sysv/linux/m68k/sys/ucontext.h: Similarly. * sysdeps/unix/sysv/linux/microblaze/sys/ucontext.h: Similarly. * sysdeps/unix/sysv/linux/mips/sys/ucontext.h: Similarly. * sysdeps/unix/sysv/linux/nios2/sys/ucontext.h: Similarly. * sysdeps/unix/sysv/linux/powerpc/sys/ucontext.h: Similarly. * sysdeps/unix/sysv/linux/riscv/sys/ucontext.h: Similarly. * sysdeps/unix/sysv/linux/s390/sys/ucontext.h: Similarly. * sysdeps/unix/sysv/linux/sh/sys/ucontext.h: Similarly. * sysdeps/unix/sysv/linux/sparc/sys/ucontext.h: Similarly. * sysdeps/unix/sysv/linux/x86/sys/ucontext.h: Similarly. * stdlib/Makefile: Install bits/ucontext.h. * stdlib/sys/ucontext.h: New backward compatibility stub header, includes ucontext.h. * include/sys/ucontext.h: New wrapper. * sysdeps/unix/sysv/linux/aarch64/bits/procfs.h: Allow inclusion by bits/ucontext.h as well as sys/procfs.h. Include sys/user.h. * sysdeps/unix/sysv/linux/aarch64/bits/ucontext.h: Include bits/procfs.h instead of sys/procfs.h. * sysdeps/unix/sysv/linux/ia64/bits/types/__ia64_fpreg.h: New file, contents factored out of ia64/bits/sigcontext.h and ia64/bits/ucontext.h. * sysdeps/unix/sysv/linux/ia64/Makefile: Install bits/types/__ia64_fpreg.h. Merge subdir=misc blocks. * sysdeps/unix/sysv/linux/ia64/bits/sigcontext.h * sysdeps/unix/sysv/linux/ia64/bits/ucontext.h: Include bits/types/__ia64_fpreg.h for struct ia64_fpreg. * sysdeps/unix/sysv/linux/ia64/bits/procfs.h: Include bits/types/__ia64_fpreg.h for struct ia64_fpreg. Don’t include bits/sigcontext.h or bits/ucontext.h. * sysdeps/unix/sysv/linux/ia64/sys/ptrace.h: Don’t include bits/sigcontext.h. * sysdeps/unix/sysv/linux/riscv/makecontext.c: Include ucontext.h, not sys/ucontext.h. Correct function head to match prototype in ucontext.h. Use va_arg to retrieve all arguments past argc. * sysdeps/unix/sysv/linux/s390/tst-ptrace-singleblock.c: Sort list of includes. * signal/signal.h, stdlib/ucontext.h * sysdeps/unix/sysv/linux/alpha/bits/procfs-prregset.h * sysdeps/unix/sysv/linux/ia64/sys/ptrace.h * sysdeps/unix/sysv/linux/riscv/bits/procfs.h * sysdeps/unix/sysv/linux/s390/bits/procfs.h: Include bits/ucontext.h, not sys/ucontext.h. * sysdeps/unix/sysv/linux/aarch64/sigcontextinfo.h * sysdeps/unix/sysv/linux/arm/sigcontextinfo.h * sysdeps/unix/sysv/linux/nios2/sigcontextinfo.h * sysdeps/unix/sysv/linux/riscv/sigcontextinfo.h: Include signal.h, not sys/ucontext.h. * sysdeps/unix/sysv/linux/arm/register-dump.h * sysdeps/unix/sysv/linux/csky/register-dump.h: Include ucontext.h, not sys/ucontext.h. * sysdeps/unix/sysv/linux/aarch64/ucontext_i.sym * sysdeps/unix/sysv/linux/alpha/ucontext-offsets.sym * sysdeps/unix/sysv/linux/arm/ucontext_i.sym * sysdeps/unix/sysv/linux/csky/abiv2/ucontext_i.sym * sysdeps/unix/sysv/linux/hppa/ucontext_i.sym * sysdeps/unix/sysv/linux/i386/ucontext_i.sym * sysdeps/unix/sysv/linux/ia64/sigcontext-offsets.sym * sysdeps/unix/sysv/linux/m68k/m680x0/ucontext_i.sym * sysdeps/unix/sysv/linux/powerpc/powerpc32/ucontext_i.sym * sysdeps/unix/sysv/linux/powerpc/powerpc64/ucontext_i.sym * sysdeps/unix/sysv/linux/mips/ucontext_i.sym * sysdeps/unix/sysv/linux/nios2/ucontext_i.sym * sysdeps/unix/sysv/linux/riscv/ucontext_i.sym * sysdeps/unix/sysv/linux/s390/ucontext_i.sym * sysdeps/unix/sysv/linux/sh/sh3/ucontext_i.sym * sysdeps/unix/sysv/linux/sh/sh4/ucontext_i.sym * sysdeps/unix/sysv/linux/sparc/sparc32/ucontext_i.sym * sysdeps/unix/sysv/linux/x86_64/ucontext_i.sym: Include stddef.h and signal.h; don’t include any other headers. * scripts/check-obsolete-constructs.py (HEADER_ALLOWED_INCLUDES) (SYSDEP_ALLOWED_INCLUDES): Update. --- {sysdeps/generic/sys => bits}/ucontext.h | 6 ++--- include/sys/ucontext.h | 1 + scripts/check-obsolete-constructs.py | 25 ++++++++----------- signal/signal.h | 2 +- stdlib/Makefile | 2 +- stdlib/sys/ucontext.h | 1 + stdlib/ucontext.h | 2 +- sysdeps/arm/{sys => bits}/ucontext.h | 6 ++--- sysdeps/i386/{sys => bits}/ucontext.h | 6 ++--- sysdeps/m68k/{sys => bits}/ucontext.h | 6 ++--- sysdeps/mips/{sys => bits}/ucontext.h | 6 ++--- sysdeps/unix/sysv/linux/aarch64/bits/procfs.h | 3 ++- .../linux/aarch64/{sys => bits}/ucontext.h | 8 +++--- .../unix/sysv/linux/aarch64/sigcontextinfo.h | 2 +- .../unix/sysv/linux/aarch64/ucontext_i.sym | 5 +--- .../sysv/linux/alpha/bits/procfs-prregset.h | 4 +-- .../sysv/linux/alpha/{sys => bits}/ucontext.h | 6 ++--- .../sysv/linux/alpha/ucontext-offsets.sym | 2 +- .../sysv/linux/arm/{sys => bits}/ucontext.h | 6 ++--- sysdeps/unix/sysv/linux/arm/register-dump.h | 2 +- sysdeps/unix/sysv/linux/arm/sigcontextinfo.h | 2 +- sysdeps/unix/sysv/linux/arm/ucontext_i.sym | 4 +-- .../unix/sysv/linux/csky/abiv2/ucontext_i.sym | 4 +-- .../sysv/linux/csky/{sys => bits}/ucontext.h | 6 ++--- sysdeps/unix/sysv/linux/csky/register-dump.h | 2 +- .../sysv/linux/hppa/{sys => bits}/ucontext.h | 6 ++--- sysdeps/unix/sysv/linux/hppa/ucontext_i.sym | 1 - sysdeps/unix/sysv/linux/i386/ucontext_i.sym | 1 - sysdeps/unix/sysv/linux/ia64/Makefile | 6 ++--- sysdeps/unix/sysv/linux/ia64/bits/procfs.h | 5 +--- .../unix/sysv/linux/ia64/bits/sigcontext.h | 9 +------ .../sysv/linux/ia64/bits/types/__ia64_fpreg.h | 22 ++++++++++++++++ .../sysv/linux/ia64/{sys => bits}/ucontext.h | 18 ++++--------- .../sysv/linux/ia64/sigcontext-offsets.sym | 2 +- sysdeps/unix/sysv/linux/ia64/sys/ptrace.h | 3 +-- .../sysv/linux/m68k/{sys => bits}/ucontext.h | 6 ++--- .../sysv/linux/m68k/m680x0/ucontext_i.sym | 1 - .../linux/microblaze/{sys => bits}/ucontext.h | 6 ++--- .../sysv/linux/mips/{sys => bits}/ucontext.h | 6 ++--- sysdeps/unix/sysv/linux/mips/ucontext_i.sym | 2 -- .../sysv/linux/nios2/{sys => bits}/ucontext.h | 6 ++--- .../unix/sysv/linux/nios2/sigcontextinfo.h | 3 +-- sysdeps/unix/sysv/linux/nios2/ucontext_i.sym | 2 -- .../linux/powerpc/{sys => bits}/ucontext.h | 6 ++--- .../linux/powerpc/powerpc32/ucontext_i.sym | 1 - .../linux/powerpc/powerpc64/ucontext_i.sym | 1 - sysdeps/unix/sysv/linux/riscv/bits/procfs.h | 6 ++--- .../sysv/linux/riscv/{sys => bits}/ucontext.h | 6 ++--- sysdeps/unix/sysv/linux/riscv/makecontext.c | 18 ++++--------- .../unix/sysv/linux/riscv/sigcontextinfo.h | 2 +- sysdeps/unix/sysv/linux/riscv/ucontext_i.sym | 4 +-- sysdeps/unix/sysv/linux/s390/bits/procfs.h | 6 ++--- .../sysv/linux/s390/{sys => bits}/ucontext.h | 6 ++--- .../sysv/linux/s390/tst-ptrace-singleblock.c | 10 ++++---- sysdeps/unix/sysv/linux/s390/ucontext_i.sym | 1 - .../sysv/linux/sh/{sys => bits}/ucontext.h | 6 ++--- sysdeps/unix/sysv/linux/sh/sh3/ucontext_i.sym | 1 - sysdeps/unix/sysv/linux/sh/sh4/ucontext_i.sym | 1 - .../sysv/linux/sparc/{sys => bits}/ucontext.h | 6 ++--- .../sysv/linux/sparc/sparc32/ucontext_i.sym | 1 - .../sysv/linux/x86/{sys => bits}/ucontext.h | 6 ++--- sysdeps/unix/sysv/linux/x86_64/ucontext_i.sym | 1 - 62 files changed, 142 insertions(+), 171 deletions(-) rename {sysdeps/generic/sys => bits}/ucontext.h (95%) create mode 100644 include/sys/ucontext.h create mode 100644 stdlib/sys/ucontext.h rename sysdeps/arm/{sys => bits}/ucontext.h (96%) rename sysdeps/i386/{sys => bits}/ucontext.h (97%) rename sysdeps/m68k/{sys => bits}/ucontext.h (96%) rename sysdeps/mips/{sys => bits}/ucontext.h (97%) rename sysdeps/unix/sysv/linux/aarch64/{sys => bits}/ucontext.h (95%) rename sysdeps/unix/sysv/linux/alpha/{sys => bits}/ucontext.h (96%) rename sysdeps/unix/sysv/linux/arm/{sys => bits}/ucontext.h (97%) rename sysdeps/unix/sysv/linux/csky/{sys => bits}/ucontext.h (96%) rename sysdeps/unix/sysv/linux/hppa/{sys => bits}/ucontext.h (96%) create mode 100644 sysdeps/unix/sysv/linux/ia64/bits/types/__ia64_fpreg.h rename sysdeps/unix/sysv/linux/ia64/{sys => bits}/ucontext.h (91%) rename sysdeps/unix/sysv/linux/m68k/{sys => bits}/ucontext.h (97%) rename sysdeps/unix/sysv/linux/microblaze/{sys => bits}/ucontext.h (96%) rename sysdeps/unix/sysv/linux/mips/{sys => bits}/ucontext.h (97%) rename sysdeps/unix/sysv/linux/nios2/{sys => bits}/ucontext.h (95%) rename sysdeps/unix/sysv/linux/powerpc/{sys => bits}/ucontext.h (98%) rename sysdeps/unix/sysv/linux/riscv/{sys => bits}/ucontext.h (97%) rename sysdeps/unix/sysv/linux/s390/{sys => bits}/ucontext.h (96%) rename sysdeps/unix/sysv/linux/sh/{sys => bits}/ucontext.h (97%) rename sysdeps/unix/sysv/linux/sparc/{sys => bits}/ucontext.h (99%) rename sysdeps/unix/sysv/linux/x86/{sys => bits}/ucontext.h (98%) diff --git a/sysdeps/generic/sys/ucontext.h b/bits/ucontext.h similarity index 95% rename from sysdeps/generic/sys/ucontext.h rename to bits/ucontext.h index b09bdf6743..5d8ec3469a 100644 --- a/sysdeps/generic/sys/ucontext.h +++ b/bits/ucontext.h @@ -21,8 +21,8 @@ use of struct sigcontext does not conform to POSIX namespace requirements. */ -#ifndef _SYS_UCONTEXT_H -#define _SYS_UCONTEXT_H 1 +#ifndef _BITS_UCONTEXT_H +#define _BITS_UCONTEXT_H 1 #include @@ -51,4 +51,4 @@ typedef struct ucontext_t #undef __ctx -#endif /* sys/ucontext.h */ +#endif /* bits/ucontext.h */ diff --git a/include/sys/ucontext.h b/include/sys/ucontext.h new file mode 100644 index 0000000000..1450bae8f3 --- /dev/null +++ b/include/sys/ucontext.h @@ -0,0 +1 @@ +#include diff --git a/scripts/check-obsolete-constructs.py b/scripts/check-obsolete-constructs.py index 95360158b5..997b73bc36 100755 --- a/scripts/check-obsolete-constructs.py +++ b/scripts/check-obsolete-constructs.py @@ -504,24 +504,25 @@ HEADER_ALLOWED_INCLUDES = { # tgmath.h -> complex.h, math.h # threads.h -> time.h "inttypes.h": [ "stdint.h" ], - "signal.h": [ "sys/ucontext.h" ], - "stdlib.h": [ "alloca.h", "sys/types.h" ], "tgmath.h": [ "complex.h", "math.h" ], "threads.h": [ "time.h" ], + # necessary for backward compatibility with old GNU extensions + "stdlib.h": [ "alloca.h", "sys/types.h" ], # POSIX top-level headers # mandated: pthread.h -> sched.h, time.h + "pthread.h": [ "sched.h", "time.h" ], # allowed: ftw.h -> sys/stat.h # mqueue.h -> fcntl.h # sched.h -> time.h # spawn.h -> sched.h "ftw.h": [ "sys/stat.h" ], - "langinfo.h": [ "nl_types.h" ], "mqueue.h": [ "fcntl.h" ], - "pthread.h": [ "sched.h", "time.h" ], - "regex.h": [ "limits.h", "sys/types.h" ], "sched.h": [ "time.h" ], "spawn.h": [ "sched.h" ], + # not yet analyzed + "langinfo.h": [ "nl_types.h" ], + "regex.h": [ "limits.h", "sys/types.h" ], "termios.h": [ "sys/ttydefaults.h" ], "utmpx.h": [ "paths.h" ], @@ -562,7 +563,6 @@ HEADER_ALLOWED_INCLUDES = { "shadow.h": [ "paths.h" ], "stdio_ext.h": [ "stdio.h" ], "thread_db.h": [ "pthread.h", "stdint.h", "sys/procfs.h" ], - "ucontext.h": [ "sys/ucontext.h" ], "utmp.h": [ "paths.h" ], "values.h": [ "float.h", "limits.h" ], @@ -574,12 +574,10 @@ HEADER_ALLOWED_INCLUDES = { "sys/mount.h": [ "sys/ioctl.h" ], "sys/mtio.h": [ "sys/ioctl.h" ], "sys/param.h": [ "endian.h", "limits.h", "sys/types.h" ], - "sys/procfs.h": [ "sys/ucontext.h", "sys/user.h" ], - "sys/ptrace.h": [ "sys/ucontext.h" ], + "sys/procfs.h": [ "sys/user.h" ], "sys/raw.h": [ "sys/ioctl.h" ], "sys/timerfd.h": [ "time.h" ], "sys/ttychars.h": [ "sys/ttydefaults.h" ], - "sys/ucontext.h": [ "sys/procfs.h" ], "sys/vfs.h": [ "sys/statfs.h" ], # Nonstandardized headers that do nothing but include some other @@ -597,6 +595,7 @@ HEADER_ALLOWED_INCLUDES = { "sys/socketvar.h": [ "sys/socket.h" ], "sys/syslog.h": [ "syslog.h" ], "sys/termios.h": [ "termios.h" ], + "sys/ucontext.h": [ "ucontext.h" ], "sys/unistd.h": [ "unistd.h" ], "syscall.h": [ "sys/syscall.h" ], "termio.h": [ "sys/ioctl.h", "termios.h" ], @@ -623,8 +622,6 @@ HEADER_ALLOWED_INCLUDES = { "features.h": [ "gnu/stubs.h", "stdc-predef.h", "sys/cdefs.h" ], - "bits/procfs.h": [ "signal.h", "sys/ucontext.h" ], - "bits/types/__va_list.h": [ "stdarg.h" ], "bits/types/ptrdiff_t.h": [ "stddef.h" ], "bits/types/size_t.h": [ "stddef.h" ], @@ -670,8 +667,8 @@ SYSDEP_ALLOWED_INCLUDES = { "bits/ioctls.h": [ "asm/ioctls.h", "linux/sockios.h" ], "bits/local_lim.h": [ "linux/limits.h" ], "bits/param.h": [ "linux/limits.h", "linux/param.h" ], - "bits/procfs.h": [ "asm/elf.h", "asm/ptrace.h" ], - "bits/procfs-prregset.h": [ "sys/ucontext.h" ], + "bits/procfs.h": [ "asm/elf.h", "asm/ptrace.h", + "sys/user.h" ], "bits/sigcontext.h": [ "asm/sigcontext.h" ], "bits/socket.h": [ "asm/socket.h" ], }, @@ -689,7 +686,6 @@ SYSDEP_ALLOWED_INCLUDES = { "sys/fpregdef.h": [ "sgidefs.h" ], "sys/regdef.h": [ "sgidefs.h" ], "sys/tas.h": [ "sgidefs.h" ], - "sys/ucontext.h": [ "sgidefs.h" ], "sys/user.h": [ "sgidefs.h" ], "bits/fcntl.h": [ "sgidefs.h" ], @@ -699,6 +695,7 @@ SYSDEP_ALLOWED_INCLUDES = { "bits/setjmp.h": [ "sgidefs.h" ], "bits/sigcontext.h": [ "sgidefs.h" ], "bits/stat.h": [ "sgidefs.h" ], + "bits/ucontext.h": [ "sgidefs.h" ], "bits/wordsize.h": [ "sgidefs.h" ], }, } diff --git a/signal/signal.h b/signal/signal.h index 2c52466791..3ddd7ab9f4 100644 --- a/signal/signal.h +++ b/signal/signal.h @@ -293,7 +293,7 @@ extern int sigreturn (struct sigcontext *__scp) __THROW; # include # if defined __USE_XOPEN || defined __USE_XOPEN2K8 /* This will define `ucontext_t' and `mcontext_t'. */ -# include +# include # endif #endif /* Use POSIX.1-2008 or X/Open Unix. */ diff --git a/stdlib/Makefile b/stdlib/Makefile index fbf1b84a4b..41609a965a 100644 --- a/stdlib/Makefile +++ b/stdlib/Makefile @@ -26,7 +26,7 @@ headers := stdlib.h bits/stdlib.h bits/stdlib-ldbl.h bits/stdlib-float.h \ monetary.h bits/monetary-ldbl.h \ inttypes.h stdint.h bits/wordsize.h bits/timesize.h \ errno.h sys/errno.h bits/errno.h bits/types/error_t.h \ - ucontext.h sys/ucontext.h bits/indirect-return.h \ + ucontext.h sys/ucontext.h bits/ucontext.h bits/indirect-return.h \ alloca.h fmtmsg.h \ bits/stdlib-bsearch.h sys/random.h bits/stdint-intn.h \ bits/stdint-uintn.h bits/time64.h bits/NULL.h \ diff --git a/stdlib/sys/ucontext.h b/stdlib/sys/ucontext.h new file mode 100644 index 0000000000..5fdbd63dbb --- /dev/null +++ b/stdlib/sys/ucontext.h @@ -0,0 +1 @@ +#include diff --git a/stdlib/ucontext.h b/stdlib/ucontext.h index ab97224e1a..f12587a66e 100644 --- a/stdlib/ucontext.h +++ b/stdlib/ucontext.h @@ -26,7 +26,7 @@ #include /* Get machine dependent definition of data structures. */ -#include +#include __BEGIN_DECLS diff --git a/sysdeps/arm/sys/ucontext.h b/sysdeps/arm/bits/ucontext.h similarity index 96% rename from sysdeps/arm/sys/ucontext.h rename to sysdeps/arm/bits/ucontext.h index bf210f0cc5..0436adb478 100644 --- a/sysdeps/arm/sys/ucontext.h +++ b/sysdeps/arm/bits/ucontext.h @@ -17,8 +17,8 @@ /* System V/ARM ABI compliant context switching support. */ -#ifndef _SYS_UCONTEXT_H -#define _SYS_UCONTEXT_H 1 +#ifndef _BITS_UCONTEXT_H +#define _BITS_UCONTEXT_H 1 #include @@ -107,4 +107,4 @@ typedef struct ucontext_t #undef __ctx -#endif /* sys/ucontext.h */ +#endif /* bits/ucontext.h */ diff --git a/sysdeps/i386/sys/ucontext.h b/sysdeps/i386/bits/ucontext.h similarity index 97% rename from sysdeps/i386/sys/ucontext.h rename to sysdeps/i386/bits/ucontext.h index b1a5ab9156..74fd0e02d3 100644 --- a/sysdeps/i386/sys/ucontext.h +++ b/sysdeps/i386/bits/ucontext.h @@ -17,8 +17,8 @@ /* System V/i386 ABI compliant context switching support. */ -#ifndef _SYS_UCONTEXT_H -#define _SYS_UCONTEXT_H 1 +#ifndef _BITS_UCONTEXT_H +#define _BITS_UCONTEXT_H 1 #include @@ -135,4 +135,4 @@ typedef struct ucontext_t #undef __ctx #undef __ctxt -#endif /* sys/ucontext.h */ +#endif /* bits/ucontext.h */ diff --git a/sysdeps/m68k/sys/ucontext.h b/sysdeps/m68k/bits/ucontext.h similarity index 96% rename from sysdeps/m68k/sys/ucontext.h rename to sysdeps/m68k/bits/ucontext.h index 2204cae370..9e50996b68 100644 --- a/sysdeps/m68k/sys/ucontext.h +++ b/sysdeps/m68k/bits/ucontext.h @@ -17,8 +17,8 @@ /* System V/m68k ABI compliant context switching support. */ -#ifndef _SYS_UCONTEXT_H -#define _SYS_UCONTEXT_H 1 +#ifndef _BITS_UCONTEXT_H +#define _BITS_UCONTEXT_H 1 #include @@ -122,4 +122,4 @@ typedef struct ucontext_t #undef __ctx -#endif /* sys/ucontext.h */ +#endif /* bits/ucontext.h */ diff --git a/sysdeps/mips/sys/ucontext.h b/sysdeps/mips/bits/ucontext.h similarity index 97% rename from sysdeps/mips/sys/ucontext.h rename to sysdeps/mips/bits/ucontext.h index e5bbb46670..411f8419c3 100644 --- a/sysdeps/mips/sys/ucontext.h +++ b/sysdeps/mips/bits/ucontext.h @@ -17,8 +17,8 @@ /* System V/mips ABI compliant context switching support. */ -#ifndef _SYS_UCONTEXT_H -#define _SYS_UCONTEXT_H 1 +#ifndef _BITS_UCONTEXT_H +#define _BITS_UCONTEXT_H 1 #include @@ -173,4 +173,4 @@ typedef struct ucontext_t #undef __ctx -#endif /* sys/ucontext.h */ +#endif /* bits/ucontext.h */ diff --git a/sysdeps/unix/sysv/linux/aarch64/bits/procfs.h b/sysdeps/unix/sysv/linux/aarch64/bits/procfs.h index fec2f6a266..9603b025c7 100644 --- a/sysdeps/unix/sysv/linux/aarch64/bits/procfs.h +++ b/sysdeps/unix/sysv/linux/aarch64/bits/procfs.h @@ -20,11 +20,12 @@ #ifndef _BITS_PROCFS_H #define _BITS_PROCFS_H 1 -#ifndef _SYS_PROCFS_H +#if !defined _SYS_PROCFS_H && !defined _BITS_UCONTEXT_H # error "Never include directly; use instead." #endif #include +#include /* Type for a general-purpose register. */ typedef __uint64_t elf_greg_t; diff --git a/sysdeps/unix/sysv/linux/aarch64/sys/ucontext.h b/sysdeps/unix/sysv/linux/aarch64/bits/ucontext.h similarity index 95% rename from sysdeps/unix/sysv/linux/aarch64/sys/ucontext.h rename to sysdeps/unix/sysv/linux/aarch64/bits/ucontext.h index 140d4b3fc8..7be5302038 100644 --- a/sysdeps/unix/sysv/linux/aarch64/sys/ucontext.h +++ b/sysdeps/unix/sysv/linux/aarch64/bits/ucontext.h @@ -18,8 +18,8 @@ /* System V/AArch64 ABI compliant context switching support. */ -#ifndef _SYS_UCONTEXT_H -#define _SYS_UCONTEXT_H 1 +#ifndef _BITS_UCONTEXT_H +#define _BITS_UCONTEXT_H 1 #include @@ -33,7 +33,7 @@ #endif #ifdef __USE_MISC -# include +# include typedef elf_greg_t greg_t; @@ -75,4 +75,4 @@ typedef struct ucontext_t #undef __ctx -#endif /* sys/ucontext.h */ +#endif /* bits/ucontext.h */ diff --git a/sysdeps/unix/sysv/linux/aarch64/sigcontextinfo.h b/sysdeps/unix/sysv/linux/aarch64/sigcontextinfo.h index a0b0002c3d..fa0483f5f9 100644 --- a/sysdeps/unix/sysv/linux/aarch64/sigcontextinfo.h +++ b/sysdeps/unix/sysv/linux/aarch64/sigcontextinfo.h @@ -17,7 +17,7 @@ . */ #include -#include +#include #define SIGCONTEXT siginfo_t *_si, ucontext_t * #define GET_PC(ctx) ((void *) (uintptr_t) (ctx)->uc_mcontext.pc) diff --git a/sysdeps/unix/sysv/linux/aarch64/ucontext_i.sym b/sysdeps/unix/sysv/linux/aarch64/ucontext_i.sym index ab3930c173..7d5c4a1117 100644 --- a/sysdeps/unix/sysv/linux/aarch64/ucontext_i.sym +++ b/sysdeps/unix/sysv/linux/aarch64/ucontext_i.sym @@ -1,8 +1,5 @@ -#include -#include #include -#include -#include +#include #include "kernel_rt_sigframe.h" diff --git a/sysdeps/unix/sysv/linux/alpha/bits/procfs-prregset.h b/sysdeps/unix/sysv/linux/alpha/bits/procfs-prregset.h index 58b015fbc6..33bc086b89 100644 --- a/sysdeps/unix/sysv/linux/alpha/bits/procfs-prregset.h +++ b/sysdeps/unix/sysv/linux/alpha/bits/procfs-prregset.h @@ -25,8 +25,8 @@ #endif /* For gregset_t and fpregset_t. FIXME: sys/procfs.h should not - expose all of sys/ucontext.h. */ -#include + expose all of bits/ucontext.h. */ +#include typedef gregset_t __prgregset_t; typedef fpregset_t __prfpregset_t; diff --git a/sysdeps/unix/sysv/linux/alpha/sys/ucontext.h b/sysdeps/unix/sysv/linux/alpha/bits/ucontext.h similarity index 96% rename from sysdeps/unix/sysv/linux/alpha/sys/ucontext.h rename to sysdeps/unix/sysv/linux/alpha/bits/ucontext.h index d2f93da8a7..284911797e 100644 --- a/sysdeps/unix/sysv/linux/alpha/sys/ucontext.h +++ b/sysdeps/unix/sysv/linux/alpha/bits/ucontext.h @@ -15,8 +15,8 @@ License along with the GNU C Library. If not, see . */ -#ifndef _SYS_UCONTEXT_H -#define _SYS_UCONTEXT_H 1 +#ifndef _BITS_UCONTEXT_H +#define _BITS_UCONTEXT_H 1 #include @@ -91,4 +91,4 @@ typedef struct ucontext_t #undef __ctx -#endif /* sys/ucontext.h */ +#endif /* bits/ucontext.h */ diff --git a/sysdeps/unix/sysv/linux/alpha/ucontext-offsets.sym b/sysdeps/unix/sysv/linux/alpha/ucontext-offsets.sym index 9e86f8a7ca..f57c779f5b 100644 --- a/sysdeps/unix/sysv/linux/alpha/ucontext-offsets.sym +++ b/sysdeps/unix/sysv/linux/alpha/ucontext-offsets.sym @@ -1,5 +1,5 @@ #include -#include +#include -- UC_LINK offsetof (ucontext_t, uc_link) diff --git a/sysdeps/unix/sysv/linux/arm/sys/ucontext.h b/sysdeps/unix/sysv/linux/arm/bits/ucontext.h similarity index 97% rename from sysdeps/unix/sysv/linux/arm/sys/ucontext.h rename to sysdeps/unix/sysv/linux/arm/bits/ucontext.h index 76ea4dc343..60c72891c9 100644 --- a/sysdeps/unix/sysv/linux/arm/sys/ucontext.h +++ b/sysdeps/unix/sysv/linux/arm/bits/ucontext.h @@ -17,8 +17,8 @@ /* System V/ARM ABI compliant context switching support. */ -#ifndef _SYS_UCONTEXT_H -#define _SYS_UCONTEXT_H 1 +#ifndef _BITS_UCONTEXT_H +#define _BITS_UCONTEXT_H 1 #include @@ -141,4 +141,4 @@ typedef struct ucontext_t #undef __ctx -#endif /* sys/ucontext.h */ +#endif /* bits/ucontext.h */ diff --git a/sysdeps/unix/sysv/linux/arm/register-dump.h b/sysdeps/unix/sysv/linux/arm/register-dump.h index 44c69a2552..f702c591fa 100644 --- a/sysdeps/unix/sysv/linux/arm/register-dump.h +++ b/sysdeps/unix/sysv/linux/arm/register-dump.h @@ -19,7 +19,7 @@ #include #include <_itoa.h> -#include +#include /* We will print the register dump in this format: diff --git a/sysdeps/unix/sysv/linux/arm/sigcontextinfo.h b/sysdeps/unix/sysv/linux/arm/sigcontextinfo.h index 0bf3beaa0f..37049938b2 100644 --- a/sysdeps/unix/sysv/linux/arm/sigcontextinfo.h +++ b/sysdeps/unix/sysv/linux/arm/sigcontextinfo.h @@ -16,7 +16,7 @@ License along with the GNU C Library. If not, see . */ -#include +#include #define SIGCONTEXT siginfo_t *_si, ucontext_t * diff --git a/sysdeps/unix/sysv/linux/arm/ucontext_i.sym b/sysdeps/unix/sysv/linux/arm/ucontext_i.sym index 306292f1f8..ccf555d2ab 100644 --- a/sysdeps/unix/sysv/linux/arm/ucontext_i.sym +++ b/sysdeps/unix/sysv/linux/arm/ucontext_i.sym @@ -1,7 +1,5 @@ -#include -#include #include -#include +#include SIG_BLOCK SIG_SETMASK diff --git a/sysdeps/unix/sysv/linux/csky/abiv2/ucontext_i.sym b/sysdeps/unix/sysv/linux/csky/abiv2/ucontext_i.sym index 4581b65e49..0ee6dd0584 100644 --- a/sysdeps/unix/sysv/linux/csky/abiv2/ucontext_i.sym +++ b/sysdeps/unix/sysv/linux/csky/abiv2/ucontext_i.sym @@ -1,7 +1,5 @@ -#include -#include #include -#include +#include SIG_BLOCK SIG_SETMASK diff --git a/sysdeps/unix/sysv/linux/csky/sys/ucontext.h b/sysdeps/unix/sysv/linux/csky/bits/ucontext.h similarity index 96% rename from sysdeps/unix/sysv/linux/csky/sys/ucontext.h rename to sysdeps/unix/sysv/linux/csky/bits/ucontext.h index 5eac9e6494..90ee71bfd3 100644 --- a/sysdeps/unix/sysv/linux/csky/sys/ucontext.h +++ b/sysdeps/unix/sysv/linux/csky/bits/ucontext.h @@ -16,8 +16,8 @@ License along with the GNU C Library. If not, see . */ -#ifndef _SYS_UCONTEXT_H -#define _SYS_UCONTEXT_H 1 +#ifndef _BITS_UCONTEXT_H +#define _BITS_UCONTEXT_H 1 #include @@ -86,4 +86,4 @@ typedef struct ucontext_t #undef __ctx -#endif /* sys/ucontext.h */ +#endif /* bits/ucontext.h */ diff --git a/sysdeps/unix/sysv/linux/csky/register-dump.h b/sysdeps/unix/sysv/linux/csky/register-dump.h index 949618911e..47b273ba80 100644 --- a/sysdeps/unix/sysv/linux/csky/register-dump.h +++ b/sysdeps/unix/sysv/linux/csky/register-dump.h @@ -19,7 +19,7 @@ #include #include <_itoa.h> #include -#include +#include /* abiv1 register dump in this format: diff --git a/sysdeps/unix/sysv/linux/hppa/sys/ucontext.h b/sysdeps/unix/sysv/linux/hppa/bits/ucontext.h similarity index 96% rename from sysdeps/unix/sysv/linux/hppa/sys/ucontext.h rename to sysdeps/unix/sysv/linux/hppa/bits/ucontext.h index 9a55d93a06..fe8a82fddc 100644 --- a/sysdeps/unix/sysv/linux/hppa/sys/ucontext.h +++ b/sysdeps/unix/sysv/linux/hppa/bits/ucontext.h @@ -17,8 +17,8 @@ /* Don't rely on this, the interface is currently messed up and may need to be broken to be fixed. */ -#ifndef _SYS_UCONTEXT_H -#define _SYS_UCONTEXT_H 1 +#ifndef _BITS_UCONTEXT_H +#define _BITS_UCONTEXT_H 1 #include @@ -79,4 +79,4 @@ typedef struct ucontext_t #undef __ctx -#endif /* sys/ucontext.h */ +#endif /* bits/ucontext.h */ diff --git a/sysdeps/unix/sysv/linux/hppa/ucontext_i.sym b/sysdeps/unix/sysv/linux/hppa/ucontext_i.sym index ee33029a07..1ec474c759 100644 --- a/sysdeps/unix/sysv/linux/hppa/ucontext_i.sym +++ b/sysdeps/unix/sysv/linux/hppa/ucontext_i.sym @@ -1,6 +1,5 @@ #include #include -#include -- diff --git a/sysdeps/unix/sysv/linux/i386/ucontext_i.sym b/sysdeps/unix/sysv/linux/i386/ucontext_i.sym index b11a5509cd..79d95709f2 100644 --- a/sysdeps/unix/sysv/linux/i386/ucontext_i.sym +++ b/sysdeps/unix/sysv/linux/i386/ucontext_i.sym @@ -1,6 +1,5 @@ #include #include -#include -- diff --git a/sysdeps/unix/sysv/linux/ia64/Makefile b/sysdeps/unix/sysv/linux/ia64/Makefile index 97fc7df0b1..36240a6057 100644 --- a/sysdeps/unix/sysv/linux/ia64/Makefile +++ b/sysdeps/unix/sysv/linux/ia64/Makefile @@ -1,5 +1,5 @@ -ifeq ($(subdir),misc) -sysdep_headers += sys/rse.h +ifeq ($(subdir),signal) +sysdep_headers += bits/types/__ia64_fpreg.h endif ifeq ($(subdir),stdlib) @@ -8,7 +8,7 @@ gen-as-const-headers += sigcontext-offsets.sym endif ifeq ($(subdir),misc) -sysdep_headers += sys/io.h +sysdep_headers += sys/io.h sys/rse.h sysdep_routines += ioperm clone2 gen-as-const-headers += sigaltstack-offsets.sym endif diff --git a/sysdeps/unix/sysv/linux/ia64/bits/procfs.h b/sysdeps/unix/sysv/linux/ia64/bits/procfs.h index 754e9690c9..def7e5b87f 100644 --- a/sysdeps/unix/sysv/linux/ia64/bits/procfs.h +++ b/sysdeps/unix/sysv/linux/ia64/bits/procfs.h @@ -23,10 +23,7 @@ # error "Never include directly; use instead." #endif -/* For struct __ia64_fpreg. FIXME: sys/procfs.h should not expose all - of sys/ucontext.h. */ -#include -#include +#include /* We really need just 72 but let's leave some headroom... */ #define ELF_NGREG 128 diff --git a/sysdeps/unix/sysv/linux/ia64/bits/sigcontext.h b/sysdeps/unix/sysv/linux/ia64/bits/sigcontext.h index b1b45ee5de..54047467a9 100644 --- a/sysdeps/unix/sysv/linux/ia64/bits/sigcontext.h +++ b/sysdeps/unix/sysv/linux/ia64/bits/sigcontext.h @@ -26,17 +26,10 @@ #include #include #include +#include #include #include -struct __ia64_fpreg - { - union - { - unsigned long bits[2]; - } u; - } __attribute__ ((__aligned__ (16))); - struct sigcontext { unsigned long int sc_flags; /* see manifest constants below */ diff --git a/sysdeps/unix/sysv/linux/ia64/bits/types/__ia64_fpreg.h b/sysdeps/unix/sysv/linux/ia64/bits/types/__ia64_fpreg.h new file mode 100644 index 0000000000..6d69586ab4 --- /dev/null +++ b/sysdeps/unix/sysv/linux/ia64/bits/types/__ia64_fpreg.h @@ -0,0 +1,22 @@ +#ifndef ____ia64_fpreg_defined +#define ____ia64_fpreg_defined + +#include + +#ifdef __USE_MISC +# define __ctx(fld) fld +#else +# define __ctx(fld) __ ## fld +#endif + +struct __ia64_fpreg + { + union + { + unsigned long __ctx(bits)[2]; + } __ctx(u); + } __attribute__ ((__aligned__ (16))); + +#undef __ctx + +#endif /* __ia64_fpreg */ diff --git a/sysdeps/unix/sysv/linux/ia64/sys/ucontext.h b/sysdeps/unix/sysv/linux/ia64/bits/ucontext.h similarity index 91% rename from sysdeps/unix/sysv/linux/ia64/sys/ucontext.h rename to sysdeps/unix/sysv/linux/ia64/bits/ucontext.h index 2aeac65346..219526c54b 100644 --- a/sysdeps/unix/sysv/linux/ia64/sys/ucontext.h +++ b/sysdeps/unix/sysv/linux/ia64/bits/ucontext.h @@ -15,14 +15,14 @@ License along with the GNU C Library; if not, see . */ -#ifndef _SYS_UCONTEXT_H -#define _SYS_UCONTEXT_H 1 +#ifndef _BITS_UCONTEXT_H +#define _BITS_UCONTEXT_H 1 #include #include #include - +#include #ifdef __USE_MISC # define __ctx(fld) fld @@ -36,14 +36,6 @@ * "ucontext_t" as all the necessary info is inside the former. */ -struct __ia64_fpreg_mcontext - { - union - { - unsigned long __ctx(bits)[2]; - } __ctx(u); - } __attribute__ ((__aligned__ (16))); - typedef struct { unsigned long int __ctx(sc_flags); @@ -63,7 +55,7 @@ typedef struct unsigned long int __ctx(sc_pr); unsigned long int __ctx(sc_br)[8]; unsigned long int __ctx(sc_gr)[32]; - struct __ia64_fpreg_mcontext __ctx(sc_fr)[128]; + struct __ia64_fpreg __ctx(sc_fr)[128]; unsigned long int __ctx(sc_rbs_base); unsigned long int __ctx(sc_loadrs); unsigned long int __ctx(sc_ar25); @@ -103,4 +95,4 @@ ucontext_t; #define uc_stack _u._mc.__ctx(sc_stack) #define uc_link _u._uc._link -#endif /* sys/ucontext.h */ +#endif /* bits/ucontext.h */ diff --git a/sysdeps/unix/sysv/linux/ia64/sigcontext-offsets.sym b/sysdeps/unix/sysv/linux/ia64/sigcontext-offsets.sym index ac3e3c8dea..46459f7ad0 100644 --- a/sysdeps/unix/sysv/linux/ia64/sigcontext-offsets.sym +++ b/sysdeps/unix/sysv/linux/ia64/sigcontext-offsets.sym @@ -1,5 +1,5 @@ #include -#include +#include -- SC_NAT offsetof (mcontext_t, sc_nat) diff --git a/sysdeps/unix/sysv/linux/ia64/sys/ptrace.h b/sysdeps/unix/sysv/linux/ia64/sys/ptrace.h index 4578ffb50f..9f12f59a71 100644 --- a/sysdeps/unix/sysv/linux/ia64/sys/ptrace.h +++ b/sysdeps/unix/sysv/linux/ia64/sys/ptrace.h @@ -20,9 +20,8 @@ #define _SYS_PTRACE_H 1 #include -#include -#include #include +#include __BEGIN_DECLS diff --git a/sysdeps/unix/sysv/linux/m68k/sys/ucontext.h b/sysdeps/unix/sysv/linux/m68k/bits/ucontext.h similarity index 97% rename from sysdeps/unix/sysv/linux/m68k/sys/ucontext.h rename to sysdeps/unix/sysv/linux/m68k/bits/ucontext.h index 8a3b69d60e..11752ce3da 100644 --- a/sysdeps/unix/sysv/linux/m68k/sys/ucontext.h +++ b/sysdeps/unix/sysv/linux/m68k/bits/ucontext.h @@ -17,8 +17,8 @@ /* System V/m68k ABI compliant context switching support. */ -#ifndef _SYS_UCONTEXT_H -#define _SYS_UCONTEXT_H 1 +#ifndef _BITS_UCONTEXT_H +#define _BITS_UCONTEXT_H 1 #include @@ -127,4 +127,4 @@ typedef struct ucontext_t #undef __ctx -#endif /* sys/ucontext.h */ +#endif /* bits/ucontext.h */ diff --git a/sysdeps/unix/sysv/linux/m68k/m680x0/ucontext_i.sym b/sysdeps/unix/sysv/linux/m68k/m680x0/ucontext_i.sym index 46bd4bf15f..400c57b7f3 100644 --- a/sysdeps/unix/sysv/linux/m68k/m680x0/ucontext_i.sym +++ b/sysdeps/unix/sysv/linux/m68k/m680x0/ucontext_i.sym @@ -1,6 +1,5 @@ #include #include -#include -- diff --git a/sysdeps/unix/sysv/linux/microblaze/sys/ucontext.h b/sysdeps/unix/sysv/linux/microblaze/bits/ucontext.h similarity index 96% rename from sysdeps/unix/sysv/linux/microblaze/sys/ucontext.h rename to sysdeps/unix/sysv/linux/microblaze/bits/ucontext.h index cbdc677f90..1f168ea0bf 100644 --- a/sysdeps/unix/sysv/linux/microblaze/sys/ucontext.h +++ b/sysdeps/unix/sysv/linux/microblaze/bits/ucontext.h @@ -16,8 +16,8 @@ License along with the GNU C Library; if not, see . */ -#ifndef _SYS_UCONTEXT_H -#define _SYS_UCONTEXT_H 1 +#ifndef _BITS_UCONTEXT_H +#define _BITS_UCONTEXT_H 1 #include @@ -89,4 +89,4 @@ typedef struct ucontext_t #undef __ctx -#endif /* sys/ucontext.h */ +#endif /* bits/ucontext.h */ diff --git a/sysdeps/unix/sysv/linux/mips/sys/ucontext.h b/sysdeps/unix/sysv/linux/mips/bits/ucontext.h similarity index 97% rename from sysdeps/unix/sysv/linux/mips/sys/ucontext.h rename to sysdeps/unix/sysv/linux/mips/bits/ucontext.h index 39fe23cb13..0b2c02c7de 100644 --- a/sysdeps/unix/sysv/linux/mips/sys/ucontext.h +++ b/sysdeps/unix/sysv/linux/mips/bits/ucontext.h @@ -16,8 +16,8 @@ /* Don't rely on this, the interface is currently messed up and may need to be broken to be fixed. */ -#ifndef _SYS_UCONTEXT_H -#define _SYS_UCONTEXT_H 1 +#ifndef _BITS_UCONTEXT_H +#define _BITS_UCONTEXT_H 1 #include @@ -121,4 +121,4 @@ typedef struct ucontext_t #undef __ctx -#endif /* sys/ucontext.h */ +#endif /* bits/ucontext.h */ diff --git a/sysdeps/unix/sysv/linux/mips/ucontext_i.sym b/sysdeps/unix/sysv/linux/mips/ucontext_i.sym index f14b886407..d9692adcba 100644 --- a/sysdeps/unix/sysv/linux/mips/ucontext_i.sym +++ b/sysdeps/unix/sysv/linux/mips/ucontext_i.sym @@ -1,7 +1,5 @@ -#include #include #include -#include #include diff --git a/sysdeps/unix/sysv/linux/nios2/sys/ucontext.h b/sysdeps/unix/sysv/linux/nios2/bits/ucontext.h similarity index 95% rename from sysdeps/unix/sysv/linux/nios2/sys/ucontext.h rename to sysdeps/unix/sysv/linux/nios2/bits/ucontext.h index e3773ce90c..8549117f32 100644 --- a/sysdeps/unix/sysv/linux/nios2/sys/ucontext.h +++ b/sysdeps/unix/sysv/linux/nios2/bits/ucontext.h @@ -18,8 +18,8 @@ /* System V/Nios II ABI compliant context switching support. */ -#ifndef _SYS_UCONTEXT_H -#define _SYS_UCONTEXT_H 1 +#ifndef _BITS_UCONTEXT_H +#define _BITS_UCONTEXT_H 1 #include @@ -58,4 +58,4 @@ typedef struct ucontext_t #undef __ctx -#endif /* sys/ucontext.h */ +#endif /* bits/ucontext.h */ diff --git a/sysdeps/unix/sysv/linux/nios2/sigcontextinfo.h b/sysdeps/unix/sysv/linux/nios2/sigcontextinfo.h index dbbb47b50d..9a4e5111ee 100644 --- a/sysdeps/unix/sysv/linux/nios2/sigcontextinfo.h +++ b/sysdeps/unix/sysv/linux/nios2/sigcontextinfo.h @@ -16,8 +16,7 @@ License along with the GNU C Library; if not, see . */ -#include -#include "kernel-features.h" +#include #define SIGCONTEXT siginfo_t *_si, ucontext_t * #define GET_PC(ctx) ((void *) (ctx)->uc_mcontext.regs[27]) diff --git a/sysdeps/unix/sysv/linux/nios2/ucontext_i.sym b/sysdeps/unix/sysv/linux/nios2/ucontext_i.sym index a844c96796..5455cdb681 100644 --- a/sysdeps/unix/sysv/linux/nios2/ucontext_i.sym +++ b/sysdeps/unix/sysv/linux/nios2/ucontext_i.sym @@ -1,7 +1,5 @@ -#include #include #include -#include #include "kernel_rt_sigframe.h" diff --git a/sysdeps/unix/sysv/linux/powerpc/sys/ucontext.h b/sysdeps/unix/sysv/linux/powerpc/bits/ucontext.h similarity index 98% rename from sysdeps/unix/sysv/linux/powerpc/sys/ucontext.h rename to sysdeps/unix/sysv/linux/powerpc/bits/ucontext.h index 640381a5c7..324ec3ce19 100644 --- a/sysdeps/unix/sysv/linux/powerpc/sys/ucontext.h +++ b/sysdeps/unix/sysv/linux/powerpc/bits/ucontext.h @@ -15,8 +15,8 @@ License along with the GNU C Library; if not, see . */ -#ifndef _SYS_UCONTEXT_H -#define _SYS_UCONTEXT_H 1 +#ifndef _BITS_UCONTEXT_H +#define _BITS_UCONTEXT_H 1 #include @@ -197,4 +197,4 @@ typedef struct ucontext_t #undef __ctx -#endif /* sys/ucontext.h */ +#endif /* bits/ucontext.h */ diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/ucontext_i.sym b/sysdeps/unix/sysv/linux/powerpc/powerpc32/ucontext_i.sym index 293761f260..e1b22b844e 100644 --- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/ucontext_i.sym +++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/ucontext_i.sym @@ -1,6 +1,5 @@ #include #include -#include -- diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/ucontext_i.sym b/sysdeps/unix/sysv/linux/powerpc/powerpc64/ucontext_i.sym index 8364e4614f..b2d420e15e 100644 --- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/ucontext_i.sym +++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/ucontext_i.sym @@ -1,6 +1,5 @@ #include #include -#include -- diff --git a/sysdeps/unix/sysv/linux/riscv/bits/procfs.h b/sysdeps/unix/sysv/linux/riscv/bits/procfs.h index 6ab26013a6..4e2dae40dc 100644 --- a/sysdeps/unix/sysv/linux/riscv/bits/procfs.h +++ b/sysdeps/unix/sysv/linux/riscv/bits/procfs.h @@ -23,10 +23,10 @@ # error "Never include directly; use instead." #endif -/* FIXME: sys/ucontext.h does not define NGREG or NFPREG unless +/* FIXME: bits/ucontext.h does not define NGREG or NFPREG unless __USE_MISC is active, and sys/procfs.h should not expose all of - sys/ucontext.h. */ -#include + bits/ucontext.h. */ +#include /* ELF register definitions */ #define ELF_NGREG NGREG diff --git a/sysdeps/unix/sysv/linux/riscv/sys/ucontext.h b/sysdeps/unix/sysv/linux/riscv/bits/ucontext.h similarity index 97% rename from sysdeps/unix/sysv/linux/riscv/sys/ucontext.h rename to sysdeps/unix/sysv/linux/riscv/bits/ucontext.h index 6f62eb3d08..48ff2cd5af 100644 --- a/sysdeps/unix/sysv/linux/riscv/sys/ucontext.h +++ b/sysdeps/unix/sysv/linux/riscv/bits/ucontext.h @@ -18,8 +18,8 @@ /* Don't rely on this, the interface is currently messed up and may need to be broken to be fixed. */ -#ifndef _SYS_UCONTEXT_H -#define _SYS_UCONTEXT_H 1 +#ifndef _BITS_UCONTEXT_H +#define _BITS_UCONTEXT_H 1 #include @@ -107,4 +107,4 @@ typedef struct ucontext_t mcontext_t uc_mcontext; } ucontext_t; -#endif /* sys/ucontext.h */ +#endif /* bits/ucontext.h */ diff --git a/sysdeps/unix/sysv/linux/riscv/makecontext.c b/sysdeps/unix/sysv/linux/riscv/makecontext.c index 671f20203d..8a929bf54a 100644 --- a/sysdeps/unix/sysv/linux/riscv/makecontext.c +++ b/sysdeps/unix/sysv/linux/riscv/makecontext.c @@ -18,14 +18,12 @@ #include #include -#include +#include #include #include void -__makecontext (ucontext_t *ucp, void (*func) (void), int argc, - long int a0, long int a1, long int a2, long int a3, long int a4, - ...) +__makecontext (ucontext_t *ucp, void (*func) (void), int argc, ...) { extern void __start_context (void) attribute_hidden; long int i, sp; @@ -47,19 +45,13 @@ __makecontext (ucontext_t *ucp, void (*func) (void), int argc, ucp->uc_mcontext.__gregs[REG_PC] = (long int) &__start_context; /* Put args in a0-a7, then put any remaining args on the stack. */ - ucp->uc_mcontext.__gregs[REG_A0 + 0] = a0; - ucp->uc_mcontext.__gregs[REG_A0 + 1] = a1; - ucp->uc_mcontext.__gregs[REG_A0 + 2] = a2; - ucp->uc_mcontext.__gregs[REG_A0 + 3] = a3; - ucp->uc_mcontext.__gregs[REG_A0 + 4] = a4; - - if (__glibc_unlikely (argc > 5)) + if (argc > 0) { va_list vl; - va_start (vl, a4); + va_start (vl, argc); long reg_args = argc < REG_NARGS ? argc : REG_NARGS; - for (i = 5; i < reg_args; i++) + for (i = 0; i < reg_args; i++) ucp->uc_mcontext.__gregs[REG_A0 + i] = va_arg (vl, long); long int stack_args = argc - reg_args; diff --git a/sysdeps/unix/sysv/linux/riscv/sigcontextinfo.h b/sysdeps/unix/sysv/linux/riscv/sigcontextinfo.h index 27ed9bdb87..5f7ba368ed 100644 --- a/sysdeps/unix/sysv/linux/riscv/sigcontextinfo.h +++ b/sysdeps/unix/sysv/linux/riscv/sigcontextinfo.h @@ -16,7 +16,7 @@ License along with the GNU C Library. If not, see . */ -#include +#include #define SIGCONTEXT siginfo_t *_si, ucontext_t * #define GET_PC(ctx) ((void *) ctx->uc_mcontext.__gregs[REG_PC]) diff --git a/sysdeps/unix/sysv/linux/riscv/ucontext_i.sym b/sysdeps/unix/sysv/linux/riscv/ucontext_i.sym index be55b26310..105b538684 100644 --- a/sysdeps/unix/sysv/linux/riscv/ucontext_i.sym +++ b/sysdeps/unix/sysv/linux/riscv/ucontext_i.sym @@ -1,7 +1,5 @@ -#include -#include #include -#include +#include -- Constants used by the rt_sigprocmask call. diff --git a/sysdeps/unix/sysv/linux/s390/bits/procfs.h b/sysdeps/unix/sysv/linux/s390/bits/procfs.h index 597ccdb754..c2a4b54cb1 100644 --- a/sysdeps/unix/sysv/linux/s390/bits/procfs.h +++ b/sysdeps/unix/sysv/linux/s390/bits/procfs.h @@ -23,9 +23,9 @@ # error "Never include directly; use instead." #endif -/* FIXME: sys/ucontext.h does not define NGREG unless __USE_MISC is - active, and sys/procfs.h should not expose all of sys/ucontext.h. */ -#include +/* FIXME: bits/ucontext.h does not define NGREG unless __USE_MISC is + active, and sys/procfs.h should not expose all of bits/ucontext.h. */ +#include typedef greg_t elf_greg_t; #define ELF_NGREG NGREG diff --git a/sysdeps/unix/sysv/linux/s390/sys/ucontext.h b/sysdeps/unix/sysv/linux/s390/bits/ucontext.h similarity index 96% rename from sysdeps/unix/sysv/linux/s390/sys/ucontext.h rename to sysdeps/unix/sysv/linux/s390/bits/ucontext.h index c1770ca6d4..4ce1ee8717 100644 --- a/sysdeps/unix/sysv/linux/s390/sys/ucontext.h +++ b/sysdeps/unix/sysv/linux/s390/bits/ucontext.h @@ -16,8 +16,8 @@ License along with the GNU C Library; if not, see . */ -#ifndef _SYS_UCONTEXT_H -#define _SYS_UCONTEXT_H 1 +#ifndef _BITS_UCONTEXT_H +#define _BITS_UCONTEXT_H 1 #include @@ -92,4 +92,4 @@ typedef struct ucontext_t #undef __ctx -#endif /* sys/ucontext.h */ +#endif /* bits/ucontext.h */ diff --git a/sysdeps/unix/sysv/linux/s390/tst-ptrace-singleblock.c b/sysdeps/unix/sysv/linux/s390/tst-ptrace-singleblock.c index e7d36d2d75..1c2aed9ddb 100644 --- a/sysdeps/unix/sysv/linux/s390/tst-ptrace-singleblock.c +++ b/sysdeps/unix/sysv/linux/s390/tst-ptrace-singleblock.c @@ -16,19 +16,19 @@ License along with the GNU C Library; if not, see . */ +#include +#include #include #include #include #include #include -#include #include #include -#include -#include +#include + #include -#include -#include +#include /* Ensure that we use the PTRACE_SINGLEBLOCK definition from glibc ptrace.h in tracer_func. We need the kernel ptrace.h for structs ptrace_area diff --git a/sysdeps/unix/sysv/linux/s390/ucontext_i.sym b/sysdeps/unix/sysv/linux/s390/ucontext_i.sym index 6cc9f19624..5b98555049 100644 --- a/sysdeps/unix/sysv/linux/s390/ucontext_i.sym +++ b/sysdeps/unix/sysv/linux/s390/ucontext_i.sym @@ -1,6 +1,5 @@ #include #include -#include -- diff --git a/sysdeps/unix/sysv/linux/sh/sys/ucontext.h b/sysdeps/unix/sysv/linux/sh/bits/ucontext.h similarity index 97% rename from sysdeps/unix/sysv/linux/sh/sys/ucontext.h rename to sysdeps/unix/sysv/linux/sh/bits/ucontext.h index 9092103a7d..65b66cea37 100644 --- a/sysdeps/unix/sysv/linux/sh/sys/ucontext.h +++ b/sysdeps/unix/sysv/linux/sh/bits/ucontext.h @@ -17,8 +17,8 @@ /* Where is System V/SH ABI? */ -#ifndef _SYS_UCONTEXT_H -#define _SYS_UCONTEXT_H 1 +#ifndef _BITS_UCONTEXT_H +#define _BITS_UCONTEXT_H 1 #include @@ -123,4 +123,4 @@ typedef struct ucontext_t #undef __ctx -#endif /* sys/ucontext.h */ +#endif /* bits/ucontext.h */ diff --git a/sysdeps/unix/sysv/linux/sh/sh3/ucontext_i.sym b/sysdeps/unix/sysv/linux/sh/sh3/ucontext_i.sym index 25f914a93b..4cd312ac5d 100644 --- a/sysdeps/unix/sysv/linux/sh/sh3/ucontext_i.sym +++ b/sysdeps/unix/sysv/linux/sh/sh3/ucontext_i.sym @@ -1,6 +1,5 @@ #include #include -#include -- diff --git a/sysdeps/unix/sysv/linux/sh/sh4/ucontext_i.sym b/sysdeps/unix/sysv/linux/sh/sh4/ucontext_i.sym index 130f60cd96..530a06f6d0 100644 --- a/sysdeps/unix/sysv/linux/sh/sh4/ucontext_i.sym +++ b/sysdeps/unix/sysv/linux/sh/sh4/ucontext_i.sym @@ -1,6 +1,5 @@ #include #include -#include -- diff --git a/sysdeps/unix/sysv/linux/sparc/sys/ucontext.h b/sysdeps/unix/sysv/linux/sparc/bits/ucontext.h similarity index 99% rename from sysdeps/unix/sysv/linux/sparc/sys/ucontext.h rename to sysdeps/unix/sysv/linux/sparc/bits/ucontext.h index a125084c78..9c3f4e3f55 100644 --- a/sysdeps/unix/sysv/linux/sparc/sys/ucontext.h +++ b/sysdeps/unix/sysv/linux/sparc/bits/ucontext.h @@ -15,8 +15,8 @@ License along with the GNU C Library; if not, see . */ -#ifndef _SYS_UCONTEXT_H -#define _SYS_UCONTEXT_H 1 +#ifndef _BITS_UCONTEXT_H +#define _BITS_UCONTEXT_H 1 #include @@ -301,4 +301,4 @@ typedef struct ucontext_t } ucontext_t; #endif /* __WORDSIZE == 32 */ -#endif /* sys/ucontext.h */ +#endif /* bits/ucontext.h */ diff --git a/sysdeps/unix/sysv/linux/sparc/sparc32/ucontext_i.sym b/sysdeps/unix/sysv/linux/sparc/sparc32/ucontext_i.sym index 8a7cb5ab84..0fe920d35a 100644 --- a/sysdeps/unix/sysv/linux/sparc/sparc32/ucontext_i.sym +++ b/sysdeps/unix/sysv/linux/sparc/sparc32/ucontext_i.sym @@ -1,6 +1,5 @@ #include #include -#include -- diff --git a/sysdeps/unix/sysv/linux/x86/sys/ucontext.h b/sysdeps/unix/sysv/linux/x86/bits/ucontext.h similarity index 98% rename from sysdeps/unix/sysv/linux/x86/sys/ucontext.h rename to sysdeps/unix/sysv/linux/x86/bits/ucontext.h index 3d883c2bf1..e78658394f 100644 --- a/sysdeps/unix/sysv/linux/x86/sys/ucontext.h +++ b/sysdeps/unix/sysv/linux/x86/bits/ucontext.h @@ -15,8 +15,8 @@ License along with the GNU C Library; if not, see . */ -#ifndef _SYS_UCONTEXT_H -#define _SYS_UCONTEXT_H 1 +#ifndef _BITS_UCONTEXT_H +#define _BITS_UCONTEXT_H 1 #include @@ -259,4 +259,4 @@ typedef struct ucontext_t #undef __ctx -#endif /* sys/ucontext.h */ +#endif /* bits/ucontext.h */ diff --git a/sysdeps/unix/sysv/linux/x86_64/ucontext_i.sym b/sysdeps/unix/sysv/linux/x86_64/ucontext_i.sym index c08b3b8b47..4bffe048a0 100644 --- a/sysdeps/unix/sysv/linux/x86_64/ucontext_i.sym +++ b/sysdeps/unix/sysv/linux/x86_64/ucontext_i.sym @@ -1,6 +1,5 @@ #include #include -#include --