about summary refs log tree commit diff
path: root/misc
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2007-07-12 18:26:36 +0000
committerJakub Jelinek <jakub@redhat.com>2007-07-12 18:26:36 +0000
commit0ecb606cb6cf65de1d9fc8a919bceb4be476c602 (patch)
tree2ea1f8305970753e4a657acb2ccc15ca3eec8e2c /misc
parent7d58530341304d403a6626d7f7a1913165fe2f32 (diff)
downloadglibc-0ecb606cb6cf65de1d9fc8a919bceb4be476c602.tar.gz
glibc-0ecb606cb6cf65de1d9fc8a919bceb4be476c602.tar.xz
glibc-0ecb606cb6cf65de1d9fc8a919bceb4be476c602.zip
2.5-18.1
Diffstat (limited to 'misc')
-rw-r--r--misc/Makefile23
-rw-r--r--misc/Versions4
-rw-r--r--misc/acct.c34
-rw-r--r--misc/bits/syslog-ldbl.h36
-rw-r--r--misc/bits/syslog.h39
-rw-r--r--misc/brk.c37
-rw-r--r--misc/chflags.c43
-rw-r--r--misc/chroot.c34
-rw-r--r--misc/efgcvt.c49
-rw-r--r--misc/efgcvt_r.c40
-rw-r--r--misc/error.c207
-rw-r--r--misc/error.h10
-rw-r--r--misc/fchflags.c43
-rw-r--r--misc/fdatasync.c28
-rw-r--r--misc/fgetxattr.c31
-rw-r--r--misc/flistxattr.c30
-rw-r--r--misc/fremovexattr.c30
-rw-r--r--misc/fsetxattr.c31
-rw-r--r--misc/fsync.c33
-rw-r--r--misc/ftruncate.c36
-rw-r--r--misc/ftruncate64.c36
-rw-r--r--misc/futimes.c34
-rw-r--r--misc/futimesat.c46
-rw-r--r--misc/getclktck.c30
-rw-r--r--misc/getdomain.c64
-rw-r--r--misc/getdtsz.c33
-rw-r--r--misc/gethostid.c32
-rw-r--r--misc/gethostname.c36
-rw-r--r--misc/getloadavg.c37
-rw-r--r--misc/getpagesize.c33
-rw-r--r--misc/getpass.c20
-rw-r--r--misc/getsysstats.c69
-rw-r--r--misc/getusershell.c49
-rw-r--r--misc/getxattr.c31
-rw-r--r--misc/gtty.c40
-rw-r--r--misc/hsearch_r.c4
-rw-r--r--misc/insremque.c22
-rw-r--r--misc/ioctl.c35
-rw-r--r--misc/lgetxattr.c31
-rw-r--r--misc/listxattr.c30
-rw-r--r--misc/llistxattr.c30
-rw-r--r--misc/lremovexattr.c30
-rw-r--r--misc/lseek.c53
-rw-r--r--misc/lsetxattr.c31
-rw-r--r--misc/lutimes.c35
-rw-r--r--misc/madvise.c34
-rw-r--r--misc/mincore.c30
-rw-r--r--misc/mlock.c35
-rw-r--r--misc/mlockall.c36
-rw-r--r--misc/mmap.c41
-rw-r--r--misc/mmap64.c48
-rw-r--r--misc/mntent_r.c12
-rw-r--r--misc/mprotect.c36
-rw-r--r--misc/msync.c35
-rw-r--r--misc/munlock.c34
-rw-r--r--misc/munlockall.c34
-rw-r--r--misc/munmap.c35
-rw-r--r--misc/pselect.c70
-rw-r--r--misc/ptrace.c103
-rw-r--r--misc/qefgcvt_r.c2
-rw-r--r--misc/readv.c41
-rw-r--r--misc/reboot.c34
-rw-r--r--misc/remap_file_pages.c35
-rw-r--r--misc/removexattr.c30
-rw-r--r--misc/revoke.c31
-rw-r--r--misc/sbrk.c56
-rw-r--r--misc/select.c43
-rw-r--r--misc/setdomain.c34
-rw-r--r--misc/setegid.c32
-rw-r--r--misc/seteuid.c32
-rw-r--r--misc/sethostid.c34
-rw-r--r--misc/sethostname.c35
-rw-r--r--misc/setregid.c36
-rw-r--r--misc/setreuid.c36
-rw-r--r--misc/setxattr.c31
-rw-r--r--misc/sstk.c35
-rw-r--r--misc/stty.c40
-rw-r--r--misc/swapoff.c31
-rw-r--r--misc/swapon.c34
-rw-r--r--misc/sync.c31
-rw-r--r--misc/sys/cdefs.h51
-rw-r--r--misc/sys/mman.h18
-rw-r--r--misc/sys/queue.h420
-rw-r--r--misc/sys/syslog.h19
-rw-r--r--misc/syscall.c35
-rw-r--r--misc/syslog.c78
-rw-r--r--misc/truncate.c34
-rw-r--r--misc/truncate64.c35
-rw-r--r--misc/tsearch.c15
-rw-r--r--misc/tst-error1.c26
-rw-r--r--misc/tst-insremque.c61
-rw-r--r--misc/tst-mntent2.c41
-rw-r--r--misc/tst-pselect.c128
-rw-r--r--misc/ualarm.c37
-rw-r--r--misc/usleep.c32
-rw-r--r--misc/ustat.c33
-rw-r--r--misc/utimes.c43
-rw-r--r--misc/vhangup.c33
-rw-r--r--misc/writev.c41
99 files changed, 3860 insertions, 325 deletions
diff --git a/misc/Makefile b/misc/Makefile
index 862eb1b800..9eac1b6275 100644
--- a/misc/Makefile
+++ b/misc/Makefile
@@ -1,4 +1,4 @@
-# Copyright (C) 1991-2002, 2003, 2004 Free Software Foundation, Inc.
+# Copyright (C) 1991-2002,2003,2004,2005,2006 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
@@ -25,11 +25,13 @@ subdir	:= misc
 headers	:= sys/uio.h bits/uio.h sys/ioctl.h bits/ioctls.h bits/ioctl-types.h \
 	   sys/ptrace.h sys/file.h sys/dir.h sys/cdefs.h \
 	   ar.h a.out.h libgen.h stab.h bits/stab.def sgtty.h \
-	   ttyent.h syslog.h sys/syslog.h paths.h sys/reboot.h \
+	   ttyent.h paths.h sys/reboot.h \
 	   sys/mman.h sys/param.h fstab.h mntent.h search.h err.h error.h \
 	   sys/queue.h sysexits.h syscall.h sys/syscall.h sys/swap.h \
 	   sys/select.h ustat.h sys/ustat.h bits/ustat.h sys/sysinfo.h \
-	   regexp.h bits/select.h bits/mman.h sys/xattr.h
+	   regexp.h bits/select.h bits/mman.h sys/xattr.h \
+	   syslog.h sys/syslog.h \
+	   bits/syslog.h bits/syslog-ldbl.h bits/syslog-path.h
 
 routines := brk sbrk sstk ioctl \
 	    readv writev \
@@ -47,7 +49,7 @@ routines := brk sbrk sstk ioctl \
 	    gtty stty \
 	    ptrace \
 	    fstab mntent mntent_r \
-	    utimes lutimes futimes \
+	    utimes lutimes futimes futimesat \
 	    truncate ftruncate truncate64 ftruncate64 \
 	    chflags fchflags \
 	    insremque getttyent getusershell getpass ttyslot \
@@ -65,6 +67,8 @@ routines := brk sbrk sstk ioctl \
 
 distribute := device-nrs.h
 
+generated := tst-error1.mtrace tst-error1-mem
+
 include ../Makeconfig
 
 aux := init-misc
@@ -73,7 +77,11 @@ install-lib := libbsd-compat.a libg.a
 endif
 gpl2lgpl := error.c error.h
 
-tests := tst-dirname tst-tsearch tst-fdset tst-efgcvt tst-mntent tst-hsearch
+tests := tst-dirname tst-tsearch tst-fdset tst-efgcvt tst-mntent tst-hsearch \
+	 tst-error1 tst-pselect tst-insremque tst-mntent2
+ifeq (no,$(cross-compiling))
+tests: $(objpfx)tst-error1-mem
+endif
 
 CFLAGS-tsearch.c = $(uses-callbacks)
 CFLAGS-lsearch.c = $(uses-callbacks)
@@ -106,3 +114,8 @@ endif
 ifeq ($(build-bounded),yes)
 $(objpfx)tst-tsearch-bp: $(common-objpfx)math/libm_b.a
 endif
+
+tst-error1-ENV = MALLOC_TRACE=$(objpfx)tst-error1.mtrace
+tst-error1-ARGS = $(objpfx)tst-error1.out
+$(objpfx)tst-error1-mem: $(objpfx)tst-error1.out
+	$(common-objpfx)malloc/mtrace $(objpfx)tst-error1.mtrace > $@
diff --git a/misc/Versions b/misc/Versions
index 13b38eec72..fdf2d9d2af 100644
--- a/misc/Versions
+++ b/misc/Versions
@@ -130,4 +130,8 @@ libc {
   GLIBC_2.3.3 {
     remap_file_pages;
   }
+  GLIBC_2.4 {
+    futimesat;
+    __syslog_chk; __vsyslog_chk;
+  }
 }
diff --git a/misc/acct.c b/misc/acct.c
new file mode 100644
index 0000000000..b626b5d938
--- /dev/null
+++ b/misc/acct.c
@@ -0,0 +1,34 @@
+/* Copyright (C) 1991, 1995, 1996, 1997 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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <errno.h>
+#include <unistd.h>
+
+/* Turn accounting on if NAME is an existing file.  The system will then write
+   a record for each process as it terminates, to this file.  If NAME is NULL,
+   turn accounting off.  This call is restricted to the super-user.  */
+int
+acct (name)
+     const char *name;
+{
+  __set_errno (ENOSYS);
+  return -1;
+}
+
+stub_warning (acct)
+#include <stub-tag.h>
diff --git a/misc/bits/syslog-ldbl.h b/misc/bits/syslog-ldbl.h
new file mode 100644
index 0000000000..d153c8f8cd
--- /dev/null
+++ b/misc/bits/syslog-ldbl.h
@@ -0,0 +1,36 @@
+/* -mlong-double-64 compatibility mode for syslog functions.
+   Copyright (C) 2006 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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#ifndef _SYS_SYSLOG_H
+# error "Never include <bits/syslog-ldbl.h> directly; use <sys/syslog.h> instead."
+#endif
+
+__LDBL_REDIR_DECL (syslog)
+
+#ifdef __USE_BSD
+__LDBL_REDIR_DECL (vsyslog)
+#endif
+
+#if __USE_FORTIFY_LEVEL > 0 && !defined __cplusplus
+__LDBL_REDIR_DECL (__syslog_chk)
+
+# ifdef __USE_BSD
+__LDBL_REDIR_DECL (__vsyslog_chk)
+# endif
+#endif
diff --git a/misc/bits/syslog.h b/misc/bits/syslog.h
new file mode 100644
index 0000000000..c0427214e3
--- /dev/null
+++ b/misc/bits/syslog.h
@@ -0,0 +1,39 @@
+/* Checking macros for syslog functions.
+   Copyright (C) 2005 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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#ifndef _SYS_SYSLOG_H
+# error "Never include <bits/syslog.h> directly; use <sys/syslog.h> instead."
+#endif
+
+
+extern void __syslog_chk (int __pri, int __flag, __const char *__fmt, ...)
+     __attribute__ ((__format__ (__printf__, 3, 4)));
+
+#define syslog(pri, ...) \
+  __syslog_chk (pri, __USE_FORTIFY_LEVEL - 1, __VA_ARGS__)
+
+
+#ifdef __USE_BSD
+extern void __vsyslog_chk (int __pri, int __flag, __const char *__fmt,
+			   __gnuc_va_list __ap)
+     __attribute__ ((__format__ (__printf__, 3, 0)));
+
+# define vsyslog(pri, fmt, ap)						\
+  __vsyslog_chk (pri, __USE_FORTIFY_LEVEL - 1, fmt, ap)
+#endif
diff --git a/misc/brk.c b/misc/brk.c
new file mode 100644
index 0000000000..b951819f21
--- /dev/null
+++ b/misc/brk.c
@@ -0,0 +1,37 @@
+/* Copyright (C) 1991, 1995, 1996, 1997, 2002 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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <errno.h>
+#include <unistd.h>
+
+/* sbrk.c expects this.  */
+void *__curbrk;
+
+/* Set the end of the process's data space to ADDR.
+   Return 0 if successful, -1 if not.  */
+int
+__brk (addr)
+     void *addr;
+{
+  __set_errno (ENOSYS);
+  return -1;
+}
+stub_warning (brk)
+
+weak_alias (__brk, brk)
+#include <stub-tag.h>
diff --git a/misc/chflags.c b/misc/chflags.c
new file mode 100644
index 0000000000..b678121265
--- /dev/null
+++ b/misc/chflags.c
@@ -0,0 +1,43 @@
+/* Copyright (C) 1991, 1995, 1996, 1997, 2004 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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <errno.h>
+#include <stddef.h>
+#include <sys/stat.h>
+
+/* Change the flags of FILE to FLAGS.  */
+
+int chflags (const char *file, int flags) __THROW;
+
+int
+chflags (file, flags)
+     const char *file;
+     int flags;
+{
+  if (file == NULL)
+    {
+      __set_errno (EINVAL);
+      return -1;
+    }
+
+  __set_errno (ENOSYS);
+  return -1;
+}
+
+stub_warning (chflags)
+#include <stub-tag.h>
diff --git a/misc/chroot.c b/misc/chroot.c
new file mode 100644
index 0000000000..f20ccf4c2b
--- /dev/null
+++ b/misc/chroot.c
@@ -0,0 +1,34 @@
+/* Copyright (C) 1991, 1995, 1996, 1997 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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <errno.h>
+#include <unistd.h>
+
+/* Make PATH be the root directory (the starting point for absolute paths).
+   This call is restricted to the super-user.  */
+int
+chroot (path)
+     const char *path;
+{
+  __set_errno (ENOSYS);
+  return -1;
+}
+
+
+stub_warning (chroot)
+#include <stub-tag.h>
diff --git a/misc/efgcvt.c b/misc/efgcvt.c
index 915d00dfd5..b9fb4a9b71 100644
--- a/misc/efgcvt.c
+++ b/misc/efgcvt.c
@@ -1,5 +1,6 @@
 /* Compatibility functions for floating point formatting.
-   Copyright (C) 1995, 1996, 1997, 1999, 2002 Free Software Foundation, Inc.
+   Copyright (C) 1995, 1996, 1997, 1999, 2002, 2006
+   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
@@ -23,6 +24,7 @@
 #include <sys/param.h>
 #include <float.h>
 #include <bits/libc-lock.h>
+#include <math_ldbl_opt.h>
 
 #ifndef FLOAT_TYPE
 # define FLOAT_TYPE double
@@ -44,10 +46,14 @@
 #  error "NDIGIT_MAX must be precomputed"
 #  define NDIGIT_MAX (lrint (ceil (M_LN2 / M_LN10 * DBL_MANT_DIG + 1.0)))
 # endif
+#else
+# define LONG_DOUBLE_CVT
 #endif
 
 #define APPEND(a, b) APPEND2 (a, b)
 #define APPEND2(a, b) a##b
+#define __APPEND(a, b) __APPEND2 (a, b)
+#define __APPEND2(a, b) __##a##b
 
 
 #define FCVT_BUFFER APPEND (FUNC_PREFIX, fcvt_buffer)
@@ -60,14 +66,14 @@ static char ECVT_BUFFER[MAXDIG];
 libc_freeres_ptr (static char *FCVT_BUFPTR);
 
 char *
-APPEND (FUNC_PREFIX, fcvt) (value, ndigit, decpt, sign)
+__APPEND (FUNC_PREFIX, fcvt) (value, ndigit, decpt, sign)
      FLOAT_TYPE value;
      int ndigit, *decpt, *sign;
 {
   if (FCVT_BUFPTR == NULL)
     {
-      if (APPEND (FUNC_PREFIX, fcvt_r) (value, ndigit, decpt, sign,
-					FCVT_BUFFER, MAXDIG) != -1)
+      if (__APPEND (FUNC_PREFIX, fcvt_r) (value, ndigit, decpt, sign,
+					  FCVT_BUFFER, MAXDIG) != -1)
 	return FCVT_BUFFER;
 
       FCVT_BUFPTR = (char *) malloc (FCVT_MAXDIG);
@@ -75,26 +81,26 @@ APPEND (FUNC_PREFIX, fcvt) (value, ndigit, decpt, sign)
 	return FCVT_BUFFER;
     }
 
-  (void) APPEND (FUNC_PREFIX, fcvt_r) (value, ndigit, decpt, sign,
-				       FCVT_BUFPTR, FCVT_MAXDIG);
+  (void) __APPEND (FUNC_PREFIX, fcvt_r) (value, ndigit, decpt, sign,
+					 FCVT_BUFPTR, FCVT_MAXDIG);
 
   return FCVT_BUFPTR;
 }
 
 
 char *
-APPEND (FUNC_PREFIX, ecvt) (value, ndigit, decpt, sign)
+__APPEND (FUNC_PREFIX, ecvt) (value, ndigit, decpt, sign)
      FLOAT_TYPE value;
      int ndigit, *decpt, *sign;
 {
-  (void) APPEND (FUNC_PREFIX, ecvt_r) (value, ndigit, decpt, sign,
-				       ECVT_BUFFER, MAXDIG);
+  (void) __APPEND (FUNC_PREFIX, ecvt_r) (value, ndigit, decpt, sign,
+					 ECVT_BUFFER, MAXDIG);
 
   return ECVT_BUFFER;
 }
 
 char *
-APPEND (FUNC_PREFIX, gcvt) (value, ndigit, buf)
+__APPEND (FUNC_PREFIX, gcvt) (value, ndigit, buf)
      FLOAT_TYPE value;
      int ndigit;
      char *buf;
@@ -102,3 +108,26 @@ APPEND (FUNC_PREFIX, gcvt) (value, ndigit, buf)
   sprintf (buf, "%.*" FLOAT_FMT_FLAG "g", MIN (ndigit, NDIGIT_MAX), value);
   return buf;
 }
+
+#if LONG_DOUBLE_COMPAT (libc, GLIBC_2_0)
+# ifdef LONG_DOUBLE_CVT
+#  define cvt_symbol(symbol) \
+  cvt_symbol_1 (libc, __APPEND (FUNC_PREFIX, symbol), \
+	      APPEND (FUNC_PREFIX, symbol), GLIBC_2_4)
+#  define cvt_symbol_1(lib, local, symbol, version) \
+    versioned_symbol (lib, local, symbol, version)
+# else
+#  define cvt_symbol(symbol) \
+  cvt_symbol_1 (libc, __APPEND (FUNC_PREFIX, symbol), \
+	      APPEND (q, symbol), GLIBC_2_0); \
+  strong_alias (__APPEND (FUNC_PREFIX, symbol), APPEND (FUNC_PREFIX, symbol))
+#  define cvt_symbol_1(lib, local, symbol, version) \
+  compat_symbol (lib, local, symbol, version)
+# endif
+#else
+# define cvt_symbol(symbol) \
+  strong_alias (__APPEND (FUNC_PREFIX, symbol), APPEND (FUNC_PREFIX, symbol))
+#endif
+cvt_symbol(fcvt);
+cvt_symbol(ecvt);
+cvt_symbol(gcvt);
diff --git a/misc/efgcvt_r.c b/misc/efgcvt_r.c
index 69cca9038f..ba9566d22c 100644
--- a/misc/efgcvt_r.c
+++ b/misc/efgcvt_r.c
@@ -1,5 +1,6 @@
 /* Compatibility functions for floating point formatting, reentrant versions.
-   Copyright (C) 1995,96,97,98,99,2000,01,02,04 Free Software Foundation, Inc.
+   Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2004, 2006
+   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
@@ -25,6 +26,7 @@
 #include <math.h>
 #include <stdlib.h>
 #include <sys/param.h>
+#include <math_ldbl_opt.h>
 
 #ifndef FLOAT_TYPE
 # define FLOAT_TYPE double
@@ -55,10 +57,14 @@
 #  error "FLOAT_MIN_10_NORM must be precomputed"
 #  define FLOAT_MIN_10_NORM	exp10 (DBL_MIN_10_EXP)
 # endif
+#else
+# define LONG_DOUBLE_CVT
 #endif
 
 #define APPEND(a, b) APPEND2 (a, b)
 #define APPEND2(a, b) a##b
+#define __APPEND(a, b) __APPEND2 (a, b)
+#define __APPEND2(a, b) __##a##b
 
 #define FLOOR APPEND(floor, FLOAT_NAME_EXT)
 #define FABS APPEND(fabs, FLOAT_NAME_EXT)
@@ -67,7 +73,7 @@
 
 
 int
-APPEND (FUNC_PREFIX, fcvt_r) (value, ndigit, decpt, sign, buf, len)
+__APPEND (FUNC_PREFIX, fcvt_r) (value, ndigit, decpt, sign, buf, len)
      FLOAT_TYPE value;
      int ndigit, *decpt, *sign;
      char *buf;
@@ -163,10 +169,9 @@ APPEND (FUNC_PREFIX, fcvt_r) (value, ndigit, decpt, sign, buf, len)
 
   return 0;
 }
-libc_hidden_def (APPEND (FUNC_PREFIX, fcvt_r))
 
 int
-APPEND (FUNC_PREFIX, ecvt_r) (value, ndigit, decpt, sign, buf, len)
+__APPEND (FUNC_PREFIX, ecvt_r) (value, ndigit, decpt, sign, buf, len)
      FLOAT_TYPE value;
      int ndigit, *decpt, *sign;
      char *buf;
@@ -229,11 +234,32 @@ APPEND (FUNC_PREFIX, ecvt_r) (value, ndigit, decpt, sign, buf, len)
       *sign = isfinite (value) ? signbit (value) != 0 : 0;
     }
   else
-    if (APPEND (FUNC_PREFIX, fcvt_r) (value, MIN (ndigit, NDIGIT_MAX) - 1,
-				      decpt, sign, buf, len))
+    if (__APPEND (FUNC_PREFIX, fcvt_r) (value, MIN (ndigit, NDIGIT_MAX) - 1,
+					decpt, sign, buf, len))
       return -1;
 
   *decpt += exponent;
   return 0;
 }
-libc_hidden_def (APPEND (FUNC_PREFIX, ecvt_r))
+
+#if LONG_DOUBLE_COMPAT (libc, GLIBC_2_0)
+# ifdef LONG_DOUBLE_CVT
+#  define cvt_symbol(symbol) \
+  cvt_symbol_1 (libc, __APPEND (FUNC_PREFIX, symbol), \
+	      APPEND (FUNC_PREFIX, symbol), GLIBC_2_4)
+#  define cvt_symbol_1(lib, local, symbol, version) \
+    versioned_symbol (lib, local, symbol, version)
+# else
+#  define cvt_symbol(symbol) \
+  cvt_symbol_1 (libc, __APPEND (FUNC_PREFIX, symbol), \
+	      APPEND (q, symbol), GLIBC_2_0); \
+  strong_alias (__APPEND (FUNC_PREFIX, symbol), APPEND (FUNC_PREFIX, symbol))
+#  define cvt_symbol_1(lib, local, symbol, version) \
+  compat_symbol (lib, local, symbol, version)
+# endif
+#else
+# define cvt_symbol(symbol) \
+  strong_alias (__APPEND (FUNC_PREFIX, symbol), APPEND (FUNC_PREFIX, symbol))
+#endif
+cvt_symbol(fcvt_r);
+cvt_symbol(ecvt_r);
diff --git a/misc/error.c b/misc/error.c
index 2501583366..85d1cffbf9 100644
--- a/misc/error.c
+++ b/misc/error.c
@@ -1,7 +1,6 @@
 /* Error handler for noninteractive utilities
-   Copyright (C) 1990-1998, 2000-2003, 2004 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.  Its master source is NOT part of
-   the C library, however.  The master source lives in /gd/gnu/lib.
+   Copyright (C) 1990-1998, 2000-2005, 2006 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
@@ -24,33 +23,19 @@
 # include <config.h>
 #endif
 
+#include <stdarg.h>
 #include <stdio.h>
-#include <libintl.h>
+#include <stdlib.h>
+#include <string.h>
+
 #ifdef _LIBC
+# include <libintl.h>
+# include <stdbool.h>
+# include <stdint.h>
 # include <wchar.h>
 # define mbsrtowcs __mbsrtowcs
 #endif
 
-#if HAVE_VPRINTF || HAVE_DOPRNT || _LIBC
-# if __STDC__
-#  include <stdarg.h>
-#  define VA_START(args, lastarg) va_start(args, lastarg)
-# else
-#  include <varargs.h>
-#  define VA_START(args, lastarg) va_start(args)
-# endif
-#else
-# define va_alist a1, a2, a3, a4, a5, a6, a7, a8
-# define va_dcl char *a1, *a2, *a3, *a4, *a5, *a6, *a7, *a8;
-#endif
-
-#if STDC_HEADERS || _LIBC
-# include <stdlib.h>
-# include <string.h>
-#else
-void exit ();
-#endif
-
 #include "error.h"
 
 #ifndef _
@@ -60,11 +45,7 @@ void exit ();
 /* If NULL, error will flush stdout, then print on stderr the program
    name, a colon and a space.  Otherwise, error will call this
    function without parameters instead.  */
