diff options
-rw-r--r-- | bits/poll.h | 9 | ||||
-rw-r--r-- | include/poll.h | 24 | ||||
-rw-r--r-- | include/sys/poll.h | 21 | ||||
-rw-r--r-- | io/bits/poll2.h | 9 | ||||
-rw-r--r-- | io/poll.h | 77 | ||||
-rw-r--r-- | io/sys/poll.h | 77 | ||||
-rwxr-xr-x | scripts/check-obsolete-constructs.py | 3 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/bits/poll.h | 9 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/m68k/bits/poll.h | 9 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/mips/bits/poll.h | 9 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/sparc/bits/poll.h | 9 |
11 files changed, 145 insertions, 111 deletions
diff --git a/bits/poll.h b/bits/poll.h index 3fe34d7512..177fa4e7aa 100644 --- a/bits/poll.h +++ b/bits/poll.h @@ -15,8 +15,11 @@ License along with the GNU C Library; if not, see <https://www.gnu.org/licenses/>. */ -#ifndef _SYS_POLL_H -# error "Never use <bits/poll.h> directly; include <sys/poll.h> instead." +#ifndef _BITS_POLL_H +#define _BITS_POLL_H 1 + +#ifndef _POLL_H +# error "Never use <bits/poll.h> directly; include <poll.h> 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..f6a0630a18 100644 --- a/include/poll.h +++ b/include/poll.h @@ -1 +1,23 @@ -#include <include/sys/poll.h> +#ifndef _POLL_H +# include <io/poll.h> +# ifndef _ISOMAC + +extern int __poll (struct pollfd *__fds, unsigned long int __nfds, + int __timeout); +libc_hidden_proto (__poll) +libc_hidden_proto (ppoll) + +# if __TIMESIZE == 64 +# define __ppoll64 __ppoll +# else +# include <time.h> +# include <signal.h> + +extern int __ppoll64 (struct pollfd *fds, nfds_t nfds, + const struct __timespec64 *timeout, + const sigset_t *sigmask); +libc_hidden_proto (__ppoll64) + +# endif +# endif +#endif diff --git a/include/sys/poll.h b/include/sys/poll.h index f904e21f89..5365742a4b 100644 --- a/include/sys/poll.h +++ b/include/sys/poll.h @@ -1,22 +1,3 @@ -#ifndef _SYS_POLL_H +#ifndef _POLL_H # include <io/sys/poll.h> - -#ifndef _ISOMAC -extern int __poll (struct pollfd *__fds, unsigned long int __nfds, - int __timeout); -libc_hidden_proto (__poll) -libc_hidden_proto (ppoll) - -# if __TIMESIZE == 64 -# define __ppoll64 __ppoll -# else -# include <time.h> -# include <signal.h> - -extern int __ppoll64 (struct pollfd *fds, nfds_t nfds, - const struct __timespec64 *timeout, - const sigset_t *sigmask); -libc_hidden_proto (__ppoll64) -# endif -#endif #endif diff --git a/io/bits/poll2.h b/io/bits/poll2.h index dca49717db..12c23c469e 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 <https://www.gnu.org/licenses/>. */ -#ifndef _SYS_POLL_H -# error "Never include <bits/poll2.h> directly; use <sys/poll.h> instead." +#ifndef _BITS_POLL2_H +#define _BITS_POLL2_H 1 + +#ifndef _POLL_H +# error "Never include <bits/poll2.h> directly; use <poll.h> 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/poll.h b/io/poll.h index 06fb41ab89..425f4f0c7c 100644 --- a/io/poll.h +++ b/io/poll.h @@ -1 +1,76 @@ -#include <sys/poll.h> +/* System V `poll' interface. + Copyright (C) 1994-2020 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 + <https://www.gnu.org/licenses/>. */ + +#ifndef _POLL_H +#define _POLL_H 1 + +#include <features.h> + +/* Get the platform dependent bits of `poll'. */ +#include <bits/poll.h> +#ifdef __USE_GNU +# include <bits/types/__sigset_t.h> +# include <bits/types/struct_timespec.h> +#endif + + +/* Type used for the number of file descriptors. */ +typedef unsigned long int nfds_t; + +/* Data structure describing a polling request. */ +struct pollfd + { + int fd; /* File descriptor to poll. */ + short int events; /* Types of events poller cares about. */ + short int revents; /* Types of events that actually occurred. */ + }; + + +__BEGIN_DECLS + +/* Poll the file descriptors described by the NFDS structures starting at + FDS. If TIMEOUT is nonzero and not -1, allow TIMEOUT milliseconds for + an event to occur; if TIMEOUT is -1, block until an event occurs. + Returns the number of file descriptors with events, zero if timed out, + or -1 for errors. + + This function is a cancellation point and therefore not marked with + __THROW. */ +extern int poll (struct pollfd *__fds, nfds_t __nfds, int __timeout); + +#ifdef __USE_GNU +/* Like poll, but before waiting the threads signal mask is replaced + with that specified in the fourth parameter. For better usability, + the timeout value is specified using a TIMESPEC object. + + This function is a cancellation point and therefore not marked with + __THROW. */ +extern int ppoll (struct pollfd *__fds, nfds_t __nfds, + const struct timespec *__timeout, + const __sigset_t *__ss); +#endif + +__END_DECLS + + +/* Define some inlines helping to catch common problems. */ +#if __USE_FORTIFY_LEVEL > 0 && defined __fortify_function +# include <bits/poll2.h> +#endif + +#endif /* sys/poll.h */ diff --git a/io/sys/poll.h b/io/sys/poll.h index 857be0f5ac..43ee82dcbc 100644 --- a/io/sys/poll.h +++ b/io/sys/poll.h @@ -1,76 +1,3 @@ -/* Compatibility definitions for System V `poll' interface. - Copyright (C) 1994-2020 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 - <https://www.gnu.org/licenses/>. */ - -#ifndef _SYS_POLL_H -#define _SYS_POLL_H 1 - -#include <features.h> - -/* Get the platform dependent bits of `poll'. */ -#include <bits/poll.h> -#ifdef __USE_GNU -# include <bits/types/__sigset_t.h> -# include <bits/types/struct_timespec.h> +#ifndef _POLL_H +# include <poll.h> #endif - - -/* Type used for the number of file descriptors. */ -typedef unsigned long int nfds_t; - -/* Data structure describing a polling request. */ -struct pollfd - { - int fd; /* File descriptor to poll. */ - short int events; /* Types of events poller cares about. */ - short int revents; /* Types of events that actually occurred. */ - }; - - -__BEGIN_DECLS - -/* Poll the file descriptors described by the NFDS structures starting at - FDS. If TIMEOUT is nonzero and not -1, allow TIMEOUT milliseconds for - an event to occur; if TIMEOUT is -1, block until an event occurs. - Returns the number of file descriptors with events, zero if timed out, - or -1 for errors. - - This function is a cancellation point and therefore not marked with - __THROW. */ -extern int poll (struct pollfd *__fds, nfds_t __nfds, int __timeout); - -#ifdef __USE_GNU -/* Like poll, but before waiting the threads signal mask is replaced - with that specified in the fourth parameter. For better usability, - the timeout value is specified using a TIMESPEC object. - - This function is a cancellation point and therefore not marked with - __THROW. */ -extern int ppoll (struct pollfd *__fds, nfds_t __nfds, - const struct timespec *__timeout, - const __sigset_t *__ss); -#endif - -__END_DECLS - - -/* Define some inlines helping to catch common problems. */ -#if __USE_FORTIFY_LEVEL > 0 && defined __fortify_function -# include <bits/poll2.h> -#endif - -#endif /* sys/poll.h */ diff --git a/scripts/check-obsolete-constructs.py b/scripts/check-obsolete-constructs.py index 6f5d21c2bb..1d9eec5d0e 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 40ca6ebba7..3cf2e56ae9 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 <https://www.gnu.org/licenses/>. */ -#ifndef _SYS_POLL_H -# error "Never use <bits/poll.h> directly; include <sys/poll.h> instead." +#ifndef _BITS_POLL_H +#define _BITS_POLL_H 1 + +#ifndef _POLL_H +# error "Never use <bits/poll.h> directly; include <poll.h> 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 8384efbbad..42873d11f7 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 <https://www.gnu.org/licenses/>. */ -#ifndef _SYS_POLL_H -# error "Never use <bits/poll.h> directly; include <sys/poll.h> instead." +#ifndef _BITS_POLL_H +#define _BITS_POLL_H 1 + +#ifndef _POLL_H +# error "Never use <bits/poll.h> directly; include <poll.h> 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 8384efbbad..42873d11f7 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 <https://www.gnu.org/licenses/>. */ -#ifndef _SYS_POLL_H -# error "Never use <bits/poll.h> directly; include <sys/poll.h> instead." +#ifndef _BITS_POLL_H +#define _BITS_POLL_H 1 + +#ifndef _POLL_H +# error "Never use <bits/poll.h> directly; include <poll.h> 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 f83374dd2a..6b10f07b02 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 <https://www.gnu.org/licenses/>. */ -#ifndef _SYS_POLL_H -# error "Never use <bits/poll.h> directly; include <sys/poll.h> instead." +#ifndef _BITS_POLL_H +#define _BITS_POLL_H 1 + +#ifndef _POLL_H +# error "Never use <bits/poll.h> directly; include <poll.h> 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 */ |