summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog26
-rw-r--r--include/aio.h1
-rw-r--r--linuxthreads/attr.c5
-rw-r--r--linuxthreads/internals.h1
-rw-r--r--linuxthreads/manager.c3
-rw-r--r--linuxthreads/ptfork.c1
-rw-r--r--linuxthreads/pthread.c1
-rw-r--r--linuxthreads/semaphore.c1
-rw-r--r--linuxthreads/specific.c1
-rw-r--r--linuxthreads/spinlock.c1
-rw-r--r--linuxthreads/sysdeps/pthread/bits/pthreadtypes.h119
-rw-r--r--linuxthreads/sysdeps/pthread/pthread.h116
-rw-r--r--posix/Makefile11
-rw-r--r--posix/annexc.c867
-rw-r--r--posix/bits/posix1_lim.h32
-rw-r--r--rt/aio.h1
-rw-r--r--rt/aio_misc.c1
-rw-r--r--rt/aio_notify.c3
-rw-r--r--stdlib/isomac.c2
-rw-r--r--sysdeps/unix/sysv/linux/alpha/bits/types.h7
-rw-r--r--sysdeps/unix/sysv/linux/bits/errno.h3
-rw-r--r--sysdeps/unix/sysv/linux/bits/fcntl.h6
-rw-r--r--sysdeps/unix/sysv/linux/bits/pthreadtypes.h1
-rw-r--r--sysdeps/unix/sysv/linux/bits/sched.h26
-rw-r--r--sysdeps/unix/sysv/linux/bits/siginfo.h12
-rw-r--r--sysdeps/unix/sysv/linux/bits/types.h7
-rw-r--r--sysdeps/unix/sysv/linux/mips/bits/types.h7
-rw-r--r--sysdeps/unix/sysv/linux/sparc/sparc64/bits/types.h7
28 files changed, 1146 insertions, 123 deletions
diff --git a/ChangeLog b/ChangeLog
index 87faab7c38..291c83b62e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,29 @@
+1998-06-30 11:47  Ulrich Drepper  <drepper@cygnus.com>
+
+	* include/aio.h: New file.
+	* posix/Makefile (distribute): Add bits/pthreadtypes.h.
+	(tests): Build and run annexc program.
+	* posix/annexc.c: New file.
+	* posix/bits/posix1_lim.h: Add several more _POSIX_* limits.
+	* rt/aio.h: Remove __need_timespec_t.  We can include the whole time.h.
+	* rt/aio_misc.c: Include limits.h.
+	* rt/aio_notify.c: Include errno.h.
+	* sysdeps/unix/sysv/linux/alpha/bits/types.h: Include pthreadtypes.h.
+	Define size_t.
+	* sysdeps/unix/sysv/linux/bits/types.h: Likewise.
+	* sysdeps/unix/sysv/linux/mips/bits/types.h: Likewise.
+	* sysdeps/unix/sysv/linux/sparc/sparc64/bits/types.h: Likewise.
+	* sysdeps/unix/sysv/linux/bits/errno.h: Define ENOTSUP though the
+	kernel doesn't do this.
+	* sysdeps/unix/sysv/linux/bits/fcntl.h: Define O_LARGEFILE only if
+	__USE_LARGEFILE64 is defined.
+	* sysdeps/unix/sysv/linux/bits/pthreadtypes.h: New file.  Empty.
+	* sysdeps/unix/sysv/linux/bits/sched.h: Define __sched_param struct
+	if requested.
+	* sysdeps/unix/sysv/linux/bits/siginifo.h: Protect non-standard names.
+
+	* stdlib/isomac.c: Avoid include_next warning.
+
 1998-06-29 12:27  Ulrich Drepper  <drepper@cygnus.com>
 
 	* argp/argp.h: Use __PMT instead of __P for function pointer.
diff --git a/include/aio.h b/include/aio.h
new file mode 100644
index 0000000000..c2a4145a86
--- /dev/null
+++ b/include/aio.h
@@ -0,0 +1 @@
+#include <rt/aio.h>
diff --git a/linuxthreads/attr.c b/linuxthreads/attr.c
index d1f605810f..cdd27d6012 100644
--- a/linuxthreads/attr.c
+++ b/linuxthreads/attr.c
@@ -14,6 +14,7 @@
 
 /* Handling of thread attributes */
 
+#include <errno.h>
 #include <unistd.h>
 #include <sys/param.h>
 #include "pthread.h"
@@ -79,14 +80,14 @@ int pthread_attr_setschedparam(pthread_attr_t *attr,
 
   if (param->sched_priority < min_prio || param->sched_priority > max_prio)
     return EINVAL;
-  attr->schedparam = *param;
+  memcpy (&attr->schedparam, param, sizeof (struct sched_param));
   return 0;
 }
 
 int pthread_attr_getschedparam(const pthread_attr_t *attr,
                                struct sched_param *param)
 {
-  *param = attr->schedparam;
+  memcpy (param, &attr->schedparam, sizeof (struct sched_param));
   return 0;
 }
 
diff --git a/linuxthreads/internals.h b/linuxthreads/internals.h
index 9d6f2fadcf..d68adeb987 100644
--- a/linuxthreads/internals.h
+++ b/linuxthreads/internals.h
@@ -17,6 +17,7 @@
 /* Includes */
 
 #include <bits/libc-lock.h> /* for _LIBC_TSD_KEY_N */
+#include <limits.h>
 #include <setjmp.h>
 #include <signal.h>
 #include <unistd.h>