-void (*error_print_progname) (
-#if __STDC__ - 0
-			      void
-#endif
-			      );
+void (*error_print_progname) (void);
 
 /* This variable is incremented each time `error' is called.  */
 unsigned int error_message_count;
@@ -74,6 +55,7 @@ unsigned int error_message_count;
 
 # define program_name program_invocation_name
 # include <errno.h>
+# include <limits.h>
 # include <libio/libioP.h>
 
 /* In GNU libc we want do not want to use the common name `error' directly.
@@ -109,27 +91,6 @@ extern char *program_name;
 
 # if HAVE_STRERROR_R || defined strerror_r
 #  define __strerror_r strerror_r
-# else
-#  if HAVE_STRERROR
-#   ifndef HAVE_DECL_STRERROR
-"this configure-time declaration test was not run"
-#   endif
-#   if !HAVE_DECL_STRERROR
-char *strerror ();
-#   endif
-#  else
-static char *
-private_strerror (int errnum)
-{
-  extern char *sys_errlist[];
-  extern int sys_nerr;
-
-  if (errnum > 0 && errnum <= sys_nerr)
-    return _(sys_errlist[errnum]);
-  return _("Unknown system error");
-}
-#   define strerror private_strerror
-#  endif /* HAVE_STRERROR */
 # endif	/* HAVE_STRERROR_R || defined strerror_r */
 #endif	/* not _LIBC */
 
@@ -158,38 +119,33 @@ print_errno_message (int errnum)
 #endif
 
 #if _LIBC
-  if (_IO_fwide (stderr, 0) > 0)
-    {
-      __fwprintf (stderr, L": %s", s);
-      return;
-    }
-#endif
-
+  __fxprintf (NULL, ": %s", s);
+#else
   fprintf (stderr, ": %s", s);
+#endif
 }
 
-#ifdef VA_START
 static void
 error_tail (int status, int errnum, const char *message, va_list args)
 {
-# if HAVE_VPRINTF || _LIBC
-#  if _LIBC
+#if _LIBC
   if (_IO_fwide (stderr, 0) > 0)
     {
-#   define ALLOCA_LIMIT	2000
+# define ALLOCA_LIMIT 2000
       size_t len = strlen (message) + 1;
       wchar_t *wmessage = NULL;
       mbstate_t st;
       size_t res;
       const char *tmp;
+      bool use_malloc = false;
 
-      do
+      while (1)
 	{
-	  if (len < ALLOCA_LIMIT)
+	  if (__libc_use_alloca (len * sizeof (wchar_t)))
 	    wmessage = (wchar_t *) alloca (len * sizeof (wchar_t));
 	  else
 	    {
-	      if (wmessage != NULL && len / 2 < ALLOCA_LIMIT)
+	      if (!use_malloc)
 		wmessage = NULL;
 
 	      wchar_t *p = (wchar_t *) realloc (wmessage,
@@ -201,62 +157,69 @@ error_tail (int status, int errnum, const char *message, va_list args)
 		  return;
 		}
 	      wmessage = p;
+	      use_malloc = true;
 	    }
 
 	  memset (&st, '\0', sizeof (st));
 	  tmp = message;
+
+	  res = mbsrtowcs (wmessage, &tmp, len, &st);
+	  if (res != len)
+	    break;
+
+	  if (__builtin_expect (len >= SIZE_MAX / 2, 0))
+	    {
+	      /* This really should not happen if everything is fine.  */
+	      res = (size_t) -1;
+	      break;
+	    }
+
+	  len *= 2;
 	}
-      while ((res = mbsrtowcs (wmessage, &tmp, len, &st)) == len);
 
       if (res == (size_t) -1)
-	/* The string cannot be converted.  */
-	wmessage = (wchar_t *) L"???";
+	{
+	  /* The string cannot be converted.  */
+	  if (use_malloc)
+	    {
+	      free (wmessage);
+	      use_malloc = false;
+	    }
+	  wmessage = (wchar_t *) L"???";
+	}
 
       __vfwprintf (stderr, wmessage, args);
+
+      if (use_malloc)
+	free (wmessage);
     }
   else
-#  endif
+#endif
     vfprintf (stderr, message, args);
-# else
-  _doprnt (message, args, stderr);
-# endif
   va_end (args);
 
   ++error_message_count;
   if (errnum)
     print_errno_message (errnum);
-# if _LIBC
-  if (_IO_fwide (stderr, 0) > 0)
-    putwc (L'\n', stderr);
-  else
-# endif
-    putc ('\n', stderr);
+#if _LIBC
+  __fxprintf (NULL, "\n");
+#else
+  putc ('\n', stderr);
+#endif
   fflush (stderr);
   if (status)
     exit (status);
 }
-#endif
 
 
 /* Print the program name and error message MESSAGE, which is a printf-style
    format string with optional args.
    If ERRNUM is nonzero, print its corresponding system error message.
    Exit with status STATUS if it is nonzero.  */
-/* VARARGS */
 void
-#if defined VA_START && __STDC__
 error (int status, int errnum, const char *message, ...)
