public inbox for glibc-cvs@sourceware.org
help / color / mirror / Atom feed
* [glibc/zack/no-nested-includes] Don't include sys/types.h 6/n: sys/epoll.h
@ 2019-06-18 15:34 Zack Weinberg
  0 siblings, 0 replies; 2+ messages in thread
From: Zack Weinberg @ 2019-06-18 15:34 UTC (permalink / raw)
  To: glibc-cvs

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset="us-ascii", Size: 6767 bytes --]

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=30013aae10293b1fb384c643866be410718978af

commit 30013aae10293b1fb384c643866be410718978af
Author: Zack Weinberg <zackw@panix.com>
Date:   Sun May 26 12:06:13 2019 -0400

    Don't include sys/types.h 6/n: sys/epoll.h
    
    I thought I was going to need to change all of the arch-specific
    bits/epoll.h headers as well, but it turned out not to be necessary.
    I still took the opportunity to give them all multiple inclusion
    guards.
    
    	* 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.
    	* scripts/check-obsolete-constructs.py (HEADER_ALLOWED_INCLUDES):
    	Update.

Diff:
---
 scripts/check-obsolete-constructs.py       |  1 -
 sysdeps/unix/sysv/linux/alpha/bits/epoll.h |  5 +++++
 sysdeps/unix/sysv/linux/bits/epoll.h       |  5 +++++
 sysdeps/unix/sysv/linux/hppa/bits/epoll.h  |  5 +++++
 sysdeps/unix/sysv/linux/mips/bits/epoll.h  |  5 +++++
 sysdeps/unix/sysv/linux/sparc/bits/epoll.h |  5 +++++
 sysdeps/unix/sysv/linux/sys/epoll.h        | 10 +++++-----
 sysdeps/unix/sysv/linux/x86/bits/epoll.h   |  5 +++++
 8 files changed, 35 insertions(+), 6 deletions(-)

diff --git a/scripts/check-obsolete-constructs.py b/scripts/check-obsolete-constructs.py
index 4472c80..f9121ab 100755
--- a/scripts/check-obsolete-constructs.py
+++ b/scripts/check-obsolete-constructs.py
@@ -594,7 +594,6 @@ HEADER_ALLOWED_INCLUDES = {
     "sys/bitypes.h":               [ "sys/types.h" ],
     "sys/dir.h":                   [ "dirent.h" ],
     "sys/elf.h":                   [ "sys/procfs.h" ],
-    "sys/epoll.h":                 [ "stdint.h", "sys/types.h" ],
     "sys/errno.h":                 [ "errno.h" ],
     "sys/eventfd.h":               [ "stdint.h" ],
     "sys/fanotify.h":              [ "stdint.h" ],
diff --git a/sysdeps/unix/sysv/linux/alpha/bits/epoll.h b/sysdeps/unix/sysv/linux/alpha/bits/epoll.h
index 3bf1853..41dd9c5 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
    <http://www.gnu.org/licenses/>.  */
 
+#ifndef _BITS_EPOLL_H
+#define _BITS_EPOLL_H 1
+
 #ifndef	_SYS_EPOLL_H
 # error "Never use <bits/epoll.h> directly; include <sys/epoll.h> 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/bits/epoll.h b/sysdeps/unix/sysv/linux/bits/epoll.h
index eaba990..a00f3d9 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
    <http://www.gnu.org/licenses/>.  */
 
+#ifndef _BITS_EPOLL_H
+#define _BITS_EPOLL_H 1
+
 #ifndef	_SYS_EPOLL_H
 # error "Never use <bits/epoll.h> directly; include <sys/epoll.h> 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/hppa/bits/epoll.h b/sysdeps/unix/sysv/linux/hppa/bits/epoll.h
index 156bda0..7772214 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
    <http://www.gnu.org/licenses/>.  */
 
+#ifndef _BITS_EPOLL_H
+#define _BITS_EPOLL_H 1
+
 #ifndef	_SYS_EPOLL_H
 # error "Never use <bits/epoll.h> directly; include <sys/epoll.h> 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/mips/bits/epoll.h b/sysdeps/unix/sysv/linux/mips/bits/epoll.h
index eaba990..a00f3d9 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
    <http://www.gnu.org/licenses/>.  */
 
+#ifndef _BITS_EPOLL_H
+#define _BITS_EPOLL_H 1
+
 #ifndef	_SYS_EPOLL_H
 # error "Never use <bits/epoll.h> directly; include <sys/epoll.h> 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/sparc/bits/epoll.h b/sysdeps/unix/sysv/linux/sparc/bits/epoll.h
index 29e0052..2ddfe7b 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
    <http://www.gnu.org/licenses/>.  */
 
+#ifndef _BITS_EPOLL_H
+#define _BITS_EPOLL_H 1
+
 #ifndef	_SYS_EPOLL_H
 # error "Never use <bits/epoll.h> directly; include <sys/epoll.h> 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/sys/epoll.h b/sysdeps/unix/sysv/linux/sys/epoll.h
index 51ec53d..3a16323 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 <stdint.h>
-#include <sys/types.h>
+#include <features.h>
 
+#include <bits/types.h>
 #include <bits/types/sigset_t.h>
 
 /* 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/x86/bits/epoll.h b/sysdeps/unix/sysv/linux/x86/bits/epoll.h
index 162874a..c8c8737 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
    <http://www.gnu.org/licenses/>.  */
 
+#ifndef _BITS_EPOLL_H
+#define _BITS_EPOLL_H 1
+
 #ifndef	_SYS_EPOLL_H
 # error "Never use <bits/epoll.h> directly; include <sys/epoll.h> instead."
 #endif
@@ -27,3 +30,5 @@ enum
   };
 
 #define __EPOLL_PACKED __attribute__ ((__packed__))
