summary refs log tree commit diff
path: root/sysdeps
diff options
context:
space:
mode:
Diffstat (limited to 'sysdeps')
-rw-r--r--sysdeps/generic/bits/confname.h10
-rw-r--r--sysdeps/generic/bits/resource.h15
-rw-r--r--sysdeps/generic/bits/stat.h14
-rw-r--r--sysdeps/generic/bits/statfs.h24
-rw-r--r--sysdeps/generic/bits/stdio_lim.h23
-rw-r--r--sysdeps/generic/fstatfs64.c21
-rw-r--r--sysdeps/generic/ftruncate64.c35
-rw-r--r--sysdeps/generic/getrlimit.c3
-rw-r--r--sysdeps/generic/getrlimit64.c23
-rw-r--r--sysdeps/generic/setrlimit.c3
-rw-r--r--sysdeps/generic/setrlimit64.c17
-rw-r--r--sysdeps/generic/statfs64.c21
-rw-r--r--sysdeps/generic/sysconf.c11
-rw-r--r--sysdeps/generic/testrtsig.h2
-rw-r--r--sysdeps/generic/truncate64.c35
-rw-r--r--sysdeps/generic/ulimit.c6
-rw-r--r--sysdeps/generic/waitid.c1
-rw-r--r--sysdeps/m68k/fpu/bits/mathinline.h9
-rw-r--r--sysdeps/posix/mk-stdiolim.c57
-rw-r--r--sysdeps/posix/sysconf.c47
-rw-r--r--sysdeps/standalone/arm/bits/errno.h1
-rw-r--r--sysdeps/unix/bsd/sun/sunos4/bits/resource.h4
-rw-r--r--sysdeps/unix/bsd/ulimit.c68
-rw-r--r--sysdeps/unix/sysv/linux/Dist2
-rw-r--r--sysdeps/unix/sysv/linux/Makefile4
-rw-r--r--sysdeps/unix/sysv/linux/alpha/bits/types.h3
-rw-r--r--sysdeps/unix/sysv/linux/alpha/fstatfs64.c1
-rw-r--r--sysdeps/unix/sysv/linux/alpha/ftruncate64.c1
-rw-r--r--sysdeps/unix/sysv/linux/alpha/getrlimit64.c1
-rw-r--r--sysdeps/unix/sysv/linux/alpha/init-first.h48
-rw-r--r--sysdeps/unix/sysv/linux/alpha/readdir.c4
-rw-r--r--sysdeps/unix/sysv/linux/alpha/readdir64.c1
-rw-r--r--sysdeps/unix/sysv/linux/alpha/readdir64_r.c1
-rw-r--r--sysdeps/unix/sysv/linux/alpha/readdir_r.c4
-rw-r--r--sysdeps/unix/sysv/linux/alpha/setrlimit64.c1
-rw-r--r--sysdeps/unix/sysv/linux/alpha/statfs64.c1
-rw-r--r--sysdeps/unix/sysv/linux/alpha/syscalls.list8
-rw-r--r--sysdeps/unix/sysv/linux/alpha/truncate64.c1
-rw-r--r--sysdeps/unix/sysv/linux/bits/msq.h16
-rw-r--r--sysdeps/unix/sysv/linux/bits/resource.h16
-rw-r--r--sysdeps/unix/sysv/linux/bits/shm.h16
-rw-r--r--sysdeps/unix/sysv/linux/bits/termios.h82
-rw-r--r--sysdeps/unix/sysv/linux/bits/types.h3
-rw-r--r--sysdeps/unix/sysv/linux/fxstat64.c41
-rw-r--r--sysdeps/unix/sysv/linux/getdents.c6
-rw-r--r--sysdeps/unix/sysv/linux/getdents64.c2
-rw-r--r--sysdeps/unix/sysv/linux/lxstat64.c41
-rw-r--r--sysdeps/unix/sysv/linux/mips/bits/types.h130
-rw-r--r--sysdeps/unix/sysv/linux/readdir64.c103
-rw-r--r--sysdeps/unix/sysv/linux/readdir64_r.c107
-rw-r--r--sysdeps/unix/sysv/linux/rt_sigpending.c (renamed from sysdeps/unix/sysv/linux/powerpc/sigreturn.S)14
-rw-r--r--sysdeps/unix/sysv/linux/siglist.c4
-rw-r--r--sysdeps/unix/sysv/linux/sparc/sparc64/bits/types.h3
-rw-r--r--sysdeps/unix/sysv/linux/sparc/sparc64/fstatfs64.c1
-rw-r--r--sysdeps/unix/sysv/linux/sparc/sparc64/ftruncate64.c1
-rw-r--r--sysdeps/unix/sysv/linux/sparc/sparc64/getrlimit64.c1
-rw-r--r--sysdeps/unix/sysv/linux/sparc/sparc64/readdir.c4
-rw-r--r--sysdeps/unix/sysv/linux/sparc/sparc64/readdir64.c1
-rw-r--r--sysdeps/unix/sysv/linux/sparc/sparc64/readdir64_r.c1
-rw-r--r--sysdeps/unix/sysv/linux/sparc/sparc64/readdir_r.c4
-rw-r--r--sysdeps/unix/sysv/linux/sparc/sparc64/setrlimit64.c1
-rw-r--r--sysdeps/unix/sysv/linux/sparc/sparc64/statfs64.c1
-rw-r--r--sysdeps/unix/sysv/linux/sparc/sparc64/syscalls.list6
-rw-r--r--sysdeps/unix/sysv/linux/sparc/sparc64/truncate64.c1
-rw-r--r--sysdeps/unix/sysv/linux/stdio_lim.h.in23
-rw-r--r--sysdeps/unix/sysv/linux/testrtsig.h4
-rw-r--r--sysdeps/unix/sysv/linux/ulimit.c55
-rw-r--r--sysdeps/unix/sysv/linux/xstat64.c41
-rw-r--r--sysdeps/unix/sysv/linux/xstatconv.c62
-rw-r--r--sysdeps/wordsize-32/inttypes.h9
-rw-r--r--sysdeps/wordsize-64/inttypes.h9
71 files changed, 1109 insertions, 231 deletions
diff --git a/sysdeps/generic/bits/confname.h b/sysdeps/generic/bits/confname.h
index 1b75d6e5b5..8aac5cb67d 100644
--- a/sysdeps/generic/bits/confname.h
+++ b/sysdeps/generic/bits/confname.h
@@ -41,6 +41,7 @@ enum
     _PC_NO_TRUNC,
 #define	_PC_NO_TRUNC			_PC_NO_TRUNC
     _PC_VDISABLE,
+#define _PC_VDISABLE			_PC_VDISABLE
     _PC_SYNC_IO,
 #define	_PC_SYNC_IO			_PC_SYNC_IO
     _PC_ASYNC_IO,
@@ -325,8 +326,15 @@ enum
 #define _SC_XBS5_ILP32_OFFBIG		_SC_XBS5_ILP32_OFFBIG
     _SC_XBS5_LP64_OFF64,
 #define _SC_XBS5_LP64_OFF64		_SC_XBS5_LP64_OFF64
-    _SC_XBS5_LPBIG_OFFBIG
+    _SC_XBS5_LPBIG_OFFBIG,
 #define _SC_XBS5_LPBIG_OFFBIG		_SC_XBS5_LPBIG_OFFBIG
+
+    _SC_XOPEN_LEGACY,
+#define _SC_XOPEN_LEGACY		_SC_XOPEN_LEGACY
+    _SC_XOPEN_REALTIME,
+#define _SC_XOPEN_REALTIME		_SC_XOPEN_REALTIME
+    _SC_XOPEN_REALTIME_THREADS
+#define _SC_XOPEN_REALTIME_THREADS	_SC_XOPEN_REALTIME_THREADS
   };
 
 #if (defined __USE_POSIX2 || defined __USE_UNIX98 \
diff --git a/sysdeps/generic/bits/resource.h b/sysdeps/generic/bits/resource.h
index e72836d3c7..e29be98210 100644
--- a/sysdeps/generic/bits/resource.h
+++ b/sysdeps/generic/bits/resource.h
@@ -66,11 +66,20 @@ enum __rlimit_resource
 
     RLIMIT_NLIMITS,		/* Number of limit flavors.  */
     RLIM_NLIMITS = RLIMIT_NLIMITS, /* Traditional name for same.  */
-
-    RLIM_INFINITY = 0x7fffffff /* Value to indicate that there is no limit.  */
-#define RLIM_INFINITY RLIM_INFINITY
   };
 
+/* Value to indicate that there is no limit.  */
+#ifndef __USE_FILE_OFFSET64
+# define RLIM_INFINITY 0x7fffffff
+#else
+# define RLIM_INFINITY 0x7fffffffffffffffLL
+#endif
+
+#ifdef __USE_LARGEFILE64
+# define RLIM64_INFINITY 0x7fffffffffffffffLL
+#endif
+
+
 /* Type for resource quantity measurement.  */
 #ifndef __USE_FILE_OFFSET64
 typedef __rlim_t rlim_t;
diff --git a/sysdeps/generic/bits/stat.h b/sysdeps/generic/bits/stat.h
index a0edf2be52..bdc3a48de9 100644
--- a/sysdeps/generic/bits/stat.h
+++ b/sysdeps/generic/bits/stat.h
@@ -31,13 +31,21 @@ struct stat
     /* These are the members that POSIX.1 requires.  */
 
     __mode_t st_mode;		/* File mode.  */
+#ifndef __USE_FILE_OFFSET64
     __ino_t st_ino;		/* File serial number.  */
+#else
+    __ino64_t st_ino;		/* File serial number.	*/
+#endif
     __dev_t st_dev;		/* Device containing the file.  */
     __nlink_t st_nlink;		/* Link count.  */
 
     __uid_t st_uid;		/* User ID of the file's owner.  */
     __gid_t st_gid;		/* Group ID of the file's group.  */
+#ifndef __USE_FILE_OFFSET64
     __off_t st_size;		/* Size of file, in bytes.  */
+#else
+    __off64_t st_size;		/* Size of file, in bytes.  */
+#endif
 
     __time_t st_atime;		/* Time of last access.  */
     __time_t st_mtime;		/* Time of last modification.  */