-#else
-error (status, errnum, message, va_alist)
-     int status;
-     int errnum;
-     char *message;
-     va_dcl
-#endif
 {
-#ifdef VA_START
   va_list args;
-#endif
 
 #if defined _LIBC && defined __libc_ptf_call
   /* We do not want this call to be cut short by a thread
@@ -275,27 +238,14 @@ error (status, errnum, message, va_alist)
   else
     {
 #if _LIBC
-      if (_IO_fwide (stderr, 0) > 0)
-	__fwprintf (stderr, L"%s: ", program_name);
-      else
+      __fxprintf (NULL, "%s: ", program_name);
+#else
+      fprintf (stderr, "%s: ", program_name);
 #endif
-	fprintf (stderr, "%s: ", program_name);
     }
 
-#ifdef VA_START
-  VA_START (args, message);
+  va_start (args, message);
   error_tail (status, errnum, message, args);
-#else
-  fprintf (stderr, message, a1, a2, a3, a4, a5, a6, a7, a8);
-
-  ++error_message_count;
-  if (errnum)
-    print_errno_message (errnum);
-  putc ('\n', stderr);
-  fflush (stderr);
-  if (status)
-    exit (status);
-#endif
 
 #ifdef _LIBC
   _IO_funlockfile (stderr);
@@ -310,22 +260,10 @@ error (status, errnum, message, va_alist)
 int error_one_per_line;
 
 void
-#if defined VA_START && __STDC__
 error_at_line (int status, int errnum, const char *file_name,
 	       unsigned int line_number, const char *message, ...)
-#else
-error_at_line (status, errnum, file_name, line_number, message, va_alist)
-     int status;
-     int errnum;
-     const char *file_name;
-     unsigned int line_number;
-     char *message;
-     va_dcl
-#endif
 {
-#ifdef VA_START
   va_list args;
-#endif
 
   if (error_one_per_line)
     {
@@ -359,37 +297,22 @@ error_at_line (status, errnum, file_name, line_number, message, va_alist)
   else
     {
 #if _LIBC
-      if (_IO_fwide (stderr, 0) > 0)
-	__fwprintf (stderr, L"%s: ", program_name);
-      else
+      __fxprintf (NULL, "%s:", program_name);
+#else
+      fprintf (stderr, "%s:", program_name);
 #endif
-	fprintf (stderr, "%s:", program_name);
     }
 
-  if (file_name != NULL)
-    {
 #if _LIBC
-      if (_IO_fwide (stderr, 0) > 0)
-	__fwprintf (stderr, L"%s:%d: ", file_name, line_number);
-      else
+  __fxprintf (NULL, file_name != NULL ? "%s:%d: " : " ",
+	      file_name, line_number);
+#else
+  fprintf (stderr, file_name != NULL ? "%s:%d: " : " ",
+	   file_name, line_number);
 #endif
-	fprintf (stderr, "%s:%d: ", file_name, line_number);
-    }
 
-#ifdef VA_START
-  VA_START (args, message);
+  va_start (args, message);
   error_tail (status, errnum, message, args);
-#else
-  fprintf (stderr, message, a1, a2, a3, a4, a5, a6, a7, a8);
-
-  ++error_message_count;
-  if (errnum)
-    print_errno_message (errnum);
-  putc ('\n', stderr);
-  fflush (stderr);
-  if (status)
-    exit (status);
-#endif
 
 #ifdef _LIBC
   _IO_funlockfile (stderr);
diff --git a/misc/error.h b/misc/error.h
index 3638bc6e98..f25005b0e8 100644
--- a/misc/error.h
+++ b/misc/error.h
@@ -1,5 +1,5 @@
 /* Declaration for error-reporting function
-   Copyright (C) 1995, 1996, 1997, 2003 Free Software Foundation, Inc.
+   Copyright (C) 1995, 1996, 1997, 2003, 2006 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
@@ -37,8 +37,6 @@
 extern "C" {
 #endif
 
-#if defined __STDC__ && __STDC__
-
 /* Print a message with `fprintf (stderr, FORMAT, ...)';
    if ERRNUM is nonzero, follow it with ": " and strerror (ERRNUM).
    If STATUS is nonzero, terminate the program with `exit (STATUS)'.  */
@@ -55,12 +53,6 @@ extern void error_at_line (int __status, int __errnum, const char *__fname,
    function without parameters instead.  */
 extern void (*error_print_progname) (void);
 
-#else
-void error ();
-void error_at_line ();
-extern void (*error_print_progname) ();
-#endif
-
 /* This variable is incremented each time `error' is called.  */
 extern unsigned int error_message_count;
 
diff --git a/misc/fchflags.c b/misc/fchflags.c
new file mode 100644
index 0000000000..f191194c12
--- /dev/null
+++ b/misc/fchflags.c
@@ -0,0 +1,43 @@
+/* Copyright (C) 1991, 1995, 1996, 1997, 2004 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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <errno.h>
+#include <stddef.h>
+#include <sys/stat.h>
+
+/* Change the flags of the file FD refers to to FLAGS.  */
+
+int fchflags (int fd, int flags) __THROW;
+
+int
+fchflags (fd, flags)
+     int fd;
+     int flags;
+{
+  if (fd < 0)
+    {
+      __set_errno (EINVAL);
+      return -1;
+    }
+
+  __set_errno (ENOSYS);
+  return -1;
+}
+
+stub_warning (fchflags)
+#include <stub-tag.h>
diff --git a/misc/fdatasync.c b/misc/fdatasync.c
new file mode 100644
index 0000000000..3edeef0c9e
--- /dev/null
+++ b/misc/fdatasync.c
@@ -0,0 +1,28 @@
+/* Copyright (C) 1996, 1997 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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <unistd.h>
+
+
+/* Synchronize at least the data part of a file with the underlying
+   media.  */
+int
+fdatasync (int fildes)
+{
+  return fsync (fildes);
+}
diff --git a/misc/fgetxattr.c b/misc/fgetxattr.c
new file mode 100644
index 0000000000..610ed32d1f
--- /dev/null
+++ b/misc/fgetxattr.c
@@ -0,0 +1,31 @@
+/* Copyright (C) 2002 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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <errno.h>
+#include <sys/xattr.h>
+
+ssize_t
+fgetxattr (int __fd, const char *__name,
+	   void *__value, size_t __size)
+{
+  __set_errno (ENOSYS);
+  return -1;
+}
+
+stub_warning (fgetxattr)
+#include <stub-tag.h>
diff --git a/misc/flistxattr.c b/misc/flistxattr.c
new file mode 100644
index 0000000000..fc2863d31c
--- /dev/null
+++ b/misc/flistxattr.c
@@ -0,0 +1,30 @@
+/* Copyright (C) 2002 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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <errno.h>
+#include <sys/xattr.h>
+
+ssize_t
+flistxattr (int __fd, char *__list, size_t __size)
+{
+  __set_errno (ENOSYS);
+  return -1;
+}
+
+stub_warning (flistxattr)
+#include <stub-tag.h>
diff --git a/misc/fremovexattr.c b/misc/fremovexattr.c
new file mode 100644
index 0000000000..9719d42d40
--- /dev/null
+++ b/misc/fremovexattr.c
@@ -0,0 +1,30 @@
+/* Copyright (C) 2002 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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <errno.h>
+#include <sys/xattr.h>
+
+int
+fremovexattr (int __fd, const char *__name)
+{
+  __set_errno (ENOSYS);
+  return -1;
+}
+
+stub_warning (fremovexattr)
+#include <stub-tag.h>
diff --git a/misc/fsetxattr.c b/misc/fsetxattr.c
new file mode 100644
index 0000000000..8a52e72529
--- /dev/null
+++ b/misc/fsetxattr.c
@@ -0,0 +1,31 @@
+/* Copyright (C) 2002 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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <errno.h>
+#include <sys/xattr.h>
+
+int
+fsetxattr (int __fd, const char *__name, const void *__value,
+	   size_t __size, int __flags)
+{
+  __set_errno (ENOSYS);
+  return -1;
+}
+
+stub_warning (fsetxattr)
+#include <stub-tag.h>
diff --git a/misc/fsync.c b/misc/fsync.c
new file mode 100644
index 0000000000..e2a4d700d5
--- /dev/null
+++ b/misc/fsync.c
@@ -0,0 +1,33 @@
+/* Copyright (C) 1991, 1995, 1996, 1997 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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <errno.h>
+#include <unistd.h>
+
+/* Make all changes done to FD actually appear on disk.  */
+int
+fsync (fd)
+     int fd;
+{
+  __set_errno (ENOSYS);
+  return -1;
+}
+
+
+stub_warning (fsync)
+#include <stub-tag.h>
diff --git a/misc/ftruncate.c b/misc/ftruncate.c
new file mode 100644
index 0000000000..d4cca2e267
--- /dev/null
+++ b/misc/ftruncate.c
@@ -0,0 +1,36 @@
+/* Copyright (C) 1991, 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
+   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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <errno.h>
+#include <sys/types.h>
+#include <unistd.h>
+
+/* Truncate the file FD refers to to LENGTH bytes.  */
+int
+__ftruncate (fd, length)
+     int fd;
+     off_t length;
+{
+  __set_errno (ENOSYS);
+  return -1;
+}
+
+weak_alias (__ftruncate, ftruncate)
+     
+stub_warning (ftruncate)
+#include <stub-tag.h>
diff --git a/misc/ftruncate64.c b/misc/ftruncate64.c
new file mode 100644
index 0000000000..df84b7c3c1
--- /dev/null
+++ b/misc/ftruncate64.c
@@ -0,0 +1,36 @@
+/* Copyright (C) 1997, 1998, 2001 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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <sys/types.h>
+#include <errno.h>
+#include <unistd.h>
+
+/* Truncate the file FD refers to to LENGTH bytes.  */
+int
+__ftruncate64 (fd, length)
+     int fd;
+     off64_t length;
+{
+  if ((off_t) length != length)
+    {
+      __set_errno (EINVAL);
+      return -1;
+    }
+  return __ftruncate (fd, (off_t) length);
+}
+weak_alias (__ftruncate64, ftruncate64)
diff --git a/misc/futimes.c b/misc/futimes.c
new file mode 100644
index 0000000000..3378dbf416
--- /dev/null
+++ b/misc/futimes.c
@@ -0,0 +1,34 @@
+/* futimes -- change access and modification times of open file.  Stub version.
+   Copyright (C) 2002 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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <sys/time.h>
+#include <errno.h>
+
+/* Change the access time of FILE to TVP[0] and
+   the modification time of FILE to TVP[1], but do not follow symlinks.  */
+int
+__futimes (int fd, const struct timeval tvp[2])
+{
+  __set_errno (ENOSYS);
+  return -1;
+}
+weak_alias (__futimes, futimes)
+
+stub_warning (futimes)
+#include <stub-tag.h>
diff --git a/misc/futimesat.c b/misc/futimesat.c
new file mode 100644
index 0000000000..bf16ce8de0
--- /dev/null
+++ b/misc/futimesat.c
@@ -0,0 +1,46 @@
+/* Copyright (C) 2005 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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <errno.h>
+#include <fcntl.h>
+#include <stddef.h>
+#include <sys/time.h>
+
+
+/* Change the access time of FILE relative to FD to TVP[0] and
+   the modification time of FILE to TVP[1].  */
+int
+futimesat (fd, file, tvp)
+     int fd;
+     const char *file;
+     const struct timeval tvp[2];
+{
+  if (fd < 0
+      && (file == NULL
+          || (fd != AT_FDCWD && file[0] != '/')))
+    {
+      __set_errno (EBADF);
+      return -1;
+    }
+
+  __set_errno (ENOSYS);
+  return -1;
+}
+
+stub_warning (futimesat)
+#include <stub-tag.h>
diff --git a/misc/getclktck.c b/misc/getclktck.c
new file mode 100644
index 0000000000..897c6a25ba
--- /dev/null
+++ b/misc/getclktck.c
@@ -0,0 +1,30 @@
+/* Copyright (C) 2000 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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <time.h>
+
+/* Return frequency of times().  */
+int
+__getclktck ()
+{
+#ifdef	CLK_TCK
+  return CLK_TCK;
+#else
+  return 60;
+#endif
+}
diff --git a/misc/getdomain.c b/misc/getdomain.c
new file mode 100644
index 0000000000..6074ccfb79
--- /dev/null
+++ b/misc/getdomain.c
@@ -0,0 +1,64 @@
+/* Copyright (C) 1994,95,97,2000,02 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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+/* Put the name of the current YP domain in no more than LEN bytes of NAME.
+   The result is null-terminated if LEN is large enough for the full
+   name and the terminator.  */
+
+#include <errno.h>
+#include <unistd.h>
+#include <sys/param.h>
+#include <sys/utsname.h>
+#include <string.h>
+
+#if _UTSNAME_DOMAIN_LENGTH
+/* The `uname' information includes the domain name.  */
+
+int
+getdomainname (name, len)
+    char *name;
+    size_t len;
+{
+  struct utsname u;
+  size_t u_len;
+
+  if (uname (&u) < 0)
+    return -1;
+
+  u_len = strlen (u.domainname);
+  memcpy (name, u.domainname, MIN (u_len + 1, len));
+  return 0;
+}
+
+#else
+
+int
+getdomainname (name, len)
+     char *name;
+     size_t len;
+{
+  __set_errno (ENOSYS);
+  return -1;
+}
+
+stub_warning (getdomainname)
+#include <stub-tag.h>
+
+#endif
+
+libc_hidden_def (getdomainname)
diff --git a/misc/getdtsz.c b/misc/getdtsz.c
new file mode 100644
index 0000000000..38b7577914
--- /dev/null
+++ b/misc/getdtsz.c
@@ -0,0 +1,33 @@
+/* Copyright (C) 1991, 1995, 1996, 1997 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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <errno.h>
+#include <unistd.h>
+
+/* Return the maximum number of file descriptors
+   the current process could possibly have.  */
+int
+__getdtablesize ()
+{
+  __set_errno (ENOSYS);
+  return -1;
+}
+stub_warning (getdtablesize)
+
+weak_alias (__getdtablesize, getdtablesize)
+#include <stub-tag.h>
diff --git a/misc/gethostid.c b/misc/gethostid.c
new file mode 100644
index 0000000000..01baf12230
--- /dev/null
+++ b/misc/gethostid.c
@@ -0,0 +1,32 @@
+/* Copyright (C) 1991, 1995, 1996, 1997 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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <errno.h>
+#include <unistd.h>
+
+/* Return the current machine's Internet number.  */
+long int
+gethostid ()
+{
+  __set_errno (ENOSYS);
+  return -1L;
+}
+
+
+stub_warning (gethostid)
+#include <stub-tag.h>
diff --git a/misc/gethostname.c b/misc/gethostname.c
new file mode 100644
index 0000000000..bc59ab57c6
--- /dev/null
+++ b/misc/gethostname.c
@@ -0,0 +1,36 @@
+/* Copyright (C) 1991,1995,1996,1997,2000,2001 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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <errno.h>
+#include <unistd.h>
+
+/* Put the name of the current host in no more than LEN bytes of NAME.
+   The result is null-terminated if LEN is large enough for the full
+   name and the terminator.  */
+int
+__gethostname (name, len)
+     char *name;
+     size_t len;
+{
+  __set_errno (ENOSYS);
+  return -1;
+}
+stub_warning (gethostname)
+
+weak_alias (__gethostname, gethostname)
+#include <stub-tag.h>
diff --git a/misc/getloadavg.c b/misc/getloadavg.c
new file mode 100644
index 0000000000..070c879fd5
--- /dev/null
+++ b/misc/getloadavg.c
@@ -0,0 +1,37 @@
+/* Get system load averages.  Stub version.
+   Copyright (C) 1999 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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <errno.h>
+#include <unistd.h>
+#include <stdlib.h>
+
+
+/* Put the 1 minute, 5 minute and 15 minute load averages
+   into the first NELEM elements of LOADAVG.
+   Return the number written (never more than 3, but may be less than NELEM),
+   or -1 if an error occurred.  */
+
+int
+getloadavg (double loadavg[], int nelem)
+{
+  __set_errno (ENOSYS);
+  return -1;
+}
+stub_warning (getloadavg)
+#include <stub-tag.h>
diff --git a/misc/getpagesize.c b/misc/getpagesize.c
new file mode 100644
index 0000000000..40ed1ee2b1
--- /dev/null
+++ b/misc/getpagesize.c
@@ -0,0 +1,33 @@
+/* Copyright (C) 1991, 1993, 1995, 1996, 2002 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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <errno.h>
+#include <unistd.h>
+
+/* Return the system page size.  */
+int
+__getpagesize ()
+{
+  __set_errno (ENOSYS);
+  return 0;
+}
+libc_hidden_def (__getpagesize)
+stub_warning (getpagesize)
+
+weak_alias (__getpagesize, getpagesize)
+#include <stub-tag.h>
diff --git a/misc/getpass.c b/misc/getpass.c
index 62e56866a1..5290c3c7d3 100644
--- a/misc/getpass.c
+++ b/misc/getpass.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1992-1999, 2001, 2003, 2004 Free Software Foundation, Inc.
+/* Copyright (C) 1992-1999,2001,2003,2004,2005 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
@@ -91,12 +91,7 @@ getpass (prompt)
     tty_changed = 0;
 
   /* Write the prompt.  */
-#ifdef USE_IN_LIBIO
-  if (_IO_fwide (out, 0) > 0)
-    __fwprintf (out, L"%s", prompt);
-  else
-#endif
-    fputs_unlocked (prompt, out);
+  __fxprintf (out, "%s", prompt);
   fflush_unlocked (out);
 
   /* Read the password.  */
@@ -110,15 +105,8 @@ getpass (prompt)
 	  /* Remove the newline.  */
 	  buf[nread - 1] = '\0';
 	  if (tty_changed)
-	    {
-	      /* Write the newline that was not echoed.  */
-#ifdef USE_IN_LIBIO
-	      if (_IO_fwide (out, 0) > 0)
-		putwc_unlocked (L'\n', out);
-	      else
-#endif
-		putc_unlocked ('\n', out);
-	    }
+	    /* Write the newline that was not echoed.  */
+	    __fxprintf (out, "\n");
 	}
     }
 
diff --git a/misc/getsysstats.c b/misc/getsysstats.c
new file mode 100644
index 0000000000..bc67e23e79
--- /dev/null
+++ b/misc/getsysstats.c
@@ -0,0 +1,69 @@
+/* getsysstats - Determine various system internal values, stub version.
+   Copyright (C) 1996, 1997, 2001 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
+
+   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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <errno.h>
+#include <sys/sysinfo.h>
+
+int
+__get_nprocs_conf ()
+{
+  /* We don't know how to determine the number.  Simply return always 1.  */
+  return 1;
+}
+weak_alias (__get_nprocs_conf, get_nprocs_conf)
+
+link_warning (get_nprocs_conf, "warning: get_nprocs_conf will always return 1")
+
+
+
+int
+__get_nprocs ()
+{
+  /* We don't know how to determine the number.  Simply return always 1.  */
+  return 1;
+}
+weak_alias (__get_nprocs, get_nprocs)
+
+link_warning (get_nprocs, "warning: get_nprocs will always return 1")
+
+
+long int
+__get_phys_pages ()
+{
+  /* We have no general way to determine this value.  */
+  __set_errno (ENOSYS);
+  return -1;
+}
+weak_alias (__get_phys_pages, get_phys_pages)
+
+stub_warning (get_phys_pages)
+
+
+long int
+__get_avphys_pages ()
+{
+  /* We have no general way to determine this value.  */
+  __set_errno (ENOSYS);
+  return -1;
+}
+weak_alias (__get_avphys_pages, get_avphys_pages)
+
+stub_warning (get_avphys_pages)
+#include <stub-tag.h>
diff --git a/misc/getusershell.c b/misc/getusershell.c
index 95f0eab5e2..636da322f9 100644
--- a/misc/getusershell.c
+++ b/misc/getusershell.c
@@ -46,7 +46,15 @@ static char sccsid[] = "@(#)getusershell.c	8.1 (Berkeley) 6/4/93";
  * /etc/shells.
  */
 
-static const char *okshells[] = { _PATH_BSHELL, _PATH_CSHELL, NULL };
+/* NB: we do not initialize okshells here.  The initialization needs
+   relocations.  These interfaces are used so rarely that this is not
+   justified.  Instead explicitly initialize the array when it is
+   used.  */
+#if 0
+static const char *const okshells[] = { _PATH_BSHELL, _PATH_CSHELL, NULL };
+#else
+static const char *okshells[3];
+#endif
 static char **curshell, **shells, *strings;
 static char **initshells (void) __THROW;
 
@@ -70,11 +78,9 @@ void
 endusershell()
 {
 
-	if (shells != NULL)
-		free(shells);
+	free(shells);
 	shells = NULL;
-	if (strings != NULL)
-		free(strings);
+	free(strings);
 	strings = NULL;
 	curshell = NULL;
 }
@@ -92,40 +98,39 @@ initshells()
 	register char **sp, *cp;
 	register FILE *fp;
 	struct stat64 statb;
-	int flen;
+	size_t flen;
 
-	if (shells != NULL)
-		free(shells);
+	free(shells);
 	shells = NULL;
-	if (strings != NULL)
-		free(strings);
+	free(strings);
 	strings = NULL;
 	if ((fp = fopen(_PATH_SHELLS, "rc")) == NULL)
-		return (char **) okshells;
+		goto init_okshells_noclose;
 	if (fstat64(fileno(fp), &statb) == -1) {
+	init_okshells:
 		(void)fclose(fp);
+	init_okshells_noclose:
+		okshells[0] = _PATH_BSHELL;
+		okshells[1] = _PATH_CSHELL;
 		return (char **) okshells;
 	}
-	if ((strings = malloc((u_int)statb.st_size + 1)) == NULL) {
-		(void)fclose(fp);
-		return (char **) okshells;
-	}
-	shells = calloc((unsigned)statb.st_size / 3, sizeof (char *));
+	if (statb.st_size > ~(size_t)0 / sizeof (char *) * 3)
+		goto init_okshells;
+	if ((strings = malloc(statb.st_size + 2)) == NULL)
+		goto init_okshells;
+	shells = malloc(statb.st_size / 3 * sizeof (char *));
 	if (shells == NULL) {
-		(void)fclose(fp);
 		free(strings);
 		strings = NULL;
-		return (char **) okshells;
+		goto init_okshells;
 	}
-	/* No threads using this stream.  */
-	__fsetlocking (fp, FSETLOCKING_BYCALLER);
 	sp = shells;
 	cp = strings;