+
+#endif /* bits/epoll.h */


^ permalink raw reply	[flat|nested] 2+ messages in thread

* [glibc/zack/no-nested-includes] Don't include sys/types.h 6/n: sys/epoll.h
@ 2019-05-26 16:37 Zack Weinberg
  0 siblings, 0 replies; 2+ messages in thread
From: Zack Weinberg @ 2019-05-26 16:37 UTC (permalink / raw)
  To: glibc-cvs

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset="us-ascii", Size: 6767 bytes --]

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=8ba85a77a5b70086599850969f3e6256907eaca3

commit 8ba85a77a5b70086599850969f3e6256907eaca3
Author: Zack Weinberg <zackw@panix.com>
Date:   Sun May 26 12:06:13 2019 -0400

    Don't include sys/types.h 6/n: sys/epoll.h
    
    I thought I was going to need to change all of the arch-specific
    bits/epoll.h headers as well, but it turned out not to be necessary.
    I still took the opportunity to give them all multiple inclusion
    guards.
    
    	* 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.
    	* scripts/check-obsolete-constructs.py (HEADER_ALLOWED_INCLUDES):
    	Update.

Diff:
---
 scripts/check-obsolete-constructs.py       |  1 -
 sysdeps/unix/sysv/linux/alpha/bits/epoll.h |  5 +++++
 sysdeps/unix/sysv/linux/bits/epoll.h       |  5 +++++
 sysdeps/unix/sysv/linux/hppa/bits/epoll.h  |  5 +++++
 sysdeps/unix/sysv/linux/mips/bits/epoll.h  |  5 +++++
 sysdeps/unix/sysv/linux/sparc/bits/epoll.h |  5 +++++
 sysdeps/unix/sysv/linux/sys/epoll.h        | 10 +++++-----
 sysdeps/unix/sysv/linux/x86/bits/epoll.h   |  5 +++++
 8 files changed, 35 insertions(+), 6 deletions(-)

