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: 33426 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 */