-	flen = statb.st_size;
+	flen = statb.st_size + 2;
 	while (fgets_unlocked(cp, flen - (cp - strings), fp) != NULL) {
 		while (*cp != '#' && *cp != '/' && *cp != '\0')
 			cp++;
-		if (*cp == '#' || *cp == '\0')
+		if (*cp == '#' || *cp == '\0' || cp[1] == '\0')
 			continue;
 		*sp++ = cp;
 		while (!isspace(*cp) && *cp != '#' && *cp != '\0')
diff --git a/misc/getxattr.c b/misc/getxattr.c
new file mode 100644
index 0000000000..ebf7bf2b4d
--- /dev/null
+++ b/misc/getxattr.c
@@ -0,0 +1,31 @@
+/* Copyright (C) 2002 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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <errno.h>
+#include <sys/xattr.h>
+
+ssize_t
+getxattr (const char *__path, const char *__name,
+	  void *__value, size_t __size)
+{
+  __set_errno (ENOSYS);
+  return -1;
+}
+
+stub_warning (getxattr)
+#include <stub-tag.h>
diff --git a/misc/gtty.c b/misc/gtty.c
new file mode 100644
index 0000000000..84e7fed55e
--- /dev/null
+++ b/misc/gtty.c
@@ -0,0 +1,40 @@
+/* Copyright (C) 1991, 1992, 1995, 1996, 1997 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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <errno.h>
+#include <sgtty.h>
+#include <stddef.h>
+
+/* Fill in *PARAMS with terminal parameters associated with FD.  */
+int
+gtty (fd, params)
+     int fd;
+     struct sgttyb *params;
+{
+  if (params == NULL)
+    {
+      __set_errno (EINVAL);
+      return -1;
+    }
+
+  __set_errno (ENOSYS);
+  return -1;
+}
+
+stub_warning (gtty)
+#include <stub-tag.h>
diff --git a/misc/hsearch_r.c b/misc/hsearch_r.c
index 398f0b6dd9..b03c12ce0b 100644
--- a/misc/hsearch_r.c
+++ b/misc/hsearch_r.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1993, 1995, 1996, 1997, 2002 Free Software Foundation, Inc.
+/* Copyright (C) 1993,1995,1996,1997,2002,2005 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1993.
 
@@ -206,7 +206,7 @@ hsearch_r (item, action, retval, htab)
     {
       /* If table is full and another entry should be entered return
 	 with error.  */
-      if (action == ENTER && htab->filled == htab->size)
+      if (htab->filled == htab->size)
 	{
 	  __set_errno (ENOMEM);
 	  *retval = NULL;
diff --git a/misc/insremque.c b/misc/insremque.c
index e366ac8063..7f086cd392 100644
--- a/misc/insremque.c
+++ b/misc/insremque.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1992, 1995, 1996 Free Software Foundation, Inc.
+/* Copyright (C) 1992, 1995, 1996, 2006 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
@@ -24,12 +24,20 @@
 void
 insque (void *elem, void *prev)
 {
-  struct qelem *next = ((struct qelem *) prev)->q_forw;
-  ((struct qelem *) prev)->q_forw = (struct qelem *) elem;
-  if (next != NULL)
-    next->q_back = (struct qelem *) elem;
-  ((struct qelem *) elem)->q_forw = next;
-  ((struct qelem *) elem)->q_back = (struct qelem *) prev;
+  if (prev == NULL)
+    {
+      ((struct qelem *) elem)->q_forw = NULL;
+      ((struct qelem *) elem)->q_back = NULL;
+    }
+  else
+    {
+      struct qelem *next = ((struct qelem *) prev)->q_forw;
+      ((struct qelem *) prev)->q_forw = (struct qelem *) elem;
+      if (next != NULL)
+	next->q_back = (struct qelem *) elem;
+      ((struct qelem *) elem)->q_forw = next;
+      ((struct qelem *) elem)->q_back = (struct qelem *) prev;
+    }
 }
 
 /* Unlink ELEM from the doubly-linked list that it is in.  */
diff --git a/misc/ioctl.c b/misc/ioctl.c
new file mode 100644
index 0000000000..3f71452cc1
--- /dev/null
+++ b/misc/ioctl.c
@@ -0,0 +1,35 @@
+/* Copyright (C) 1991, 93, 94, 95, 96, 97 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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <errno.h>
+#include <sys/ioctl.h>
+
+/* Perform the I/O control operation specified by REQUEST on FD.
+   The actual type and use of ARG and the return value depend on REQUEST.  */
+int
+__ioctl (fd, request)
+     int fd;
+     unsigned long int request;
+{
+  __set_errno (ENOSYS);
+  return -1;
+}
+stub_warning (ioctl)
+
+weak_alias (__ioctl, ioctl)
+#include <stub-tag.h>
diff --git a/misc/lgetxattr.c b/misc/lgetxattr.c
new file mode 100644
index 0000000000..6adf1fdf04
--- /dev/null
+++ b/misc/lgetxattr.c
@@ -0,0 +1,31 @@
+/* Copyright (C) 2002 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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <errno.h>
+#include <sys/xattr.h>
+
+ssize_t
+lgetxattr (const char *__path, const char *__name,
+	   void *__value, size_t __size)
+{
+  __set_errno (ENOSYS);
+  return -1;
+}
+
+stub_warning (lgetxattr)
+#include <stub-tag.h>
diff --git a/misc/listxattr.c b/misc/listxattr.c
new file mode 100644
index 0000000000..490a092b75
--- /dev/null
+++ b/misc/listxattr.c
@@ -0,0 +1,30 @@
+/* Copyright (C) 2002 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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <errno.h>
+#include <sys/xattr.h>
+
+ssize_t
+listxattr (const char *__path, char *__list, size_t __size)
+{
+  __set_errno (ENOSYS);
+  return -1;
+}
+
+stub_warning (listxattr)
+#include <stub-tag.h>
diff --git a/misc/llistxattr.c b/misc/llistxattr.c
new file mode 100644
index 0000000000..1a7e1e4cfd
--- /dev/null
+++ b/misc/llistxattr.c
@@ -0,0 +1,30 @@
+/* Copyright (C) 2002 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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <errno.h>
+#include <sys/xattr.h>
+
+ssize_t
+llistxattr (const char *__path, char *__list, size_t __size)
+{
+  __set_errno (ENOSYS);
+  return -1;
+}
+
+stub_warning (llistxattr)
+#include <stub-tag.h>
diff --git a/misc/lremovexattr.c b/misc/lremovexattr.c
new file mode 100644
index 0000000000..fad64e5150
--- /dev/null
+++ b/misc/lremovexattr.c
@@ -0,0 +1,30 @@
+/* Copyright (C) 2002 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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <errno.h>
+#include <sys/xattr.h>
+
+int
+lremovexattr (const char *__path, const char *__name)
+{
+  __set_errno (ENOSYS);
+  return -1;
+}
+
+stub_warning (lremovexattr)
+#include <stub-tag.h>
diff --git a/misc/lseek.c b/misc/lseek.c
new file mode 100644
index 0000000000..6daf6ef154
--- /dev/null
+++ b/misc/lseek.c
@@ -0,0 +1,53 @@
+/* Copyright (C) 1991, 1995, 1996, 1997, 2002 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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <errno.h>
+#include <unistd.h>
+#include <sys/types.h>
+
+/* Seek to OFFSET on FD, starting from WHENCE.  */
+off_t
+__lseek (fd, offset, whence)
+     int fd;
+     off_t offset;
+     int whence;
+{
+  if (fd < 0)
+    {
+      __set_errno (EBADF);
+      return -1;
+    }
+  switch (whence)
+    {
+    case SEEK_SET:
+    case SEEK_CUR:
+    case SEEK_END:
+      break;
+    default:
+      __set_errno (EINVAL);
+      return -1;
+    }
+
+  __set_errno (ENOSYS);
+  return -1;
+}
+stub_warning (lseek)
+libc_hidden_def (__lseek)
+
+weak_alias (__lseek, lseek)
+#include <stub-tag.h>
diff --git a/misc/lsetxattr.c b/misc/lsetxattr.c
new file mode 100644
index 0000000000..6f8cdde1da
--- /dev/null
+++ b/misc/lsetxattr.c
@@ -0,0 +1,31 @@
+/* Copyright (C) 2002 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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <errno.h>
+#include <sys/xattr.h>
+
+int
+lsetxattr (const char *__path, const char *__name,
+	   const void *__value, size_t __size, int __flags)
+{
+  __set_errno (ENOSYS);
+  return -1;
+}
+
+stub_warning (lsetxattr)
+#include <stub-tag.h>
diff --git a/misc/lutimes.c b/misc/lutimes.c
new file mode 100644
index 0000000000..34fc1838f0
--- /dev/null
+++ b/misc/lutimes.c
@@ -0,0 +1,35 @@
+/* lutimes -- change access and modification times of a symlink.  Stub version.
+   Copyright (C) 2002 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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <sys/time.h>
+#include <errno.h>
+#include <stddef.h>
+
+/* Change the access time of FILE to TVP[0] and
+   the modification time of FILE to TVP[1], but do not follow symlinks.  */
+int
+__lutimes (const char *file, const struct timeval tvp[2])
+{
+  __set_errno (ENOSYS);
+  return -1;
+}
+weak_alias (__lutimes, lutimes)
+
+stub_warning (lutimes)
+#include <stub-tag.h>
diff --git a/misc/madvise.c b/misc/madvise.c
new file mode 100644
index 0000000000..7a4aa8ab8e
--- /dev/null
+++ b/misc/madvise.c
@@ -0,0 +1,34 @@
+/* Copyright (C) 1994,1995,1996,1997,2000,2007 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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <sys/types.h>
+#include <sys/mman.h>
+#include <errno.h>
+
+/* Advise the system about particular usage patterns the program follows
+   for the region starting at ADDR and extending LEN bytes.  */
+
+int
+madvise (__ptr_t addr, size_t len, int advice)
+{
+  __set_errno (ENOSYS);
+  return -1;
+}
+libc_hidden_def (madvise)
+stub_warning (madvise)
+#include <stub-tag.h>
diff --git a/misc/mincore.c b/misc/mincore.c
new file mode 100644
index 0000000000..804447e8f3
--- /dev/null
+++ b/misc/mincore.c
@@ -0,0 +1,30 @@
+/* Copyright (C) 2000 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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <sys/mman.h>
+#include <errno.h>
+
+int
+mincore (void *__start, size_t __len, unsigned char *__vec)
+{
+  __set_errno (ENOSYS);
+  return -1;
+}
+
+stub_warning (mincore)
+#include <stub-tag.h>
diff --git a/misc/mlock.c b/misc/mlock.c
new file mode 100644
index 0000000000..fd8dc8bc9d
--- /dev/null
+++ b/misc/mlock.c
@@ -0,0 +1,35 @@
+/* mlock -- guarantee pages are resident in memory.  Stub version.
+   Copyright (C) 2001 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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <sys/types.h>
+#include <sys/mman.h>
+#include <errno.h>
+
+/* Guarantee all whole pages mapped by the range [ADDR,ADDR+LEN) to
+   be memory resident.  */
+
+int
+mlock (const void *addr, size_t len)
+{
+  __set_errno (ENOSYS);
+  return -1;
+}
+
+stub_warning (mlock)
+#include <stub-tag.h>
diff --git a/misc/mlockall.c b/misc/mlockall.c
new file mode 100644
index 0000000000..3d3ed6736d
--- /dev/null
+++ b/misc/mlockall.c
@@ -0,0 +1,36 @@
+/* mlockall -- lock in core all the pages in this process.  Stub version.
+   Copyright (C) 2001 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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <sys/types.h>
+#include <sys/mman.h>
+#include <errno.h>
+
+/* Cause all currently mapped pages of the process to be memory resident
+   until unlocked by a call to the `munlockall', until the process exits,
+   or until the process calls `execve'.  */
+
+int
+mlockall (int flags)
+{
+  __set_errno (ENOSYS);
+  return -1;
+}
+
+stub_warning (mlockall)
+#include <stub-tag.h>
diff --git a/misc/mmap.c b/misc/mmap.c
new file mode 100644
index 0000000000..43b25a06d2
--- /dev/null
+++ b/misc/mmap.c
@@ -0,0 +1,41 @@
+/* Copyright (C) 1994, 1995, 1996, 1997 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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <sys/types.h>
+#include <sys/mman.h>
+#include <errno.h>
+
+/* Map addresses starting near ADDR and extending for LEN bytes.  From
+   OFFSET into the file FD describes according to PROT and FLAGS.  If ADDR
+   is nonzero, it is the desired mapping address.  If the MAP_FIXED bit is
+   set in FLAGS, the mapping will be at ADDR exactly (which must be
+   page-aligned); otherwise the system chooses a convenient nearby address.
+   The return value is the actual mapping address chosen or MAP_FAILED
+   for errors (in which case `errno' is set).  A successful `mmap' call
+   deallocates any previous mapping for the affected region.  */
+
+__ptr_t
+__mmap (__ptr_t addr, size_t len, int prot, int flags, int fd, off_t offset)
+{
+  __set_errno (ENOSYS);
+  return MAP_FAILED;
+}
+
+stub_warning (mmap)
+#include <stub-tag.h>
+weak_alias (__mmap, mmap)
diff --git a/misc/mmap64.c b/misc/mmap64.c
new file mode 100644
index 0000000000..2c8aac808b
--- /dev/null
+++ b/misc/mmap64.c
@@ -0,0 +1,48 @@
+/* Copyright (C) 1997 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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <errno.h>
+#include <sys/mman.h>
+#include <sys/types.h>
+
+/* Map addresses starting near ADDR and extending for LEN bytes.  From
+   OFFSET into the file FD describes according to PROT and FLAGS.  If ADDR
+   is nonzero, it is the desired mapping address.  If the MAP_FIXED bit is
+   set in FLAGS, the mapping will be at ADDR exactly (which must be
+   page-aligned); otherwise the system chooses a convenient nearby address.
+   The return value is the actual mapping address chosen or MAP_FAILED
+   for errors (in which case `errno' is set).  A successful `mmap' call
+   deallocates any previous mapping for the affected region.  */
+
+__ptr_t
+__mmap64 (__ptr_t addr, size_t len, int prot, int flags, int fd,
+	  __off64_t offset)
+{
+  off_t small_offset = (off_t) offset;
+
+  if (small_offset != offset)
+    {
+      /* We cannot do this since the offset is too large.  */
+      __set_errno (EOVERFLOW);
+      return MAP_FAILED;
+    }
+
+  return __mmap (addr, len, prot, flags, fd, small_offset);
+}
+
+weak_alias (__mmap64, mmap64)
diff --git a/misc/mntent_r.c b/misc/mntent_r.c
index 1476c86ee2..829750b395 100644
--- a/misc/mntent_r.c
+++ b/misc/mntent_r.c
@@ -1,5 +1,6 @@
 /* Utilities for reading/writing fstab, mtab, etc.
-   Copyright (C) 1995-2000, 2001, 2002, 2003 Free Software Foundation, Inc.
+   Copyright (C) 1995-2000, 2001, 2002, 2003, 2006
+   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
@@ -278,14 +279,11 @@ __hasmntopt (const struct mntent *mnt, const char *opt)
 
   while ((p = strstr (rest, opt)) != NULL)
     {
-      if (p == rest
-	  || (p[-1] == ','
-	      && (p[optlen] == '\0' ||
-		  p[optlen] == '='  ||
-		  p[optlen] == ',')))
+      if ((p == rest || p[-1] == ',')
+	  && (p[optlen] == '\0' || p[optlen] == '=' || p[optlen] == ','))
 	return p;
 
-      rest = strchr (rest, ',');
+      rest = strchr (p, ',');
       if (rest == NULL)
 	break;
       ++rest;
diff --git a/misc/mprotect.c b/misc/mprotect.c
new file mode 100644
index 0000000000..9fefdfce71
--- /dev/null
+++ b/misc/mprotect.c
@@ -0,0 +1,36 @@
+/* Copyright (C) 1994, 1995, 1996, 1997 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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <sys/types.h>
+#include <sys/mman.h>
+#include <errno.h>
+
+/* Change the memory protection of the region starting at ADDR and
+   extending LEN bytes to PROT.  Returns 0 if successful, -1 for errors
+   (and sets errno).  */
+
+int
+__mprotect (__ptr_t addr, size_t len, int prot)
+{
+  __set_errno (ENOSYS);
+  return -1;
+}
+weak_alias (__mprotect, mprotect)
+
+stub_warning (mprotect)
+#include <stub-tag.h>
diff --git a/misc/msync.c b/misc/msync.c
new file mode 100644
index 0000000000..0ffd5c04f6
--- /dev/null
+++ b/misc/msync.c
@@ -0,0 +1,35 @@
+/* Copyright (C) 1994, 1995, 1996, 1997 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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <sys/types.h>
+#include <sys/mman.h>
+#include <errno.h>
+
+/* Synchronize the region starting at ADDR and extending LEN bytes with the
+   file it maps.  Filesystem operations on a file being mapped are
+   unpredictable before this is done.  */
+
+int
+msync (__ptr_t addr, size_t len, int flags)
+{
+  __set_errno (ENOSYS);
+  return -1;
+}
+
+stub_warning (msync)
+#include <stub-tag.h>
diff --git a/misc/munlock.c b/misc/munlock.c
new file mode 100644
index 0000000000..3c728c01d5
--- /dev/null
+++ b/misc/munlock.c
@@ -0,0 +1,34 @@
+/* munlock -- undo the effects of prior mlock calls.  Stub version.
+   Copyright (C) 2001 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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <sys/types.h>
+#include <sys/mman.h>
+#include <errno.h>
+
+/* Undo the effects on these whole pages of any prior mlock calls.  */
+
+int
+munlock (const void *addr, size_t len)
+{
+  __set_errno (ENOSYS);
+  return -1;
+}
+
+stub_warning (munlock)
+#include <stub-tag.h>
diff --git a/misc/munlockall.c b/misc/munlockall.c
new file mode 100644
index 0000000000..ca7198265f
--- /dev/null
+++ b/misc/munlockall.c
@@ -0,0 +1,34 @@
+/* munlockall -- undo the effects of all prior mlock calls.  Stub version.
+   Copyright (C) 2001 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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <sys/types.h>
+#include <sys/mman.h>
+#include <errno.h>
+
+/* Undo the effects of all prior mlock calls in this process.  */
+
+int
+munlockall (void)
+{
+  __set_errno (ENOSYS);
+  return -1;
+}
+
+stub_warning (munlockall)
+#include <stub-tag.h>
diff --git a/misc/munmap.c b/misc/munmap.c
new file mode 100644
index 0000000000..4a78c324ad
--- /dev/null
+++ b/misc/munmap.c
@@ -0,0 +1,35 @@
+/* Copyright (C) 1994, 1995, 1996, 1997 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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <sys/types.h>
+#include <sys/mman.h>
+#include <errno.h>
+
+/* Deallocate any mapping for the region starting at ADDR and extending LEN
+   bytes.  Returns 0 if successful, -1 for errors (and sets errno).  */
+
+int
+__munmap (__ptr_t addr, size_t len)
+{
+  __set_errno (ENOSYS);
+  return -1;
+}
+
+stub_warning (munmap)
+#include <stub-tag.h>
+weak_alias (__munmap, munmap)
diff --git a/misc/pselect.c b/misc/pselect.c
new file mode 100644
index 0000000000..80cf8be4b3
--- /dev/null
+++ b/misc/pselect.c
@@ -0,0 +1,70 @@
+/* Copyright (C) 1996-1998,2001,2002,2003,2006 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
+
+   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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <errno.h>
+#include <signal.h>
+#include <stddef.h>	/* For NULL.  */
+#include <sys/time.h>
+#include <sys/select.h>
+#include <sysdep-cancel.h>
+
+
+/* Check the first NFDS descriptors each in READFDS (if not NULL) for read
+   readiness, in WRITEFDS (if not NULL) for write readiness, and in EXCEPTFDS
+   (if not NULL) for exceptional conditions.  If TIMEOUT is not NULL, time out
+   after waiting the interval specified therein.  Additionally set the sigmask
+   SIGMASK for this call.  Returns the number of ready descriptors, or -1 for
+   errors.  */
+int
+__pselect (int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds,
+	   const struct timespec *timeout, const sigset_t *sigmask)
+{
+  struct timeval tval;
+  int retval;
+  sigset_t savemask;
+
+  /* Change nanosecond number to microseconds.  This might mean losing
+     precision and therefore the `pselect` should be available.  But
+     for now it is hardly found.  */
+  if (timeout != NULL)
+    TIMESPEC_TO_TIMEVAL (&tval, timeout);
+
+  /* The setting and restoring of the signal mask and the select call
+     should be an atomic operation.  This can't be done without kernel
+     help.  */
+  if (sigmask != NULL)
+    __sigprocmask (SIG_SETMASK, sigmask, &savemask);
+
+  /* Note the pselect() is a cancellation point.  But since we call
+     select() which itself is a cancellation point we do not have
+     to do anything here.  */
+  retval = __select (nfds, readfds, writefds, exceptfds,
+		     timeout != NULL ? &tval : NULL);
+
+  if (sigmask != NULL)
+    __sigprocmask (SIG_SETMASK, &savemask, NULL);
+
+  return retval;
+}
+#ifndef __pselect
+weak_alias (__pselect, pselect)
+strong_alias (__pselect, __libc_pselect)
+/* __select handles cancellation.  */
+LIBC_CANCEL_HANDLED ();
+#endif
diff --git a/misc/ptrace.c b/misc/ptrace.c
new file mode 100644
index 0000000000..1825d57143
--- /dev/null
+++ b/misc/ptrace.c
@@ -0,0 +1,103 @@
+/* Copyright (C) 1991, 92, 93, 95, 96, 97 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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <errno.h>
+#include <sys/ptrace.h>
+#include <sys/types.h>
+#include <stdarg.h>
+
+/* Perform process tracing functions.  REQUEST is one of the values
+   in <sys/ptrace.h>, and determines the action to be taken.
+   For all requests except PTRACE_TRACEME, PID specifies the process to be
+   traced.
+
+   PID and the other arguments described above for the various requests should
+   appear (those that are used for the particular request) as:
+     pid_t PID, void *ADDR, int DATA, void *ADDR2
+   after PID.  */
+int
+ptrace (request)
+     enum __ptrace_request request;
+{
+  pid_t pid;
+  void *addr;
+  void *addr2;
+  int data;
+  va_list ap;
+
+  switch (request)
+    {
+    case PTRACE_TRACEME:
+    case PTRACE_CONT:
+    case PTRACE_KILL:
+    case PTRACE_SINGLESTEP:
+    case PTRACE_ATTACH:
+    case PTRACE_DETACH:
+      break;
+
+    case PTRACE_PEEKTEXT:
+    case PTRACE_PEEKDATA:
+    case PTRACE_PEEKUSER:
+    case PTRACE_GETREGS:
+    case PTRACE_SETREGS:
+#ifdef PTRACE_GETFPREGS
+    case PTRACE_GETFPGEGS:
+#endif
+    case PTRACE_SETFPREGS:
+    case PTRACE_GETFPAREGS:
+    case PTRACE_SETFPAREGS:
+      va_start(ap, request);
+      pid = va_arg(ap, pid_t);
+      addr = va_arg(ap, void *);
+      va_end(ap);
+      break;
+
+    case PTRACE_POKETEXT:
+    case PTRACE_POKEDATA:
+    case PTRACE_POKEUSER:
+      va_start(ap, request);
+      pid = va_arg(ap, pid_t);
+      addr = va_arg(ap, void *);
+      data = va_arg(ap, int);
+      va_end(ap);
+      break;
+
+    case PTRACE_READDATA:
+    case PTRACE_WRITEDATA:
+    case PTRACE_READTEXT:
+    case PTRACE_WRITETEXT:
+      va_start(ap, request);
+      pid = va_arg(ap, pid_t);
+      addr = va_arg(ap, void *);
+      data = va_arg(ap, int);
+      addr2 = va_arg(ap, void *);
+      va_end(ap);
+      break;
+
+    default:
+      __set_errno (EINVAL);
+      return -1;
+    }
+
+  __set_errno (ENOSYS);
+  return -1;
+}
+
+
+stub_warning (ptrace)
+#include <stub-tag.h>
diff --git a/misc/qefgcvt_r.c b/misc/qefgcvt_r.c
index d5b2a799b3..a03ff748ef 100644
--- a/misc/qefgcvt_r.c
+++ b/misc/qefgcvt_r.c
@@ -43,6 +43,8 @@
 #endif
 #if LDBL_MIN_10_EXP == -37
 # define FLOAT_MIN_10_NORM	1.0e-37L
+#elif LDBL_MIN_10_EXP == -291
+# define FLOAT_MIN_10_NORM	1.0e-291L
 #elif LDBL_MIN_10_EXP == -307
 # define FLOAT_MIN_10_NORM	1.0e-307L
 #elif LDBL_MIN_10_EXP == -4931
diff --git a/misc/readv.c b/misc/readv.c
new file mode 100644
index 0000000000..b33444c036
--- /dev/null
+++ b/misc/readv.c
@@ -0,0 +1,41 @@
+/* Copyright (C) 1991,1995,1996,1997,1998,2002 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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <errno.h>
+#include <unistd.h>
+#include <sys/uio.h>
+
+/* Read data from file descriptor FD, and put the result in the
+   buffers described by VECTOR, which is a vector of COUNT `struct iovec's.
+   The buffers are filled in the order specified.
+   Operates just like `read' (see <unistd.h>) except that data are
+   put in VECTOR instead of a contiguous buffer.  */
+ssize_t
+__libc_readv (fd, vector, count)
+     int fd;
+     const struct iovec *vector;
+     int count;
+{
+  __set_errno (ENOSYS);
+  return -1;
+}
+strong_alias (__libc_readv, __readv)
+weak_alias (__libc_readv, readv)
+
+stub_warning (readv)
+#include <stub-tag.h>
diff --git a/misc/reboot.c b/misc/reboot.c
new file mode 100644
index 0000000000..6036726c1f
--- /dev/null
+++ b/misc/reboot.c
@@ -0,0 +1,34 @@
+/* Copyright (C) 1992, 1995, 1996, 1997 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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <errno.h>
+#include <unistd.h>
+#include <sys/reboot.h>
+
+/* Reboot the system.  */
+int
+reboot (howto)
+     int howto;
+{
+  __set_errno (ENOSYS);
+  return -1;
+}
+
+
+stub_warning (reboot)
+#include <stub-tag.h>
diff --git a/misc/remap_file_pages.c b/misc/remap_file_pages.c
new file mode 100644
index 0000000000..0f15ea44c2
--- /dev/null
+++ b/misc/remap_file_pages.c
@@ -0,0 +1,35 @@
+/* Copyright (C) 2003 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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <sys/mman.h>
+#include <errno.h>
+
+/* Remap arbitrary pages of a shared backing store within an existing
+   VMA.  */
+
+int
+__remap_file_pages (void *start, size_t size, int prot, size_t pgoff,
+		    int flags)
+{
+  __set_errno (ENOSYS);
+  return -1;
+}
+
+stub_warning (remap_file_pages)
+#include <stub-tag.h>
+weak_alias (__remap_file_pages, remap_file_pages)
diff --git a/misc/removexattr.c b/misc/removexattr.c
new file mode 100644
index 0000000000..8379ed10c8
--- /dev/null
+++ b/misc/removexattr.c
@@ -0,0 +1,30 @@
+/* Copyright (C) 2002 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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <errno.h>
+#include <sys/xattr.h>
+
+int
+removexattr (const char *__path, const char *__name)
+{
+  __set_errno (ENOSYS);
+  return -1;
+}
+
+stub_warning (removexattr)
+#include <stub-tag.h>
diff --git a/misc/revoke.c b/misc/revoke.c
new file mode 100644
index 0000000000..fc757d80b4
--- /dev/null
+++ b/misc/revoke.c
@@ -0,0 +1,31 @@
+/* Revoke the access of all descriptors currently open on a file.
+   Copyright (C) 1995, 1996, 1997 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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <unistd.h>
+#include <errno.h>
+
+int
+revoke (file)
+     const char *file;
+{
+  __set_errno (ENOSYS);
+  return -1;
+}
+stub_warning (revoke)
+#include <stub-tag.h>
diff --git a/misc/sbrk.c b/misc/sbrk.c
new file mode 100644
index 0000000000..0df60076cc
--- /dev/null
+++ b/misc/sbrk.c
@@ -0,0 +1,56 @@
+/* Copyright (C) 1991,1995,1996,1997,2000,2002 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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <unistd.h>
+#include <errno.h>
+
+/* Defined in brk.c.  */
+extern void *__curbrk;
+extern int __brk (void *addr);
+
+/* Defined in init-first.c.  */
+extern int __libc_multiple_libcs attribute_hidden;
+
+/* Extend the process's data space by INCREMENT.
+   If INCREMENT is negative, shrink data space by - INCREMENT.
+   Return start of new space allocated, or -1 for errors.  */
+void *
+__sbrk (intptr_t increment)
+{
+  void *oldbrk;
+
+  /* If this is not part of the dynamic library or the library is used
+     via dynamic loading in a statically linked program update
+     __curbrk from the kernel's brk value.  That way two separate
+     instances of __brk and __sbrk can share the heap, returning
+     interleaved pieces of it.  */
+  if (__curbrk == NULL || __libc_multiple_libcs)
+    if (__brk (0) < 0)		/* Initialize the break.  */
+      return (void *) -1;
+
+  if (increment == 0)
+    return __curbrk;
+
+  oldbrk = __curbrk;
+  if (__brk (oldbrk + increment) < 0)
+    return (void *) -1;
+
+  return oldbrk;
+}
+libc_hidden_def (__sbrk)
+weak_alias (__sbrk, sbrk)
diff --git a/misc/select.c b/misc/select.c
new file mode 100644
index 0000000000..124f26aff7
--- /dev/null
+++ b/misc/select.c
@@ -0,0 +1,43 @@
+/* Copyright (C) 1991, 1995, 1996, 1997, 2002 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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <sys/time.h>
+#include <sys/types.h>
+#include <errno.h>
+
+/* Check the first NFDS descriptors each in READFDS (if not NULL) for read
+   readiness, in WRITEFDS (if not NULL) for write readiness, and in EXCEPTFDS
+   (if not NULL) for exceptional conditions.  If TIMEOUT is not NULL, time out
+   after waiting the interval specified therein.  Returns the number of ready
+   descriptors, or -1 for errors.  */
+int
+__select (nfds, readfds, writefds, exceptfds, timeout)
+     int nfds;
+     fd_set *readfds;
+     fd_set *writefds;
+     fd_set *exceptfds;
+     struct timeval *timeout;
+{
+  __set_errno (ENOSYS);
+  return -1;
+}
+libc_hidden_def (__select)
+stub_warning (select)
+
+weak_alias (__select, select)
+#include <stub-tag.h>
diff --git a/misc/setdomain.c b/misc/setdomain.c
new file mode 100644
index 0000000000..4d9cbb7cac
--- /dev/null
+++ b/misc/setdomain.c
@@ -0,0 +1,34 @@
+/* Copyright (C) 1994, 1995, 1996, 1997 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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <errno.h>
+#include <unistd.h>
+
+/* Set the name of the current YP domain to NAME, which is LEN bytes long.
+   This call is restricted to the super-user.  */
+int
+setdomainname (name, len)
+     const char *name;
+     size_t len;
+{
+  __set_errno (ENOSYS);
+  return -1;
+}
+
+stub_warning (setdomainname)
+#include <stub-tag.h>
diff --git a/misc/setegid.c b/misc/setegid.c
new file mode 100644
index 0000000000..5b5e2cf4bb
--- /dev/null
+++ b/misc/setegid.c
@@ -0,0 +1,32 @@
+/* Copyright (C) 1992,1994,1995,1996,1997,2002 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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <errno.h>
+#include <unistd.h>
+
+/* Set the effective group ID of the calling process to GID.  */
+int
+setegid (gid)
+     __gid_t gid;
+{
+  __set_errno (ENOSYS);
+  return -1;
+}
+libc_hidden_def (setegid)
+stub_warning (setegid)
+#include <stub-tag.h>
diff --git a/misc/seteuid.c b/misc/seteuid.c
new file mode 100644
index 0000000000..689000f993
--- /dev/null
+++ b/misc/seteuid.c
@@ -0,0 +1,32 @@
+/* Copyright (C) 1992, 1995, 1996, 1997, 2002 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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <errno.h>
+#include <unistd.h>
+
+/* Set the effective user ID of the calling process to UID.  */
+int
+seteuid (uid)
+     __uid_t uid;
+{
+  __set_errno (ENOSYS);
+  return -1;
+}
+libc_hidden_def (seteuid)
+stub_warning (seteuid)
+#include <stub-tag.h>
diff --git a/misc/sethostid.c b/misc/sethostid.c
new file mode 100644
index 0000000000..6f393de06a
--- /dev/null
+++ b/misc/sethostid.c
@@ -0,0 +1,34 @@
+/* Copyright (C) 1991, 1995, 1996, 1997 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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <errno.h>
+#include <unistd.h>
+
+/* Set the current machine's Internet number to ID.
+   This call is restricted to the super-user.  */
+int
+sethostid (id)
+     long int id;
+{
+  __set_errno (ENOSYS);
+  return -1;
+}
+
+
+stub_warning (sethostid)
+#include <stub-tag.h>
diff --git a/misc/sethostname.c b/misc/sethostname.c
new file mode 100644
index 0000000000..1f65b1e759
--- /dev/null
+++ b/misc/sethostname.c
@@ -0,0 +1,35 @@
+/* Copyright (C) 1991, 1995, 1996, 1997 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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <errno.h>
+#include <unistd.h>
+
+/* Set the name of the current host to NAME, which is LEN bytes long.
+   This call is restricted to the super-user.  */
+int
+sethostname (name, len)
+     const char *name;
+     size_t len;
+{
+  __set_errno (ENOSYS);
+  return -1;
+}
+
+
+stub_warning (sethostname)
+#include <stub-tag.h>
diff --git a/misc/setregid.c b/misc/setregid.c
new file mode 100644
index 0000000000..f8f33d1da7
--- /dev/null
+++ b/misc/setregid.c
@@ -0,0 +1,36 @@
+/* Copyright (C) 1991, 1992, 1995, 1996, 1997 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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <errno.h>
+#include <unistd.h>
+#include <sys/types.h>
+
+/* Set the real group ID of the calling process to RGID,
+   and the effective group ID of the calling process to EGID.  */
+int
+__setregid (effective_gid, real_gid)
+     gid_t effective_gid;
+     gid_t real_gid;
+{
+  __set_errno (ENOSYS);
+  return -1;
+}
+stub_warning (setregid)
+
+weak_alias (__setregid, setregid)
+#include <stub-tag.h>
diff --git a/misc/setreuid.c b/misc/setreuid.c
new file mode 100644
index 0000000000..cce2d9d52b
--- /dev/null
+++ b/misc/setreuid.c
@@ -0,0 +1,36 @@
+/* Copyright (C) 1991, 1992, 1995, 1996, 1997 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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <errno.h>
+#include <unistd.h>
+#include <sys/types.h>
+
+/* Set the real user ID of the calling process to RUID,
+   and the effective user ID of the calling process to EUID.  */
+int
+__setreuid (effective_uid, real_uid)
+     uid_t effective_uid;
+     uid_t real_uid;
+{
+  __set_errno (ENOSYS);
+  return -1;
+}
+stub_warning (setreuid)
+
+weak_alias (__setreuid, setreuid)
+#include <stub-tag.h>
diff --git a/misc/setxattr.c b/misc/setxattr.c
new file mode 100644
index 0000000000..5b8743a7ce
--- /dev/null
+++ b/misc/setxattr.c
@@ -0,0 +1,31 @@
+/* Copyright (C) 2002 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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <errno.h>
+#include <sys/xattr.h>
+
+int
+setxattr (const char *__path, const char *__name,
+	  const void *__value, size_t __size, int __flags)
+{
+  __set_errno (ENOSYS);
+  return -1;
+}
+
+stub_warning (setxattr)
+#include <stub-tag.h>
diff --git a/misc/sstk.c b/misc/sstk.c
new file mode 100644
index 0000000000..6cba9b7fba
--- /dev/null
+++ b/misc/sstk.c
@@ -0,0 +1,35 @@
+/* Copyright (C) 1991, 1995, 1996, 1997, 2004 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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <errno.h>
+
+/* Increase the size of the stack by INCREMENT,
+   and return the address of the bottom of the stack.  */
+
+void *sstk (int increment) __THROW;
+
+void *
+sstk (increment)
+     int increment;
+{
+  __set_errno (ENOSYS);
+  return (void *) -1;
+}
+
+stub_warning (sstk)
+#include <stub-tag.h>
diff --git a/misc/stty.c b/misc/stty.c
new file mode 100644
index 0000000000..49c569a77b
--- /dev/null
+++ b/misc/stty.c
@@ -0,0 +1,40 @@
+/* Copyright (C) 1991, 1992, 1995, 1996, 1997 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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <errno.h>
+#include <sgtty.h>
+#include <stddef.h>
+
+/* Set the terminal parameters associated with FD to *PARAMS.  */
+int
+stty (fd, params)
+     int fd;
+     const struct sgttyb *params;
+{
+  if (params == NULL)
+    {
+      __set_errno (EINVAL);
+      return -1;
+    }
+
+  __set_errno (ENOSYS);
+  return -1;
+}
+
+stub_warning (stty)
+#include <stub-tag.h>
diff --git a/misc/swapoff.c b/misc/swapoff.c
new file mode 100644
index 0000000000..033d841d95
--- /dev/null
+++ b/misc/swapoff.c
@@ -0,0 +1,31 @@
+/* Copyright (C) 1996, 1997 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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <errno.h>
+#include <unistd.h>
+
+/* Stop using block special device PATH for swapping.  */
+int
+swapoff (const char *path)
+{
+  __set_errno (ENOSYS);
+  return -1;
+}
+
+stub_warning (swapoff)
+#include <stub-tag.h>
diff --git a/misc/swapon.c b/misc/swapon.c
new file mode 100644
index 0000000000..910781fa93
--- /dev/null
+++ b/misc/swapon.c
@@ -0,0 +1,34 @@
+/* Copyright (C) 1991, 1995, 1996, 1997 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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <errno.h>
+#include <unistd.h>
+#include <sys/swap.h>
+
+/* Make the block special device PATH available to the system for swapping.
+   This call is restricted to the super-user.  */
+int
+swapon (path)
+     const char *path;
+{
+  __set_errno (ENOSYS);
+  return -1;
+}
+
+stub_warning (swapon)
+#include <stub-tag.h>
diff --git a/misc/sync.c b/misc/sync.c
new file mode 100644
index 0000000000..5ccdb5d5bf
--- /dev/null
+++ b/misc/sync.c
@@ -0,0 +1,31 @@
+/* Copyright (C) 1991, 1995, 1996, 1997, 2001 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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <errno.h>
+#include <unistd.h>
+
+/* Make all changes done to all files actually appear on disk.  */
+void
+sync ()
+{
+  __set_errno (ENOSYS);
+}
+
+
+stub_warning (sync)
+#include <stub-tag.h>
diff --git a/misc/sys/cdefs.h b/misc/sys/cdefs.h
index 475cf62961..ce5e83d571 100644
--- a/misc/sys/cdefs.h
+++ b/misc/sys/cdefs.h
@@ -1,4 +1,5 @@
-/* Copyright (C) 1992-2001, 2002, 2004 Free Software Foundation, Inc.
+/* Copyright (C) 1992-2001, 2002, 2004, 2005, 2006
+   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
@@ -130,6 +131,7 @@
 /* Fortify support.  */
 #define __bos(ptr) __builtin_object_size (ptr, __USE_FORTIFY_LEVEL > 1)
 #define __bos0(ptr) __builtin_object_size (ptr, 0)
+#define __warndecl(name, msg) extern void name (void)
 
 
 /* Support for flexible arrays.  */
@@ -255,6 +257,28 @@
 # define __nonnull(params)
 #endif
 
+/* If fortification mode, we warn about unused results of certain
+   function calls which can lead to problems.  */
+#if __GNUC_PREREQ (3,4)
+# define __attribute_warn_unused_result__ \
+   __attribute__ ((__warn_unused_result__))
+# if __USE_FORTIFY_LEVEL > 0
+#  define __wur __attribute_warn_unused_result__
+# endif
+#else
+# define __attribute_warn_unused_result__ /* empty */
+#endif
+#ifndef __wur
+# define __wur /* Ignore */
+#endif
+
+/* Forces a function to be always inlined.  */
+#if __GNUC_PREREQ (3,2)
+# define __always_inline __inline __attribute__ ((__always_inline__))
+#else
+# define __always_inline __inline
+#endif
+
 /* It is possible to compile containing GCC extensions even if GCC is
    run in pedantic mode if the uses are carefully marked using the
    `__extension__' keyword.  But this is not generally available before
@@ -286,4 +310,29 @@
 # endif
 #endif
 
+#include <bits/wordsize.h>
+
+#if defined __LONG_DOUBLE_MATH_OPTIONAL && defined __NO_LONG_DOUBLE_MATH
+# define __LDBL_COMPAT 1
+# ifdef __REDIRECT
+#  define __LDBL_REDIR1(name, proto, alias) __REDIRECT (name, proto, alias)
+#  define __LDBL_REDIR(name, proto) \
+  __LDBL_REDIR1 (name, proto, __nldbl_##name)
+#  define __LDBL_REDIR1_NTH(name, proto, alias) __REDIRECT_NTH (name, proto, alias)
+#  define __LDBL_REDIR_NTH(name, proto) \
+  __LDBL_REDIR1_NTH (name, proto, __nldbl_##name)
+#  define __LDBL_REDIR1_DECL(name, alias) \
+  extern __typeof (name) name __asm (__ASMNAME (#alias));
+#  define __LDBL_REDIR_DECL(name) \
+  extern __typeof (name) name __asm (__ASMNAME ("__nldbl_" #name));
+# endif
+#endif
+#if !defined __LDBL_COMPAT || !defined __REDIRECT
+# define __LDBL_REDIR1(name, proto, alias) name proto
+# define __LDBL_REDIR(name, proto) name proto
+# define __LDBL_REDIR1_NTH(name, proto, alias) name proto __THROW
+# define __LDBL_REDIR_NTH(name, proto) name proto __THROW
+# define __LDBL_REDIR_DECL(name)
+#endif
+
 #endif	 /* sys/cdefs.h */
diff --git a/misc/sys/mman.h b/misc/sys/mman.h
index ae4dd64fc6..4cd8a3fe72 100644
--- a/misc/sys/mman.h
+++ b/misc/sys/mman.h
@@ -1,5 +1,5 @@
 /* Definitions for BSD-style memory management.
-   Copyright (C) 1994-2000, 2003, 2004 Free Software Foundation, Inc.
+   Copyright (C) 1994-2000, 2003, 2004, 2005 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
@@ -116,12 +116,6 @@ extern int mlockall (int __flags) __THROW;
 extern int munlockall (void) __THROW;
 
 #ifdef __USE_MISC
-/* Remap pages mapped by the range [ADDR,ADDR+OLD_LEN) to new length
-   NEW_LEN.  If MAY_MOVE is MREMAP_MAYMOVE the returned address may
-   differ from ADDR.  */
-extern void *mremap (void *__addr, size_t __old_len, size_t __new_len,
-		     int __may_move) __THROW;
-
 /* mincore returns the memory residency status of the pages in the
    current process's address space specified by [start, start + len).
    The status is returned in a vector of bytes.  The least significant
@@ -129,6 +123,16 @@ extern void *mremap (void *__addr, size_t __old_len, size_t __new_len,
    it is zero.  */
 extern int mincore (void *__start, size_t __len, unsigned char *__vec)
      __THROW;
+#endif
+
+#ifdef __USE_GNU
+/* Remap pages mapped by the range [ADDR,ADDR+OLD_LEN) to new length
+   NEW_LEN.  If MREMAP_MAYMOVE is set in FLAGS the returned address
+   may differ from ADDR.  If MREMAP_FIXED is set in FLAGS the function
+   takes another paramter which is a fixed address at which the block
+   resides after a successful call.  */
+extern void *mremap (void *__addr, size_t __old_len, size_t __new_len,
+		     int __flags, ...) __THROW;
 
 /* Remap arbitrary pages of a shared backing store within an existing
    VMA.  */
diff --git a/misc/sys/queue.h b/misc/sys/queue.h
index 5b6e2a0a23..b0e6b38c19 100644
--- a/misc/sys/queue.h
+++ b/misc/sys/queue.h
@@ -10,7 +10,7 @@
  * 2. Redistributions in binary form must reproduce the above copyright
  *    notice, this list of conditions and the following disclaimer in the
  *    documentation and/or other materials provided with the distribution.
- * 4. Neither the name of the University nor the names of its contributors
+ * 3. Neither the name of the University nor the names of its contributors
  *    may be used to endorse or promote products derived from this software
  *    without specific prior written permission.
  *
@@ -26,29 +26,46 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- *	@(#)queue.h	8.3 (Berkeley) 12/13/93
+ *	@(#)queue.h	8.5 (Berkeley) 8/20/94
  */
 
-#ifndef	_SYS_QUEUE_H
-#define	_SYS_QUEUE_H 1
+#ifndef	_SYS_QUEUE_H_
+#define	_SYS_QUEUE_H_
 
 /*
- * This file defines three types of data structures: lists, tail queues,
- * and circular queues.
+ * This file defines five types of data structures: singly-linked lists,
+ * lists, simple queues, tail queues, and circular queues.
+ *
+ * A singly-linked list is headed by a single forward pointer. The
+ * elements are singly linked for minimum space and pointer manipulation
+ * overhead at the expense of O(n) removal for arbitrary elements. New
+ * elements can be added to the list after an existing element or at the
+ * head of the list.  Elements being removed from the head of the list
+ * should use the explicit macro for this purpose for optimum
+ * efficiency. A singly-linked list may only be traversed in the forward
+ * direction.  Singly-linked lists are ideal for applications with large
+ * datasets and few or no removals or for implementing a LIFO queue.
  *
  * A list is headed by a single forward pointer (or an array of forward
  * pointers for a hash table header). The elements are doubly linked
  * so that an arbitrary element can be removed without a need to
- * traverse the list. New elements can be added to the list after
- * an existing element or at the head of the list. A list may only be
- * traversed in the forward direction.
+ * traverse the list. New elements can be added to the list before
+ * or after an existing element or at the head of the list. A list
+ * may only be traversed in the forward direction.
+ *
+ * A simple queue is headed by a pair of pointers, one the head of the
+ * list and the other to the tail of the list. The elements are singly
+ * linked to save space, so elements can only be removed from the
+ * head of the list. New elements can be added to the list after
+ * an existing element, at the head of the list, or at the end of the
+ * list. A simple queue may only be traversed in the forward direction.
  *
  * A tail queue is headed by a pair of pointers, one to the head of the
  * list and the other to the tail of the list. The elements are doubly
  * linked so that an arbitrary element can be removed without a need to
- * traverse the list. New elements can be added to the list after
- * an existing element, at the head of the list, or at the end of the
- * list. A tail queue may only be traversed in the forward direction.
+ * traverse the list. New elements can be added to the list before or
+ * after an existing element, at the head of the list, or at the end of
+ * the list. A tail queue may be traversed in either direction.
  *
  * A circle queue is headed by a pair of pointers, one to the head of the
  * list and the other to the tail of the list. The elements are doubly
@@ -64,12 +81,15 @@
 /*
  * List definitions.
  */
-#define LIST_HEAD(name, type)						\
+#define	LIST_HEAD(name, type)						\
 struct name {								\
 	struct type *lh_first;	/* first element */			\
 }
 
-#define LIST_ENTRY(type)						\
+#define	LIST_HEAD_INITIALIZER(head)					\
+	{ NULL }
+
+#define	LIST_ENTRY(type)						\
 struct {								\
 	struct type *le_next;	/* next element */			\
 	struct type **le_prev;	/* address of previous next element */	\
@@ -78,73 +98,307 @@ struct {								\
 /*
  * List functions.
  */
-#define	LIST_INIT(head) {						\
+#define	LIST_INIT(head) do {						\
 	(head)->lh_first = NULL;					\
-}
+} while (/*CONSTCOND*/0)
 
-#define LIST_INSERT_AFTER(listelm, elm, field) {			\
+#define	LIST_INSERT_AFTER(listelm, elm, field) do {			\
 	if (((elm)->field.le_next = (listelm)->field.le_next) != NULL)	\
 		(listelm)->field.le_next->field.le_prev =		\
 		    &(elm)->field.le_next;				\
 	(listelm)->field.le_next = (elm);				\
 	(elm)->field.le_prev = &(listelm)->field.le_next;		\
-}
+} while (/*CONSTCOND*/0)
 
-#define LIST_INSERT_HEAD(head, elm, field) {				\
+#define	LIST_INSERT_BEFORE(listelm, elm, field) do {			\
+	(elm)->field.le_prev = (listelm)->field.le_prev;		\
+	(elm)->field.le_next = (listelm);				\
+	*(listelm)->field.le_prev = (elm);				\
+	(listelm)->field.le_prev = &(elm)->field.le_next;		\
+} while (/*CONSTCOND*/0)
+
+#define	LIST_INSERT_HEAD(head, elm, field) do {				\
 	if (((elm)->field.le_next = (head)->lh_first) != NULL)		\
 		(head)->lh_first->field.le_prev = &(elm)->field.le_next;\
 	(head)->lh_first = (elm);					\
 	(elm)->field.le_prev = &(head)->lh_first;			\
-}
+} while (/*CONSTCOND*/0)
 