@@ -70,11 +78,11 @@ struct stat
 #ifdef __USE_LARGEFILE64
 struct stat64
   {
-    __dev_t st_dev;		/* Device.  */
-
-    __ino64_t st_ino;		/* File serial number.	*/
     __mode_t st_mode;		/* File mode.  */
+    __ino64_t st_ino;		/* File serial number.	*/
+    __dev_t st_dev;		/* Device.  */
     __nlink_t st_nlink;		/* Link count.  */
+
     __uid_t st_uid;		/* User ID of the file's owner.	*/
     __gid_t st_gid;		/* Group ID of the file's group.*/
     __off64_t st_size;		/* Size of file, in bytes.  */
diff --git a/sysdeps/generic/bits/statfs.h b/sysdeps/generic/bits/statfs.h
index a92cf52315..03b92d8faa 100644
--- a/sysdeps/generic/bits/statfs.h
+++ b/sysdeps/generic/bits/statfs.h
@@ -35,12 +35,36 @@ struct statfs
   {
     unsigned int f_type;
     unsigned int f_bsize;
+#ifndef __USE_FILE_OFFSET64
     __fsblkcnt_t f_blocks;
     __fsblkcnt_t f_bfree;
     __fsblkcnt_t f_bavail;
     __fsblkcnt_t f_files;
     __fsblkcnt_t f_ffree;
+#else
+    __fsblkcnt64_t f_blocks;
+    __fsblkcnt64_t f_bfree;
+    __fsblkcnt64_t f_bavail;
+    __fsblkcnt64_t f_files;
+    __fsblkcnt64_t f_ffree;
+#endif
+    __fsid_t f_fsid;
+    unsigned int f_namelen;
+    unsigned int f_spare[6];
+  };
+
+#ifdef __USE_LARGEFILE64
+struct statfs64
+  {
+    unsigned int f_type;
+    unsigned int f_bsize;
+    __fsblkcnt64_t f_blocks;
+    __fsblkcnt64_t f_bfree;
+    __fsblkcnt64_t f_bavail;
+    __fsblkcnt64_t f_files;
+    __fsblkcnt64_t f_ffree;
     __fsid_t f_fsid;
     unsigned int f_namelen;
     unsigned int f_spare[6];
   };
+#endif
diff --git a/sysdeps/generic/bits/stdio_lim.h b/sysdeps/generic/bits/stdio_lim.h
index d9b8fbc749..86e83cf1e2 100644
--- a/sysdeps/generic/bits/stdio_lim.h
+++ b/sysdeps/generic/bits/stdio_lim.h
@@ -17,17 +17,24 @@
    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
-#ifndef _STDIO_H
+#if !defined _STDIO_H && !defined __need_FOPEN_MAX
 # error "Never include <bits/stdio_lim.h> directly; use <stdio.h> instead."
 #endif
 
-#define	L_tmpnam	1
-#define	TMP_MAX		0
+#ifndef __need_FOPEN_MAX
+# define L_tmpnam	1
+# define TMP_MAX	0
 
-#ifdef __USE_POSIX
-# define L_ctermid	1
-# define L_cuserid	1
+# ifdef __USE_POSIX
+#  define L_ctermid	1
+#  define L_cuserid	1
+# endif
+
+# define FILENAME_MAX	14
 #endif
 
-#define	FOPEN_MAX	16
-#define	FILENAME_MAX	14
+#if defined __need_FOPEN_MAX && !defined __defined_FOPEN_MAX
+# define __defined_FOPEN_MAX
+# define FOPEN_MAX	16
+#endif
+#undef __need_FOPEN_MAX
diff --git a/sysdeps/generic/fstatfs64.c b/sysdeps/generic/fstatfs64.c
index 99a2452558..e34af2aa45 100644
--- a/sysdeps/generic/fstatfs64.c
+++ b/sysdeps/generic/fstatfs64.c
@@ -25,8 +25,21 @@
 int
 fstatfs64 (int fd, struct statfs64 *buf)
 {
-  __set_errno (ENOSYS);
-  return -1;
+  struct statfs buf32;
+
+  if (fstatfs (fd, &buf32) < 0)
+    return -1;
+
+  buf->f_type = buf32.f_type;
+  buf->f_bsize = buf32.f_bsize;
+  buf->f_blocks = buf32.f_blocks;
+  buf->f_bfree = buf32.f_bfree;
+  buf->f_bavail = buf32.f_bavail;
+  buf->f_files = buf32.f_files;
+  buf->f_ffree = buf32.f_ffree;
+  buf->f_fsid = buf32.f_fsid;
+  buf->f_namelen = buf32.f_namelen;
+  memcpy (buf->f_spare, buf32.f_spare, sizeof (buf32.f_spare));
+
+  return 0;
 }
-stub_warning (fstatfs64)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/ftruncate64.c b/sysdeps/generic/ftruncate64.c
new file mode 100644
index 0000000000..40c312c21b
--- /dev/null
+++ b/sysdeps/generic/ftruncate64.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 Library General Public License as
+   published by the Free Software Foundation; either version 2 of the
+   License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Library General Public License for more details.
+
+   You should have received a copy of the GNU Library General Public
+   License along with the GNU C Library; see the file COPYING.LIB.  If not,
+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
+
+#include <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);
+}
diff --git a/sysdeps/generic/getrlimit.c b/sysdeps/generic/getrlimit.c
index c283f77038..285133c1a1 100644
--- a/sysdeps/generic/getrlimit.c
+++ b/sysdeps/generic/getrlimit.c
@@ -16,8 +16,9 @@
    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
-#include <sys/resource.h>
 #include <errno.h>
+#include <sys/resource.h>
+#include <sys/types.h>
 
 /* Put the soft and hard limits for RESOURCE in *RLIMITS.
    Returns 0 if successful, -1 if not (and sets errno).  */
diff --git a/sysdeps/generic/getrlimit64.c b/sysdeps/generic/getrlimit64.c
index 6c581edf72..742505f4b5 100644
--- a/sysdeps/generic/getrlimit64.c
+++ b/sysdeps/generic/getrlimit64.c
@@ -16,17 +16,28 @@
    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
-#include <sys/resource.h>
 #include <errno.h>
+#include <sys/resource.h>
+#include <sys/types.h>
 
 /* Put the soft and hard limits for RESOURCE in *RLIMITS.
    Returns 0 if successful, -1 if not (and sets errno).  */
 int
 getrlimit64 (enum __rlimit_resource resource, struct rlimit64 *rlimits)
 {
-  __set_errno (ENOSYS);
-  return -1;
-}
+  struct rlimit rlimits32;
 
-stub_warning (getrlimit64)
-#include <stub-tag.h>
+  if (getrlimit (resource, &rlimits32) < 0)
+    return -1;
+
+  if (rlimits32.rlim_cur == RLIM_INFINITY)
+    rlimits->rlim_cur = RLIM64_INFINITY;
+  else
+    rlimits->rlim_cur = rlimits32.rlim_cur;
+  if (rlimits32.rlim_max == RLIM_INFINITY)
+    rlimits->rlim_max = RLIM64_INFINITY;
+  else
+    rlimits->rlim_max = rlimits32.rlim_max;
+
+  return 0;
+}
diff --git a/sysdeps/generic/setrlimit.c b/sysdeps/generic/setrlimit.c
index b969ea19f7..85eb74051b 100644
--- a/sysdeps/generic/setrlimit.c
+++ b/sysdeps/generic/setrlimit.c
@@ -16,8 +16,9 @@
    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
-#include <sys/resource.h>
 #include <errno.h>
+#include <sys/resource.h>
+#include <sys/types.h>
 
 /* Set the soft and hard limits for RESOURCE to *RLIMITS.
    Only the super-user can increase hard limits.
diff --git a/sysdeps/generic/setrlimit64.c b/sysdeps/generic/setrlimit64.c
index 3d1a12279f..97329c58d8 100644
--- a/sysdeps/generic/setrlimit64.c
+++ b/sysdeps/generic/setrlimit64.c
@@ -16,8 +16,9 @@
    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
-#include <sys/resource.h>
 #include <errno.h>
+#include <sys/resource.h>
+#include <sys/types.h>
 
 /* Set the soft and hard limits for RESOURCE to *RLIMITS.
    Only the super-user can increase hard limits.
@@ -27,8 +28,18 @@ setrlimit64 (resource, rlimits)
      enum __rlimit_resource resource;
      struct rlimit64 *rlimits;
 {
-  __set_errno (ENOSYS);
-  return -1;
+  struct rlimit rlimits32;
+
+  if (rlimits->rlim_cur >= RLIM_INFINITY)
+    rlimits32.rlim_cur = RLIM_INFINITY;
+  else
+    rlimits32.rlim_cur = rlimits->rlim_cur;
+  if (rlimits->rlim_max >= RLIM_INFINITY)
+    rlimits32.rlim_max = RLIM_INFINITY;
+  else
+    rlimits32.rlim_max = rlimits->rlim_max;
+
+  return setrlimit (resource, &rlimits32);
 }
 
 stub_warning (setrlimit64)
diff --git a/sysdeps/generic/statfs64.c b/sysdeps/generic/statfs64.c
index 93b640eb74..050c05d659 100644
--- a/sysdeps/generic/statfs64.c
+++ b/sysdeps/generic/statfs64.c
@@ -25,8 +25,21 @@
 int
 statfs64 (const char *file, struct statfs64 *buf)
 {
-  __set_errno (ENOSYS);
-  return -1;
+  struct statfs buf32;
+
+  if (statfs (file, &buf32) < 0)
+    return -1;
+
+  buf->f_type = buf32.f_type;
+  buf->f_bsize = buf32.f_bsize;
+  buf->f_blocks = buf32.f_blocks;
+  buf->f_bfree = buf32.f_bfree;
+  buf->f_bavail = buf32.f_bavail;
+  buf->f_files = buf32.f_files;
+  buf->f_ffree = buf32.f_ffree;
+  buf->f_fsid = buf32.f_fsid;
+  buf->f_namelen = buf32.f_namelen;
+  memcpy (buf->f_spare, buf32.f_spare, sizeof (buf32.f_spare));
+
+  return 0;
 }
-stub_warning (statfs64)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/sysconf.c b/sysdeps/generic/sysconf.c
index b3fa62aa9a..bb6955d212 100644
--- a/sysdeps/generic/sysconf.c
+++ b/sysdeps/generic/sysconf.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991, 1993, 1995, 1996 Free Software Foundation, Inc.
+/* Copyright (C) 1991, 1993, 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
@@ -242,6 +242,15 @@ __sysconf (name)
     case _SC_NL_SETMAX:
     case _SC_NL_TEXTMAX:
 
+    case _SC_XBS5_ILP32_OFF32:
+    case _SC_XBS5_ILP32_OFFBIG:
+    case _SC_XBS5_LP64_OFF64:
+    case _SC_XBS5_LPBIG_OFFBIG:
+
+    case _SC_XOPEN_LEGACY:
+    case _SC_XOPEN_REALTIME:
+    case _SC_XOPEN_REALTIME_THREADS:
+
       break;
     }
 
diff --git a/sysdeps/generic/testrtsig.h b/sysdeps/generic/testrtsig.h
index 25eb488f84..6937372b8b 100644
--- a/sysdeps/generic/testrtsig.h
+++ b/sysdeps/generic/testrtsig.h
@@ -21,7 +21,7 @@
 #include <string.h>
 #include <sys/utsname.h>
 
-int
+static int
 kernel_has_rtsig (void)
 {
   return 0;
diff --git a/sysdeps/generic/truncate64.c b/sysdeps/generic/truncate64.c
new file mode 100644
index 0000000000..6a9d91f6d0
--- /dev/null
+++ b/sysdeps/generic/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 Library General Public License as
+   published by the Free Software Foundation; either version 2 of the
+   License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Library General Public License for more details.
+
+   You should have received a copy of the GNU Library General Public
+   License along with the GNU C Library; see the file COPYING.LIB.  If not,
+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
+
+#include <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/sysdeps/generic/ulimit.c b/sysdeps/generic/ulimit.c
index 3d90170b50..d62ba32a54 100644
--- a/sysdeps/generic/ulimit.c
+++ b/sysdeps/generic/ulimit.c
@@ -16,8 +16,8 @@
    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
-#include <sys/resource.h>
 #include <errno.h>
+#include <sys/resource.h>
 
 /* Function depends on CMD:
    1 = Return the limit on the size of a file, in units of 512 bytes.
@@ -28,9 +28,7 @@
        can open.
    Returns -1 on errors.  */
 long int