diff --git a/scripts/check-obsolete-constructs.py b/scripts/check-obsolete-constructs.py
index 4472c80..f9121ab 100755
--- a/scripts/check-obsolete-constructs.py
+++ b/scripts/check-obsolete-constructs.py
@@ -594,7 +594,6 @@ HEADER_ALLOWED_INCLUDES = {
     "sys/bitypes.h":               [ "sys/types.h" ],
     "sys/dir.h":                   [ "dirent.h" ],
     "sys/elf.h":                   [ "sys/procfs.h" ],
-    "sys/epoll.h":                 [ "stdint.h", "sys/types.h" ],
     "sys/errno.h":                 [ "errno.h" ],
     "sys/eventfd.h":               [ "stdint.h" ],
     "sys/fanotify.h":              [ "stdint.h" ],
diff --git a/sysdeps/unix/sysv/linux/alpha/bits/epoll.h b/sysdeps/unix/sysv/linux/alpha/bits/epoll.h
index 3bf1853..41dd9c5 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
    <http://www.gnu.org/licenses/>.  */
 
+#ifndef _BITS_EPOLL_H
+#define _BITS_EPOLL_H 1
+
 #ifndef	_SYS_EPOLL_H
 # error "Never use <bits/epoll.h> directly; include <sys/epoll.h> 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/bits/epoll.h b/sysdeps/unix/sysv/linux/bits/epoll.h
index eaba990..a00f3d9 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
    <http://www.gnu.org/licenses/>.  */
 
+#ifndef _BITS_EPOLL_H
+#define _BITS_EPOLL_H 1
+
 #ifndef	_SYS_EPOLL_H
 # error "Never use <bits/epoll.h> directly; include <sys/epoll.h> 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/hppa/bits/epoll.h b/sysdeps/unix/sysv/linux/hppa/bits/epoll.h
index 156bda0..7772214 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
    <http://www.gnu.org/licenses/>.  */
 
+#ifndef _BITS_EPOLL_H
+#define _BITS_EPOLL_H 1
+
 #ifndef	_SYS_EPOLL_H
 # error "Never use <bits/epoll.h> directly; include <sys/epoll.h> 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/mips/bits/epoll.h b/sysdeps/unix/sysv/linux/mips/bits/epoll.h
index eaba990..a00f3d9 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
    <http://www.gnu.org/licenses/>.  */
 
+#ifndef _BITS_EPOLL_H
+#define _BITS_EPOLL_H 1
+
 #ifndef	_SYS_EPOLL_H
 # error "Never use <bits/epoll.h> directly; include <sys/epoll.h> 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/sparc/bits/epoll.h b/sysdeps/unix/sysv/linux/sparc/bits/epoll.h
index 29e0052..2ddfe7b 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
    <http://www.gnu.org/licenses/>.  */
 
+#ifndef _BITS_EPOLL_H
+#define _BITS_EPOLL_H 1
+
 #ifndef	_SYS_EPOLL_H
 # error "Never use <bits/epoll.h> directly; include <sys/epoll.h> 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/sys/epoll.h b/sysdeps/unix/sysv/linux/sys/epoll.h
index 51ec53d..3a16323 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 <stdint.h>
-#include <sys/types.h>
+#include <features.h>
 
+#include <bits/types.h>
 #include <bits/types/sigset_t.h>
 
 /* 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/x86/bits/epoll.h b/sysdeps/unix/sysv/linux/x86/bits/epoll.h
index 162874a..c8c8737 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
    <http://www.gnu.org/licenses/>.  */
 
+#ifndef _BITS_EPOLL_H
+#define _BITS_EPOLL_H 1
+
 #ifndef	_SYS_EPOLL_H
 # error "Never use <bits/epoll.h> directly; include <sys/epoll.h> instead."
 #endif
@@ -27,3 +30,5 @@ enum
   };
 
 #define __EPOLL_PACKED __attribute__ ((__packed__))
+
+#endif /* bits/epoll.h */


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-06-18 15:34 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-06-18 15:34 [glibc/zack/no-nested-includes] Don't include sys/types.h 6/n: sys/epoll.h Zack Weinberg
  -- strict thread matches above, loose matches on Subject: below --
2019-05-26 16:37 Zack Weinberg

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).