-#define LIST_REMOVE(elm, field) {					\
+#define	LIST_REMOVE(elm, field) do {					\
 	if ((elm)->field.le_next != NULL)				\
 		(elm)->field.le_next->field.le_prev = 			\
 		    (elm)->field.le_prev;				\
 	*(elm)->field.le_prev = (elm)->field.le_next;			\
+} while (/*CONSTCOND*/0)
+
+#define	LIST_FOREACH(var, head, field)					\
+	for ((var) = ((head)->lh_first);				\
+		(var);							\
+		(var) = ((var)->field.le_next))
+
+/*
+ * List access methods.
+ */
+#define	LIST_EMPTY(head)		((head)->lh_first == NULL)
+#define	LIST_FIRST(head)		((head)->lh_first)
+#define	LIST_NEXT(elm, field)		((elm)->field.le_next)
+
+
+/*
+ * Singly-linked List definitions.
+ */
+#define	SLIST_HEAD(name, type)						\
+struct name {								\
+	struct type *slh_first;	/* first element */			\
+}
+
+#define	SLIST_HEAD_INITIALIZER(head)					\
+	{ NULL }
+
+#define	SLIST_ENTRY(type)						\
+struct {								\
+	struct type *sle_next;	/* next element */			\
+}
+
+/*
+ * Singly-linked List functions.
+ */
+#define	SLIST_INIT(head) do {						\
+	(head)->slh_first = NULL;					\
+} while (/*CONSTCOND*/0)
+
+#define	SLIST_INSERT_AFTER(slistelm, elm, field) do {			\
+	(elm)->field.sle_next = (slistelm)->field.sle_next;		\
+	(slistelm)->field.sle_next = (elm);				\
+} while (/*CONSTCOND*/0)
+
+#define	SLIST_INSERT_HEAD(head, elm, field) do {			\
+	(elm)->field.sle_next = (head)->slh_first;			\
+	(head)->slh_first = (elm);					\
+} while (/*CONSTCOND*/0)
+
+#define	SLIST_REMOVE_HEAD(head, field) do {				\
+	(head)->slh_first = (head)->slh_first->field.sle_next;		\
+} while (/*CONSTCOND*/0)
+
+#define	SLIST_REMOVE(head, elm, type, field) do {			\
+	if ((head)->slh_first == (elm)) {				\
+		SLIST_REMOVE_HEAD((head), field);			\
+	}								\
+	else {								\
+		struct type *curelm = (head)->slh_first;		\
+		while(curelm->field.sle_next != (elm))			\
+			curelm = curelm->field.sle_next;		\
+		curelm->field.sle_next =				\
+		    curelm->field.sle_next->field.sle_next;		\
+	}								\
+} while (/*CONSTCOND*/0)
+
+#define	SLIST_FOREACH(var, head, field)					\
+	for((var) = (head)->slh_first; (var); (var) = (var)->field.sle_next)
+
+/*
+ * Singly-linked List access methods.
+ */
+#define	SLIST_EMPTY(head)	((head)->slh_first == NULL)
+#define	SLIST_FIRST(head)	((head)->slh_first)
+#define	SLIST_NEXT(elm, field)	((elm)->field.sle_next)
+
+
+/*
+ * Singly-linked Tail queue declarations.
+ */
+#define	STAILQ_HEAD(name, type)					\
+struct name {								\
+	struct type *stqh_first;	/* first element */			\
+	struct type **stqh_last;	/* addr of last next element */		\
+}
+
+#define	STAILQ_HEAD_INITIALIZER(head)					\
+	{ NULL, &(head).stqh_first }
+
+#define	STAILQ_ENTRY(type)						\
+struct {								\
+	struct type *stqe_next;	/* next element */			\
+}
+
+/*
+ * Singly-linked Tail queue functions.
+ */
+#define	STAILQ_INIT(head) do {						\
+	(head)->stqh_first = NULL;					\
+	(head)->stqh_last = &(head)->stqh_first;				\
+} while (/*CONSTCOND*/0)
+
+#define	STAILQ_INSERT_HEAD(head, elm, field) do {			\
+	if (((elm)->field.stqe_next = (head)->stqh_first) == NULL)	\
+		(head)->stqh_last = &(elm)->field.stqe_next;		\
+	(head)->stqh_first = (elm);					\
+} while (/*CONSTCOND*/0)
+
+#define	STAILQ_INSERT_TAIL(head, elm, field) do {			\
+	(elm)->field.stqe_next = NULL;					\
+	*(head)->stqh_last = (elm);					\
+	(head)->stqh_last = &(elm)->field.stqe_next;			\
+} while (/*CONSTCOND*/0)
+
+#define	STAILQ_INSERT_AFTER(head, listelm, elm, field) do {		\
+	if (((elm)->field.stqe_next = (listelm)->field.stqe_next) == NULL)\
+		(head)->stqh_last = &(elm)->field.stqe_next;		\
+	(listelm)->field.stqe_next = (elm);				\
+} while (/*CONSTCOND*/0)
+
+#define	STAILQ_REMOVE_HEAD(head, field) do {				\
+	if (((head)->stqh_first = (head)->stqh_first->field.stqe_next) == NULL) \
+		(head)->stqh_last = &(head)->stqh_first;			\
+} while (/*CONSTCOND*/0)
+
+#define	STAILQ_REMOVE(head, elm, type, field) do {			\
+	if ((head)->stqh_first == (elm)) {				\
+		STAILQ_REMOVE_HEAD((head), field);			\
+	} else {							\
+		struct type *curelm = (head)->stqh_first;		\
+		while (curelm->field.stqe_next != (elm))			\
+			curelm = curelm->field.stqe_next;		\
+		if ((curelm->field.stqe_next =				\
+			curelm->field.stqe_next->field.stqe_next) == NULL) \
+			    (head)->stqh_last = &(curelm)->field.stqe_next; \
+	}								\
+} while (/*CONSTCOND*/0)
+
+#define	STAILQ_FOREACH(var, head, field)				\
+	for ((var) = ((head)->stqh_first);				\
+		(var);							\
+		(var) = ((var)->field.stqe_next))
+
+/*
+ * Singly-linked Tail queue access methods.
+ */
+#define	STAILQ_EMPTY(head)	((head)->stqh_first == NULL)
+#define	STAILQ_FIRST(head)	((head)->stqh_first)
+#define	STAILQ_NEXT(elm, field)	((elm)->field.stqe_next)
+
+
+/*
+ * Simple queue definitions.
+ */
+#define	SIMPLEQ_HEAD(name, type)					\
+struct name {								\
+	struct type *sqh_first;	/* first element */			\
+	struct type **sqh_last;	/* addr of last next element */		\
+}
+
+#define	SIMPLEQ_HEAD_INITIALIZER(head)					\
+	{ NULL, &(head).sqh_first }
+
+#define	SIMPLEQ_ENTRY(type)						\
+struct {								\
+	struct type *sqe_next;	/* next element */			\
 }
 
 /*
+ * Simple queue functions.
+ */
+#define	SIMPLEQ_INIT(head) do {						\
+	(head)->sqh_first = NULL;					\
+	(head)->sqh_last = &(head)->sqh_first;				\
+} while (/*CONSTCOND*/0)
+
+#define	SIMPLEQ_INSERT_HEAD(head, elm, field) do {			\
+	if (((elm)->field.sqe_next = (head)->sqh_first) == NULL)	\
+		(head)->sqh_last = &(elm)->field.sqe_next;		\
+	(head)->sqh_first = (elm);					\
+} while (/*CONSTCOND*/0)
+
+#define	SIMPLEQ_INSERT_TAIL(head, elm, field) do {			\
+	(elm)->field.sqe_next = NULL;					\
+	*(head)->sqh_last = (elm);					\
+	(head)->sqh_last = &(elm)->field.sqe_next;			\
+} while (/*CONSTCOND*/0)
+
+#define	SIMPLEQ_INSERT_AFTER(head, listelm, elm, field) do {		\
+	if (((elm)->field.sqe_next = (listelm)->field.sqe_next) == NULL)\
+		(head)->sqh_last = &(elm)->field.sqe_next;		\
+	(listelm)->field.sqe_next = (elm);				\
+} while (/*CONSTCOND*/0)
+
+#define	SIMPLEQ_REMOVE_HEAD(head, field) do {				\
+	if (((head)->sqh_first = (head)->sqh_first->field.sqe_next) == NULL) \
+		(head)->sqh_last = &(head)->sqh_first;			\
+} while (/*CONSTCOND*/0)
+
+#define	SIMPLEQ_REMOVE(head, elm, type, field) do {			\
+	if ((head)->sqh_first == (elm)) {				\
+		SIMPLEQ_REMOVE_HEAD((head), field);			\
+	} else {							\
+		struct type *curelm = (head)->sqh_first;		\
+		while (curelm->field.sqe_next != (elm))			\
+			curelm = curelm->field.sqe_next;		\
+		if ((curelm->field.sqe_next =				\
+			curelm->field.sqe_next->field.sqe_next) == NULL) \
+			    (head)->sqh_last = &(curelm)->field.sqe_next; \
+	}								\
+} while (/*CONSTCOND*/0)
+
+#define	SIMPLEQ_FOREACH(var, head, field)				\
+	for ((var) = ((head)->sqh_first);				\
+		(var);							\
+		(var) = ((var)->field.sqe_next))
+
+/*
+ * Simple queue access methods.
+ */
+#define	SIMPLEQ_EMPTY(head)		((head)->sqh_first == NULL)
+#define	SIMPLEQ_FIRST(head)		((head)->sqh_first)
+#define	SIMPLEQ_NEXT(elm, field)	((elm)->field.sqe_next)
+
+
+/*
  * Tail queue definitions.
  */