-__ulimit (cmd, newlimit)
-     int cmd;
-     long int newlimit;
+__ulimit (int cmd, ...)
 {
   __set_errno (ENOSYS);
   return -1;
diff --git a/sysdeps/generic/waitid.c b/sysdeps/generic/waitid.c
index 8843977a01..4454f7d34b 100644
--- a/sysdeps/generic/waitid.c
+++ b/sysdeps/generic/waitid.c
@@ -19,6 +19,7 @@
    Boston, MA 02111-1307, USA.  */
 
 #include <errno.h>
+#include <sys/types.h>
 #include <sys/wait.h>
 
 int
diff --git a/sysdeps/m68k/fpu/bits/mathinline.h b/sysdeps/m68k/fpu/bits/mathinline.h
index 034b6f8294..569e5a06c4 100644
--- a/sysdeps/m68k/fpu/bits/mathinline.h
+++ b/sysdeps/m68k/fpu/bits/mathinline.h
@@ -173,7 +173,6 @@ __inline_mathop(significand, getman)
 
 # ifdef __USE_ISOC9X
 __inline_mathop(log2, log2)
-__inline_mathop(exp2, twotox)
 __inline_mathop(trunc, intrz)
 # endif
 
@@ -445,7 +444,6 @@ __inline_forward_c(double,ceil, (double __x), (__x))
 __inline_forward_c(int,isinf, (double __value), (__value))
 __inline_forward_c(int,finite, (double __value), (__value))
 __inline_forward_c(double,scalbn, (double __x, int __n), (__x, __n))
-__inline_forward_c(double,scalbln, (double __x, long int __n), (__x, __n))
 # endif
 # if defined __USE_MISC || defined __USE_XOPEN
 #  ifndef __USE_ISOC9X /* Conflict with macro of same name.  */
@@ -453,6 +451,7 @@ __inline_forward_c(int,isnan, (double __value), (__value))
 #  endif
 # endif
 # ifdef __USE_ISOC9X
+__inline_forward_c(double,scalbln, (double __x, long int __n), (__x, __n))
 __inline_forward_c(double,nearbyint, (double __value), (__value))
 __inline_forward_c(long int,lrint, (double __value), (__value))
 __inline_forward_c(double,fma, (double __x, double __y, double __z),
@@ -473,10 +472,10 @@ __inline_forward_c(float,ceilf, (float __x), (__x))
 __inline_forward_c(int,isinff, (float __value), (__value))
 __inline_forward_c(int,finitef, (float __value), (__value))
 __inline_forward_c(float,scalbnf, (float __x, int __n), (__x, __n))
-__inline_forward_c(float,scalblnf, (float __x, long int __n), (__x, __n))
 __inline_forward_c(int,isnanf, (float __value), (__value))
 #  endif
 # ifdef __USE_ISOC9X
+__inline_forward_c(float,scalblnf, (float __x, long int __n), (__x, __n))
 __inline_forward_c(float,nearbyintf, (float __value), (__value))
 __inline_forward_c(long int,lrintf, (float __value), (__value))
 __inline_forward_c(float,fmaf, (float __x, float __y, float __z),
@@ -495,11 +494,11 @@ __inline_forward_c(long double,ceill, (long double __x), (__x))
 __inline_forward_c(int,isinfl, (long double __value), (__value))
 __inline_forward_c(int,finitel, (long double __value), (__value))
 __inline_forward_c(long double,scalbnl, (long double __x, int __n), (__x, __n))
-__inline_forward_c(long double,scalblnl, (long double __x, long int __n),
-		   (__x, __n))
 __inline_forward_c(int,isnanl, (long double __value), (__value))
 # endif
 # ifdef __USE_ISOC9X
+__inline_forward_c(long double,scalblnl, (long double __x, long int __n),
+		   (__x, __n))
 __inline_forward_c(long double,nearbyintl, (long double __value), (__value))
 __inline_forward_c(long int,lrintl, (long double __value), (__value))
 __inline_forward_c(long double,fmal,
diff --git a/sysdeps/posix/mk-stdiolim.c b/sysdeps/posix/mk-stdiolim.c
index c268b642de..8858ebeae5 100644
--- a/sysdeps/posix/mk-stdiolim.c
+++ b/sysdeps/posix/mk-stdiolim.c
@@ -42,27 +42,48 @@ main()
    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,\n\
    Boston, MA 02111-1307, USA.  */\n\
 \n\
-#ifndef _STDIO_H\n\
+#if !defined _STDIO_H && !defined __need_FOPEN_MAX\n\
 # error \"Never include <bits/stdio_lim.h> directly; use <stdio.h> instead.\"\n\
 #endif\n\
 \n");
 
   /* These values correspond to the code in sysdeps/posix/tempname.c.
      Change the values here if you change that code.  */
-  printf ("#define L_tmpnam %u\n", sizeof ("/usr/tmp/") + 9);
-  printf ("#define TMP_MAX %u\n", 62 * 62 * 62);
+  puts ("#ifndef __need_FOPEN_MAX");
+  printf ("# define L_tmpnam %u\n", sizeof ("/usr/tmp/") + 9);
+  printf ("# define TMP_MAX %u\n", 62 * 62 * 62);
 
-  puts   ("#ifdef __USE_POSIX");
-  printf ("# define L_ctermid %u\n", sizeof ("/dev/tty"));
-  printf ("# define L_cuserid 9\n");
-  puts   ("#endif");
+  puts   ("# ifdef __USE_POSIX");
+  printf ("#  define L_ctermid %u\n", sizeof ("/dev/tty"));
+  printf ("#  define L_cuserid 9\n");
+  puts   ("# endif");
+
+  printf (" #define FILENAME_MAX %u\n",
+#ifdef	PATH_MAX
+	  PATH_MAX
+#else
+	 /* This is supposed to be the size needed to hold the longest file
+	    name string the implementation guarantees can be opened.
+	    PATH_MAX not being defined means the actual limit on the length
+	    of a file name is runtime-variant (or it is unlimited).  ISO
+	    says in such a case FILENAME_MAX should be a good size to
+	    allocate for a file name string.  POSIX.1 guarantees that a
+	    file name up to _POSIX_PATH_MAX chars long can be opened, so
+	    this value must be at least that.  */
+	  1024		/* _POSIX_PATH_MAX is 255.  */
+#endif
+	  );
+
+  puts ("#endif\n");
 
   /* POSIX does not require that OPEN_MAX and PATH_MAX be defined, so
      <bits/local_lim.h> will not define them if they are run-time
      variant (which is the case in the Hurd).  ISO still requires
      that FOPEN_MAX and FILENAME_MAX be defined, however.  */
 
-  printf ("#define FOPEN_MAX %u\n",
+  puts ("#if defined __need_FOPEN_MAX && !defined __defined_FOPEN_MAX");
+  puts ("# define __defined_FOPEN_MAX");
+  printf ("# define FOPEN_MAX %u\n",
 #ifdef	OPEN_MAX
 
 	  OPEN_MAX
@@ -76,22 +97,8 @@ main()
 #endif
 
 	  );
+  puts ("#endif");
+  puts ("#undef __need_FOPEN_MAX");
 
-  printf ("#define FILENAME_MAX %u\n",
-#ifdef	PATH_MAX
-	  PATH_MAX
-#else
-	 /* This is supposed to be the size needed to hold the longest file
-	    name string the implementation guarantees can be opened.
-	    PATH_MAX not being defined means the actual limit on the length
-	    of a file name is runtime-variant (or it is unlimited).  ISO
-	    says in such a case FILENAME_MAX should be a good size to
-	    allocate for a file name string.  POSIX.1 guarantees that a
-	    file name up to _POSIX_PATH_MAX chars long can be opened, so
-	    this value must be at least that.  */
-	  1024		/* _POSIX_PATH_MAX is 255.  */
-#endif
-	  );
-
-  exit(0);
+  exit (0);
 }
diff --git a/sysdeps/posix/sysconf.c b/sysdeps/posix/sysconf.c
index 8dde095b79..b0c559f70b 100644
--- a/sysdeps/posix/sysconf.c
+++ b/sysdeps/posix/sysconf.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991, 1993, 1995, 1996 Free Software Foundation, Inc.
+/* Copyright (C) 1991, 1993, 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
@@ -443,9 +443,7 @@ __sysconf (name)
 #endif
 
     case _SC_2_VERSION:
-      /* This is actually supposed to return the version
-	 of the 1003.2 utilities on the system {POSIX2_VERSION}.  */
-      return _POSIX2_C_VERSION;
+      return _POSIX2_VERSION;
 
     case _SC_2_C_BIND:
 #ifdef	_POSIX2_C_BIND
@@ -783,6 +781,47 @@ __sysconf (name)
 #else
       return -1;
 #endif
+
+    case _SC_XBS5_ILP32_OFF32:
+#ifdef _XBS5_ILP32_OFF32
+      return _XBS5_ILP32_OFF32;
+#else
+      return -1;
+#endif
+    case _SC_XBS5_ILP32_OFFBIG:
+#ifdef _XBS5_ILP32_OFFBIG
+      return _XBS5_ILP32_OFFBIG;
+#else
+      return -1;
+#endif
+    case _SC_XBS5_LP64_OFF64:
+#ifdef _XBS5_LP64_OFF64
+      return _XBS5_LP64_OFF64;
+#else
+      return -1;
+#endif
+    case _SC_XBS5_LPBIG_OFFBIG:
+#ifdef _XBS5_LPBIG_OFFBIG
+      return _XBS5_LPBIG_OFFBIG;
+#else
+      return -1;
+#endif
+
+    case _SC_XOPEN_LEGACY:
+      return _XOPEN_LEGACY;
+
+    case _SC_XOPEN_REALTIME:
+#ifdef _XOPEN_REALTIME
+      return _XOPEN_REALTIME;
+#else
+      return -1;
+#endif
+    case _SC_XOPEN_REALTIME_THREADS:
+#ifdef _XOPEN_REALTIME_THREADS
+      return _XOPEN_REALTIME_THREADS;
+#else
+      return -1;
+#endif
     }
 }
 
diff --git a/sysdeps/standalone/arm/bits/errno.h b/sysdeps/standalone/arm/bits/errno.h
index 391f92548f..373d701bc3 100644
--- a/sysdeps/standalone/arm/bits/errno.h
+++ b/sysdeps/standalone/arm/bits/errno.h
@@ -56,6 +56,7 @@
 # define EIO		28
 # define ENOSPC		29
 # define EEXIST		30
+# define EBUSY		31
 #endif
 
 #define __set_errno(val) errno = (val)
diff --git a/sysdeps/unix/bsd/sun/sunos4/bits/resource.h b/sysdeps/unix/bsd/sun/sunos4/bits/resource.h
index 6978c87dd2..c0b40ba0d1 100644
--- a/sysdeps/unix/bsd/sun/sunos4/bits/resource.h
+++ b/sysdeps/unix/bsd/sun/sunos4/bits/resource.h
@@ -65,11 +65,11 @@ enum __rlimit_resource
 #ifndef __USE_FILE_OFFSET64
 # define RLIM_INFINITY 0x7fffffff
 #else
-# define RLIM_INFINITY 0x7fffffffffffffffL
+# define RLIM_INFINITY 0x7fffffffffffffffLL
 #endif
 
 #ifdef __USE_LARGEFILE64
-# define RLIM64_INFINITY 0x7fffffffffffffffL
+# define RLIM64_INFINITY 0x7fffffffffffffffLL
 #endif
 
 
diff --git a/sysdeps/unix/bsd/ulimit.c b/sysdeps/unix/bsd/ulimit.c
index b25a58314d..4a242efe1c 100644
--- a/sysdeps/unix/bsd/ulimit.c
+++ b/sysdeps/unix/bsd/ulimit.c
@@ -16,10 +16,11 @@
    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
+#include <errno.h>
+#include <stdarg.h>
 #include <sysdep.h>
-#include <sys/resource.h>
 #include <unistd.h>
-#include <errno.h>
+#include <sys/resource.h>
 
 #ifndef	 HAVE_GNU_LD
 #define	 _etext	etext
@@ -36,51 +37,50 @@ extern int _etext;
        can open.
    Returns -1 on errors.  */
 long int
-ulimit (cmd, newlimit)
-     int cmd;
-     long int newlimit;
+ulimit (int cmd, ...)
 {
-  int status;
+  struct rlimit limit;
+  va_list va;
+  long int result = -1;
+
+  va_start (va, cmd);
 
   switch (cmd)
     {
-    case 1:
-      {
-	/* Get limit on file size.  */
-	struct rlimit fsize;
-
-	status = getrlimit (RLIMIT_FSIZE, &fsize);
-	if (status < 0)
-	  return -1;
-
+    case UL_GETFSIZE:
+      /* Get limit on file size.  */
+      if (getrlimit (RLIMIT_FSIZE, &limit) == 0)
 	/* Convert from bytes to 512 byte units.  */
-	return fsize.rlim_cur / 512;
-      }
-    case 2:
+	result = limit.rlim_cur / 512;
+      break;
+
+    case UL_SETFSIZE:
       /* Set limit on file size.  */
       {
-	struct rlimit fsize;
-	fsize.rlim_cur = newlimit * 512;
-	fsize.rlim_max = newlimit * 512;
+	long int newlimit = va_arg (va, long int);
+
+	limit.rlim_cur = newlimit * 512;
+	limit.rlim_max = newlimit * 512;
 
-	return setrlimit (RLIMIT_FSIZE, &fsize);
+	result = setrlimit (RLIMIT_FSIZE, &limit);
       }
-    case 3:
-      /* Get maximum address for `brk'.  */
-      {
-	struct rlimit dsize;
+      break;
 
-	status = getrlimit (RLIMIT_DATA, &dsize);
-	if (status < 0)
-	  return -1;
+    case __UL_GETMAXBRK:
+      /* Get maximum address for `brk'.  */
+      if (getrlimit (RLIMIT_DATA, &limit) == 0)
+	result = ((long int) &_etext) + limit.rlim_cur;
+      break;
 
-	return ((long int) &_etext) + dsize.rlim_cur;
-      }
-    case 4:
-      return sysconf (_SC_OPEN_MAX);
+    case __UL_GETOPENMAX:
+      result = sysconf (_SC_OPEN_MAX);
+      break;
 
     default:
       __set_errno (EINVAL);
-      return -1;
     }
+
+  va_end (va);
+
+  return result;
 }
diff --git a/sysdeps/unix/sysv/linux/Dist b/sysdeps/unix/sysv/linux/Dist
index fa95317ec9..e22cec7dec 100644
--- a/sysdeps/unix/sysv/linux/Dist
+++ b/sysdeps/unix/sysv/linux/Dist
@@ -32,6 +32,7 @@ netinet/udp.h
 netipx/ipx.h
 nfs/nfs.h
 rt_sigaction.c
+rt_sigpending.c
 rt_sigprocmask.c
 rt_sigqueueinfo.c
 rt_sigreturn.c
@@ -61,3 +62,4 @@ sys/ultrasound.h
 sys/user.h
 sys/vt.h
 xstatconv.c
+getdents64.c
diff --git a/sysdeps/unix/sysv/linux/Makefile b/sysdeps/unix/sysv/linux/Makefile
index 27684ef3fe..152c7984bd 100644
--- a/sysdeps/unix/sysv/linux/Makefile
+++ b/sysdeps/unix/sysv/linux/Makefile
@@ -120,4 +120,8 @@ sysdep_routines += rt_sigsuspend rt_sigprocmask rt_sigtimedwait	\
 		   rt_sigqueueinfo rt_sigaction rt_sigpending
 endif
 
+ifeq ($(subdir),dirent)
+sysdep_routines += getdents64
+endif
+
 common-generated += bits/stdio_lim.h bits/stdio_lim.d
diff --git a/sysdeps/unix/sysv/linux/alpha/bits/types.h b/sysdeps/unix/sysv/linux/alpha/bits/types.h
index 9acdf0c490..9033fdb362 100644
--- a/sysdeps/unix/sysv/linux/alpha/bits/types.h
+++ b/sysdeps/unix/sysv/linux/alpha/bits/types.h
@@ -77,6 +77,9 @@ typedef long int __swblk_t;		/* Type of a swap block maybe?  */
 typedef long int __clock_t;
 typedef int __key_t;			/* Type of a SYSV IPC key. */
 
+/* Used in `struct shmid_ds'.  */
+typedef int __ipc_pid_t;
+
 /* One element in the file descriptor mask array.  */
 typedef unsigned long int __fd_mask;
 
diff --git a/sysdeps/unix/sysv/linux/alpha/fstatfs64.c b/sysdeps/unix/sysv/linux/alpha/fstatfs64.c
new file mode 100644
index 0000000000..2be4e59ba4
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/alpha/fstatfs64.c
@@ -0,0 +1 @@
+/* fstatfs64 is the same as fstatfs. */
diff --git a/sysdeps/unix/sysv/linux/alpha/ftruncate64.c b/sysdeps/unix/sysv/linux/alpha/ftruncate64.c
new file mode 100644
index 0000000000..673a8b525a
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/alpha/ftruncate64.c
@@ -0,0 +1 @@
+/* ftruncate64 is the same as ftruncate. */
diff --git a/sysdeps/unix/sysv/linux/alpha/getrlimit64.c b/sysdeps/unix/sysv/linux/alpha/getrlimit64.c
new file mode 100644
index 0000000000..9feab0e6b8
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/alpha/getrlimit64.c
@@ -0,0 +1 @@
+/* getrlimit64 is the same as getrlimit. */
diff --git a/sysdeps/unix/sysv/linux/alpha/init-first.h b/sysdeps/unix/sysv/linux/alpha/init-first.h
index ffbcaf1521..a3f5d8f0c4 100644
--- a/sysdeps/unix/sysv/linux/alpha/init-first.h
+++ b/sysdeps/unix/sysv/linux/alpha/init-first.h
@@ -2,28 +2,26 @@
    This is done in one of two ways: either in the stack context
    of program start, or having dlopen pass them in.  */
 
-#define SYSDEP_CALL_INIT(NAME, INIT)		\
-    asm(".weak _dl_starting_up\n\t"		\
-        ".globl " #NAME "\n\t"			\
-	".ent " #NAME "\n"			\
-	#NAME ":\n\t"				\
-	"ldgp	$29, 0($27)\n\t"		\
-	".prologue 1\n\t"			\
-	".set at\n\t"				\
-	/* Are we a dynamic libc being loaded into a static program?  */ \
-	"lda	$0, _dl_starting_up\n\t"	\
-	"beq	$0, 1f\n\t"			\
-	"ldl	$0, 0($0)\n"			\
-	"cmpeq	$31, $0, $0\n"			\
-	"1:\t"					\
-	"stl	$0, __libc_multiple_libcs\n\t"	\
-	/* If so, argc et al are in a0-a2 already.  Otherwise, load them.  */ \
-	"bne	$0, 2f\n\t"			\
-	"ldl	$16, 0($30)\n\t"		\
-	"lda	$17, 8($30)\n\t"		\
-	"s8addq	$16, $17, $18\n\t"		\
-	"addq	$18, 8, $18\n"			\
-	"2:\t"					\
-	"br $31, " #INIT "..ng\n\t"		\
-	".set noat\n\t"				\
-	".end " #NAME);
+#define SYSDEP_CALL_INIT(NAME, INIT) asm("\
+	.weak _dl_starting_up
+	.globl " #NAME "
+	.ent " #NAME "
+" #NAME ":
+	ldgp	$29, 0($27)
+	.prologue 1
+	.set at
+	/* Are we a dynamic libc being loaded into a static program?  */
+	lda	$0, _dl_starting_up
+	beq	$0, 1f
+	ldl	$0, 0($0)
+	cmpeq	$31, $0, $0
+1:	stl	$0, __libc_multiple_libcs
+	/* If so, argc et al are in a0-a2 already.  Otherwise, load them.  */
+	bne	$0, 2f
+	ldl	$16, 0($30)
+	lda	$17, 8($30)
+	s8addq	$16, $17, $18
+	addq	$18, 8, $18
+2:	br $31, " ASM_ALPHA_NG_SYMBOL_PREFIX #INIT "..ng
+	.set noat
+	.end " #NAME);
diff --git a/sysdeps/unix/sysv/linux/alpha/readdir.c b/sysdeps/unix/sysv/linux/alpha/readdir.c
new file mode 100644
index 0000000000..96a6a76945
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/alpha/readdir.c
@@ -0,0 +1,4 @@
+#define readdir64 __no_readdir64_decl
+#include <sysdeps/unix/readdir.c>
+#undef readdir64
+weak_alias (__readdir, readdir64)
diff --git a/sysdeps/unix/sysv/linux/alpha/readdir64.c b/sysdeps/unix/sysv/linux/alpha/readdir64.c
new file mode 100644
index 0000000000..9796431dc4
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/alpha/readdir64.c
@@ -0,0 +1 @@
+/* readdir64 is in readdir.c */
diff --git a/sysdeps/unix/sysv/linux/alpha/readdir64_r.c b/sysdeps/unix/sysv/linux/alpha/readdir64_r.c
new file mode 100644
index 0000000000..b8fe9a31b4
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/alpha/readdir64_r.c
@@ -0,0 +1 @@
+/* readdir64_r is in readdir_r.c */
diff --git a/sysdeps/unix/sysv/linux/alpha/readdir_r.c b/sysdeps/unix/sysv/linux/alpha/readdir_r.c
new file mode 100644
index 0000000000..adb92db6af
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/alpha/readdir_r.c
@@ -0,0 +1,4 @@
+#define readdir64_r __no_readdir64_r_decl
+#include <sysdeps/unix/readdir_r.c>
+#undef readdir64_r
+weak_alias (__readdir_r, readdir64_r)
diff --git a/sysdeps/unix/sysv/linux/alpha/setrlimit64.c b/sysdeps/unix/sysv/linux/alpha/setrlimit64.c
new file mode 100644
index 0000000000..8edcff0086
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/alpha/setrlimit64.c
@@ -0,0 +1 @@
+/* setrlimit64 is the same as setrlimit. */
diff --git a/sysdeps/unix/sysv/linux/alpha/statfs64.c b/sysdeps/unix/sysv/linux/alpha/statfs64.c
new file mode 100644
index 0000000000..06bc68826f
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/alpha/statfs64.c
@@ -0,0 +1 @@
+/* statfs64 is the same as statfs. */
diff --git a/sysdeps/unix/sysv/linux/alpha/syscalls.list b/sysdeps/unix/sysv/linux/alpha/syscalls.list
index d3bc033b3d..af964718bc 100644
--- a/sysdeps/unix/sysv/linux/alpha/syscalls.list
+++ b/sysdeps/unix/sysv/linux/alpha/syscalls.list
@@ -23,10 +23,14 @@ mmap		-	mmap		6	__mmap		mmap
 llseek		EXTRA	lseek		3	__llseek	llseek lseek64
 pread		EXTRA	pread		4	__pread		pread __pread64 pread64
 pwrite		EXTRA	pwrite		4	__pwrite	pwrite __pwrite64 pwrite64
+fstatfs		-	fstatfs		2	__fstatfs	fstatfs fstatfs64
+statfs		-	statfs		2	__statfs	statfs statfs64
+getrlimit	-	getrlimit	2	getrlimit	getrlimit64
+setrlimit	-	setrlimit	2	setrlimit	setrlimit64
+ftruncate	-	ftruncate	2	ftruncate	ftruncate64
+truncate	-	truncate	2	truncate	truncate64
 
 # these are actually common with the x86:
-fstatfs		-	fstatfs		2	__fstatfs	fstatfs
-statfs		-	statfs		2	__statfs	statfs
 sys_ustat	ustat	ustat		2	__syscall_ustat
 sys_mknod	xmknod	mknod		3	__syscall_mknod
 
diff --git a/sysdeps/unix/sysv/linux/alpha/truncate64.c b/sysdeps/unix/sysv/linux/alpha/truncate64.c
new file mode 100644
index 0000000000..8999768874
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/alpha/truncate64.c
@@ -0,0 +1 @@
+/* truncate64 is the same as truncate. */
diff --git a/sysdeps/unix/sysv/linux/bits/msq.h b/sysdeps/unix/sysv/linux/bits/msq.h
index 9d0b9a9afa..d7a8e5ee0f 100644
--- a/sysdeps/unix/sysv/linux/bits/msq.h
+++ b/sysdeps/unix/sysv/linux/bits/msq.h
@@ -17,7 +17,7 @@
    Boston, MA 02111-1307, USA.  */
 
 #ifndef _SYS_MSG_H
-#error "Never use <bits/msq.h> directly; include <sys/msg.h> instead."
+# error "Never use <bits/msq.h> directly; include <sys/msg.h> instead."
 #endif
 
 #include <sys/types.h>
@@ -28,7 +28,7 @@
 
 
 /* Structure of record for one message inside the kernel.
-   The type `struct __msg' is opaque.  */
+   The type `struct msg' is opaque.  */
 struct msqid_ds
 {
   struct ipc_perm msg_perm;	/* structure describing operation permission */
@@ -42,17 +42,17 @@ struct msqid_ds
   unsigned short int __msg_cbytes;/* current number of bytes on queue */
   unsigned short int msg_qnum;	/* number of messages currently on queue */
   unsigned short int msg_qbytes;/* max number of bytes allowed on queue */
-  int msg_lspid;		/* pid of last msgsnd() */
-  int msg_lrpid;		/* pid of last msgrcv() */
+  __ipc_pid_t msg_lspid;	/* pid of last msgsnd() */
+  __ipc_pid_t msg_lrpid;	/* pid of last msgrcv() */
 };
 
 #ifdef __USE_MISC
 
-#define msg_cbytes	__msg_cbytes
+# define msg_cbytes	__msg_cbytes
 
 /* ipcs ctl commands */
-#define MSG_STAT 11
-#define MSG_INFO 12
+# define MSG_STAT 11
+# define MSG_INFO 12
 
 /* buffer for msgctl calls IPC_INFO, MSG_INFO */
 struct msginfo
@@ -64,7 +64,7 @@ struct msginfo
     int msgmni;
     int msgssz;
     int msgtql;
-    ushort  msgseg;
+    unsigned short int msgseg;
   };
 
 #endif /* __USE_MISC */
diff --git a/sysdeps/unix/sysv/linux/bits/resource.h b/sysdeps/unix/sysv/linux/bits/resource.h
index f825cba929..c649217e7e 100644
--- a/sysdeps/unix/sysv/linux/bits/resource.h
+++ b/sysdeps/unix/sysv/linux/bits/resource.h
@@ -102,12 +102,20 @@ enum __rlimit_resource
   RLIM_NLIMITS = RLIMIT_NLIMITS,
 #define RLIMIT_NLIMITS RLIMIT_NLIMITS
 #define RLIM_NLIMITS RLIM_NLIMITS
-
-  /* Value to indicate that there is no limit.  */
-  RLIM_INFINITY = (long int)(~0UL >> 1)
-#define RLIM_INFINITY RLIM_INFINITY
 };
 
+/* Value to indicate that there is no limit.  */
+#ifndef __USE_FILE_OFFSET64
+# define RLIM_INFINITY ((long int)(~0UL >> 1))
+#else
+# define RLIM_INFINITY 0x7fffffffffffffffLL
+#endif
+
+#ifdef __USE_LARGEFILE64
+# define RLIM64_INFINITY 0x7fffffffffffffffLL
+#endif
+
+
 /* Type for resource quantity measurement.  */
 #ifndef __USE_FILE_OFFSET64
 typedef __rlim_t rlim_t;
diff --git a/sysdeps/unix/sysv/linux/bits/shm.h b/sysdeps/unix/sysv/linux/bits/shm.h
index 6f5f840909..c7070595b8 100644
--- a/sysdeps/unix/sysv/linux/bits/shm.h
+++ b/sysdeps/unix/sysv/linux/bits/shm.h
@@ -44,8 +44,8 @@ struct shmid_ds
     __time_t shm_atime;			/* time of last shmat() */
     __time_t shm_dtime;			/* time of last shmdt() */
     __time_t shm_ctime;			/* time of last change by shmctl() */
-    int shm_cpid;			/* pid of creator */
-    int shm_lpid;			/* pid of last shmop */
+    __ipc_pid_t shm_cpid;		/* pid of creator */
+    __ipc_pid_t shm_lpid;		/* pid of last shmop */
     unsigned short int shm_nattch;	/* number of current attaches */
     unsigned short int __shm_npages;	/* size of segment (pages) */
     unsigned long int *__shm_pages;	/* array of ptrs to frames -> SHMMAX */
@@ -73,12 +73,12 @@ struct	shminfo
 
 struct shm_info
   {
-    int   used_ids;
-    ulong shm_tot;	/* total allocated shm */
-    ulong shm_rss;	/* total resident shm */
-    ulong shm_swp;	/* total swapped shm */
-    ulong swap_attempts;
-    ulong swap_successes;
+    int used_ids;
+    unsigned long int shm_tot;	/* total allocated shm */
+    unsigned long int shm_rss;	/* total resident shm */
+    unsigned long int shm_swp;	/* total swapped shm */
+    unsigned long int swap_attempts;
+    unsigned long int swap_successes;
   };
 
 #endif /* __USE_MISC */
diff --git a/sysdeps/unix/sysv/linux/bits/termios.h b/sysdeps/unix/sysv/linux/bits/termios.h
index 926c3f32f4..0a5891210e 100644
--- a/sysdeps/unix/sysv/linux/bits/termios.h
+++ b/sysdeps/unix/sysv/linux/bits/termios.h
@@ -82,32 +82,40 @@ struct termios
 #define ONLRET	0000040
 #define OFILL	0000100
 #define OFDEL	0000200
-#define NLDLY	0000400
-#define   NL0	0000000
-#define   NL1	0000400
-#define CRDLY	0003000
-#define   CR0	0000000
-#define   CR1	0001000
-#define   CR2	0002000
-#define   CR3	0003000
-#define TABDLY	0014000
-#define   TAB0	0000000
-#define   TAB1	0004000
-#define   TAB2	0010000
-#define   TAB3	0014000
-#define   XTABS	0014000
-#define BSDLY	0020000
-#define   BS0	0000000
-#define   BS1	0020000
+#if !defined __USE_POSIX || defined __USE_UNIX98
+# define NLDLY	0000400
+# define   NL0	0000000
+# define   NL1	0000400
+# define CRDLY	0003000
+# define   CR0	0000000
+# define   CR1	0001000
+# define   CR2	0002000
+# define   CR3	0003000
+# define TABDLY	0014000
+# define   TAB0	0000000
+# define   TAB1	0004000
+# define   TAB2	0010000
+# define   TAB3	0014000
+# define BSDLY	0020000
+# define   BS0	0000000
+# define   BS1	0020000
+# define FFDLY	0100000
+# define   FF0	0000000
+# define   FF1	0100000
+#endif
+
 #define VTDLY	0040000
 #define   VT0	0000000
 #define   VT1	0040000
-#define FFDLY	0100000
-#define   FF0	0000000
-#define   FF1	0100000
+
+#if (!defined __USE_POSIX && !defined __USE_XOPEN) || defined __USE_GNU
+# define XTABS	0014000
+#endif
 
 /* c_cflag bit meaning */
-#define CBAUD	0010017
+#if (!defined __USE_POSIX && !defined __USE_XOPEN) || defined __USE_GNU
+# define CBAUD	0010017
+#endif
 #define  B0	0000000		/* hang up */
 #define  B50	0000001
 #define  B75	0000002
@@ -124,8 +132,10 @@ struct termios
 #define  B9600	0000015
 #define  B19200	0000016
 #define  B38400	0000017
-#define EXTA B19200
-#define EXTB B38400
+#if (!defined __USE_POSIX && !defined __USE_XOPEN) || defined __USE_GNU
+# define EXTA B19200
+# define EXTB B38400
+#endif
 #define CSIZE	0000060
 #define   CS5	0000000
 #define   CS6	0000020
@@ -137,29 +147,37 @@ struct termios
 #define PARODD	0001000
 #define HUPCL	0002000
 #define CLOCAL	0004000
-#define CBAUDEX 0010000
+#if (!defined __USE_POSIX && !defined __USE_XOPEN) || defined __USE_GNU
+# define CBAUDEX 0010000
+#endif
 #define  B57600  0010001
 #define  B115200 0010002
 #define  B230400 0010003
 #define  B460800 0010004
-#define CIBAUD	  002003600000	/* input baud rate (not used) */
-#define CRTSCTS	  020000000000		/* flow control */
+#if (!defined __USE_POSIX && !defined __USE_XOPEN) || defined __USE_GNU
+# define CIBAUD	  002003600000		/* input baud rate (not used) */
+# define CRTSCTS  020000000000		/* flow control */
+#endif
 
 /* c_lflag bits */
 #define ISIG	0000001
 #define ICANON	0000002
-#define XCASE	0000004
+#if !defined __USE_POSIX || defined __USE_UNIX98
+# define XCASE	0000004
+#endif
 #define ECHO	0000010
 #define ECHOE	0000020
 #define ECHOK	0000040
 #define ECHONL	0000100
 #define NOFLSH	0000200
 #define TOSTOP	0000400
-#define ECHOCTL	0001000
-#define ECHOPRT	0002000
-#define ECHOKE	0004000
-#define FLUSHO	0010000
-#define PENDIN	0040000
+#if (!defined __USE_POSIX && !defined __USE_XOPEN) || defined __USE_GNU
+# define ECHOCTL 0001000
+# define ECHOPRT 0002000
+# define ECHOKE	 0004000
+# define FLUSHO	 0010000
+# define PENDIN	 0040000
+#endif
 #define IEXTEN	0100000
 
 /* tcflow() and TCXONC use these */
diff --git a/sysdeps/unix/sysv/linux/bits/types.h b/sysdeps/unix/sysv/linux/bits/types.h
index dec60e244b..723e0ff223 100644
--- a/sysdeps/unix/sysv/linux/bits/types.h
+++ b/sysdeps/unix/sysv/linux/bits/types.h
@@ -103,6 +103,9 @@ typedef struct
 
 typedef int __key_t;
 
+/* Used in `struct shmid_ds'.  */
+typedef short int __ipc_pid_t;
+
 
 /* Types from the Large File Support interface.  */
 
diff --git a/sysdeps/unix/sysv/linux/fxstat64.c b/sysdeps/unix/sysv/linux/fxstat64.c
new file mode 100644
index 0000000000..f6884998c7
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/fxstat64.c
@@ -0,0 +1,41 @@
+/* fxstat64 using old-style Unix fstat system call.
+   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 Library General Public License as
+   published by the Free Software Foundation; either version 2 of the
+   License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Library General Public License for more details.
+
+   You should have received a copy of the GNU Library General Public
+   License along with the GNU C Library; see the file COPYING.LIB.  If not,
+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
+
+#include <errno.h>
+#include <stddef.h>
+#include <sys/stat.h>
+#include <kernel_stat.h>
+
+#include <xstatconv.c>
+
+extern int __syscall_fstat (int, struct kernel_stat *);
+
+/* Get information about the file FD in BUF.  */
+int
+__fxstat64 (int vers, int fd, struct stat64 *buf)
+{
+  struct kernel_stat kbuf;
+  int result;
+
+  result =  __syscall_fstat (fd, &kbuf);
+  if (result == 0)
+    result = xstat64_conv (vers, &kbuf, buf);
+
+  return result;
+}
diff --git a/sysdeps/unix/sysv/linux/getdents.c b/sysdeps/unix/sysv/linux/getdents.c
index b4b12d48eb..b1b532a396 100644
--- a/sysdeps/unix/sysv/linux/getdents.c
+++ b/sysdeps/unix/sysv/linux/getdents.c
@@ -46,6 +46,10 @@ struct kernel_dirent
     char d_name[256];
   };
 
+#ifdef GETDENTS64
+#define __getdirentries __getdirentries64
+#define dirent dirent64
+#endif
 
 /* The problem here is that we cannot simply read the next NBYTES
    bytes.  We need to take the additional field into account.  We use
@@ -111,4 +115,6 @@ __getdirentries (fd, buf, nbytes, basep)
   return (char *) dp - buf;
 }
 
+#ifndef GETDENTS64
 weak_alias (__getdirentries, getdirentries)
+#endif
diff --git a/sysdeps/unix/sysv/linux/getdents64.c b/sysdeps/unix/sysv/linux/getdents64.c
new file mode 100644
index 0000000000..f50b0be615
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/getdents64.c
@@ -0,0 +1,2 @@
+#define GETDENTS64
+#include <getdents.c>
diff --git a/sysdeps/unix/sysv/linux/lxstat64.c b/sysdeps/unix/sysv/linux/lxstat64.c
new file mode 100644
index 0000000000..8813fadd4c
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/lxstat64.c
@@ -0,0 +1,41 @@
+/* lxstat64 using old-style Unix lstat system call.
+   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 Library General Public License as
+   published by the Free Software Foundation; either version 2 of the
+   License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Library General Public License for more details.
+
+   You should have received a copy of the GNU Library General Public
+   License along with the GNU C Library; see the file COPYING.LIB.  If not,
+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
+
+#include <errno.h>
+#include <stddef.h>
+#include <sys/stat.h>
+#include <kernel_stat.h>
+
+#include <xstatconv.c>
+
+extern int __syscall_lstat (const char *, struct kernel_stat *);
+
+/* Get information about the file NAME in BUF.  */
+int
+__lxstat64 (int vers, const char *name, struct stat64 *buf)
+{
+  struct kernel_stat kbuf;
+  int result;
+
+  result =  __syscall_lstat (name, &kbuf);
+  if (result == 0)
+    result = xstat64_conv (vers, &kbuf, buf);
+
+  return result;
+}
diff --git a/sysdeps/unix/sysv/linux/mips/bits/types.h b/sysdeps/unix/sysv/linux/mips/bits/types.h
new file mode 100644
index 0000000000..56075d13c2
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/mips/bits/types.h
@@ -0,0 +1,130 @@
+/* Copyright (C) 1991, 92, 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 Library General Public License as
+   published by the Free Software Foundation; either version 2 of the
+   License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Library General Public License for more details.
+
+   You should have received a copy of the GNU Library General Public
+   License along with the GNU C Library; see the file COPYING.LIB.  If not,
+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
+
+/*
+ * Never include this file directly; use <sys/types.h> instead.
+ */
+
+#ifndef	_BITS_TYPES_H
+#define	_BITS_TYPES_H	1
+
+#include <features.h>
+
+/* Convenience types.  */
+typedef unsigned char __u_char;
+typedef unsigned short __u_short;
+typedef unsigned int __u_int;
+typedef unsigned long __u_long;
+#ifdef __GNUC__
+typedef unsigned long long int __u_quad_t;
+typedef long long int __quad_t;
+#else
+typedef struct
+  {
+    long int __val[2];
+  } __quad_t;
+typedef struct
+  {
+    __u_long __val[2];
+  } __u_quad_t;
+#endif
+typedef signed char __int8_t;
+typedef unsigned char __uint8_t;
+typedef signed short int __int16_t;
+typedef unsigned short int __uint16_t;
+typedef signed int __int32_t;
+typedef unsigned int __uint32_t;
+#ifdef __GNUC__
+typedef signed long long int __int64_t;
+typedef unsigned long long int __uint64_t;
+#endif
+typedef __quad_t *__qaddr_t;
+
+typedef __u_quad_t __dev_t;		/* Type of device numbers.  */
+typedef __u_int __uid_t;		/* Type of user identifications.  */
+typedef __u_int __gid_t;		/* Type of group identifications.  */
+typedef __u_long __ino_t;		/* Type of file serial numbers.  */
+typedef __u_int __mode_t;		/* Type of file attribute bitmasks.  */
+typedef __u_int __nlink_t; 		/* Type of file link counts.  */
+typedef long int __off_t;		/* Type of file sizes and offsets.  */
+typedef __quad_t __loff_t;		/* Type of file sizes and offsets.  */
+typedef int __pid_t;			/* Type of process identifications.  */
+typedef int __ssize_t;			/* Type of a byte count, or error.  */
+typedef long int __rlim_t;		/* Type of resource counts.  */
+typedef __quad_t __rlim64_t;		/* Type of resource counts (LFS).  */
+typedef __u_int __id_t;			/* General type for ID.  */
+
+typedef struct
+  {
+    int __val[2];
+  } __fsid_t;				/* Type of file system IDs.  */
+
+/* Everythin' else.  */
+typedef int __daddr_t;			/* The type of a disk address.  */
+typedef char *__caddr_t;
+typedef long int __time_t;
+typedef long int __swblk_t;		/* Type of a swap block maybe?  */
+
+typedef long int __clock_t;
+
+/* One element in the file descriptor mask array.  */
+typedef unsigned long int __fd_mask;
+
+/* Number of descriptors that can fit in an `fd_set'.  */
+#define __FD_SETSIZE	1024
+
+/* It's easier to assume 8-bit bytes than to get CHAR_BIT.  */
+#define __NFDBITS	(8 * sizeof (__fd_mask))
+#define	__FDELT(d)	((d) / __NFDBITS)
+#define	__FDMASK(d)	((__fd_mask) 1 << ((d) % __NFDBITS))
+
+/* fd_set for select and pselect.  */
+typedef struct
+  {
+    /* XPG4.2 requires this member name.  */
+    __fd_mask fds_bits[__FD_SETSIZE / __NFDBITS];
+  } __fd_set;
+
+
+typedef int __key_t;
+
+/* Used in `struct shmid_ds'.  */
+typedef long int __ipc_pid_t;
+
+
+/* Types from the Large File Support interface.  */
+
+/* Type to count number os disk blocks.  */
+typedef __u_long __blkcnt_t;
+typedef __u_quad_t __blkcnt64_t;
+
+/* Type to count file system blocks.  */
+typedef long int __fsblkcnt_t;
+typedef __quad_t __fsblkcnt64_t;
+
+/* Type to count file system inodes.  */
+typedef __u_long __fsfilcnt_t;
+typedef __u_quad_t __fsfilcnt64_t;
+
+/* Type of file serial numbers.  */
+typedef __u_long __ino64_t;
+
+/* Type of file sizes and offsets.  */
+typedef __loff_t __off64_t;
+
+#endif /* bits/types.h */
diff --git a/sysdeps/unix/sysv/linux/readdir64.c b/sysdeps/unix/sysv/linux/readdir64.c
new file mode 100644
index 0000000000..37623655f4
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/readdir64.c
@@ -0,0 +1,103 @@
+/* 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 Library General Public License as
+   published by the Free Software Foundation; either version 2 of the
+   License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Library General Public License for more details.
+
+   You should have received a copy of the GNU Library General Public
+   License along with the GNU C Library; see the file COPYING.LIB.  If not,
+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
+
+#include <errno.h>
+#include <limits.h>
+#include <stddef.h>
+#include <string.h>
+#include <dirent.h>
+#include <unistd.h>
+#include <sys/types.h>
+#include <assert.h>
+
+#include <dirstream.h>
+
+extern ssize_t __getdirentries64 (int, char *, size_t, off_t *);
+
+
+/* Read a directory entry from DIRP.  */
+struct dirent64 *
+readdir64 (DIR *dirp)
+{
+  struct dirent64 *dp;
+
+  __libc_lock_lock (dirp->lock);
+
+  do
+    {
+      size_t reclen;
+
+      if (dirp->offset >= dirp->size)
+	{
+	  /* We've emptied out our buffer.  Refill it.  */
+
+	  size_t maxread;
+	  off_t base;
+	  ssize_t bytes;
+
+#ifndef _DIRENT_HAVE_D_RECLEN
+	  /* Fixed-size struct; must read one at a time (see below).  */
+	  maxread = sizeof *dp;
+#else
+	  maxread = dirp->allocation;
+#endif
+
+	  base = dirp->filepos;
+	  bytes = __getdirentries64 (dirp->fd, dirp->data, maxread, &base);
+	  if (bytes <= 0)
+	    {
+	      dp = NULL;
+	      break;
+	    }
+	  dirp->size = (size_t) bytes;
+
+	  /* Reset the offset into the buffer.  */
+	  dirp->offset = 0;
+	}
+
+      dp = (struct dirent64 *) &dirp->data[dirp->offset];
+
+#ifdef _DIRENT_HAVE_D_RECLEN
+      reclen = dp->d_reclen;
+#else
+      /* The only version of `struct dirent64' that lacks `d_reclen'
+	 is fixed-size.  */
+      assert (sizeof dp->d_name > 1);
+      reclen = sizeof *dp;
+      /* The name is not terminated if it is the largest possible size.
+	 Clobber the following byte to ensure proper null termination.  We
+	 read jst one entry at a time above so we know that byte will not
+	 be used later.  */
+      dp->d_name[sizeof dp->d_name] = '\0';
+#endif
+
+      dirp->offset += reclen;
+
+#ifdef _DIRENT_HAVE_D_OFF
+      dirp->filepos = dp->d_off;
+#else
+      dirp->filepos += reclen;
+#endif
+
+      /* Skip deleted files.  */
+    } while (dp->d_ino == 0);
+
+  __libc_lock_unlock (dirp->lock);
+
+  return dp;
+}
diff --git a/sysdeps/unix/sysv/linux/readdir64_r.c b/sysdeps/unix/sysv/linux/readdir64_r.c
new file mode 100644
index 0000000000..57ae4c786e
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/readdir64_r.c
@@ -0,0 +1,107 @@
+/* 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 Library General Public License as
+   published by the Free Software Foundation; either version 2 of the
+   License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Library General Public License for more details.
+
+   You should have received a copy of the GNU Library General Public
+   License along with the GNU C Library; see the file COPYING.LIB.  If not,
+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
+
+#include <errno.h>
+#include <limits.h>
+#include <stddef.h>
+#include <string.h>
+#include <dirent.h>
+#include <unistd.h>
+#include <sys/types.h>
+#include <assert.h>
+
+#include <dirstream.h>
+
+extern ssize_t __getdirentries64 (int, char *, size_t, off_t *);
+
+
+/* Read a directory entry from DIRP, store result in ENTRY and return
+   pointer to result in *RESULT.  */
+int
+readdir64_r (DIR *dirp, struct dirent64 *entry, struct dirent64 **result)
+{
+  struct dirent64 *dp;
+  size_t reclen;
+
+  __libc_lock_lock (dirp->lock);
+
+  do
+    {
+      if (dirp->offset >= dirp->size)
+	{
+	  /* We've emptied out our buffer.  Refill it.  */
+
+	  size_t maxread;
+	  off_t base;
+	  ssize_t bytes;
+
+#ifndef _DIRENT_HAVE_D_RECLEN
+	  /* Fixed-size struct; must read one at a time (see below).  */
+	  maxread = sizeof *dp;
+#else
+	  maxread = dirp->allocation;
+#endif
+
+	  base = dirp->filepos;
+	  bytes = __getdirentries64 (dirp->fd, dirp->data, maxread, &base);
+	  if (bytes <= 0)
+	    {
+	      dp = NULL;
+	      reclen = 0;
+	      break;
+	    }
+	  dirp->size = (size_t) bytes;
+
+	  /* Reset the offset into the buffer.  */
+	  dirp->offset = 0;
+	}
+
+      dp = (struct dirent64 *) &dirp->data[dirp->offset];
+
+#ifdef _DIRENT_HAVE_D_RECLEN
+      reclen = dp->d_reclen;
+#else
+      /* The only version of `struct dirent64' that lacks `d_reclen'
+	 is fixed-size.  */
+      assert (sizeof dp->d_name > 1);
+      reclen = sizeof *dp;
+      /* The name is not terminated if it is the largest possible size.
+	 Clobber the following byte to ensure proper null termination.  We
+	 read just one entry at a time above so we know that byte will not
+	 be used later.  */
+      dp->d_name[sizeof dp->d_name] = '\0';
+#endif
+
+      dirp->offset += reclen;
+
+#ifdef _DIRENT_HAVE_D_OFF
+      dirp->filepos = dp->d_off;
+#else
+      dirp->filepos += reclen;
+#endif
+
+      /* Skip deleted files.  */
+    } while (dp->d_ino == 0);
+
+  if (dp != NULL)
+    *result = memcpy (entry, dp, reclen);
+
+  __libc_lock_unlock (dirp->lock);
+
+  return dp != NULL ? 0 : errno;
+}
diff --git a/sysdeps/unix/sysv/linux/powerpc/sigreturn.S b/sysdeps/unix/sysv/linux/rt_sigpending.c
index 9b9413e2f3..b605315644 100644
--- a/sysdeps/unix/sysv/linux/powerpc/sigreturn.S
+++ b/sysdeps/unix/sysv/linux/rt_sigpending.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
+/* 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
@@ -16,8 +16,12 @@
    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
-#include <sysdep.h>
+#include <errno.h>
+#include <signal.h>
 
-PSEUDO (__sigreturn, sigreturn, 1)
-	/* Shouldn't get here.  */
-PSEUDO_END(__sigreturn)
+int
+__syscall_rt_sigpending (sigset_t *set, size_t setsize)
+{
+  __set_errno (ENOSYS);
+  return -1;
+}
diff --git a/sysdeps/unix/sysv/linux/siglist.c b/sysdeps/unix/sysv/linux/siglist.c
index 9f42cc0a87..6bb8562899 100644
--- a/sysdeps/unix/sysv/linux/siglist.c
+++ b/sysdeps/unix/sysv/linux/siglist.c
@@ -21,6 +21,6 @@ default_symbol_version (__new_sys_siglist, _sys_siglist, GLIBC_2.1);
 default_symbol_version (_new_sys_siglist, sys_siglist, GLIBC_2.1);
 default_symbol_version (__new_sys_sigabbrev, sys_sigabbrev, GLIBC_2.1);
 #else
-weak_alias(_sys_siglist, sys_siglist)
-weak_alias(_sys_sigabbrev, sys_sigabbrev)
+weak_alias(__new_sys_siglist, sys_siglist)
+weak_alias(__new_sys_sigabbrev, sys_sigabbrev)
 #endif
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/bits/types.h b/sysdeps/unix/sysv/linux/sparc/sparc64/bits/types.h
index 0c421fb7a7..5ee6c0ee7a 100644
--- a/sysdeps/unix/sysv/linux/sparc/sparc64/bits/types.h
+++ b/sysdeps/unix/sysv/linux/sparc/sparc64/bits/types.h
@@ -95,6 +95,9 @@ typedef struct
 
 typedef int __key_t;
 
+/* Used in `struct shmid_ds'.  */
+typedef int __ipc_pid_t;
+
 
 /* Types from the Large File Support interface.  */
 
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/fstatfs64.c b/sysdeps/unix/sysv/linux/sparc/sparc64/fstatfs64.c
new file mode 100644
index 0000000000..2be4e59ba4
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/sparc/sparc64/fstatfs64.c
@@ -0,0 +1 @@
+/* fstatfs64 is the same as fstatfs. */
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/ftruncate64.c b/sysdeps/unix/sysv/linux/sparc/sparc64/ftruncate64.c
new file mode 100644
index 0000000000..673a8b525a
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/sparc/sparc64/ftruncate64.c
@@ -0,0 +1 @@
+/* ftruncate64 is the same as ftruncate. */
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/getrlimit64.c b/sysdeps/unix/sysv/linux/sparc/sparc64/getrlimit64.c
new file mode 100644
index 0000000000..9feab0e6b8
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/sparc/sparc64/getrlimit64.c
@@ -0,0 +1 @@
+/* getrlimit64 is the same as getrlimit. */
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/readdir.c b/sysdeps/unix/sysv/linux/sparc/sparc64/readdir.c
new file mode 100644
index 0000000000..96a6a76945
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/sparc/sparc64/readdir.c
@@ -0,0 +1,4 @@
+#define readdir64 __no_readdir64_decl
+#include <sysdeps/unix/readdir.c>
+#undef readdir64
+weak_alias (__readdir, readdir64)
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/readdir64.c b/sysdeps/unix/sysv/linux/sparc/sparc64/readdir64.c
new file mode 100644
index 0000000000..9796431dc4
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/sparc/sparc64/readdir64.c
@@ -0,0 +1 @@
+/* readdir64 is in readdir.c */
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/readdir64_r.c b/sysdeps/unix/sysv/linux/sparc/sparc64/readdir64_r.c
new file mode 100644
index 0000000000..b8fe9a31b4
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/sparc/sparc64/readdir64_r.c
@@ -0,0 +1 @@
+/* readdir64_r is in readdir_r.c */
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/readdir_r.c b/sysdeps/unix/sysv/linux/sparc/sparc64/readdir_r.c
new file mode 100644
index 0000000000..adb92db6af
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/sparc/sparc64/readdir_r.c
@@ -0,0 +1,4 @@
+#define readdir64_r __no_readdir64_r_decl
+#include <sysdeps/unix/readdir_r.c>
+#undef readdir64_r
+weak_alias (__readdir_r, readdir64_r)
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/setrlimit64.c b/sysdeps/unix/sysv/linux/sparc/sparc64/setrlimit64.c
new file mode 100644
index 0000000000..8edcff0086
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/sparc/sparc64/setrlimit64.c
@@ -0,0 +1 @@
+/* setrlimit64 is the same as setrlimit. */
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/statfs64.c b/sysdeps/unix/sysv/linux/sparc/sparc64/statfs64.c
new file mode 100644
index 0000000000..06bc68826f
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/sparc/sparc64/statfs64.c
@@ -0,0 +1 @@
+/* statfs64 is the same as statfs. */
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/syscalls.list b/sysdeps/unix/sysv/linux/sparc/sparc64/syscalls.list
index 6491a9ccac..7e64daf578 100644
--- a/sysdeps/unix/sysv/linux/sparc/sparc64/syscalls.list
+++ b/sysdeps/unix/sysv/linux/sparc/sparc64/syscalls.list
@@ -4,6 +4,12 @@
 llseek		EXTRA	lseek		3	__llseek	llseek lseek64
 pread		EXTRA	pread		4	__pread		pread __pread64 pread64
 pwrite		EXTRA	pwrite		4	__pwrite	pwrite __pwrite64 pwrite64
+fstatfs		-	fstatfs		2	__fstatfs	fstatfs fstatfs64
+statfs		-	statfs		2	__statfs	statfs statfs64
+getrlimit	-	getrlimit	2	getrlimit	getrlimit64
+setrlimit	-	setrlimit	2	setrlimit	setrlimit64
+ftruncate	-	ftruncate	2	ftruncate	ftruncate64
+truncate	-	truncate	2	truncate	truncate64
 
 # Override select.S in parent directory:
 select		-	select		5	__select	select
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/truncate64.c b/sysdeps/unix/sysv/linux/sparc/sparc64/truncate64.c
new file mode 100644
index 0000000000..8999768874
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/sparc/sparc64/truncate64.c
@@ -0,0 +1 @@
+/* truncate64 is the same as truncate. */
diff --git a/sysdeps/unix/sysv/linux/stdio_lim.h.in b/sysdeps/unix/sysv/linux/stdio_lim.h.in
index 7fa98f7733..07280956f2 100644
--- a/sysdeps/unix/sysv/linux/stdio_lim.h.in
+++ b/sysdeps/unix/sysv/linux/stdio_lim.h.in
@@ -17,17 +17,24 @@
    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
-#ifndef _STDIO_H
+#if !defined _STDIO_H && !defined __need_FOPEN_MAX
 # error "Never include <bits/stdio_lim.h> directly; use <stdio.h> instead."
 #endif
 
-#define L_tmpnam 19
-#define TMP_MAX 238328
+#ifndef __need_FOPEN_MAX
+# define L_tmpnam 19
+# define TMP_MAX 238328
 
-#ifdef __USE_POSIX
-# define L_ctermid 9
-# define L_cuserid 9
+# ifdef __USE_POSIX
+#  define L_ctermid 9
+#  define L_cuserid 9
+# endif
+
+# define FILENAME_MAX	DEFAULT_FILENAME_MAX
 #endif
 
-#define FOPEN_MAX	DEFAULT_FOPEN_MAX
-#define FILENAME_MAX	DEFAULT_FILENAME_MAX
+#if defined __need_FOPEN_MAX && !defined __defined_FOPEN_MAX
+# define __defined_FOPEN_MAX
+# define FOPEN_MAX	DEFAULT_FOPEN_MAX
+#endif
+#undef __need_FOPEN_MAX
diff --git a/sysdeps/unix/sysv/linux/testrtsig.h b/sysdeps/unix/sysv/linux/testrtsig.h
index 7256d71227..7c41877e66 100644
--- a/sysdeps/unix/sysv/linux/testrtsig.h
+++ b/sysdeps/unix/sysv/linux/testrtsig.h
@@ -21,10 +21,10 @@
 #include <string.h>
 #include <sys/utsname.h>
 
-int
+static int
 kernel_has_rtsig (void)
 {
   struct utsname name;
 
-  return uname (&name) < 0 || __strverscmp (name.release, "2.1.70") >= 0;
+  return uname (&name) == 0 && __strverscmp (name.release, "2.1.70") >= 0;
 }
diff --git a/sysdeps/unix/sysv/linux/ulimit.c b/sysdeps/unix/sysv/linux/ulimit.c
index ef224d22ac..58ff111612 100644
--- a/sysdeps/unix/sysv/linux/ulimit.c
+++ b/sysdeps/unix/sysv/linux/ulimit.c
@@ -16,10 +16,11 @@
    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
+#include <errno.h>
+#include <stdarg.h>
 #include <sysdep.h>
-#include <sys/resource.h>
 #include <unistd.h>
-#include <errno.h>
+#include <sys/resource.h>
 
 /* Function depends on CMD:
    1 = Return the limit on the size of a file, in units of 512 bytes.
@@ -31,42 +32,46 @@
        can open.
    Returns -1 on errors.  */
 long int
-__ulimit (cmd, newlimit)
-     int cmd;
-     long int newlimit;
+__ulimit (int cmd, ...)
 {
-  int status;
+  struct rlimit limit;
+  va_list va;
+  long int result = -1;
+
+  va_start (va, cmd);
 
   switch (cmd)
     {
-    case 1:
-      {
-	/* Get limit on file size.  */
-	struct rlimit fsize;
-
-	status = getrlimit (RLIMIT_FSIZE, &fsize);
-	if (status < 0)
-	  return -1;
-
+    case UL_GETFSIZE:
+      /* Get limit on file size.  */
+      if (getrlimit (RLIMIT_FSIZE, &limit) == 0)
 	/* Convert from bytes to 512 byte units.  */
-	return fsize.rlim_cur / 512;
-      }
-    case 2:
+	result =  limit.rlim_cur / 512;
+      break;
+
+    case UL_SETFSIZE:
       /* Set limit on file size.  */
       {
-	struct rlimit fsize;
-	fsize.rlim_cur = newlimit * 512;
-	fsize.rlim_max = newlimit * 512;
+	long int newlimit = va_arg (va, long int);
+
+	limit.rlim_cur = newlimit * 512;
+	limit.rlim_max = newlimit * 512;
 
-	return setrlimit (RLIMIT_FSIZE, &fsize);
+	result = setrlimit (RLIMIT_FSIZE, &limit);
       }
-    case 4:
-      return sysconf (_SC_OPEN_MAX);
+      break;
+
+    case __UL_GETOPENMAX:
+      result = sysconf (_SC_OPEN_MAX);
+      break;
 
     default:
       __set_errno (EINVAL);
-      return -1;
     }
+
+  va_end (va);
+
+  return result;
 }
 
 weak_alias (__ulimit, ulimit);
diff --git a/sysdeps/unix/sysv/linux/xstat64.c b/sysdeps/unix/sysv/linux/xstat64.c
new file mode 100644
index 0000000000..02f70c5c51
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/xstat64.c
@@ -0,0 +1,41 @@
+/* xstat64 using old-style Unix stat system call.
+   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 Library General Public License as
+   published by the Free Software Foundation; either version 2 of the
+   License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Library General Public License for more details.
+
+   You should have received a copy of the GNU Library General Public
+   License along with the GNU C Library; see the file COPYING.LIB.  If not,
+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
+
+#include <errno.h>
+#include <stddef.h>
+#include <sys/stat.h>
+#include <kernel_stat.h>
+
+#include <xstatconv.c>
+
+extern int __syscall_stat (const char *, struct kernel_stat *);
+
+/* Get information about the file NAME in BUF.  */
+int
+__xstat64 (int vers, const char *name, struct stat64 *buf)
+{
+  struct kernel_stat kbuf;
+  int result;
+
+  result =  __syscall_stat (name, &kbuf);
+  if (result == 0)
+    result = xstat64_conv (vers, &kbuf, buf);
+
+  return result;
+}
diff --git a/sysdeps/unix/sysv/linux/xstatconv.c b/sysdeps/unix/sysv/linux/xstatconv.c
index fcf2f3b9f6..0a8e0c47f9 100644
--- a/sysdeps/unix/sysv/linux/xstatconv.c
+++ b/sysdeps/unix/sysv/linux/xstatconv.c
@@ -81,3 +81,65 @@ xstat_conv (int vers, struct kernel_stat *kbuf, void *ubuf)
 
   return 0;
 }
+
+static inline int
+xstat64_conv (int vers, struct kernel_stat *kbuf, void *ubuf)
+{
+#ifdef XSTAT_IS_XSTAT64
+  return xstat_conv (vers, kbuf, ubuf);
+#else
+  switch (vers)
+    {
+    case _STAT_VER_LINUX:
+      {
+	struct stat64 *buf = ubuf;
+
+	/* Convert to current kernel version of `struct stat64'.  */
+	buf->st_dev = kbuf->st_dev;
+#ifdef _HAVE___PAD1
+	buf->__pad1 = 0;
+#endif
+	buf->st_ino = kbuf->st_ino;
+	buf->st_mode = kbuf->st_mode;
+	buf->st_nlink = kbuf->st_nlink;
+	buf->st_uid = kbuf->st_uid;
+	buf->st_gid = kbuf->st_gid;
+	buf->st_rdev = kbuf->st_rdev;
+#ifdef _HAVE___PAD2
+	buf->__pad2 = 0;
+#endif
+	buf->st_size = kbuf->st_size;
+	buf->st_blksize = kbuf->st_blksize;
+	buf->st_blocks = kbuf->st_blocks;
+	buf->st_atime = kbuf->st_atime;
+#ifdef _HAVE___UNUSED1
+	buf->__unused1 = 0;
+#endif
+	buf->st_mtime = kbuf->st_mtime;
+#ifdef _HAVE___UNUSED2
+	buf->__unused2 = 0;
+#endif
+	buf->st_ctime = kbuf->st_ctime;
+#ifdef _HAVE___UNUSED3
+	buf->__unused3 = 0;
+#endif
+#ifdef _HAVE___UNUSED4
+	buf->__unused4 = 0;
+#endif
+#ifdef _HAVE___UNUSED5
+	buf->__unused5 = 0;
+#endif
+      }
+      break;
+
+      /* If struct stat64 is different from struct stat then
+	 _STAT_VER_KERNEL does not make sense.  */
+    case _STAT_VER_KERNEL:
+    default:
+      __set_errno (EINVAL);
+      return -1;
+    }
+
+  return 0;
+#endif
+}
diff --git a/sysdeps/wordsize-32/inttypes.h b/sysdeps/wordsize-32/inttypes.h
index f569be5b51..9200b8c2b8 100644
--- a/sysdeps/wordsize-32/inttypes.h
+++ b/sysdeps/wordsize-32/inttypes.h
@@ -313,20 +313,29 @@ typedef unsigned long long int uint_fast64_t;
 /* Macros for printing format specifiers.  */
 
 /* Decimal notation.  */
+#define SCNd8		"hhd"
 #define SCNd16		"hd"
 #define SCNd32		"d"
 #define SCNd64		"lld"
 
+#define SCNi8		"hhi"
 #define SCNi16		"hi"
 #define SCNi32		"i"
 #define SCNi64		"lli"
 
+#define SCNu8		"hhu"
+#define SCNu16		"hu"
+#define SCNu32		"u"
+#define SCNu64		"llu"
+
 /* Octal notation.  */
+#define SCNo8		"hho"
 #define SCNo16		"ho"
 #define SCNo32		"o"
 #define SCNo64		"llo"
 
 /* Hexadecimal notation.  */
+#define SCNx8		"hhx"
 #define SCNx16		"hx"
 #define SCNx32		"x"
 #define SCNx64		"llx"
diff --git a/sysdeps/wordsize-64/inttypes.h b/sysdeps/wordsize-64/inttypes.h
index c62d516c4b..8ec8095620 100644
--- a/sysdeps/wordsize-64/inttypes.h
+++ b/sysdeps/wordsize-64/inttypes.h
@@ -313,20 +313,29 @@ typedef unsigned long int uint_fast64_t;
 /* Macros for printing format specifiers.  */
 
 /* Decimal notation.  */
+#define SCNd8		"hhd"
 #define SCNd16		"hd"
 #define SCNd32		"d"
 #define SCNd64		"ld"
 
+#define SCNi8		"hhi"
 #define SCNi16		"hi"
 #define SCNi32		"i"
 #define SCNi64		"li"
 
+#define SCNu8		"hhu"
+#define SCNu16		"hu"
+#define SCNu32		"u"
+#define SCNu64		"lu"
+
 /* Octal notation.  */
+#define SCNo8		"hho"
 #define SCNo16		"ho"
 #define SCNo32		"o"
 #define SCNo64		"lo"
 
 /* Hexadecimal notation.  */
+#define SCNx8		"hhx"
 #define SCNx16		"hx"
 #define SCNx32		"x"
 #define SCNx64		"lx"