diff --git a/linuxthreads/manager.c b/linuxthreads/manager.c
index e69abac009..7d48489f76 100644
--- a/linuxthreads/manager.c
+++ b/linuxthreads/manager.c
@@ -303,7 +303,8 @@ static int pthread_handle_create(pthread_t *thread, const pthread_attr_t *attr,
     switch(attr->inheritsched) {
     case PTHREAD_EXPLICIT_SCHED:
       new_thread->p_start_args.schedpolicy = attr->schedpolicy;
-      new_thread->p_start_args.schedparam = attr->schedparam;
+      memcpy (&new_thread->p_start_args.schedparam, &attr->schedparam,
+	      sizeof (struct sched_param));
       break;
     case PTHREAD_INHERIT_SCHED:
       /* schedpolicy doesn't need to be set, only get priority */
diff --git a/linuxthreads/ptfork.c b/linuxthreads/ptfork.c
index 8a7b7972a3..32b1d26d92 100644
--- a/linuxthreads/ptfork.c
+++ b/linuxthreads/ptfork.c
@@ -14,6 +14,7 @@
 
 /* The "atfork" stuff */
 
+#include <errno.h>
 #include <stddef.h>
 #include <stdlib.h>
 #include <unistd.h>
diff --git a/linuxthreads/pthread.c b/linuxthreads/pthread.c
index 4e8a9f1dd7..a7511f7eee 100644
--- a/linuxthreads/pthread.c
+++ b/linuxthreads/pthread.c
@@ -14,6 +14,7 @@
 
 /* Thread creation, initialization, and basic low-level routines */
 
+#include <errno.h>
 #include <stddef.h>
 #include <stdio.h>
 #include <stdlib.h>
diff --git a/linuxthreads/semaphore.c b/linuxthreads/semaphore.c
index 7ca609f6b2..6f79dc0138 100644
--- a/linuxthreads/semaphore.c
+++ b/linuxthreads/semaphore.c
@@ -14,6 +14,7 @@
 
 /* Semaphores a la POSIX 1003.1b */
 
+#include <errno.h>
 #include "pthread.h"
 #include "semaphore.h"
 #include "internals.h"
diff --git a/linuxthreads/specific.c b/linuxthreads/specific.c
index 71f1ede541..12990f454c 100644
--- a/linuxthreads/specific.c
+++ b/linuxthreads/specific.c
@@ -14,6 +14,7 @@
 
 /* Thread-specific data */
 
+#include <errno.h>
 #include <stddef.h>
 #include <stdlib.h>
 #include "pthread.h"
diff --git a/linuxthreads/spinlock.c b/linuxthreads/spinlock.c
index df30c35e6c..2546e2a6e0 100644
--- a/linuxthreads/spinlock.c
+++ b/linuxthreads/spinlock.c
@@ -14,6 +14,7 @@
 
 /* Internal locks */
 
+#include <errno.h>
 #include <sched.h>
 #include <time.h>
 #include "pthread.h"
diff --git a/linuxthreads/sysdeps/pthread/bits/pthreadtypes.h b/linuxthreads/sysdeps/pthread/bits/pthreadtypes.h
new file mode 100644
index 0000000000..20b0bed311
--- /dev/null
+++ b/linuxthreads/sysdeps/pthread/bits/pthreadtypes.h
@@ -0,0 +1,119 @@
+/* Linuxthreads - a simple clone()-based implementation of Posix        */
+/* threads for Linux.                                                   */
+/* Copyright (C) 1996 Xavier Leroy (Xavier.Leroy@inria.fr)              */
+/*                                                                      */
+/* This program is free software; you can redistribute it and/or        */
+/* modify it under the terms of the GNU Library General Public License  */
+/* as published by the Free Software Foundation; either version 2       */
+/* of the License, or (at your option) any later version.               */
+/*                                                                      */
+/* This program 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 Library General Public License for more details.                 */
+
+#if !defined _BITS_TYPES_H && !defined _PTHREAD_H
+# error "Never include <bits/pthreadtypes.h> directly; use <sys/types.h> instead."
+#endif
+
+#ifndef _BITS_PTHREADTYPES_H
+#define _BITS_PTHREADTYPES_H	1
+
+#define __need_schedparam
+#include <bits/sched.h>
+
+/* Fast locks (not abstract because mutexes and conditions aren't abstract). */
+struct _pthread_fastlock
+{
+  long int status;              /* "Free" or "taken" or head of waiting list */
+  int spinlock;                 /* For compare-and-swap emulation */
+};
+
+/* Thread descriptors */
+typedef struct _pthread_descr_struct *_pthread_descr;
+
+
+/* Attributes for threads.  */
+typedef struct
+{
+  int detachstate;
+  int schedpolicy;
+  struct __sched_param schedparam;
+  int inheritsched;
+  int scope;
+  size_t guardsize;
+  int stackaddr_set;
+  void *stackaddr;
+  size_t stacksize;
+} pthread_attr_t;
+
+
+/* Conditions (not abstract because of PTHREAD_COND_INITIALIZER */
+typedef struct
+{
+  struct _pthread_fastlock c_lock; /* Protect against concurrent access */
+  _pthread_descr c_waiting;        /* Threads waiting on this condition */
+} pthread_cond_t;
+
+
+/* Attribute for conditionally variables.  */
+typedef struct
+{
+  int dummy;
+} pthread_condattr_t;
+
+/* Keys for thread-specific data */
+typedef unsigned int pthread_key_t;
+
+
+/* Mutexes (not abstract because of PTHREAD_MUTEX_INITIALIZER).  */
+/* (The layout is unnatural to maintain binary compatibility
+    with earlier releases of LinuxThreads.) */
+typedef struct
+{
+  int m_reserved;               /* Reserved for future use */
+  int m_count;                  /* Depth of recursive locking */
+  _pthread_descr m_owner;       /* Owner thread (if recursive or errcheck) */
+  int m_kind;                   /* Mutex kind: fast, recursive or errcheck */
+  struct _pthread_fastlock m_lock; /* Underlying fast lock */
+} pthread_mutex_t;
+
+
+/* Attribute for mutex.  */
+typedef struct
+{
+  int mutexkind;
+} pthread_mutexattr_t;
+
+
+/* Once-only execution */
+typedef int pthread_once_t;
+
+
+#ifdef __USE_UNIX98
+/* Read-write locks.  */
+typedef struct
+{
+  struct _pthread_fastlock rw_lock; /* Lock to guarantee mutual exclusion */
+  int rw_readers;               /* Number of readers */
+  _pthread_descr rw_writer;     /* Identity of writer, or NULL if none */
+  _pthread_descr rw_read_waiting; /* Threads waiting for reading */
+  _pthread_descr rw_write_waiting; /* Threads waiting for writing */
+  int rw_kind;                  /* Reader/Writer preference selection */
+  int rw_pshared;               /* Shared between processes or not */
+} pthread_rwlock_t;
+
+
+/* Attribute for read-write locks.  */
+typedef struct
+{
+  int lockkind;
+  int pshared;
+} pthread_rwlockattr_t;
+#endif
+
+
+/* Thread identifiers */
+typedef unsigned long int pthread_t;
+
+#endif	/* bits/pthreadtypes.h */
diff --git a/linuxthreads/sysdeps/pthread/pthread.h b/linuxthreads/sysdeps/pthread/pthread.h
index 7e98123f43..1d402e6329 100644
--- a/linuxthreads/sysdeps/pthread/pthread.h
+++ b/linuxthreads/sysdeps/pthread/pthread.h
@@ -17,85 +17,34 @@
 
 #include <features.h>
 
-#include <errno.h>
-#include <limits.h>
 #include <sched.h>
-#include <unistd.h>
+#include <time.h>
 
 #define __need_sigset_t
 #include <signal.h>
-#define __need_timespec
-#include <time.h>
-
-/* Linux has no ENOTSUP error code.  */
-#ifndef ENOTSUP
-#define ENOTSUP EOPNOTSUPP
-#endif
+#include <bits/pthreadtypes.h>
 
 
 __BEGIN_DECLS
 
-/*** Types ***/
-
-/* Thread identifiers */
-typedef unsigned long int pthread_t;
-
-/* Thread descriptors */
-typedef struct _pthread_descr_struct *_pthread_descr;
-
-/* Fast locks (not abstract because mutexes and conditions aren't abstract). */
-struct _pthread_fastlock
-{
-  long int status;              /* "Free" or "taken" or head of waiting list */
-  int spinlock;                 /* For compare-and-swap emulation */
-};
-
-/* Mutexes (not abstract because of PTHREAD_MUTEX_INITIALIZER).  */
-/* (The layout is unnatural to maintain binary compatibility
-    with earlier releases of LinuxThreads.) */
-
-typedef struct
-{
-  int m_reserved;               /* Reserved for future use */
-  int m_count;                  /* Depth of recursive locking */
-  _pthread_descr m_owner;       /* Owner thread (if recursive or errcheck) */
-  int m_kind;                   /* Mutex kind: fast, recursive or errcheck */
-  struct _pthread_fastlock m_lock; /* Underlying fast lock */
-} pthread_mutex_t;
+/* Initializers.  */
 
 #define PTHREAD_MUTEX_INITIALIZER \
   {0, 0, 0, PTHREAD_MUTEX_FAST_NP, {0, 0}}
-#define PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP \
+#ifdef __USE_GNU
+# define PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP \
   {0, 0, 0, PTHREAD_MUTEX_RECURSIVE_NP, {0, 0}}
-
-/* Conditions (not abstract because of PTHREAD_COND_INITIALIZER */
-typedef struct
-{
-  struct _pthread_fastlock c_lock; /* Protect against concurrent access */
-  _pthread_descr c_waiting;        /* Threads waiting on this condition */
-} pthread_cond_t;
+#endif
 
 #define PTHREAD_COND_INITIALIZER {{0, 0}, 0}
 
 #ifdef __USE_UNIX98
-/* Read-write locks.  */
-typedef struct
-{
-  struct _pthread_fastlock rw_lock; /* Lock to guarantee mutual exclusion */
-  int rw_readers;               /* Number of readers */
-  _pthread_descr rw_writer;     /* Identity of writer, or NULL if none */
-  _pthread_descr rw_read_waiting; /* Threads waiting for reading */
-  _pthread_descr rw_write_waiting; /* Threads waiting for writing */
-  int rw_kind;                  /* Reader/Writer preference selection */
-  int rw_pshared;               /* Shared between processes or not */
-} pthread_rwlock_t;
-
 # define PTHREAD_RWLOCK_INITIALIZER \
   { {0, 0}, 0, NULL, NULL, NULL,					      \
     PTHREAD_RWLOCK_DEFAULT_NP, PTHREAD_PROCESS_PRIVATE }
 #endif
 
-/* Attributes */
+/* Values for attributes.  */
 
 enum
 {
@@ -121,19 +70,6 @@ enum
 #define PTHREAD_SCOPE_PROCESS	PTHREAD_SCOPE_PROCESS
 };
 
-typedef struct
-{
-  int detachstate;
-  int schedpolicy;
-  struct sched_param schedparam;
-  int inheritsched;
-  int scope;
-  size_t guardsize;
-  int stackaddr_set;
-  void *stackaddr;
-  size_t stacksize;
-} pthread_attr_t;
-
 enum
 {
   PTHREAD_MUTEX_FAST_NP,
@@ -148,46 +84,22 @@ enum
 #endif
 };
 
-typedef struct
-{
-  int mutexkind;
-} pthread_mutexattr_t;
-
-typedef struct
-{
-  int dummy;
-} pthread_condattr_t;
-
-#ifdef __USE_UNIX98
 enum
 {
   PTHREAD_PROCESS_PRIVATE,
-# define PTHREAD_PROCESS_PRIVATE	PTHREAD_PROCESS_PRIVATE
+#define PTHREAD_PROCESS_PRIVATE	PTHREAD_PROCESS_PRIVATE
   PTHREAD_PROCESS_SHARED
-# define PTHREAD_PROCESS_SHARED		PTHREAD_PROCESS_SHARED
+#define PTHREAD_PROCESS_SHARED	PTHREAD_PROCESS_SHARED
 };
 
+#ifdef __USE_UNIX98
 enum
 {
   PTHREAD_RWLOCK_PREFER_READER_NP,
   PTHREAD_RWLOCK_PREFER_WRITER_NP,
   PTHREAD_RWLOCK_DEFAULT_NP = PTHREAD_RWLOCK_PREFER_WRITER_NP
 };
-
-typedef struct
-{
-  int lockkind;
-  int pshared;
-} pthread_rwlockattr_t;
-#endif
-
-/* Keys for thread-specific data */
-
-typedef unsigned int pthread_key_t;
-
-/* Once-only execution */
-
-typedef int pthread_once_t;
+#endif	/* Unix98 */
 
 #define PTHREAD_ONCE_INIT 0
 
@@ -592,7 +504,8 @@ extern void _pthread_cleanup_pop __P ((struct _pthread_cleanup_buffer *__buffer,
 /* Install a cleanup handler as pthread_cleanup_push does, but also
    saves the current cancellation type and set it to deferred cancellation. */
 
-#define pthread_cleanup_push_defer_np(routine,arg)			      \
+#ifdef __USE_GNU
+# define pthread_cleanup_push_defer_np(routine,arg)			      \
   { struct _pthread_cleanup_buffer _buffer;				      \
     _pthread_cleanup_push_defer (&_buffer, (routine), (arg));
 
@@ -604,11 +517,12 @@ extern void _pthread_cleanup_push_defer __P ((struct _pthread_cleanup_buffer *__
    restores the cancellation type that was in effect when the matching
    pthread_cleanup_push_defer was called. */
 
-#define pthread_cleanup_pop_restore_np(execute)				      \
+# define pthread_cleanup_pop_restore_np(execute)			      \
   _pthread_cleanup_pop_restore (&_buffer, (execute)); }
 
 extern void _pthread_cleanup_pop_restore __P ((struct _pthread_cleanup_buffer *__buffer,
 					       int __execute));
+#endif
 
 /* Functions for handling signals. */
 
diff --git a/posix/Makefile b/posix/Makefile
index 20c1c2b44c..ae3a40b04c 100644
--- a/posix/Makefile
+++ b/posix/Makefile
@@ -26,7 +26,8 @@ headers	:= sys/utsname.h sys/times.h sys/wait.h sys/types.h unistd.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 re_comp.h wait.h bits/environments.h cpio.h
+	   bits/sched.h re_comp.h wait.h bits/environments.h cpio.h	      \
+	   bits/pthreadtypes.h
 
 distribute := confstr.h TESTS TESTS2C.sed testcases.h \
 	      PTESTS PTESTS2C.sed ptestcases.h \
@@ -132,3 +133,11 @@ endif
 %.gz: %
 	gzip -9v -c $< > $@-tmp
 	mv $@-tmp $@
+
+# Run a test on the header files we use.
+# XXX Please note that for now we ignore the result of this test.
+tests: $(objpfx)annexc
+	-$(dir $<)$(notdir $<) '$(CC)' '-I../include -I../include -I.. $(+sysdep-includes) -I../include -I../include -I..' > $<.out
+
+$(objpfx)annexc: annexc.c
+	$(native-compile)
diff --git a/posix/annexc.c b/posix/annexc.c
new file mode 100644
index 0000000000..dbc5e28520
--- /dev/null
+++ b/posix/annexc.c
@@ -0,0 +1,867 @@
+/* Copyright (C) 1998 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 Library General Public License as
+   published by the Free Software Foundation; either version 2 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
+   Library General Public License for more details.
+
+   You should have received a copy of the GNU Library General Public
+   License along with the GNU C Library; see the file COPYING.LIB.  If not,
+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
+
+#include <ctype.h>
+#include <fnmatch.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+#define TMPFILE             "/tmp/macros"
+#define HEADER_MAX          256
+
+/* <aio.h>.  */
+static const char *const aio_syms[] =
+{
+  "AIO_ALLDONE", "AIO_CANCELED", "AIO_NOTCANCELED", "LIO_NOP", "LIO_NOWAIT",
+  "LIO_READ", "LIO_WAIT", "LIO_WRITE",
+  /* From <fcntl.h>.  */
+  "FD_CLOEXEC", "F_DUPFD", "F_GETFD", "F_GETFL", "F_GETLK", "F_RDLCK",
+  "F_SETFD", "F_SETFL", "F_SETLK", "F_SETLKW", "F_UNLCK", "F_WRLCK",
+  "O_ACCMODE", "O_APPEND", "O_CREAT", "O_DSYNC", "O_EXCL", "O_NOCTTY",
+  "O_NONBLOCK", "O_RDONLY", "O_RDWR", "O_RSYNC", "O_SYNC", "O_TRUNC",
+  "O_WRONLY",
+  /* From <signal.h>.  */
+  "SA_NOCLDSTOP", "SA_SIGINFO", "SIGABRT", "SIGALRM", "SIGBUS", "SIGCHLD",
+  "SIGCONT", "SIGEV_NONE", "SIGEV_SIGNAL", "SIGEV_SIGNAL", "SIGEV_THREAD",
+  "SIGFPE", "SIGHUP", "SIGILL", "SIGINT", "SIGKILL", "SIGPIPE", "SIGQUIT",
+  "SIGRTMAX", "SIGRTMIN", "SIGSEGV", "SIGSTOP", "SIGTERM", "SIGTSTP",
+  "SIGTTIN", "SIGTTOU", "SIGUSR1", "SIGUSR2", "SIG_BLOCK", "SIG_DFL",
+  "SIG_ERR", "SIG_IGN", "SIG_SETMASK", "SIG_UNBLOCK", "SI_ASYNCIO",
+  "SI_MESGQ", "SI_QUEUE", "SI_TIMER", "SI_USER"
+};
+static const char *const aio_maybe[] =
+{
+  "aio_cancel", "aio_error", "aio_fsync", "aio_read", "aio_return",
+  "aio_suspend", "aio_write", "lio_listio",
+  /* From <fcntl.h>.  */
+  "creat", "fcntl", "open", "SEEK_CUR", "SEEK_END", "SEEK_SET", "S_IRGRP",
+  "S_IROTH", "S_IRUSR", "S_IRWXG", "S_IRWXO", "S_IRWXU", "S_ISBLK",
+  "S_ISCHR", "S_ISDIR", "S_ISFIFO", "S_ISGID", "S_ISREG", "S_ISUID",
+  "S_IWGRP", "S_IWOTH", "S_IWUSR", "S_IXGRP", "S_IXOTH", "S_IXUSR",
+  /* From <signal.h>.  */
+  "kill", "raise", "sigaction", "sigaddset", "sigdelset", "sigemptyset",
+  "sigfillset", "sigismember", "signal", "sigpending", "sigprocmask",
+  "sigqueue", "sigsuspend", "sigtimedwait", "sigwait", "sigwaitinfo"
+};
+
+/* <assert.h>.  */
+static const char *const assert_syms[] =
+{
+  "assert"
+};
+static const char *const assert_maybe[] =
+{
+};
+
+/* <ctype.h>.   */
+static const char *const ctype_syms[] =
+{
+};
+static const char *const ctype_maybe[] =
+{
+  "isalnum", "isalpha", "iscntrl", "isdigit", "isgraph", "islower",
+  "isprint", "ispunct", "isspace", "isupper", "isxdigit", "tolower",
+  "toupper"
+};
+
+/* <dirent.h>.  */
+static const char *const dirent_syms[] =
+{
+};
+static const char *const dirent_maybe[] =
+{
+  "closedir", "opendir", "readdir", "readdir_r", "rewinddir"
+};
+
+/* <errno.h>.  */
+static const char *const errno_syms[] =
+{
+  "E2BIG", "EACCESS", "EAGAIN", "EBADF", "EBADMSG", "EBUSY", "ECANCELED",
+  "ECHILD", "EDEADLK", "EDOM", "EEXIST", "EFAULT", "EFBIG", "EINPROGRESS",
+  "EINTR", "EINVAL", "EIO", "EISDIR", "EMFILE", "EMLINK", "EMSGSIZE",
+  "ENAMETOOLONG", "ENFILE", "ENODEV", "ENOENT", "ENOEXEC", "ENOLCK",
+  "ENOMEM", "ENOSPC", "ENOSYS", "ENOTDIR", "ENOTEMPTY", "ENOTSUP",
+  "ENOTTY", "ENXIO", "EPERM", "EPIPE", "ERANGE", "EROFS", "ESPIPE",
+  "ESRCH", "ETIMEDOUT", "EXDEV"
+};
+static const char *const errno_maybe[] =
+{
+  "errno", "E*"
+};
+
+/* <fcntl.h>.  */
+static const char *const fcntl_syms[] =
+{
+  "FD_CLOEXEC", "F_DUPFD", "F_GETFD", "F_GETFL", "F_GETLK", "F_RDLCK",
+  "F_SETFD", "F_SETFL", "F_SETLK", "F_SETLKW", "F_UNLCK", "F_WRLCK",
+  "O_ACCMODE", "O_APPEND", "O_CREAT", "O_DSYNC", "O_EXCL", "O_NOCTTY",
+  "O_NONBLOCK", "O_RDONLY", "O_RDWR", "O_RSYNC", "O_SYNC", "O_TRUNC",
+  "O_WRONLY"
+};
+static const char *const fcntl_maybe[] =
+{
+  "creat", "fcntl", "open", "SEEK_CUR", "SEEK_END", "SEEK_SET", "S_IRGRP",
+  "S_IROTH", "S_IRUSR", "S_IRWXG", "S_IRWXO", "S_IRWXU", "S_ISBLK",
+  "S_ISCHR", "S_ISDIR", "S_ISFIFO", "S_ISGID", "S_ISREG", "S_ISUID",
+  "S_IWGRP", "S_IWOTH", "S_IWUSR", "S_IXGRP", "S_IXOTH", "S_IXUSR"
+};
+
+/* <float.h>.  */
+static const char *const float_syms[] =
+{
+  "DBL_DIG", "DBL_EPSILON", "DBL_MANT_DIG", "DBL_MAX", "DBL_MAX_10_EXP",
+  "DBL_MAX_EXP", "DBL_MIN", "DBL_MIN_10_EXP", "DBL_MIN_EXP", "FLT_DIG",
+  "FLT_EPSILON", "FLT_MANT_DIG", "FLT_MAX", "FLT_MAX_10_EXP", "FLT_MAX_EXP",
+  "FLT_MIN", "FLT_MIN_10_EXP", "FLT_MIN_EXP", "FLT_RADIX", "FLT_ROUNDS",
+  "LDBL_DIG", "LDBL_EPSILON", "LDBL_MANT_DIG", "LDBL_MAX", "LDBL_MAX_10_EXP",
+  "LDBL_MAX_EXP", "LDBL_MIN", "LDBL_MIN_10_EXP", "LDBL_MIN_EXP"
+};
+static const char *const float_maybe[] =
+{
+};
+
+/* <grp.h>.  */
+static const char *const grp_syms[] =
+{
+};
+static const char *const grp_maybe[] =
+{
+  "getgrgid", "getgrgid_r", "getgrnam", "getgrnam_r"
+};
+
+/* <limits.h>.  */
+static const char *const limits_syms[] =
+{
+  "_POSIX_AIO_LISTIO_MAX", "_POSIX_AIO_MAX", "_POSIX_ARG_MAX",
+  "_POSIX_CHILD_MAX", "_POSIX_CLOCKRES_MAX", "_POSIX_DELAYTIMER_MAX",
+  "_POSIX_LINK_MAX", "_POSIX_LOGIN_NAME_MAX", "_POSIX_MAX_CANON",
+  "_POSIX_MAX_INPUT", "_POSIX_MQ_OPEN_MAX", "_POSIX_MQ_PRIO_MAX",
+  "_POSIX_NAME_MAX", "_POSIX_NGROUPS_MAX", "_POSIX_OPEN_MAX",
+  "_POSIX_PATH_MAX", "_POSIX_PIPE_BUF", "_POSIX_RTSIG_MAX",
+  "_POSIX_SEM_NSEMS_MAX", "_POSIX_SEM_VALUE_MAX", "_POSIX_SIGQUEUE_MAX",
+  "_POSIX_SSIZE_MAX", "_POSIX_STREAM_MAX",
+  "_POSIX_THREAD_DESTRUCTOR_ITERATIONS", "_POSIX_THREAD_KEYS_MAX",
+  "_POSIX_THREAD_THREADS_MAX", "_POSIX_TIMER_MAX", "_POSIX_TTY_NAME_MAX",
+  "_POSIX_TZNAME_MAX", "_POSIX_THREAD_DESTRUCTOR_ITERATIONS",
+  "CHAR_BIT", "CHAR_MAX", "CHAR_MIN", "INT_MAX", "INT_MIN", "MB_LEN_MAX",
+  "NGROUPS_MAX", "PAGESIZE", "SCHAR_MIN", "SCHAR_MAX"
+};
+static const char *const limits_maybe[] =
+{
+  "AIO_LISTIO_MAX", "AIO_MAX", "ARG_MAX", "CHILD_MAX", "DELAYTIMER_MAX",
+  "LINK_MAX", "LOGIN_NAME_MAX", "LONG_MAX", "LONG_MIN", "MAX_CANON",
+  "MAX_INPUT", "MQ_OPEN_MAX", "MQ_PRIO_MAX", "NAME_MAX", "OPEN_MAX",
+  "PATH_MAX", "PIPE_BUF", "RTSIG_MAX", "PTHREAD_DESTRUCTOR_ITERATIONS",
+  "PTHREAD_KEYS_MAX", "PTHREAD_STACK_MIN", "PTHREAD_THREADS_MAX"
+};
+
+/* <locale.h>.  */
+static const char *const locale_syms[] =
+{
+  "LC_ALL", "LC_COLLATE", "LC_CTYPE", "LC_MONETARY", "LC_NUMERIC",
+  "LC_TIME", "NULL"
+};
+static const char *const locale_maybe[] =
+{
+  "LC_*", "localeconv", "setlocale"
+};
+
+/* <math.h>.  */
+static const char *const math_syms[] =
+{
+  "HUGE_VAL"
+};
+static const char *const math_maybe[] =
+{
+  "acos", "asin", "atan2", "atan", "ceil", "cos", "cosh", "exp",
+  "fabs", "floor", "fmod", "frexp", "ldexp", "log10", "log", "modf",
+  "pow", "sin", "sinh", "sqrt", "tan", "tanh",
+  "acosf", "asinf", "atan2f", "atanf", "ceilf", "cosf", "coshf", "expf",
+  "fabsf", "floorf", "fmodf", "frexpf", "ldexpf", "log10f", "logf", "modff",
+  "powf", "sinf", "sinhf", "sqrtf", "tanf", "tanhf",
+  "acosl", "asinl", "atan2l", "atanl", "ceill", "cosl", "coshl", "expl",
+  "fabsl", "floorl", "fmodl", "frexpl", "ldexpl", "log10l", "logl", "modfl",
+  "powl", "sinl", "sinhl", "sqrtl", "tanl", "tanhl"
+};
+
+/* <mqueue.h>.  */
+static const char *const mqueue_syms[] =
+{
+};
+static const char *const mqueue_maybe[] =
+{
+  "mq_close", "mq_getattr", "mq_notify", "mq_open", "mq_receive",
+  "mq_send", "mq_setattr", "mq_unlink"
+};
+
+/* <pthread.h>.  */
+static const char *const pthread_syms[] =
+{
+  "PTHREAD_CANCELED", "PTHREAD_CANCEL_ASYNCHRONOUS",
+  "PTHREAD_CANCEL_DEFERRED", "PTHREAD_CANCEL_DISABLE", "PTHREAD_CANCEL_ENABLE",
+  "PTHREAD_COND_INITIALIZER", "PTHREAD_CREATE_DETACHED",
+  "PTHREAD_CREATE_JOINABLE", "PTHREAD_EXPLICIT_SCHED",
+  "PTHREAD_INHERIT_SCHED", "PTHREAD_MUTEX_INITIALIZER",
+  "PTHREAD_ONCE_INIT", "PTHREAD_PRIO_INHERIT", "PTHREAD_PRIO_NONE",
+  "PTHREAD_PRIO_PROTECT", "PTHREAD_PROCESS_PRIVATE",
+  "PTHREAD_PROCESS_SHARED", "PTHREAD_SCOPE_PROCESS", "PTHREAD_SCOPE_SYSTEM",
+  /* These come from <sched.h>.  */
+  "SCHED_FIFO", "SCHED_OTHER", "SCHED_RR",
+  /* These come from <time.h>.  */
+  "CLK_TCK", "CLOCKS_PER_SEC", "CLOCK_REALTIME", "NULL", "TIMER_ABSTIME"
+};
+static const char *const pthread_maybe[] =
+{
+  "pthread_atfork", "pthread_attr_destroy", "pthread_attr_getdetachstate",
+  "pthread_attr_getinheritsched", "pthread_attr_getschedparam",
+  "pthread_attr_getschedpolicy", "pthread_attr_getscope",
+  "pthread_attr_getstackaddr", "pthread_attr_getstacksize",
+  "pthread_attr_init", "pthread_attr_setdetachstate",
+  "pthread_attr_setinheritsched", "pthread_attr_setschedparam",
+  "pthread_attr_setschedpolicy", "pthread_attr_setscope",
+  "pthread_attr_setstackaddr", "pthread_attr_setstacksize",
+  "pthread_cleanup_pop", "pthread_cleanup_push", "pthread_cond_broadcast",
+  "pthread_cond_destroy", "pthread_cond_init", "pthread_cond_signal",
+  "pthread_cond_timedwait", "pthread_cond_wait", "pthread_condattr_destroy",
+  "pthread_condattr_getpshared", "pthread_condattr_init",
+  "pthread_condattr_setpshared", "pthread_create", "pthread_detach",
+  "pthread_equal", "pthread_exit", "pthread_getspecific", "pthread_join",
+  "pthread_key_create", "pthread_key_destroy", "pthread_kill",
+  "pthread_mutex_destroy", "pthread_mutex_getprioceiling",
+  "pthread_mutex_init", "pthread_mutex_lock", "pthread_mutex_setprioceiling",
+  "pthread_mutex_trylock", "pthread_mutex_unlock", "pthread_mutexattr_destroy",
+  "pthread_mutexattr_getprioceiling", "pthread_mutexattr_getprotocol",
+  "pthread_mutexattr_getpshared", "pthread_mutexattr_init",
+  "pthread_mutexattr_setprioceiling", "pthread_mutexattr_setprotocol",
+  "pthread_mutexattr_setpshared", "pthread_once", "pthread_self",
+  "pthread_setcancelstate", "pthread_setcanceltype", "pthread_setspecific",
+  "pthread_sigmask", "pthread_testcancel"
+  /* These come from <sched.h>.  */
+  "sched_get_priority_max", "sched_get_priority_min",
+  "sched_get_rr_interval", "sched_getparam", "sched_getscheduler",
+  "sched_setparam", "sched_setscheduler", "sched_yield",
+  /* These come from <time.h>.  */
+  "asctime", "asctime_r", "clock", "clock_getres", "clock_gettime",
+  "clock_settime", "ctime", "ctime_r", "difftime", "gmtime", "gmtime_r",
+  "localtime", "localtime_r", "mktime", "nanosleep", "strftime", "time",
+  "timer_create", "timer_delete", "timer_getoverrun", "timer_gettime",
+  "timer_settime", "tzset"
+};
+
+/* <pwd.h>.  */
+static const char *const pwd_syms[] =
+{
+};
+static const char *const pwd_maybe[] =
+{
+  "getpwnam", "getpwnam_r", "getpwuid", "getpwuid_r"
+};
+
+/* <sched.h>.  */
+static const char *const sched_syms[] =
+{
+  "SCHED_FIFO", "SCHED_OTHER", "SCHED_RR",
+};
+static const char *const sched_maybe[] =
+{
+  "sched_get_priority_max", "sched_get_priority_min",
+  "sched_get_rr_interval", "sched_getparam", "sched_getscheduler",
+  "sched_setparam", "sched_setscheduler", "sched_yield",
+  /* These come from <time.h>.  */
+  "CLK_TCK", "CLOCKS_PER_SEC", "CLOCK_REALTIME", "NULL", "TIMER_ABSTIME"
+  "asctime", "asctime_r", "clock", "clock_getres", "clock_gettime",
+  "clock_settime", "ctime", "ctime_r", "difftime", "gmtime", "gmtime_r",
+  "localtime", "localtime_r", "mktime", "nanosleep", "strftime", "time",
+  "timer_create", "timer_delete", "timer_getoverrun", "timer_gettime",
+  "timer_settime", "tzset"
+};
+
+/* <semaphore.h>.  */
+static const char *const semaphore_syms[] =
+{
+};
+static const char *const semaphore_maybe[] =
+{
+  "sem_close", "sem_destroy", "sem_getvalue", "sem_init", "sem_open",
+  "sen_post", "sem_trywait", "sem_unlink", "sem_wait"
+};
+
+/* <setjmp.h>.  */
+static const char *const setjmp_syms[] =
+{
+};
+static const char *const setjmp_maybe[] =
+{
+  "longjmp", "setjmp", "siglongjmp", "sigsetjmp"
+};
+
+/* <signal.h>.  */
+static const char *const signal_syms[] =
+{
+  "SA_NOCLDSTOP", "SA_SIGINFO", "SIGABRT", "SIGALRM", "SIGBUS", "SIGCHLD",
+  "SIGCONT", "SIGEV_NONE", "SIGEV_SIGNAL", "SIGEV_SIGNAL", "SIGEV_THREAD",
+  "SIGFPE", "SIGHUP", "SIGILL", "SIGINT", "SIGKILL", "SIGPIPE", "SIGQUIT",
+  "SIGRTMAX", "SIGRTMIN", "SIGSEGV", "SIGSTOP", "SIGTERM", "SIGTSTP",
+  "SIGTTIN", "SIGTTOU", "SIGUSR1", "SIGUSR2", "SIG_BLOCK", "SIG_DFL",
+  "SIG_ERR", "SIG_IGN", "SIG_SETMASK", "SIG_UNBLOCK", "SI_ASYNCIO",
+  "SI_MESGQ", "SI_QUEUE", "SI_TIMER", "SI_USER"
+};
+static const char *const signal_maybe[] =
+{
+  "kill", "raise", "sigaction", "sigaddset", "sigdelset", "sigemptyset",
+  "sigfillset", "sigismember", "signal", "sigpending", "sigprocmask",
+  "sigqueue", "sigsuspend", "sigtimedwait", "sigwait", "sigwaitinfo"
+};
+
+/* <stdarg.h>.  */
+static const char *const stdarg_syms[] =
+{
+  "va_arg", "va_end", "va_list", "va_start"
+};
+static const char *const stdarg_maybe[] =
+{
+};
+
+/* <stddef.h>.  */
+static const char *const stddef_syms[] =
+{
+  "NULL", "offsetof"
+};
+static const char *const stddef_maybe[] =
+{
+};
+
+/* <stdio.h>.  */
+static const char *const stdio_syms[] =
+{
+  "BUFSIZ", "EOF", "FILENAME_MAX", "L_ctermid", "L_cuserid", "L_tmpnam",
+  "NULL", "SEEK_CUR", "SEEK_END", "SEEK_SET", "STREAM_MAX", "TMP_MAX",
+  "stderr", "stdin", "stdout", "_IOFBF", "_IOLBF", "_IONBF"
+};
+static const char *const stdio_maybe[] =
+{
+  "clearerr", "fclose", "fdopen", "feof", "ferror", "fflush", "fgetc",
+  "fgetpos", "fgets", "fileno", "flockfile", "fopen", "fprintf", "fputc",
+  "fputs", "fread", "freopen", "fscanf", "fseek", "fsetpos", "ftell",
+  "ftrylockfile", "funlockfile", "fwrite", "getc", "getchar",
+  "getchar_unlocked", "getc_unlocked", "gets", "perror", "printf", "putc",
+  "putchar", "putchar_unlocked", "putc_unlocked", "puts", "remove", "rename",
+  "rewind", "scanf", "setbuf", "setvbuf", "sprintf", "sscanf", "tmpfile",
+  "tmpnam", "ungetc", "vfprintf", "vprintf", "vsprintf"
+};
+
+/* <stdlib.h>.  */
+static const char *const stdlib_syms[] =
+{
+  "EXIT_FAILURE", "EXIT_SUCCESS", "MB_CUR_MAX", "NULL", "RAND_MAX"
+};
+static const char *const stdlib_maybe[] =
+{
+  "abort", "abs", "atexit", "atof", "atoi", "atol", "bsearch", "calloc",
+  "div", "exit", "free", "getenv", "labs", "ldiv", "malloc", "mblen",
+  "mbstowcs", "mbtowc", "qsort", "rand", "rand_r", "realloc", "srand",
+  "strtod", "strtol", "strtoul", "system", "wcstombs", "wctomb"
+};
+
+/* <string.h>.  */
+static const char *const string_syms[] =
+{
+  "NULL"
+};
+static const char *const string_maybe[] =
+{
+  "memchr", "memcmp", "memcpy", "memmove", "memset", "strcat", "strchr",
+  "strcmp", "strcoll", "strcpy", "strcspn", "strerror", "strlen",
+  "strncat", "strncmp", "strncpy", "strpbrk", "strrchr", "strspn",
+  "strstr", "strtok", "strtok_r", "strxfrm"
+};
+
+/* <sys/mman.h>.  */
+static const char *const mman_syms[] =
+{
+  "MAP_FAILED", "MAP_FIXED", "MAP_PRIVATE", "MAP_SHARED", "MCL_CURRENT",
+  "MCL_FUTURE", "MS_ASYNC", "MS_INVALIDATE", "MS_ASYNC", "MS_INVALIDATE",
+  "MS_SYNC", "PROT_EXEC", "PROT_NONE", "PROT_READ", "PROT_WRITE"
+};
+static const char *const mman_maybe[] =
+{
+  "mlock", "mlockall", "mmap", "mprotect", "msync", "munlock", "munlockall",
+  "munmap", "shm_open", "shm_unlock"
+};
+
+/* <sys/stat.h>.  */
+static const char *const stat_syms[] =
+{
+  "S_IRGRP", "S_IROTH", "S_IRUSR", "S_IRWXG", "S_IRWXO", "S_IRWXU",
+  "S_ISBLK", "S_ISCHR", "S_ISDIR", "S_ISFIFO", "S_ISGID", "S_ISREG",
+  "S_ISUID", "S_IWGRP", "S_IWOTH", "S_IWUSR", "S_IXGRP", "S_IXOTH",
+  "S_IXUSR", "S_TYPEISMQ", "S_TYPEISSEM", "S_TYPEISSHM"
+};
+static const char *const stat_maybe[] =
+{
+  "chmod", "fchmod", "fstat", "mkdir", "mkfifo", "stat", "umask"
+};
+
+/* <sys/times.h>.  */
+static const char *const times_syms[] =
+{
+};
+static const char *const times_maybe[] =
+{
+  "times"
+};
+
+/* <sys/types.h>.  */
+static const char *const types_syms[] =
+{
+};
+static const char *const types_maybe[] =
+{
+};
+
+/* <sys/utsname.h>.  */
+static const char *const utsname_syms[] =
+{
+};
+static const char *const utsname_maybe[] =
+{
+  "uname"
+};
+
+/* <sys/wait.h>.  */
+static const char *const wait_syms[] =
+{
+  "WEXITSTATUS", "WIFEXITED", "WIFSIGNALED", "WIFSTOPPED", "WNOHANG",
+  "WSTOPSIG", "WTERMSIG", "WUNTRACED"
+};
+static const char *const wait_maybe[] =
+{
+  "wait", "waitpid"
+};
+
+/* <termios.h>.  */
+static const char *const termios_syms[] =
+{
+  "B0", "B110", "B1200", "B134", "B150", "B1800", "B19200", "B200", "B2400",
+  "B300", "B38400", "B4800", "B50", "B600", "B75", "B9600", "BRKINT", "CLOCAL",
+  "CREAD", "CS5", "CS6", "CS7", "CS8", "CSIZE", "CSTOPN", "ECHO", "ECHOE",
+  "ECHOK", "ECHONL", "HUPCL", "ICANON", "ICRNL", "IEXTEN", "IGNBRK", "IGNCR",
+  "IGNPAR", "INCLR", "INPCK", "ISIG", "ISTRIP", "IXOFF", "IXON", "NCCS",
+  "NOFLSH", "OPOST", "PARENB", "PARMRK", "PARODD", "TCIFLUSH", "TCIOFF",
+  "TCIOFLUSH", "TCOFLUSH", "TCOOFF", "TCOON", "TCSADRAIN", "TCSAFLUSH",
+  "TCSANOW", "TOSTOP", "VEOF", "VEOL", "VERASE", "VINTR", "VKILL", "VMIN",
+  "VQUIT", "VSTART", "VSTOP", "VSUSP", "VTIME"
+};
+static const char *const termios_maybe[] =
+{
+  "cfgetispeed", "cfgetospeed", "cfsetispeed", "cfsetospeed", "tcdrain",
+  "tcflow", "tcflush", "tcgetattr", "tcsendbrk", "tcsetattr"
+};
+
+/* <time.h>.  */
+static const char *const time_syms[] =
+{
+  "CLK_TCK", "CLOCKS_PER_SEC", "CLOCK_REALTIME", "NULL", "TIMER_ABSTIME"
+};
+static const char *const time_maybe[] =
+{
+  "asctime", "asctime_r", "clock", "clock_getres", "clock_gettime",
+  "clock_settime", "ctime", "ctime_r", "difftime", "gmtime", "gmtime_r",
+  "localtime", "localtime_r", "mktime", "nanosleep", "strftime", "time",
+  "timer_create", "timer_delete", "timer_getoverrun", "timer_gettime",
+  "timer_settime", "tzset"
+};
+
+/* <unistd.h>.  */
+static const char *const unistd_syms[] =
+{
+  "F_OK", "NULL", "R_OK", "SEEK_CUR", "SEEK_END", "SEEK_SET", "STDERR_FILENO",
+  "STDIN_FILENO", "STDOUT_FILENO", "W_OK", "X_OK",
+  "_PC_ASYNC_IO", "_PC_CHOWN_RESTRICTED", "_PC_LINK_MAX", "_PC_MAX_CANON",
+  "_PC_MAX_INPUT", "_PC_NAME_MAX", "_PC_NO_TRUNC", "_PC_PATH_MAX",
+  "_PC_PIPE_BUF", "_PC_PRIO_IO", "_PC_SYNC_IO", "_PC_VDISABLE",
+  "_SC_AIO_LISTIO_MAX", "_SC_AIO_MAX", "_SC_AIO_PRIO_DELTA_MAX",
+  "_SC_ARG_MAX", "_SC_ASYNCHRONOUS_IO", "_SC_CHILD_MAX", "_SC_CLK_TCK",
+  "_SC_DELAYTIMER_MAX", "_SC_FSYNC", "_SC_GETGR_R_SIZE_MAX",
+  "_SC_GETPW_R_SIZE_MAX", "_SC_JOB_CONTROL", "_SC_LOGIN_NAME_MAX",
+  "_SC_MAPPED_FILES", "_SC_MEMLOCK", "_SC_MEMLOCK_RANGE",
+  "_SC_MEMORY_PROTECTION", "_SC_MESSAGE_PASSING", "_SC_MQ_OPEN_MAX",
+  "_SC_MQ_PRIO_MAX", "_SC_NGROUPS_MAX", "_SC_OPEN_MAX", "_SC_PAGESIZE",
+  "_SC_PRIORITIZED_IO", "_SC_PRIORITY_SCHEDULING", "_SC_REALTIME_SIGNALS",
+  "_SC_RTSIG_MAX", "_SC_SAVED_IDS", "_SC_SEMAPHORES", "_SC_SEM_NSEMS_MAX",
+  "_SC_SEM_VALUE_MAX", "_SC_SHARED_MEMORY_OBJECTS", "_SC_SIGQUEUE_MAX",
+  "_SC_STREAM_MAX", "_SC_SYNCHRONIZED_IO", "_SC_THREADS",
+  "_SC_THREAD_ATTR_STACKADDR", "_SC_THREAD_ATTR_STACKSIZE",
+  "_SC_THREAD_DESTRUCTOR_ITERATIONS", "_SC_THREAD_PRIO_INHERIT",
+  "_SC_THREAD_PRIORITY_SCHEDULING", "_SC_THREAD_PRIO_PROTECT",
+  "_SC_THREAD_PROCESS_SHARED", "_SC_THREAD_SAFE_FUNCTIONS",
+  "_SC_THREAD_STACK_MIN", "_SC_THREAD_THREADS_MAX", "_SC_TIMERS",
+  "_SC_TIMER_MAX", "_SC_TTY_NAME_MAX", "_SC_TZNAME_MAX", "_SC_VERSION"
+};
+static const char *const unistd_maybe[] =
+{
+  "_POSIX_ASYNCHRONOUS_IO", "_POSIX_ASYNC_IO", "_POSIX_CHOWN_RESTRICTED",
+  "_POSIX_FSYNC", "_POSIX_JOB_CONTROL", "_POSIX_MAPPED_FILES",
+  "_POSIX_MEMLOCK", "_POSIX_MEMLOCK_RANGE", "_MEMORY_PROTECTION",
+  "_POSIX_MESSAGE_PASSING", "_POSIX_NO_TRUNC", "_POSIX_PRIORITIZED_IO",
+  "_POSIX_PRIORITY_SCHEDULING", "_POSIX_PRIO_IO", "_POSIX_REATIME_SIGNALS",
+  "_POSIX_SAVED_IDS", "_POSIX_SEMAPHORES", "_POSIX_SHARED_MEMORY_OBJECTS",
+  "_POSIX_SYNCHRONIZED_IO", "_POSIX_SYNC_IO", "_POSIX_THREADS",
+  "_POSIX_THREAD_ATTR_STACKADDR", "_POSIX_THREAD_ATTR_STACKSIZE",
+  "_POSIX_THREAD_PRIO_INHERIT", "_POSIX_THREAD_PRIO_PROTECT",
+  "_POSIX_THREAD_PROCESS_SHARED", "_POSIX_THREAD_SAFE_FUNCTIONS",
+  "_POSIX_THREAD_PRIORITY_SCHEDULING", "_POSIX_TIMERS",
+  "_POSIX_VDISABLE", "_POSIX_VERSION",
+  "_exit", "access", "alarm", "chdir", "chown", "close", "ctermid", "cuserid",
+  "dup2", "dup", "execl", "execle", "execlp", "execv", "execve", "execvp",
+  "fdatasync", "fork", "fpathconf", "fsync", "ftruncate", "getcwd", "getegid",
+  "geteuid", "getgid", "getgroups", "getlogin", "getlogin_r", "getpgrp",
+  "getpid", "getppid", "getuid", "isatty", "link", "lseek", "pathconf",
+  "pause", "pipe", "read", "rmdir", "setgid", "setgpid", "setsid", "setuid",
+  "sleep", "sleep", "sysconf", "tcgetpgrp", "tcsetpgrp", "ttyname",
+  "ttyname_r", "unlink", "write"
+};
+
+/* <utime.h>.  */
+static const char *const utime_syms[] =
+{
+};
+static const char *const utime_maybe[] =
+{
+  "utime"
+};
+
+
+static struct header
+{
+  const char *name;
+  const char *const *syms;
+  size_t nsyms;
+  const char *const *maybe;
+  size_t nmaybe;
+  const char *subset;
+} headers[] =
+{
+#define H(n) \
+  { #n ".h", n##_syms, sizeof (n##_syms) / sizeof (n##_syms[0]), \
+    n##_maybe, sizeof (n##_maybe) / sizeof (n##_maybe[0]), NULL }
+#define Hc(n, s) \
+  { #n ".h", n##_syms, sizeof (n##_syms) / sizeof (n##_syms[0]), \
+    n##_maybe, sizeof (n##_maybe) / sizeof (n##_maybe[0]), s }
+#define Hs(n) \
+  { "sys/" #n ".h", n##_syms, sizeof (n##_syms) / sizeof (n##_syms[0]), \
+    n##_maybe, sizeof (n##_maybe) / sizeof (n##_maybe[0]), NULL }
+  H(aio),
+  H(assert),
+  H(ctype),
+  H(dirent),
+  H(errno),
+  H(fcntl),
+  H(float),
+  H(grp),
+  H(limits),
+  H(locale),
+  H(math),
+  Hc(mqueue, "_POSIX_MESSAGE_PASSING"),
+  H(pthread),
+  H(pwd),
+  H(sched),
+  H(semaphore),
+  H(setjmp),
+  H(signal),
+  H(stdarg),
+  H(stddef),
+  H(stdio),
+  H(stdlib),
+  H(string),
+  Hs(mman),
+  Hs(stat),
+  Hs(times),
+  Hs(types),
+  Hs(utsname),
+  Hs(wait),
+  H(termios),
+  H(time),
+  H(unistd),
+  H(utime)
+};
+
+#define NUMBER_OF_HEADERS              (sizeof headers / sizeof *headers)
+
+
+/* Format string to build command to invoke compiler.  */
+static const char fmt[] = "\
+echo \"#include <%s>\" |\
+%s -E -dM -D_POSIX_SOURCE %s \
+-isystem `%s --print-prog-name=include` - > %s";
+
+static const char testfmt[] = "\
+echo \"#include <unistd.h>\n#ifndef %s\n#error not defined\n#endif\n\" |\
+%s -E -dM -D_POSIX_SOURCE %s \
+-isystem `%s --print-prog-name=include` - 2> /dev/null > %s";
+
+
+/* The compiler we use (given on the command line).  */
+const char *CC;
+/* The -I parameters for CC to find all headers.  */
+const char *INC;
+
+static char *xstrndup (const char *, size_t);
+static const char **get_null_defines (void);
+static int check_header (const struct header *, const char **);
+
+int
+main (int argc, char *argv[])
+{
+  int h;
+  int result = 0;
+  const char **ignore_list;
+
+  CC = argc > 1 ? argv[1] : "gcc";
+  INC = argc > 2 ? argv[2] : "";
+
+  if (system (NULL) == 0)
+    {
+      puts ("Sorry, no command processor.");
+      return EXIT_FAILURE;
+    }
+
+  /* First get list of symbols which are defined by the compiler.  */
+  ignore_list = get_null_defines ();
+
+  fputs ("Tested files:\n", stdout);
+
+  for (h = 0; h < NUMBER_OF_HEADERS; ++h)
+    result |= check_header (&headers[h], ignore_list);
+
+  /* The test suite should return errors but for now this is not
+     practical.  Give a warning and ask the user to correct the bugs.  */
+  return result;
+}
+
+
+static char *
+xstrndup (const char *s, size_t n)
+{
+  size_t len = n;
+  char *new = malloc (len + 1);
+
+  if (new == NULL)
+    return NULL;
+
+  new[len] = '\0';
+  return memcpy (new, s, len);
+}
+
+
+static const char **
+get_null_defines (void)
+{
+  char line[BUFSIZ], *command;
+  char **result = NULL;
+  size_t result_len = 0;
+  size_t result_max = 0;
+  FILE *input;
+  int first = 1;
+
+  command = malloc (sizeof fmt + sizeof "/dev/null" + 2 * strlen (CC)
+		    + strlen (INC) + strlen (TMPFILE));
+
+  if (command == NULL)
+    {
+      puts ("No more memory.");
+      exit (1);
+    }
+
+  sprintf (command, fmt, "/dev/null", CC, INC, CC, TMPFILE);
+
+  if (system (command))
+    {
+      puts ("system() returned nonzero");
+      return NULL;
+    }
+  free (command);
+  input = fopen (TMPFILE, "r");
+
+  if (input == NULL)
+    {
+      printf ("Could not read %s: ", TMPFILE);
+      perror (NULL);
+      return NULL;
+    }
+
+  while (fgets (line, sizeof line, input) != NULL)
+    {
+      char *start, *end;
+      if (strlen (line) < 9 || line[7] != ' ')
+	{ /* "#define A" */
+	  printf ("Malformed input, expected '#define MACRO'\ngot '%s'\n",
+		  line);
+	  continue;
+	}
+      if (line[8] == '_')
+	/* It's a safe identifier.  */
+	continue;
+      if (result_len == result_max)
+	{
+	  result_max += 10;
+	  result = realloc (result, result_max * sizeof (char **));
+	  if (result == NULL)
+	    {
+	      puts ("No more memory.");
+	      exit (1);
+	    }
+	}
+      start = &line[8];
+      for (end = start + 1; !isspace (*end) && *end != '\0'; ++end)
+	;
+      result[result_len++] = xstrndup (start, end - start);
+
+      if (first)
+	{
+	  fputs ("The following identifiers will be ignored since the compiler defines them\nby default:\n", stdout);
+	  first = 0;
+	}
+      puts (result[result_len - 1]);
+    }
+  if (result_len == result_max)
+    {
+      result_max += 1;
+      result = realloc (result, result_max * sizeof (char **));
+      if (result == NULL)
+	{
+	  puts ("No more memory.");
+	  exit (1);
+	}
+    }
+  result[result_len] = NULL;
+  fclose (input);
+  remove (TMPFILE);
+
+  return (const char **) result;
+}
+
+
+static int
+check_header (const struct header *header, const char **except)
+{
+  char line[BUFSIZ], *command;
+  FILE *input;
+  int result = 0;
+  int found[header->nsyms];
+  int i;
+
+  memset (found, '\0', header->nsyms * sizeof (int));
+  command = alloca (sizeof fmt + strlen (header->name) + 2 * strlen (CC)
+		    + strlen (INC) + strlen (TMPFILE));
+
+
+  if (command == NULL)
+    {
+      puts ("No more memory.");
+      exit (1);
+    }
+
+  printf ("=== %s ===\n", header->name);
+  sprintf (command, fmt, header->name, CC, INC, CC, TMPFILE);
+
+  /* First see whether this subset is supported at all.  */
+  if (header->subset != NULL)
+    {
+      sprintf (line, testfmt, header->subset, CC, INC, CC, TMPFILE);
+      if (system (line))
+	{
+	  printf ("!! not available\n");
+	  return 0;
+	}
+    }
+
+  if (system (command))
+    {
+      puts ("system() returned nonzero");
+      result = 1;
+    }
+  input = fopen (TMPFILE, "r");
+
+  if (input == NULL)
+    {
+      printf ("Could not read %s: ", TMPFILE);
+      perror (NULL);
+      return 1;
+    }
+
+  while (fgets (line, sizeof line, input) != NULL)
+    {
+      char *endmac;
+      const char **ignore;
+      if (strlen (line) < 9 || line[7] != ' ')
+	{ /* "#define A" */
+	  printf ("Malformed input, expected '#define MACRO'\ngot '%s'\n",
+		  line);
+	  result = 1;
+	  continue;
+	}
+
+      /* Now check whether it's one of the required macros.  */
+      for (i = 0; i < header->nsyms; ++i)
+	if (!strncmp (&line[8], header->syms[i], strlen (header->syms[i])))
+	  break;
+      if (i < header->nsyms)
+	{
+	  found[i] = 1;
+	  continue;
+	}
+
+      /* Symbols starting with "_" are ok.  */
+      if (line[8] == '_')
+	continue;
+
+      /* Find next char after the macro identifier; this can be either
+	 a space or an open parenthesis.  */
+      endmac = strpbrk (&line[8], " (");
+      if (endmac != NULL)
+	*endmac = '\0';
+
+      /* Maybe one of the symbols which are always defined.  */
+      for (ignore = except; *ignore != NULL; ++ignore)
+	if (! strcmp (&line[8], *ignore))
+	  break;
+      if (*ignore != NULL)
+	continue;
+
+      /* Otherwise the symbol better should match one of the following.  */
+      for (i = 0; i < header->nmaybe; ++i)
+	if (fnmatch (header->maybe[i], &line[8], 0) == 0)
+	  break;
+      if (i < header->nmaybe)
+	continue;
+
+      printf ("*  invalid macro `%s'\n", &line[8]);
+      result |= 1;
+    }
+  fclose (input);
+  remove (TMPFILE);
+
+  for (i = 0; i < header->nsyms; ++i)
+    if (found[i] == 0)
+      printf ("** macro `%s' not defined\n", header->syms[i]);
+
+  return result;
+}
diff --git a/posix/bits/posix1_lim.h b/posix/bits/posix1_lim.h
index 29d1acf947..71a7cc45a3 100644
--- a/posix/bits/posix1_lim.h
+++ b/posix/bits/posix1_lim.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991, 1992, 1993, 1996 Free Software Foundation, Inc.
+/* Copyright (C) 1991, 1992, 1993, 1996, 1998 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
@@ -28,12 +28,21 @@
 
 /* These are the standard-mandated minimum values.  */
 
+/* Minimum number of operations in one list I/O call.  */
+#define _POSIX_AIO_LISTIO_MAX	2
+
+/* Minimal number of outstanding asynchronous I/O operations.  */
+#define _POSIX_AIO_MAX		1
+
 /* Maximum length of arguments to `execve', including environment.  */
 #define	_POSIX_ARG_MAX		4096
 
 /* Maximum simultaneous processes per real user ID.  */
 #define	_POSIX_CHILD_MAX	6
 
+/* Minimal number of timer expiration overruns.  */
+#define _POSIX_DELAYTIMER_MAX	32
+
 /* Maximum link count of a file.  */
 #define	_POSIX_LINK_MAX		8
 
@@ -44,6 +53,12 @@
    available in a terminal input queue.  */
 #define	_POSIX_MAX_INPUT	255
 
+/* Maximum number of message queues open for a process.  */
+#define _POSIX_MQ_OPEN_MAX	8
+
+/* Maximum number of supported message priorities.  */
+#define _POSIX_MQ_PRIO_MAX	32
+
 /* Number of simultaneous supplementary group IDs per process.  */
 #define	_POSIX_NGROUPS_MAX	0
 
@@ -63,6 +78,18 @@
 /* Number of bytes than can be written atomically to a pipe.  */
 #define	_POSIX_PIPE_BUF		512
 
+/* Minimal number of realtime signals reserved for the application.  */
+#define _POSIX_RTSIG_MAX	8
+
+/* Number of semaphores a process can have.  */
+#define _POSIX_SEM_NSEMS_MAX	256
+
+/* Maximal value of a semaphore.  */
+#define _POSIX_SEM_VALUE_MAX	32767
+
+/* Number of pending realtime signals.  */
+#define _POSIX_SIGQUEUE_MAX	32
+
 /* Largest value of a `ssize_t'.  */
 #define	_POSIX_SSIZE_MAX	32767
 
@@ -85,6 +112,9 @@
 /* Maximum number of characters in a tty name.  */
 #define	_POSIX_TTY_NAME_MAX	9
 
+/* Number of timer for a process.  */
+#define _POSIX_TIMER_MAX	32
+
 /* Maximum length of login name.  */
 #define	_POSIX_LOGIN_NAME_MAX	9
 
diff --git a/rt/aio.h b/rt/aio.h
index 643e0fbfb9..04328317ae 100644
--- a/rt/aio.h
+++ b/rt/aio.h
@@ -26,7 +26,6 @@
 #include <features.h>
 #include <fcntl.h>
 #include <signal.h>
-#define __need_timespec
 #include <time.h>
 #include <sys/types.h>
 
diff --git a/rt/aio_misc.c b/rt/aio_misc.c
index ca8f4de4bd..0148705662 100644
--- a/rt/aio_misc.c
+++ b/rt/aio_misc.c
@@ -20,6 +20,7 @@
 
 #include <aio.h>
 #include <errno.h>
+#include <limits.h>
 #include <pthread.h>
 #include <stdlib.h>
 #include <unistd.h>
diff --git a/rt/aio_notify.c b/rt/aio_notify.c
index be2e1e246b..716a304813 100644
--- a/rt/aio_notify.c
+++ b/rt/aio_notify.c
@@ -1,5 +1,5 @@
 /* Notify initiator of AIO request.
-   Copyright (C) 1997 Free Software Foundation, Inc.
+   Copyright (C) 1997, 1998 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
 
@@ -18,6 +18,7 @@
    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
+#include <errno.h>
 #include <pthread.h>
 #include <stdlib.h>
 #include "aio_misc.h"
diff --git a/stdlib/isomac.c b/stdlib/isomac.c
index 451cf0c6f5..82a142b2d7 100644
--- a/stdlib/isomac.c
+++ b/stdlib/isomac.c
@@ -177,7 +177,7 @@ static char *macros[] =
 static const char fmt[] = "\
 echo \"#include <%s>\" |\
 %s -E -dM -ansi -pedantic %s -D_LIBC -I. \
--isystem `%s --print-prog-name=include` - > %s";
+-isystem `%s --print-prog-name=include` - 2> /dev/null > %s";
 
 
 /* The compiler we use (given on the command line).  */
diff --git a/sysdeps/unix/sysv/linux/alpha/bits/types.h b/sysdeps/unix/sysv/linux/alpha/bits/types.h
index 70b7d7294f..276236d4f5 100644
--- a/sysdeps/unix/sysv/linux/alpha/bits/types.h
+++ b/sysdeps/unix/sysv/linux/alpha/bits/types.h
@@ -25,6 +25,9 @@
 
 #include <features.h>
 
+#define __need_size_t
+#include <stddef.h>
+
 /* Convenience types.  */
 typedef unsigned char __u_char;
 typedef unsigned short int __u_short;
@@ -107,4 +110,8 @@ typedef struct
 typedef int __t_scalar_t;
 typedef unsigned int __t_uscalar_t;
 
+
+/* Now add the thread types.  */
+#include <bits/pthreadtypes.h>
+
 #endif /* bits/types.h */
diff --git a/sysdeps/unix/sysv/linux/bits/errno.h b/sysdeps/unix/sysv/linux/bits/errno.h
index 8f701c1b8d..5976c25f02 100644
--- a/sysdeps/unix/sysv/linux/bits/errno.h
+++ b/sysdeps/unix/sysv/linux/bits/errno.h
@@ -24,6 +24,9 @@
 # undef ERANGE
 # include <linux/errno.h>
 
+/* Linux has no ENOTSUP error code.  */
+# define ENOTSUP EOPNOTSUPP
+
 # ifndef __ASSEMBLER__
 /* We now need a declaration of the `errno' variable.  */
 extern int errno;
diff --git a/sysdeps/unix/sysv/linux/bits/fcntl.h b/sysdeps/unix/sysv/linux/bits/fcntl.h
index 302fa00498..4222631129 100644
--- a/sysdeps/unix/sysv/linux/bits/fcntl.h
+++ b/sysdeps/unix/sysv/linux/bits/fcntl.h
@@ -1,5 +1,5 @@
 /* O_*, F_*, FD_* bit values for Linux.
-   Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
+   Copyright (C) 1995, 1996, 1997, 1998 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
@@ -48,7 +48,9 @@
 #define O_ASYNC		020000
 
 /* XXX missing */
-#define O_LARGEFILE	0
+#ifdef __USE_LARGEFILE64
+# define O_LARGEFILE	0
+#endif
 
 /* Values for the second argument to `fcntl'.  */
 #define F_DUPFD		0	/* Duplicate file descriptor.  */
diff --git a/sysdeps/unix/sysv/linux/bits/pthreadtypes.h b/sysdeps/unix/sysv/linux/bits/pthreadtypes.h
new file mode 100644
index 0000000000..0e26952c96
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/bits/pthreadtypes.h
@@ -0,0 +1 @@
+/* No thread support.  */
diff --git a/sysdeps/unix/sysv/linux/bits/sched.h b/sysdeps/unix/sysv/linux/bits/sched.h
index 187039b2dc..c7f6d8d902 100644
--- a/sysdeps/unix/sysv/linux/bits/sched.h
+++ b/sysdeps/unix/sysv/linux/bits/sched.h
@@ -18,6 +18,8 @@
    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
+#ifndef __need_schedparam
+
 #ifndef _SCHED_H
 # error "Never include <bits/sched.h> directly; use <sched.h> instead."
 #endif
@@ -28,12 +30,6 @@
 #define SCHED_FIFO	1
 #define SCHED_RR	2
 
-/* Data structure to describe a process' schedulability.  */
-struct sched_param
-  {
-    int sched_priority;
-  };
-
 #ifdef __USE_MISC
 /* Cloning flags.  */
 # define CSIGNAL       0x000000ff /* Signal mask to be sent at exit.  */
@@ -45,6 +41,11 @@ struct sched_param
 # define CLONE_PTRACE  0x00002000 /* Set if tracing continues on the child.  */
 #endif
 
+/* The official definition.  */
+struct sched_param
+  {
+    int sched_priority;
+  };
 
 __BEGIN_DECLS
 
@@ -56,4 +57,17 @@ extern int clone __P ((int (*__fn) (void *__arg), void *__child_stack,
 		       int __flags, void *__arg));
 #endif
 
+#endif	/* need schedparam */
+
+#if !defined __defined_schedparam \
+    && (defined __need_schedparam || defined _SCHED_H)
+# define __defined_schedparam	1
+/* Data structure to describe a process' schedulability.  */
+struct __sched_param
+  {
+    int sched_priority;
+  };
+# undef __need_schedparam
+#endif
+
 __END_DECLS
diff --git a/sysdeps/unix/sysv/linux/bits/siginfo.h b/sysdeps/unix/sysv/linux/bits/siginfo.h
index 0a346181c9..1e423636c8 100644
--- a/sysdeps/unix/sysv/linux/bits/siginfo.h
+++ b/sysdeps/unix/sysv/linux/bits/siginfo.h
@@ -32,8 +32,8 @@ typedef union sigval
     void *sival_ptr;
   } sigval_t;
 
-# define SI_MAX_SIZE     128
-# define SI_PAD_SIZE     ((SI_MAX_SIZE / sizeof (int)) - 3)
+# define __SI_MAX_SIZE     128
+# define __SI_PAD_SIZE     ((__SI_MAX_SIZE / sizeof (int)) - 3)
 
 typedef struct siginfo
   {
@@ -44,7 +44,7 @@ typedef struct siginfo
 
     union
       {
-	int _pad[SI_PAD_SIZE];
+	int _pad[__SI_PAD_SIZE];
 
 	 /* kill().  */
 	struct
@@ -237,8 +237,8 @@ enum
 # define __have_sigevent_t	1
 
 /* Structure to transport application-defined values with signals.  */
-# define SIGEV_MAX_SIZE	64
-# define SIGEV_PAD_SIZE	((SIGEV_MAX_SIZE / sizeof (int)) - 3)
+# define __SIGEV_MAX_SIZE	64
+# define __SIGEV_PAD_SIZE	((__SIGEV_MAX_SIZE / sizeof (int)) - 3)
 
 typedef struct sigevent
   {
@@ -248,7 +248,7 @@ typedef struct sigevent
 
     union
       {
-	int _pad[SIGEV_PAD_SIZE];
+	int _pad[__SIGEV_PAD_SIZE];
 
 	struct
 	  {
diff --git a/sysdeps/unix/sysv/linux/bits/types.h b/sysdeps/unix/sysv/linux/bits/types.h
index 16111beed0..916910908f 100644
--- a/sysdeps/unix/sysv/linux/bits/types.h
+++ b/sysdeps/unix/sysv/linux/bits/types.h
@@ -25,6 +25,9 @@
 
 #include <features.h>
 
+#define __need_size_t
+#include <stddef.h>
+
 /* Convenience types.  */
 typedef unsigned char __u_char;
 typedef unsigned short __u_short;
@@ -131,4 +134,8 @@ typedef __loff_t __off64_t;
 typedef int __t_scalar_t;
 typedef unsigned int __t_uscalar_t;
 
+
+/* Now add the thread types.  */
+#include <bits/pthreadtypes.h>
+
 #endif /* bits/types.h */
diff --git a/sysdeps/unix/sysv/linux/mips/bits/types.h b/sysdeps/unix/sysv/linux/mips/bits/types.h
index 1d72de0321..313e96b480 100644
--- a/sysdeps/unix/sysv/linux/mips/bits/types.h
+++ b/sysdeps/unix/sysv/linux/mips/bits/types.h
@@ -25,6 +25,9 @@
 
 #include <features.h>
 
+#define __need_size_t
+#include <stddef.h>
+
 /* Convenience types.  */
 typedef unsigned char __u_char;
 typedef unsigned short __u_short;
@@ -131,4 +134,8 @@ typedef __loff_t __off64_t;
 typedef int __t_scalar_t;
 typedef unsigned int __t_uscalar_t;
 
+
+/* Now add the thread types.  */
+#include <bits/pthreadtypes.h>
+
 #endif /* bits/types.h */
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/bits/types.h b/sysdeps/unix/sysv/linux/sparc/sparc64/bits/types.h
index 5c77f9a84d..774e7dbd30 100644
--- a/sysdeps/unix/sysv/linux/sparc/sparc64/bits/types.h
+++ b/sysdeps/unix/sysv/linux/sparc/sparc64/bits/types.h
@@ -25,6 +25,9 @@
 
 #include <features.h>
 
+#define __need_size_t
+#include <stddef.h>
+
 /* Convenience types.  */
 typedef unsigned char __u_char;
 typedef unsigned short int __u_short;
@@ -117,4 +120,8 @@ typedef __u_quad_t __fsfilcnt64_t;
 typedef int __t_scalar_t;
 typedef unsigned int __t_uscalar_t;
 
+
+/* Now add the thread types.  */
+#include <bits/pthreadtypes.h>
+
 #endif /* bits/types.h */