-#define TAILQ_HEAD(name, type)						\
+#define	_TAILQ_HEAD(name, type, qual)					\
 struct name {								\
-	struct type *tqh_first;	/* first element */			\
-	struct type **tqh_last;	/* addr of last next element */		\
+	qual type *tqh_first;		/* first element */		\
+	qual type *qual *tqh_last;	/* addr of last next element */	\
 }
+#define TAILQ_HEAD(name, type)	_TAILQ_HEAD(name, struct type,)
+
+#define	TAILQ_HEAD_INITIALIZER(head)					\
+	{ NULL, &(head).tqh_first }
 
-#define TAILQ_ENTRY(type)						\
+#define	_TAILQ_ENTRY(type, qual)					\
 struct {								\
-	struct type *tqe_next;	/* next element */			\
-	struct type **tqe_prev;	/* address of previous next element */	\
+	qual type *tqe_next;		/* next element */		\
+	qual type *qual *tqe_prev;	/* address of previous next element */\
 }
+#define TAILQ_ENTRY(type)	_TAILQ_ENTRY(struct type,)
 
 /*
  * Tail queue functions.
  */
-#define	TAILQ_INIT(head) {						\
+#define	TAILQ_INIT(head) do {						\
 	(head)->tqh_first = NULL;					\
 	(head)->tqh_last = &(head)->tqh_first;				\
