Clean up the namespace in a number of standard headers.
authorSascha Wildner <saw@online.de>
Wed, 1 Mar 2017 19:36:39 +0000 (20:36 +0100)
committerSascha Wildner <saw@online.de>
Wed, 1 Mar 2017 19:37:29 +0000 (20:37 +0100)
* In most cases, instead of the full load of <sys/types.h>,
  include <machine/stdint.h> which defines the __-types that
  <monetary.h>, <pwd.h>, <search.h>, <strings.h> and <wordexp.h>
  only need.

* Additionally, extend the visibility of the size_t definition
  and adjust WRDE_NOSYS's visibility because it was only in the
  standard up to Issue 6.

* In <time.h>, include <sys/stdint.h> to get at __pid_t too.

* Likewise, include <sys/stdint.h> in <sys/wait.h> and provide
  a definition of pid_t as required.

include/monetary.h
include/pwd.h
include/search.h
include/strings.h
include/time.h
include/wordexp.h
sys/sys/wait.h

index 3c9e1df..8046451 100644 (file)
@@ -30,7 +30,7 @@
 #define        _MONETARY_H_
 
 #include <sys/cdefs.h>
-#include <sys/types.h>
+#include <machine/stdint.h>
 
 #ifndef _SIZE_T_DECLARED
 typedef        __size_t        size_t;
index f4edf7c..166520a 100644 (file)
 #define        _PWD_H_
 
 #include <sys/cdefs.h>
-#include <sys/types.h>
+#include <machine/stdint.h>
 
 #ifndef _GID_T_DECLARED
 typedef        __uint32_t      gid_t;
 #define        _GID_T_DECLARED
 #endif
 
+#ifndef _SIZE_T_DECLARED
+typedef        __size_t        size_t;
+#define        _SIZE_T_DECLARED
+#endif
+
 #ifndef _TIME_T_DECLARED
 typedef        __time_t        time_t;
 #define        _TIME_T_DECLARED
@@ -56,11 +61,6 @@ typedef      __uint32_t      uid_t;
 #define        _UID_T_DECLARED
 #endif
 
-#ifndef _SIZE_T_DECLARED
-typedef        __size_t        size_t;
-#define        _SIZE_T_DECLARED
-#endif
-
 #define        _PATH_PWD               "/etc"
 #define        _PATH_PASSWD            "/etc/passwd"
 #define        _PASSWD                 "passwd"
index d3a6127..fa80b69 100644 (file)
@@ -10,7 +10,7 @@
 #define        _SEARCH_H_
 
 #include <sys/cdefs.h>
-#include <sys/types.h>
+#include <machine/stdint.h>
 
 #ifndef _SIZE_T_DECLARED
 typedef        __size_t        size_t;
index 65a9992..1e82a75 100644 (file)
@@ -30,7 +30,7 @@
 #define        _STRINGS_H_
 
 #include <sys/cdefs.h>
-#include <sys/types.h>
+#include <machine/stdint.h>
 
 #ifndef _SIZE_T_DECLARED
 typedef        __size_t        size_t;
index 14d96d7..1dde064 100644 (file)
@@ -43,7 +43,7 @@
 
 #include <sys/cdefs.h>
 #include <sys/_null.h>
-#include <sys/types.h>
+#include <sys/stdint.h>
 
 #if __POSIX_VISIBLE > 0 && __POSIX_VISIBLE < 200112 || __BSD_VISIBLE
 /*
index 197a0e0..bdae3d7 100644 (file)
@@ -30,9 +30,9 @@
 #define        _WORDEXP_H_
 
 #include <sys/cdefs.h>
-#include <sys/types.h>
+#include <machine/stdint.h>
 
-#if __XSI_VISIBLE && !defined(_SIZE_T_DECLARED)
+#ifndef _SIZE_T_DECLARED
 typedef        __size_t        size_t;
 #define        _SIZE_T_DECLARED
 #endif
@@ -62,7 +62,7 @@ typedef       struct {
 #define        WRDE_BADVAL     2               /* undefined variable */
 #define        WRDE_CMDSUB     3               /* command substitution not allowed */
 #define        WRDE_NOSPACE    4               /* no memory for result */
-#if __XSI_VISIBLE
+#if __BSD_VISIBLE || (__XSI_VISIBLE && __XSI_VISIBLE < 700)
 #define        WRDE_NOSYS      5               /* obsolete, reserved */
 #endif
 #define        WRDE_SYNTAX     6               /* shell syntax error */
index 02bb802..ecbd953 100644 (file)
 #endif /* __BSD_VISIBLE */
 
 #if !defined(_KERNEL) || defined(_KERNEL_VIRTUAL)
-#ifndef _SYS_TYPES_H_
-#include <sys/types.h>
+#include <sys/stdint.h>
+
+#ifndef _PID_T_DECLARED
+typedef        __pid_t         pid_t;          /* process id */
+#define        _PID_T_DECLARED
 #endif
 
 __BEGIN_DECLS