-}
+} while (/*CONSTCOND*/0)
 
-#define TAILQ_INSERT_HEAD(head, elm, field) {				\
+#define	TAILQ_INSERT_HEAD(head, elm, field) do {			\
 	if (((elm)->field.tqe_next = (head)->tqh_first) != NULL)	\
-		(elm)->field.tqe_next->field.tqe_prev =			\
+		(head)->tqh_first->field.tqe_prev =			\
 		    &(elm)->field.tqe_next;				\
 	else								\
 		(head)->tqh_last = &(elm)->field.tqe_next;		\
 	(head)->tqh_first = (elm);					\
 	(elm)->field.tqe_prev = &(head)->tqh_first;			\
-}
+} while (/*CONSTCOND*/0)
 
-#define TAILQ_INSERT_TAIL(head, elm, field) {				\
+#define	TAILQ_INSERT_TAIL(head, elm, field) do {			\
 	(elm)->field.tqe_next = NULL;					\
 	(elm)->field.tqe_prev = (head)->tqh_last;			\
 	*(head)->tqh_last = (elm);					\
 	(head)->tqh_last = &(elm)->field.tqe_next;			\
-}
+} while (/*CONSTCOND*/0)
 
-#define TAILQ_INSERT_AFTER(head, listelm, elm, field) {			\
+#define	TAILQ_INSERT_AFTER(head, listelm, elm, field) do {		\
 	if (((elm)->field.tqe_next = (listelm)->field.tqe_next) != NULL)\
 		(elm)->field.tqe_next->field.tqe_prev = 		\
 		    &(elm)->field.tqe_next;				\
@@ -152,27 +406,60 @@ struct {								\
 		(head)->tqh_last = &(elm)->field.tqe_next;		\
 	(listelm)->field.tqe_next = (elm);				\
 	(elm)->field.tqe_prev = &(listelm)->field.tqe_next;		\
-}
+} while (/*CONSTCOND*/0)
+
+#define	TAILQ_INSERT_BEFORE(listelm, elm, field) do {			\
+	(elm)->field.tqe_prev = (listelm)->field.tqe_prev;		\
+	(elm)->field.tqe_next = (listelm);				\
+	*(listelm)->field.tqe_prev = (elm);				\
+	(listelm)->field.tqe_prev = &(elm)->field.tqe_next;		\
+} while (/*CONSTCOND*/0)
 
-#define TAILQ_REMOVE(head, elm, field) {				\
+#define	TAILQ_REMOVE(head, elm, field) do {				\
 	if (((elm)->field.tqe_next) != NULL)				\
 		(elm)->field.tqe_next->field.tqe_prev = 		\
 		    (elm)->field.tqe_prev;				\
 	else								\
 		(head)->tqh_last = (elm)->field.tqe_prev;		\
 	*(elm)->field.tqe_prev = (elm)->field.tqe_next;			\
-}
+} while (/*CONSTCOND*/0)
+
+#define	TAILQ_FOREACH(var, head, field)					\
+	for ((var) = ((head)->tqh_first);				\
+		(var);							\
+		(var) = ((var)->field.tqe_next))
+
+#define	TAILQ_FOREACH_REVERSE(var, head, headname, field)		\
+	for ((var) = (*(((struct headname *)((head)->tqh_last))->tqh_last));	\
+		(var);							\
+		(var) = (*(((struct headname *)((var)->field.tqe_prev))->tqh_last)))
+
+/*
+ * Tail queue access methods.
+ */
+#define	TAILQ_EMPTY(head)		((head)->tqh_first == NULL)
+#define	TAILQ_FIRST(head)		((head)->tqh_first)
+#define	TAILQ_NEXT(elm, field)		((elm)->field.tqe_next)
+
+#define	TAILQ_LAST(head, headname) \
+	(*(((struct headname *)((head)->tqh_last))->tqh_last))
+#define	TAILQ_PREV(elm, headname, field) \
+	(*(((struct headname *)((elm)->field.tqe_prev))->tqh_last))
+
 
 /*
  * Circular queue definitions.
  */
-#define CIRCLEQ_HEAD(name, type)					\
+#define	CIRCLEQ_HEAD(name, type)					\
 struct name {								\
 	struct type *cqh_first;		/* first element */		\
 	struct type *cqh_last;		/* last element */		\
 }
 
-#define CIRCLEQ_ENTRY(type)						\
+#define	CIRCLEQ_HEAD_INITIALIZER(head)					\
+	{ (void *)&head, (void *)&head }
+
+#define	CIRCLEQ_ENTRY(type)						\
 struct {								\
 	struct type *cqe_next;		/* next element */		\
 	struct type *cqe_prev;		/* previous element */		\
@@ -181,12 +468,12 @@ struct {								\
 /*
  * Circular queue functions.
  */
-#define	CIRCLEQ_INIT(head) {						\
+#define	CIRCLEQ_INIT(head) do {						\
 	(head)->cqh_first = (void *)(head);				\
 	(head)->cqh_last = (void *)(head);				\
-}
+} while (/*CONSTCOND*/0)
 
-#define CIRCLEQ_INSERT_AFTER(head, listelm, elm, field) {		\
+#define	CIRCLEQ_INSERT_AFTER(head, listelm, elm, field) do {		\
 	(elm)->field.cqe_next = (listelm)->field.cqe_next;		\
 	(elm)->field.cqe_prev = (listelm);				\
 	if ((listelm)->field.cqe_next == (void *)(head))		\
@@ -194,9 +481,9 @@ struct {								\
 	else								\
 		(listelm)->field.cqe_next->field.cqe_prev = (elm);	\
 	(listelm)->field.cqe_next = (elm);				\
-}
+} while (/*CONSTCOND*/0)
 
-#define CIRCLEQ_INSERT_BEFORE(head, listelm, elm, field) {		\
+#define	CIRCLEQ_INSERT_BEFORE(head, listelm, elm, field) do {		\
 	(elm)->field.cqe_next = (listelm);				\
 	(elm)->field.cqe_prev = (listelm)->field.cqe_prev;		\
 	if ((listelm)->field.cqe_prev == (void *)(head))		\
@@ -204,9 +491,9 @@ struct {								\
 	else								\
 		(listelm)->field.cqe_prev->field.cqe_next = (elm);	\
 	(listelm)->field.cqe_prev = (elm);				\
-}
+} while (/*CONSTCOND*/0)
 
-#define CIRCLEQ_INSERT_HEAD(head, elm, field) {				\
+#define	CIRCLEQ_INSERT_HEAD(head, elm, field) do {			\
 	(elm)->field.cqe_next = (head)->cqh_first;			\
 	(elm)->field.cqe_prev = (void *)(head);				\
 	if ((head)->cqh_last == (void *)(head))				\
@@ -214,9 +501,9 @@ struct {								\
 	else								\
 		(head)->cqh_first->field.cqe_prev = (elm);		\
 	(head)->cqh_first = (elm);					\
-}
+} while (/*CONSTCOND*/0)
 
-#define CIRCLEQ_INSERT_TAIL(head, elm, field) {				\
+#define	CIRCLEQ_INSERT_TAIL(head, elm, field) do {			\
 	(elm)->field.cqe_next = (void *)(head);				\
 	(elm)->field.cqe_prev = (head)->cqh_last;			\
 	if ((head)->cqh_first == (void *)(head))			\
@@ -224,9 +511,9 @@ struct {								\
 	else								\
 		(head)->cqh_last->field.cqe_next = (elm);		\
 	(head)->cqh_last = (elm);					\
-}
+} while (/*CONSTCOND*/0)
 
-#define	CIRCLEQ_REMOVE(head, elm, field) {				\
+#define	CIRCLEQ_REMOVE(head, elm, field) do {				\
 	if ((elm)->field.cqe_next == (void *)(head))			\
 		(head)->cqh_last = (elm)->field.cqe_prev;		\
 	else								\
@@ -237,5 +524,34 @@ struct {								\
 	else								\
 		(elm)->field.cqe_prev->field.cqe_next =			\
 		    (elm)->field.cqe_next;				\
-}
+} while (/*CONSTCOND*/0)
+
+#define	CIRCLEQ_FOREACH(var, head, field)				\
+	for ((var) = ((head)->cqh_first);				\
+		(var) != (const void *)(head);				\
+		(var) = ((var)->field.cqe_next))
+
+#define	CIRCLEQ_FOREACH_REVERSE(var, head, field)			\
+	for ((var) = ((head)->cqh_last);				\
+		(var) != (const void *)(head);				\
+		(var) = ((var)->field.cqe_prev))
+
+/*
+ * Circular queue access methods.
+ */
+#define	CIRCLEQ_EMPTY(head)		((head)->cqh_first == (void *)(head))
+#define	CIRCLEQ_FIRST(head)		((head)->cqh_first)
+#define	CIRCLEQ_LAST(head)		((head)->cqh_last)
+#define	CIRCLEQ_NEXT(elm, field)	((elm)->field.cqe_next)
+#define	CIRCLEQ_PREV(elm, field)	((elm)->field.cqe_prev)
+
+#define CIRCLEQ_LOOP_NEXT(head, elm, field)				\
+	(((elm)->field.cqe_next == (void *)(head))			\
+	    ? ((head)->cqh_first)					\
+	    : (elm->field.cqe_next))
+#define CIRCLEQ_LOOP_PREV(head, elm, field)				\
+	(((elm)->field.cqe_prev == (void *)(head))			\
+	    ? ((head)->cqh_last)					\
+	    : (elm->field.cqe_prev))
+
 #endif	/* sys/queue.h */
diff --git a/misc/sys/syslog.h b/misc/sys/syslog.h
index ace88a0979..4ed57c2787 100644
--- a/misc/sys/syslog.h
+++ b/misc/sys/syslog.h
@@ -36,8 +36,8 @@
 #define __need___va_list
 #include <stdarg.h>
 
-
-#define	_PATH_LOG	"/dev/log"
+/* This file defines _PATH_LOG.  */
+#include <bits/syslog-path.h>
 
 /*
  * priorities/facilities are encoded into a single 32-bit quantity, where the
@@ -168,7 +168,7 @@ CODE facilitynames[] =
 
 __BEGIN_DECLS
 
-/* Close desriptor used to write to system logger.
+/* Close descriptor used to write to system logger.
 
    This function is a possible cancellation point and therefore not
    marked with __THROW.  */
@@ -188,7 +188,7 @@ extern int setlogmask (int __mask) __THROW;
    This function is a possible cancellation point and therefore not
    marked with __THROW.  */
 extern void syslog (int __pri, __const char *__fmt, ...)
-     __attribute__ ((__format__(__printf__, 2, 3)));
+     __attribute__ ((__format__ (__printf__, 2, 3)));
 
 #ifdef __USE_BSD
 /* Generate a log message using FMT and using arguments pointed to by AP.
@@ -198,7 +198,16 @@ extern void syslog (int __pri, __const char *__fmt, ...)
    or due to the implementation it is a cancellation point and
    therefore not marked with __THROW.  */
 extern void vsyslog (int __pri, __const char *__fmt, __gnuc_va_list __ap)
-     __attribute__ ((__format__(__printf__, 2, 0)));
+     __attribute__ ((__format__ (__printf__, 2, 0)));
+#endif
+
+
+/* Define some macros helping to catch buffer overflows.  */
+#if __USE_FORTIFY_LEVEL > 0 && !defined __cplusplus
+# include <bits/syslog.h>
+#endif
+#ifdef __LDBL_COMPAT
+# include <bits/syslog-ldbl.h>
 #endif
 
 __END_DECLS
diff --git a/misc/syscall.c b/misc/syscall.c
new file mode 100644
index 0000000000..ad78a06b73
--- /dev/null
+++ b/misc/syscall.c
@@ -0,0 +1,35 @@
+/* Copyright (C) 1993, 1994, 1995, 1996, 1997 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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <sysdep.h>
+#include <errno.h>
+#include <unistd.h>
+
+/* Do system call CALLNO, passing it the remaining arguments.
+   This only makes sense in certain operating systems.  */
+
+long int
+syscall (callno)
+     long int callno;
+{
+  __set_errno (ENOSYS);
+  return -1;
+}
+
+stub_warning (syscall)
+#include <stub-tag.h>
diff --git a/misc/syslog.c b/misc/syslog.c
index 6916356da7..5781b4a964 100644
--- a/misc/syslog.c
+++ b/misc/syslog.c
@@ -35,6 +35,7 @@ static char sccsid[] = "@(#)syslog.c	8.4 (Berkeley) 3/18/94";
 #include <sys/socket.h>
 #include <sys/syslog.h>
 #include <sys/uio.h>
+#include <sys/un.h>
 #include <netdb.h>
 
 #include <errno.h>
@@ -57,6 +58,8 @@ static char sccsid[] = "@(#)syslog.c	8.4 (Berkeley) 3/18/94";
 #endif
 
 #include <libio/iolibio.h>
+#include <math_ldbl_opt.h>
+
 #define ftell(s) INTUSE(_IO_ftell) (s)
 
 static int	LogType = SOCK_DGRAM;	/* type of socket connection */
@@ -73,8 +76,13 @@ __libc_lock_define_initialized (static, syslog_lock)
 
 static void openlog_internal(const char *, int, int) internal_function;
 static void closelog_internal(void);
+#ifndef NO_SIGPIPE
 static void sigpipe_handler (int);
+#endif
 
+#ifndef send_flags
+# define send_flags 0
+#endif
 
 struct cleanup_arg
 {
@@ -85,11 +93,13 @@ struct cleanup_arg
 static void
 cancel_handler (void *ptr)
 {
+#ifndef NO_SIGPIPE
   /* Restore the old signal handler.  */
   struct cleanup_arg *clarg = (struct cleanup_arg *) ptr;
 
   if (clarg != NULL && clarg->oldaction != NULL)
     __sigaction (SIGPIPE, clarg->oldaction, NULL);
+#endif
 
   /* Free the lock.  */
   __libc_lock_unlock (syslog_lock);
@@ -101,32 +111,29 @@ cancel_handler (void *ptr)
  *	print message on log file; output is intended for syslogd(8).
  */
 void
-#if __STDC__
-syslog(int pri, const char *fmt, ...)
-#else
-syslog(pri, fmt, va_alist)
-	int pri;
-	char *fmt;
-	va_dcl
-#endif
+__syslog(int pri, const char *fmt, ...)
 {
 	va_list ap;
 
-#if __STDC__
 	va_start(ap, fmt);
-#else
-	va_start(ap);
-#endif
-	vsyslog(pri, fmt, ap);
+	__vsyslog_chk(pri, -1, fmt, ap);
 	va_end(ap);
 }
-libc_hidden_def (syslog)
+ldbl_hidden_def (__syslog, syslog)
+ldbl_strong_alias (__syslog, syslog)
 
 void
-vsyslog(pri, fmt, ap)
-	int pri;
-	register const char *fmt;
+__syslog_chk(int pri, int flag, const char *fmt, ...)
+{
 	va_list ap;
+
+	va_start(ap, fmt);
+	__vsyslog_chk(pri, flag, fmt, ap);
+	va_end(ap);
+}
+
+void
+__vsyslog_chk(int pri, int flag, const char *fmt, va_list ap)
 {
 	struct tm now_tm;
 	time_t now;
@@ -135,8 +142,10 @@ vsyslog(pri, fmt, ap)
 	char *buf = 0;
 	size_t bufsize = 0;
 	size_t prioff, msgoff;
+#ifndef NO_SIGPIPE
  	struct sigaction action, oldaction;
  	int sigpipe;
+#endif
 	int saved_errno = errno;
 	char failbuf[3 * sizeof (pid_t) + sizeof "out of memory []"];
 
@@ -190,7 +199,7 @@ vsyslog(pri, fmt, ap)
 					      - f->_IO_write_ptr,
 					      "%h %e %T ",
 					      __localtime_r (&now, &now_tm),
-					      &_nl_C_locobj);
+					      _nl_C_locobj_ptr);
 	    msgoff = ftell (f);
 	    if (LogTag == NULL)
 	      LogTag = __progname;
@@ -209,7 +218,10 @@ vsyslog(pri, fmt, ap)
 
 	    /* We have the header.  Print the user's format into the
                buffer.  */
-	    vfprintf (f, fmt, ap);
+	    if (flag == -1)
+	      vfprintf (f, fmt, ap);
+	    else
+	      __vfprintf_chk (f, flag, fmt, ap);
 
 	    /* Close the memory stream; this will finalize the data
 	       into a malloc'd buffer in BUF.  */
@@ -247,6 +259,7 @@ vsyslog(pri, fmt, ap)
 	__libc_cleanup_push (cancel_handler, &clarg);
 	__libc_lock_lock (syslog_lock);
 
+#ifndef NO_SIGPIPE
 	/* Prepare for a broken connection.  */
  	memset (&action, 0, sizeof (action));
  	action.sa_handler = sigpipe_handler;
@@ -254,6 +267,7 @@ vsyslog(pri, fmt, ap)
  	sigpipe = __sigaction (SIGPIPE, &action, &oldaction);
 	if (sigpipe == 0)
 	  clarg.oldaction = &oldaction;
+#endif
 
 	/* Get connected, output the message to the local logger. */
 	if (!connected)
@@ -264,7 +278,7 @@ vsyslog(pri, fmt, ap)
 	if (LogType == SOCK_STREAM)
 	  ++bufsize;
 
-	if (!connected || __send(LogFile, buf, bufsize, 0) < 0)
+	if (!connected || __send(LogFile, buf, bufsize, send_flags) < 0)
 	  {
 	    if (connected)
 	      {
@@ -274,7 +288,7 @@ vsyslog(pri, fmt, ap)
 		openlog_internal(LogTag, LogStat | LOG_NDELAY, 0);
 	      }
 
-	    if (!connected || __send(LogFile, buf, bufsize, 0) < 0)
+	    if (!connected || __send(LogFile, buf, bufsize, send_flags) < 0)
 	      {
 		closelog_internal ();	/* attempt re-open next time */
 		/*
@@ -292,8 +306,10 @@ vsyslog(pri, fmt, ap)
 	      }
 	  }
 
+#ifndef NO_SIGPIPE
 	if (sigpipe == 0)
 		__sigaction (SIGPIPE, &oldaction, (struct sigaction *) NULL);
+#endif
 
 	/* End of critical section.  */
 	__libc_cleanup_pop (0);
@@ -302,9 +318,17 @@ vsyslog(pri, fmt, ap)
 	if (buf != failbuf)
 		free (buf);
 }
-libc_hidden_def (vsyslog)
+libc_hidden_def (__vsyslog_chk)
+
+void
+__vsyslog(int pri, const char *fmt, va_list ap)
+{
+  __vsyslog_chk (pri, -1, fmt, ap);
+}
+ldbl_hidden_def (__vsyslog, vsyslog)
+ldbl_strong_alias (__vsyslog, vsyslog)
 
-static struct sockaddr SyslogAddr;	/* AF_UNIX address of local logger */
+static struct sockaddr_un SyslogAddr;	/* AF_UNIX address of local logger */
 
 
 static void
@@ -320,9 +344,9 @@ openlog_internal(const char *ident, int logstat, int logfac)
 	int retry = 0;
 	while (retry < 2) {
 		if (LogFile == -1) {
-			SyslogAddr.sa_family = AF_UNIX;
-			(void)strncpy(SyslogAddr.sa_data, _PATH_LOG,
-				      sizeof(SyslogAddr.sa_data));
+			SyslogAddr.sun_family = AF_UNIX;
+			(void)strncpy(SyslogAddr.sun_path, _PATH_LOG,
+				      sizeof(SyslogAddr.sun_path));
 			if (LogStat & LOG_NDELAY) {
 				if ((LogFile = __socket(AF_UNIX, LogType, 0))
 				    == -1)
@@ -368,11 +392,13 @@ openlog (const char *ident, int logstat, int logfac)
   __libc_cleanup_pop (1);
 }
 
+#ifndef NO_SIGPIPE
 static void
 sigpipe_handler (int signo)
 {
   closelog_internal ();
 }
+#endif
 
 static void
 closelog_internal()
diff --git a/misc/truncate.c b/misc/truncate.c
new file mode 100644
index 0000000000..6d0f0c3bcb
--- /dev/null
+++ b/misc/truncate.c
@@ -0,0 +1,34 @@
+/* Copyright (C) 1991, 1995, 1996, 1997, 2004 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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <sys/types.h>
+#include <errno.h>
+
+/* Truncate PATH to LENGTH bytes.  */
+int
+__truncate (path, length)
+     const char *path;
+     off_t length;
+{
+  __set_errno (ENOSYS);
+  return -1;
+}
+weak_alias (__truncate, truncate)
+
+stub_warning (truncate)
+#include <stub-tag.h>
diff --git a/misc/truncate64.c b/misc/truncate64.c
new file mode 100644
index 0000000000..d7e80dc3ae
--- /dev/null
+++ b/misc/truncate64.c
@@ -0,0 +1,35 @@
+/* Copyright (C) 1997 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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <sys/types.h>
+#include <errno.h>
+#include <unistd.h>
+
+/* Truncate PATH to LENGTH bytes.  */
+int
+truncate64 (path, length)
+     const char *path;
+     off64_t length;
+{
+  if ((off_t) length != length)
+    {
+      __set_errno (EINVAL);
+      return -1;
+    }
+  return truncate (path, (off_t) length);
+}
diff --git a/misc/tsearch.c b/misc/tsearch.c
index 7c3a0aaa78..1e94d64595 100644
--- a/misc/tsearch.c
+++ b/misc/tsearch.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1995, 1996, 1997, 2000 Free Software Foundation, Inc.
+/* Copyright (C) 1995, 1996, 1997, 2000, 2006 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Bernd Schmidt <crux@Pool.Informatik.RWTH-Aachen.DE>, 1997.
 
@@ -285,11 +285,12 @@ __tsearch (const void *key, void **vrootp, __compar_fn_t compar)
       q->key = key;			/* initialize new node */
       q->red = 1;
       q->left = q->right = NULL;
+
+      if (nextp != rootp)
+	/* There may be two red edges in a row now, which we must avoid by
+	   rotating the tree.  */
+	maybe_split_for_insert (nextp, rootp, parentp, r, p_r, 1);
     }
-  if (nextp != rootp)
-    /* There may be two red edges in a row now, which we must avoid by
-       rotating the tree.  */
-    maybe_split_for_insert (nextp, rootp, parentp, r, p_r, 1);
 
   return q;
 }
@@ -446,7 +447,7 @@ __tdelete (const void *key, void **vrootp, __compar_fn_t compar)
 	      /* Q is R's brother, P is R's parent.  The subtree with root
 		 R has one black edge less than the subtree with root Q.  */
 	      q = p->right;
-	      if (q != NULL && q->red)
+	      if (q->red)
 		{
 		  /* If Q is red, we know that P is black. We rotate P left
 		     so that Q becomes the top node in the tree, with P below
@@ -534,7 +535,7 @@ __tdelete (const void *key, void **vrootp, __compar_fn_t compar)
 	    {
 	      /* Comments: see above.  */
 	      q = p->left;
-	      if (q != NULL && q->red)
+	      if (q->red)
 		{
 		  q->red = 0;
 		  p->red = 1;
diff --git a/misc/tst-error1.c b/misc/tst-error1.c
new file mode 100644
index 0000000000..e84843ed2f
--- /dev/null
+++ b/misc/tst-error1.c
@@ -0,0 +1,26 @@
+#include <error.h>
+#include <mcheck.h>
+#include <stdio.h>
+#include <string.h>
+#include <wchar.h>
+
+static int
+do_test (int argc, char *argv[])
+{
+  mtrace ();
+  (void) freopen (argc == 1 ? "/dev/stdout" : argv[1], "a", stderr);
+  /* Orient the stream.  */
+  fwprintf (stderr, L"hello world\n");
+  char buf[20000];
+  static const char str[] = "hello world! ";
+  for (int i = 0; i < 1000; ++i)
+    memcpy (&buf[i * (sizeof (str) - 1)], str, sizeof (str));
+  error (0, 0, str);
+  error (0, 0, buf);
+  error (0, 0, buf);
+  error (0, 0, str);
+  return 0;
+}
+
+#define TEST_FUNCTION do_test (argc, argv)
+#include "../test-skeleton.c"
diff --git a/misc/tst-insremque.c b/misc/tst-insremque.c
new file mode 100644
index 0000000000..9f17055ef5
--- /dev/null
+++ b/misc/tst-insremque.c
@@ -0,0 +1,61 @@
+#include <search.h>
+#include <stdio.h>
+#include <string.h>
+
+#define CHECK(cond) \
+  do									\
+    if (! (cond))							\
+      {									\
+	printf ("Condition " #cond " not true on line %d\n", __LINE__);	\
+	ret = 1;							\
+      }									\
+  while (0)
+
+static int
+do_test (void)
+{
+  struct qelem elements[4];
+  int ret = 0;
+
+  /* Linear list.  */
+  memset (elements, 0xff, sizeof (elements));
+  insque (&elements[0], NULL);
+  remque (&elements[0]);
+  insque (&elements[0], NULL);
+  insque (&elements[2], &elements[0]);
+  insque (&elements[1], &elements[0]);
+  insque (&elements[3], &elements[2]);
+  remque (&elements[2]);
+  insque (&elements[2], &elements[0]);
+  CHECK (elements[0].q_back == NULL);
+  CHECK (elements[0].q_forw == &elements[2]);
+  CHECK (elements[1].q_back == &elements[2]);
+  CHECK (elements[1].q_forw == &elements[3]);
+  CHECK (elements[2].q_back == &elements[0]);
+  CHECK (elements[2].q_forw == &elements[1]);
+  CHECK (elements[3].q_back == &elements[1]);
+  CHECK (elements[3].q_forw == NULL);
+
+  /* Circular list.  */
+  memset (elements, 0xff, sizeof (elements));
+  elements[0].q_back = &elements[0];
+  elements[0].q_forw = &elements[0];
+  insque (&elements[2], &elements[0]);
+  insque (&elements[1], &elements[0]);
+  insque (&elements[3], &elements[2]);
+  remque (&elements[2]);
+  insque (&elements[2], &elements[0]);
+  CHECK (elements[0].q_back == &elements[3]);
+  CHECK (elements[0].q_forw == &elements[2]);
+  CHECK (elements[1].q_back == &elements[2]);
+  CHECK (elements[1].q_forw == &elements[3]);
+  CHECK (elements[2].q_back == &elements[0]);
+  CHECK (elements[2].q_forw == &elements[1]);
+  CHECK (elements[3].q_back == &elements[1]);
+  CHECK (elements[3].q_forw == &elements[0]);
+
+  return ret;
+}
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
diff --git a/misc/tst-mntent2.c b/misc/tst-mntent2.c
new file mode 100644
index 0000000000..6c25e0127c
--- /dev/null
+++ b/misc/tst-mntent2.c
@@ -0,0 +1,41 @@
+#include <mntent.h>
+#include <stdio.h>
+#include <string.h>
+
+
+int
+main (void)
+{
+  int result = 0;
+  struct mntent mef;
+
+  mef.mnt_fsname = strdupa ("/dev/sdf6");
+  mef.mnt_dir = strdupa ("/some dir");
+  mef.mnt_type = strdupa ("ext3");
+  mef.mnt_opts = strdupa ("opt1,opt2,noopt=6,rw,norw,brw");
+  mef.mnt_freq = 1;
+  mef.mnt_passno = 2;
+
+#define TEST(opt, found) \
+  if (!!hasmntopt (&mef, (opt)) != (found))				\
+    {									\
+      printf ("Option %s was %sfound\n", (opt), (found) ? "not " : "");	\
+      result = 1;							\
+    }
+
+  TEST ("opt1", 1)
+  TEST ("opt2", 1)
+  TEST ("noopt", 1)
+  TEST ("rw", 1)
+  TEST ("norw", 1)
+  TEST ("brw", 1)
+  TEST ("opt", 0)
+  TEST ("oopt", 0)
+  TEST ("w", 0)
+  TEST ("r", 0)
+  TEST ("br", 0)
+  TEST ("nor", 0)
+  TEST ("or", 0)
+
+  return result;
+}
diff --git a/misc/tst-pselect.c b/misc/tst-pselect.c
new file mode 100644
index 0000000000..35d51d8ee0
--- /dev/null
+++ b/misc/tst-pselect.c
@@ -0,0 +1,128 @@
+#include <errno.h>
+#include <signal.h>
+#include <stdio.h>
+#include <unistd.h>
+#include <sys/select.h>
+#include <sys/wait.h>
+
+
+static volatile int handler_called;
+
+static void
+handler (int sig)
+{
+  handler_called = 1;
+}
+
+
+static int
+do_test (void)
+{
+  struct sigaction sa;
+  sa.sa_handler = handler;
+  sa.sa_flags = 0;
+  sigemptyset (&sa.sa_mask);
+
+  if (sigaction (SIGUSR1, &sa, NULL) != 0)
+    {
+      puts ("sigaction failed");
+      return 1;
+    }
+
+  sa.sa_handler = SIG_IGN;
+  sa.sa_flags = SA_NOCLDWAIT;
+
+  if (sigaction (SIGCHLD, &sa, NULL) != 0)
+    {
+      puts ("2nd sigaction failed");
+      return 1;
+    }
+
+  if (sigblock (sigmask (SIGUSR1)) != 0)
+    {
+      puts ("sigblock failed");
+      return 1;
+    }
+
+  int fds[2][2];
+
+  if (pipe (fds[0]) != 0 || pipe (fds[1]) != 0)
+    {
+      puts ("pipe failed");
+      return 1;
+    }
+
+  fd_set rfds;
+  FD_ZERO (&rfds);
+
+  sigset_t ss;
+  sigprocmask (SIG_SETMASK, NULL, &ss);
+  sigdelset (&ss, SIGUSR1);
+
+  struct timespec to = { .tv_sec = 0, .tv_nsec = 500000000 };
+
+  pid_t parent = getpid ();
+  pid_t p = fork ();
+  if (p == 0)
+    {
+      close (fds[0][1]);
+      close (fds[1][0]);
+
+      FD_SET (fds[0][0], &rfds);
+
+      int e;
+      do
+	{
+	  if (getppid () != parent)
+	    exit (2);
+
+	  errno = 0;
+	  e = pselect (fds[0][0] + 1, &rfds, NULL, NULL, &to, &ss);
+	}
+      while (e == 0);
+
+      if (e != -1)
+	{
+	  puts ("child: pselect did not fail");
+	  return 0;
+	}
+      if (errno != EINTR)
+	{
+	  puts ("child: pselect did not set errno to EINTR");
+	  return 0;
+	}
+
+      TEMP_FAILURE_RETRY (write (fds[1][1], "foo", 3));
+
+      exit (0);
+    }
+
+  close (fds[0][0]);
+  close (fds[1][1]);
+
+  FD_SET (fds[1][0], &rfds);
+
+  kill (p, SIGUSR1);
+
+  int e = pselect (fds[1][0] + 1, &rfds, NULL, NULL, NULL, &ss);
+  if (e == -1)
+    {
+      puts ("parent: pselect failed");
+      return 1;
+    }
+  if (e != 1)
+    {
+      puts ("parent: pselect did not report readable fd");
+      return 1;
+    }
+  if (!FD_ISSET (fds[1][0], &rfds))
+    {
+      puts ("parent: pselect reports wrong fd");
+      return 1;
+    }
+
+  return 0;
+}
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
diff --git a/misc/ualarm.c b/misc/ualarm.c
new file mode 100644
index 0000000000..4ca0847576
--- /dev/null
+++ b/misc/ualarm.c
@@ -0,0 +1,37 @@
+/* Copyright (C) 1991, 1995, 1996, 1997, 1999 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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <errno.h>
+#include <unistd.h>
+
+/* Set an alarm to go off (generating a SIGALRM signal) in VALUE microseconds.
+   If INTERVAL is nonzero, when the alarm goes off, the timer is reset to go
+   off every INTERVAL microseconds thereafter.
+
+   Returns the number of microseconds remaining before the alarm.  */
+useconds_t
+ualarm (value, interval)
+     useconds_t value;
+     useconds_t interval;
+{
+  __set_errno (ENOSYS);
+  return -1;
+}
+
+stub_warning (ualarm)
+#include <stub-tag.h>
diff --git a/misc/usleep.c b/misc/usleep.c
new file mode 100644
index 0000000000..8f419f901a
--- /dev/null
+++ b/misc/usleep.c
@@ -0,0 +1,32 @@
+/* Copyright (C) 1991,1995,1996,1997,1999,2001 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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <errno.h>
+#include <unistd.h>
+
+/* Sleep USECONDS microseconds, or until a previously set timer goes off.  */
+int
+usleep (useconds)
+     useconds_t useconds;
+{
+  __set_errno (ENOSYS);
+  return -1;
+}
+
+stub_warning (usleep)
+#include <stub-tag.h>
diff --git a/misc/ustat.c b/misc/ustat.c
new file mode 100644
index 0000000000..0aeee620c5
--- /dev/null
+++ b/misc/ustat.c
@@ -0,0 +1,33 @@
+/* Return info on filesystem.
+   Copyright (C) 1995, 1996, 1997 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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <unistd.h>
+#include <errno.h>
+#include <sys/ustat.h>
+
+int
+ustat (dev, ust)
+     dev_t dev;
+     struct ustat * ust;
+{
+  __set_errno (ENOSYS);
+  return -1;
+}
+stub_warning (ustat)
+#include <stub-tag.h>
diff --git a/misc/utimes.c b/misc/utimes.c
new file mode 100644
index 0000000000..e4a6f0427f
--- /dev/null
+++ b/misc/utimes.c
@@ -0,0 +1,43 @@
+/* Copyright (C) 1991,95,96,97,2000,02 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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <sys/time.h>
+#include <errno.h>
+#include <stddef.h>
+
+/* Change the access time of FILE to TVP[0] and
+   the modification time of FILE to TVP[1].  */
+int
+__utimes (file, tvp)
+     const char *file;
+     const struct timeval tvp[2];
+{
+  if (file == NULL)
+    {
+      __set_errno (EINVAL);
+      return -1;
+    }
+
+  __set_errno (ENOSYS);
+  return -1;
+}
+
+weak_alias (__utimes, utimes)
+
+stub_warning (utimes)
+#include <stub-tag.h>
diff --git a/misc/vhangup.c b/misc/vhangup.c
new file mode 100644
index 0000000000..329fddbf24
--- /dev/null
+++ b/misc/vhangup.c
@@ -0,0 +1,33 @@
+/* Copyright (C) 1991, 1995, 1996, 1997 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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <errno.h>
+#include <unistd.h>
+
+/* Revoke access permissions to all processes currently communicating
+   with the control terminal, and then send a SIGHUP signal to the process
+   group of the control terminal.  */
+int
+vhangup ()
+{
+  __set_errno (ENOSYS);
+  return -1;
+}
+
+stub_warning (vhangup)
+#include <stub-tag.h>
diff --git a/misc/writev.c b/misc/writev.c
new file mode 100644
index 0000000000..d424c72143
--- /dev/null
+++ b/misc/writev.c
@@ -0,0 +1,41 @@
+/* Copyright (C) 1991,1995,1996,1997,1998,2002 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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <errno.h>
+#include <unistd.h>
+#include <sys/uio.h>
+
+/* Write data pointed by the buffers described by VECTOR, which
+   is a vector of COUNT `struct iovec's, to file descriptor FD.
+   The data is written in the order specified.
+   Operates just like `write' (see <unistd.h>) except that the data
+   are taken from VECTOR instead of a contiguous buffer.  */
+ssize_t
+__libc_writev (fd, vector, count)
+     int fd;
+     const struct iovec *vector;
+     int count;
+{
+  __set_errno (ENOSYS);
+  return -1;
+}
+strong_alias (__libc_writev, __writev)
+weak_alias (__libc_writev, writev)
+
+stub_warning (writev)
+#include <stub-tag.h>