about summary refs log tree commit diff
path: root/sysdeps/unix
diff options
context:
space:
mode:
Diffstat (limited to 'sysdeps/unix')
-rw-r--r--sysdeps/unix/bsd/bits/fcntl.h65
-rw-r--r--sysdeps/unix/bsd/bits/stat.h2
-rw-r--r--sysdeps/unix/bsd/bsd4.4/wait3.c2
-rw-r--r--sysdeps/unix/bsd/osf/alpha/bits/stat.h2
-rw-r--r--sysdeps/unix/bsd/sun/sunos4/bits/resource.h42
-rw-r--r--sysdeps/unix/sysv/i386/i686/time.S27
-rw-r--r--sysdeps/unix/sysv/i386/time.S6
-rw-r--r--sysdeps/unix/sysv/linux/_G_config.h15
-rw-r--r--sysdeps/unix/sysv/linux/alpha/bits/dirent.h50
-rw-r--r--sysdeps/unix/sysv/linux/alpha/bits/fcntl.h79
-rw-r--r--sysdeps/unix/sysv/linux/alpha/bits/stat.h2
-rw-r--r--sysdeps/unix/sysv/linux/alpha/bits/types.h21
-rw-r--r--sysdeps/unix/sysv/linux/bits/dirent.h25
-rw-r--r--sysdeps/unix/sysv/linux/bits/fcntl.h84
-rw-r--r--sysdeps/unix/sysv/linux/bits/resource.h115
-rw-r--r--sysdeps/unix/sysv/linux/bits/stat.h45
-rw-r--r--sysdeps/unix/sysv/linux/bits/statfs.h36
-rw-r--r--sysdeps/unix/sysv/linux/bits/types.h23
-rw-r--r--sysdeps/unix/sysv/linux/getsysstats.c6
-rw-r--r--sysdeps/unix/sysv/linux/if_index.c1
-rw-r--r--sysdeps/unix/sysv/linux/llseek.c6
-rw-r--r--sysdeps/unix/sysv/linux/lseek64.c1
-rw-r--r--sysdeps/unix/sysv/linux/mips/bits/fcntl.h94
-rw-r--r--sysdeps/unix/sysv/linux/mips/bits/stat.h51
-rw-r--r--sysdeps/unix/sysv/linux/mips/bits/statfs.h40
-rw-r--r--sysdeps/unix/sysv/linux/poll.c5
-rw-r--r--sysdeps/unix/sysv/linux/readv.c4
-rw-r--r--sysdeps/unix/sysv/linux/sparc/bits/fcntl.h80
-rw-r--r--sysdeps/unix/sysv/linux/sparc/bits/ioctls.h8
-rw-r--r--sysdeps/unix/sysv/linux/sparc/sparc64/bits/types.h23
-rw-r--r--sysdeps/unix/sysv/linux/sparc/sparc64/kernel_stat.h6
-rw-r--r--sysdeps/unix/sysv/linux/sparc/sparc64/setjmp.S13
-rw-r--r--sysdeps/unix/sysv/linux/sys/mman.h10
-rw-r--r--sysdeps/unix/sysv/linux/sys/param.h6
-rw-r--r--sysdeps/unix/sysv/linux/writev.c4
-rw-r--r--sysdeps/unix/sysv/sysv4/i386/bits/stat.h4
-rw-r--r--sysdeps/unix/sysv/sysv4/solaris2/bits/stat.h2
37 files changed, 752 insertions, 253 deletions
diff --git a/sysdeps/unix/bsd/bits/fcntl.h b/sysdeps/unix/bsd/bits/fcntl.h
index 3d9bcb5c60..8565170fa5 100644
--- a/sysdeps/unix/bsd/bits/fcntl.h
+++ b/sysdeps/unix/bsd/bits/fcntl.h
@@ -18,7 +18,7 @@
    Boston, MA 02111-1307, USA.  */
 
 #ifndef	_FCNTL_H
-#error "Never use <bits/fcntl.h> directly; include <fcntl.h> instead."
+# error "Never use <bits/fcntl.h> directly; include <fcntl.h> instead."
 #endif
 
 
@@ -35,10 +35,10 @@
 /* Apparently not assigning a controlling terminal is the default
    behavior in BSD, so no bit is required to request that behavior.  */
 #define	O_NOCTTY	0	/* Don't assign a controlling terminal.  */
-#if	defined (__USE_BSD) || defined (__USE_SVID)
-#define	O_ASYNC		0x0040	/* Send SIGIO to owner when data is ready.  */
-#define	O_FSYNC		0x2000	/* Synchronous writes.  */
-#define	O_SYNC		O_FSYNC
+#if defined __USE_BSD || defined __USE_SVID
+# define O_ASYNC		0x0040	/* Send SIGIO to owner when data is ready.  */
+# define O_FSYNC		0x2000	/* Synchronous writes.  */
+# define O_SYNC		O_FSYNC
 #endif
 
 /* File status flags for `open' and `fcntl'.  */
@@ -48,7 +48,7 @@
 #ifdef __USE_BSD
 /* BSD before 4.4 doesn't support POSIX.1 O_NONBLOCK,
    but O_NDELAY is close.  */
-#define	O_NDELAY	O_NONBLOCK
+# define O_NDELAY	O_NONBLOCK
 #endif
 
 #ifdef __USE_BSD
@@ -56,26 +56,29 @@
    These are all the O_* flags, plus FREAD and FWRITE, which are
    independent bits set by which of O_RDONLY, O_WRONLY, and O_RDWR, was
    given to `open'.  */
-#define FREAD		1
-#define	FWRITE		2
+# define FREAD		1
+# define FWRITE		2
 
 /* Traditional BSD names the O_* bits.  */
-#define FASYNC		O_ASYNC
-#define FCREAT		O_CREAT
-#define FEXCL		O_EXCL
-#define FTRUNC		O_TRUNC
-#define FNOCTTY		O_NOCTTY
-#define FFSYNC		O_FSYNC
-#define FSYNC		O_SYNC
-#define FAPPEND		O_APPEND
-#define FNONBLOCK	O_NONBLOCK
-#define FNDELAY		O_NDELAY
+# define FASYNC		O_ASYNC
+# define FCREAT		O_CREAT
+# define FEXCL		O_EXCL
+# define FTRUNC		O_TRUNC
+# define FNOCTTY	O_NOCTTY
+# define FFSYNC		O_FSYNC
+# define FSYNC		O_SYNC
+# define FAPPEND	O_APPEND
+# define FNONBLOCK	O_NONBLOCK
+# define FNDELAY	O_NDELAY
 #endif
 
 /* Mask for file access modes.  This is system-dependent in case
    some system ever wants to define some other flavor of access.  */
 #define	O_ACCMODE	(O_RDONLY|O_WRONLY|O_RDWR)
 
+/* XXX missing */
+#define O_LARGEFILE	0
+
 /* Values for the second argument to `fcntl'.  */
 #define	F_DUPFD	  	0	/* Duplicate file descriptor.  */
 #define	F_GETFD		1	/* Get file descriptor flags.  */
@@ -83,13 +86,18 @@
 #define	F_GETFL		3	/* Get file status flags.  */
 #define	F_SETFL		4	/* Set file status flags.  */
 #ifdef __USE_BSD
-#define	F_GETOWN	5	/* Get owner (receiver of SIGIO).  */
-#define	F_SETOWN	6	/* Set owner (receiver of SIGIO).  */
+# define F_GETOWN	5	/* Get owner (receiver of SIGIO).  */
+# define F_SETOWN	6	/* Set owner (receiver of SIGIO).  */
 #endif
 #define	F_GETLK		7	/* Get record locking info.  */
 #define	F_SETLK		8	/* Set record locking info (non-blocking).  */
 #define	F_SETLKW	9	/* Set record locking info (blocking).  */
 
+/* XXX missing */
+#define F_GETLK64	7	/* Get record locking info.  */
+#define F_SETLK64	8	/* Set record locking info (non-blocking).  */
+#define F_SETLKW64	9	/* Set record locking info (blocking).  */
+
 /* File descriptor flags used with F_GETFD and F_SETFD.  */
 #define	FD_CLOEXEC	1	/* Close on exec.  */
 
@@ -102,12 +110,29 @@ struct flock
   {
     short int l_type;	/* Type of lock: F_RDLCK, F_WRLCK, or F_UNLCK.  */
     short int l_whence;	/* Where `l_start' is relative to (like `lseek').  */
+#ifndef __USE_FILE_OFFSET64
     __off_t l_start;	/* Offset where the lock begins.  */
     __off_t l_len;	/* Size of the locked area; zero means until EOF.  */
+#else
+    __off64_t l_start;	/* Offset where the lock begins.  */
+    __off64_t l_len;	/* Size of the locked area; zero means until EOF.  */
+#endif
     short int l_pid;	/* Process holding the lock.  */
     short int l_xxx;	/* Reserved for future use.  */
   };
 
+#ifdef __USE_LARGEFILE64
+struct flock64
+  {
+    short int l_type;	/* Type of lock: F_RDLCK, F_WRLCK, or F_UNLCK.  */
+    short int l_whence;	/* Where `l_start' is relative to (like `lseek').  */
+    __off64_t l_start;	/* Offset where the lock begins.  */
+    __off64_t l_len;	/* Size of the locked area; zero means until EOF.  */
+    short int l_pid;	/* Process holding the lock.  */
+    short int l_xxx;	/* Reserved for future use.  */
+  };
+#endif
+
 /* Values for the `l_type' field of a `struct flock'.  */
 #define	F_RDLCK	1	/* Read lock.  */
 #define	F_WRLCK	2	/* Write lock.  */
diff --git a/sysdeps/unix/bsd/bits/stat.h b/sysdeps/unix/bsd/bits/stat.h
index 037433f388..71130f3fcb 100644
--- a/sysdeps/unix/bsd/bits/stat.h
+++ b/sysdeps/unix/bsd/bits/stat.h
@@ -56,7 +56,7 @@ struct stat
     unsigned long int st_blksize; /* Optimal block size for I/O.  */
 #define	_STATBUF_ST_BLKSIZE	/* Tell code we have this member.  */
 
-    unsigned long int st_blocks; /* Number of 512-byte blocks allocated.  */
+    __blkcnt_t st_blocks;	/* Number of 512-byte blocks allocated.  */
 
     long int st_spare[2];
   };
diff --git a/sysdeps/unix/bsd/bsd4.4/wait3.c b/sysdeps/unix/bsd/bsd4.4/wait3.c
index 5caee579b7..b3802aee69 100644
--- a/sysdeps/unix/bsd/bsd4.4/wait3.c
+++ b/sysdeps/unix/bsd/bsd4.4/wait3.c
@@ -27,7 +27,7 @@
    children; otherwise don't.  */
 pid_t
 __wait3 (stat_loc, options, usage)
-     __WAIT_STATUS_DEFN stat_loc;
+     __WAIT_STATUS stat_loc;
      int options;
      struct rusage *usage;
 {
diff --git a/sysdeps/unix/bsd/osf/alpha/bits/stat.h b/sysdeps/unix/bsd/osf/alpha/bits/stat.h
index 752d4eede1..ab0fa48f68 100644
--- a/sysdeps/unix/bsd/osf/alpha/bits/stat.h
+++ b/sysdeps/unix/bsd/osf/alpha/bits/stat.h
@@ -49,7 +49,7 @@ struct stat
     unsigned int st_blksize;	/* Optimal block size for I/O.  */
 #define	_STATBUF_ST_BLKSIZE	/* Tell code we have this member.  */
 
-    int st_blocks;		/* Number of 512-byte blocks allocated.  */
+    __blkcnt_t st_blocks;	/* Number of 512-byte blocks allocated.  */
     unsigned int st_flags;
     unsigned int st_gen;
   };
diff --git a/sysdeps/unix/bsd/sun/sunos4/bits/resource.h b/sysdeps/unix/bsd/sun/sunos4/bits/resource.h
index ff55773e69..f51262d92d 100644
--- a/sysdeps/unix/bsd/sun/sunos4/bits/resource.h
+++ b/sysdeps/unix/bsd/sun/sunos4/bits/resource.h
@@ -22,6 +22,8 @@
    and `setrlimit' are not system calls, these are the values used by the C
    library to emulate them.  */
 
+#include <bits/types.h>
+
 /* Kinds of resource limit.  */
 enum __rlimit_resource
   {
@@ -52,19 +54,47 @@ enum __rlimit_resource
 #define	RLIMIT_NOFILE	RLIMIT_NOFILE
 #define	RLIMIT_OFILE	RLIMIT_OFILE
 
-    RLIM_NLIMITS,
-
-    RLIM_INFINITY = 0x7fffffff /* Value to indicate that there is no limit.  */
-#define RLIM_INFINITY RLIM_INFINITY
+    RLIM_NLIMITS
   };
 
+/* Value to indicate that there is no limit.  */
+#ifndef __USE_FILE_OFFSET64
+# define RLIM_INFINITY 0x7fffffff
+#else
+# define RLIM_INFINITY 0x7fffffffffffffffL
+#endif
+
+#ifdef __USE_LARGEFILE64
+# define RLIM64_INFINITY 0x7fffffffffffffffL
+#endif
+
+
+/* Type to represent quantities in resource limits.  */
+#ifndef __USE_FILE_OFFSET64
+typedef __rlim_t rlim_t;
+#else
+typedef __rlim64_t rlim_t;
+#endif
+
 struct rlimit
   {
     /* The current (soft) limit.  */
-    int rlim_cur;
+    rlim_t rlim_cur;
+    /* The hard limit.  */
+    rlim_t rlim_max;
+  };
+
+#ifdef __USE_LARGEFILE64
+typedef __rlim64_t rlim64_t;
+
+struct rlimit64
+  {
+    /* The current (soft) limit.  */
+    rlim64_t rlim_cur;
     /* The hard limit.  */
-    int rlim_max;
+    rlim64_t rlim_max;
   };
+#endif
 
 /* Whose usage statistics do you want?  */
 enum __rusage_who
diff --git a/sysdeps/unix/sysv/i386/i686/time.S b/sysdeps/unix/sysv/i386/i686/time.S
new file mode 100644
index 0000000000..c5d27635c9
--- /dev/null
+++ b/sysdeps/unix/sysv/i386/i686/time.S
@@ -0,0 +1,27 @@
+/* Copyright (C) 1991, 1992, 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 <sysdep.h>
+#include <asm-syntax.h>
+
+SYSCALL (time, 1)
+	movl 4(%esp), %edx	/* Put passed pointer in %edx.  */
+	testl %edx, %edx	/* Is it non-nil?  */
+	cmovnel %eax, (%edx)	/* Yes; store the time there.  */
+	ret
+PSEUDO_END (time)
diff --git a/sysdeps/unix/sysv/i386/time.S b/sysdeps/unix/sysv/i386/time.S
index 3a7069c848..158ae6c31e 100644
--- a/sysdeps/unix/sysv/i386/time.S
+++ b/sysdeps/unix/sysv/i386/time.S
@@ -17,11 +17,13 @@
    Boston, MA 02111-1307, USA.  */
 
 #include <sysdep.h>
+#include <asm-syntax.h>
 
 SYSCALL (time, 1)
 	movl 4(%esp), %edx	/* Put passed pointer in %edx.  */
 	testl %edx, %edx	/* Is it non-nil?  */
-	je null
+	je L(null)
 	movl %eax, (%edx)	/* Yes; store the time there.  */
-null:	ret
+L(null):
+	ret
 PSEUDO_END (time)
diff --git a/sysdeps/unix/sysv/linux/_G_config.h b/sysdeps/unix/sysv/linux/_G_config.h
index 8dc9221519..ccb84ad8f7 100644
--- a/sysdeps/unix/sysv/linux/_G_config.h
+++ b/sysdeps/unix/sysv/linux/_G_config.h
@@ -15,16 +15,19 @@
    hold any value corresponding to members of the extended character
    set, as well as at least one value that does not correspond to any
    member of the extended character set.  */
-#define _WINT_T
+# define _WINT_T
 typedef unsigned int wint_t;
 #endif
 #define _G_size_t	size_t
 #define _G_fpos_t	__off_t
+#define _G_fpos64_t	__off64_t
 #define _G_ssize_t	__ssize_t
 #define _G_off_t	__off_t
+#define _G_off64_t	__off64_t
 #define	_G_pid_t	__pid_t
 #define	_G_uid_t	__uid_t
 #define _G_wint_t	wint_t
+#define _G_stat64	stat
 
 typedef int _G_int16_t __attribute__ ((__mode__ (__HI__)));
 typedef int _G_int32_t __attribute__ ((__mode__ (__SI__)));
@@ -45,6 +48,10 @@ typedef unsigned int _G_uint32_t __attribute__ ((__mode__ (__SI__)));
 #define _G_HAVE_MMAP 1
 #define _G_HAVE_LONG_DOUBLE_IO 1
 
+#define _G_OPEN64	open64
+#define _G_LSEEK64	lseek64
+#define _G_FSTAT64	fstat64
+
 /* This is defined by <bits/stat.h> if `st_blksize' exists.  */
 #define _G_HAVE_ST_BLKSIZE defined (_STATBUF_ST_BLKSIZE)
 
@@ -53,15 +60,15 @@ typedef unsigned int _G_uint32_t __attribute__ ((__mode__ (__SI__)));
 /* These are the vtbl details for ELF.  */
 #define _G_NAMES_HAVE_UNDERSCORE 0
 #define _G_VTABLE_LABEL_HAS_LENGTH 1
-#define _G_USING_THUNKS
+#define _G_USING_THUNKS	1
 #define _G_VTABLE_LABEL_PREFIX "__vt_"
 #define _G_VTABLE_LABEL_PREFIX_ID __vt_
 
 
 #if defined (__cplusplus) || defined (__STDC__)
-#define _G_ARGS(ARGLIST) ARGLIST
+# define _G_ARGS(ARGLIST) ARGLIST
 #else
-#define _G_ARGS(ARGLIST) ()
+# define _G_ARGS(ARGLIST) ()
 #endif
 
 #endif	/* _G_config.h */
diff --git a/sysdeps/unix/sysv/linux/alpha/bits/dirent.h b/sysdeps/unix/sysv/linux/alpha/bits/dirent.h
new file mode 100644
index 0000000000..4d717e4194
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/alpha/bits/dirent.h
@@ -0,0 +1,50 @@
+/* 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 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.  */
+
+#ifndef _BITS_DIRENT_H
+#define _BITS_DIRENT_H	1
+
+/* We don't have to make a difference for __USE_FILE_OFFSET64.  */
+struct dirent
+  {
+    long int d_ino;
+    __off_t d_off;
+    unsigned short int d_reclen;
+    unsigned char d_type;
+    char d_name[256];		/* We must not include limits.h! */
+  };
+
+#ifdef __USE_LARGEFILE64
+struct dirent64
+  {
+    __ino64_t d_ino;
+    __off64_t d_off;
+    unsigned short int d_reclen;
+    unsigned char d_type;
+    char d_name[256];		/* We must not include limits.h! */
+  };
+#endif
+
+#define d_fileno	d_ino	/* Backwards compatibility.  */
+
+#undef  _DIRENT_HAVE_D_NAMLEN
+#define _DIRENT_HAVE_D_RECLEN
+#define _DIRENT_HAVE_D_OFF
+#define _DIRENT_HAVE_D_TYPE
+
+#endif /* bits/dirent.h */
diff --git a/sysdeps/unix/sysv/linux/alpha/bits/fcntl.h b/sysdeps/unix/sysv/linux/alpha/bits/fcntl.h
index b70502f21a..14840649ea 100644
--- a/sysdeps/unix/sysv/linux/alpha/bits/fcntl.h
+++ b/sysdeps/unix/sysv/linux/alpha/bits/fcntl.h
@@ -18,7 +18,7 @@
    Boston, MA 02111-1307, USA.  */
 
 #ifndef	_FCNTL_H
-#error "Never use <bits/fcntl.h> directly; include <fcntl.h> instead."
+# error "Never use <bits/fcntl.h> directly; include <fcntl.h> instead."
 #endif
 
 
@@ -27,8 +27,8 @@
 
 /* In GNU, read and write are bits (unlike BSD).  */
 #ifdef __USE_GNU
-#define	O_READ		O_RDONLY /* Open for reading.  */
-#define O_WRITE		O_WRONLY /* Open for writing.  */
+# define O_READ		O_RDONLY /* Open for reading.  */
+# define O_WRITE	O_WRONLY /* Open for writing.  */
 #endif
 /* open/fcntl - O_SYNC is only implemented on blocks devices and on files
    located on an ext2 file system */
@@ -48,25 +48,36 @@
 #define O_FSYNC		O_SYNC
 #define O_ASYNC		020000	/* fcntl, for BSD compatibility */
 
-#define F_DUPFD		0	/* dup */
-#define F_GETFD		1	/* get f_flags */
-#define F_SETFD		2	/* set f_flags */
-#define F_GETFL		3	/* more flags (cloexec) */
-#define F_SETFL		4
-#define F_GETLK		7
-#define F_SETLK		8
-#define F_SETLKW	9
-
-#define F_SETOWN	5	/*  for sockets. */
-#define F_GETOWN	6	/*  for sockets. */
+/* XXX missing */
+#define O_LARGEFILE	0
+
+/* Values for the second argument to `fcntl'.  */
+#define F_DUPFD		0	/* Duplicate file descriptor.  */
+#define F_GETFD		1	/* Get file descriptor flags.  */
+#define F_SETFD		2	/* Set file descriptor flags.  */
+#define F_GETFL		3	/* Get file status flags.  */
+#define F_SETFL		4	/* Set file status flags.  */
+#define F_GETLK		7	/* Get record locking info.  */
+#define F_SETLK		8	/* Set record locking info (non-blocking).  */
+#define F_SETLKW	9	/* Set record locking info (blocking).  */
+
+/* XXX missing */
+#define F_GETLK64	7	/* Get record locking info.  */
+#define F_SETLK64	8	/* Set record locking info (non-blocking).  */
+#define F_SETLKW64	9	/* Set record locking info (blocking).  */
+
+#ifdef __USE_BSD
+# define F_SETOWN	5	/* Get owner of socket (receiver of SIGIO).  */
+# define F_GETOWN	6	/* Set owner of socket (receiver of SIGIO).  */
+#endif
 
 /* for F_[GET|SET]FL */
 #define FD_CLOEXEC	1	/* actually anything with low bit set goes */
 
-/* for posix fcntl() and lockf() */
-#define F_RDLCK		1
-#define F_WRLCK		2
-#define F_UNLCK		8
+/* For posix fcntl() and `l_type' field of a `struct flock' for lockf() */
+#define F_RDLCK		1	/* Read lock.  */
+#define F_WRLCK		2	/* Write lock.  */
+#define F_UNLCK		8	/* Remove lock.  */
 
 /* for old implementation of bsd flock () */
 #define F_EXLCK		16	/* or 3 */
@@ -79,22 +90,34 @@
 				   blocking */
 #define LOCK_UN		8	/* remove lock */
 
+/* We don't need to support __USE_FILE_OFFSET64.  */
 struct flock
   {
-    short int l_type;
-    short int l_whence;
-    __off_t l_start;
-    __off_t l_len;
-    __pid_t l_pid;
+    short int l_type;	/* Type of lock: F_RDLCK, F_WRLCK, or F_UNLCK.  */
+    short int l_whence;	/* Where `l_start' is relative to (like `lseek').  */
+    __off_t l_start;	/* Offset where the lock begins.  */
+    __off_t l_len;	/* Size of the locked area; zero means until EOF.  */
+    __pid_t l_pid;	/* Process holding the lock.  */
+  };
+
+#ifdef __USE_LARGEFILE64
+struct flock64
+  {
+    short int l_type;	/* Type of lock: F_RDLCK, F_WRLCK, or F_UNLCK.  */
+    short int l_whence;	/* Where `l_start' is relative to (like `lseek').  */
+    __off64_t l_start;	/* Offset where the lock begins.  */
+    __off64_t l_len;	/* Size of the locked area; zero means until EOF.  */
+    __pid_t l_pid;	/* Process holding the lock.  */
   };
+#endif
 
 
 /* Define some more compatibility macros to be backward compatible with
    BSD systems which did not managed to hide these kernel macros.  */
 #ifdef	__USE_BSD
-#define	FAPPEND		O_APPEND
-#define	FFSYNC		O_FSYNC
-#define	FASYNC		O_ASYNC
-#define	FNONBLOCK	O_NONBLOCK
-#define	FNDELAY		O_NDELAY
+# define FAPPEND		O_APPEND
+# define FFSYNC		O_FSYNC
+# define FASYNC		O_ASYNC
+# define FNONBLOCK	O_NONBLOCK
+# define FNDELAY		O_NDELAY
 #endif /* Use BSD.  */
diff --git a/sysdeps/unix/sysv/linux/alpha/bits/stat.h b/sysdeps/unix/sysv/linux/alpha/bits/stat.h
index 768b8192ff..cc2a2eac90 100644
--- a/sysdeps/unix/sysv/linux/alpha/bits/stat.h
+++ b/sysdeps/unix/sysv/linux/alpha/bits/stat.h
@@ -46,7 +46,7 @@ struct stat
     __time_t st_ctime;		/* Time of last status change.  */
     unsigned int st_blksize;	/* Optimal block size for I/O.  */
 #define	_STATBUF_ST_BLKSIZE	/* Tell code we have this member.  */
-    int st_blocks;		/* Nr. of 512-byte blocks allocated.  */
+    __blkcnt_t st_blocks;	/* Nr. of 512-byte blocks allocated.  */
     unsigned int st_flags;
     unsigned int st_gen;
   };
diff --git a/sysdeps/unix/sysv/linux/alpha/bits/types.h b/sysdeps/unix/sysv/linux/alpha/bits/types.h
index 9a4666a508..cf2668a0e6 100644
--- a/sysdeps/unix/sysv/linux/alpha/bits/types.h
+++ b/sysdeps/unix/sysv/linux/alpha/bits/types.h
@@ -27,9 +27,9 @@
 
 /* Convenience types.  */
 typedef unsigned char __u_char;
-typedef unsigned short __u_short;
+typedef unsigned short int __u_short;
 typedef unsigned int __u_int;
-typedef unsigned long __u_long;
+typedef unsigned long int __u_long;
 typedef unsigned long int __u_quad_t;
 typedef long int __quad_t;
 typedef signed char __int8_t;
@@ -52,6 +52,8 @@ 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 long int __ssize_t;		/* Type of a byte count, or error.  */
+typedef long int __rlim_t;		/* Type of resource counts.  */
+typedef long int __rlim64_t;		/* Type of resource counts (LFS).  */
 
 typedef struct
   {
@@ -92,4 +94,19 @@ typedef struct
 
 typedef int __key_t;
 
+
+/* Types from the Large File Support interface.  */
+
+/* Type to count number os disk blocks.  */
+typedef int __blkcnt_t;
+typedef __quad_t __blkcnt64_t;
+
+/* Type to count file system blocks.  */
+typedef unsigned int __fsblkcnt_t;
+typedef __u_quad_t __fsblkcnt64_t;
+
+/* Type to count file system inodes.  */
+typedef unsigned long int __fsfilcnt_t;
+typedef __u_quad_t __fsfilcnt64_t;
+
 #endif /* bits/types.h */
diff --git a/sysdeps/unix/sysv/linux/bits/dirent.h b/sysdeps/unix/sysv/linux/bits/dirent.h
index ccf5080151..1f8ff1e3d0 100644
--- a/sysdeps/unix/sysv/linux/bits/dirent.h
+++ b/sysdeps/unix/sysv/linux/bits/dirent.h
@@ -16,17 +16,34 @@
    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
-#ifndef _DIRENTRY_H
-#define _DIRENTRY_H	1
+#ifndef _BITS_DIRENT_H
+#define _BITS_DIRENT_H	1
 
 struct dirent
   {
-    long int d_ino;
+#ifndef __USE_FILE_OFFSET64
+    __ino_t d_ino;
     __off_t d_off;
+#else
+    __ino64_t d_ino;
+    __off64_t d_off;
+#endif
     unsigned short int d_reclen;
     unsigned char d_type;
     char d_name[256];		/* We must not include limits.h! */
   };
+
+#ifdef __USE_LARGEFILE64
+struct dirent64
+  {
+    __ino64_t d_ino;
+    __off64_t d_off;
+    unsigned short int d_reclen;
+    unsigned char d_type;
+    char d_name[256];		/* We must not include limits.h! */
+  };
+#endif
+
 #define d_fileno	d_ino	/* Backwards compatibility.  */
 
 #undef  _DIRENT_HAVE_D_NAMLEN
@@ -34,4 +51,4 @@ struct dirent
 #define _DIRENT_HAVE_D_OFF
 #define _DIRENT_HAVE_D_TYPE
 
-#endif /* _DIRENTRY_H */
+#endif /* bits/dirent.h */
diff --git a/sysdeps/unix/sysv/linux/bits/fcntl.h b/sysdeps/unix/sysv/linux/bits/fcntl.h
index 62c3052d8c..302fa00498 100644
--- a/sysdeps/unix/sysv/linux/bits/fcntl.h
+++ b/sysdeps/unix/sysv/linux/bits/fcntl.h
@@ -18,7 +18,7 @@
    Boston, MA 02111-1307, USA.  */
 
 #ifndef	_FCNTL_H
-#error "Never use <bits/fcntl.h> directly; include <fcntl.h> instead."
+# error "Never use <bits/fcntl.h> directly; include <fcntl.h> instead."
 #endif
 
 
@@ -27,8 +27,8 @@
 
 /* In GNU, read and write are bits (unlike BSD).  */
 #ifdef __USE_GNU
-#define	O_READ		O_RDONLY /* Open for reading.  */
-#define O_WRITE		O_WRONLY /* Open for writing.  */
+# define O_READ		O_RDONLY /* Open for reading.  */
+# define O_WRITE	O_WRONLY /* Open for writing.  */
 #endif
 /* open/fcntl - O_SYNC is only implemented on blocks devices and on files
    located on an ext2 file system */
@@ -47,25 +47,36 @@
 #define O_FSYNC		O_SYNC
 #define O_ASYNC		020000
 
-#define F_DUPFD		0	/* dup */
-#define F_GETFD		1	/* get f_flags */
-#define F_SETFD		2	/* set f_flags */
-#define F_GETFL		3	/* more flags (cloexec) */
-#define F_SETFL		4
-#define F_GETLK		5
-#define F_SETLK		6
-#define F_SETLKW	7
-
-#define F_SETOWN	8	/*  for sockets. */
-#define F_GETOWN	9	/*  for sockets. */
+/* XXX missing */
+#define O_LARGEFILE	0
+
+/* Values for the second argument to `fcntl'.  */
+#define F_DUPFD		0	/* Duplicate file descriptor.  */
+#define F_GETFD		1	/* Get file descriptor flags.  */
+#define F_SETFD		2	/* Set file descriptor flags.  */
+#define F_GETFL		3	/* Get file status flags.  */
+#define F_SETFL		4	/* Set file status flags.  */
+#define F_GETLK		5	/* Get record locking info.  */
+#define F_SETLK		6	/* Set record locking info (non-blocking).  */
+#define F_SETLKW	7	/* Set record locking info (blocking).  */
+
+/* XXX missing */
+#define F_GETLK64	5	/* Get record locking info.  */
+#define F_SETLK64	6	/* Set record locking info (non-blocking).  */
+#define F_SETLKW64	7	/* Set record locking info (blocking).  */
+
+#ifdef __USE_BSD
+# define F_SETOWN	8	/* Get owner of socket (receiver of SIGIO).  */
+# define F_GETOWN	9	/* Set owner of socket (receiver of SIGIO).  */
+#endif
 
-/* for F_[GET|SET]FL */
+/* For F_[GET|SET]FL.  */
 #define FD_CLOEXEC	1	/* actually anything with low bit set goes */
 
-/* for posix fcntl() and lockf() */
-#define F_RDLCK		0
-#define F_WRLCK		1
-#define F_UNLCK		2
+/* For posix fcntl() and `l_type' field of a `struct flock' for lockf().  */
+#define F_RDLCK		0	/* Read lock.  */
+#define F_WRLCK		1	/* Write lock.  */
+#define F_UNLCK		2	/* Remove lock.  */
 
 /* for old implementation of bsd flock () */
 #define F_EXLCK		4	/* or 3 */
@@ -80,20 +91,35 @@
 
 struct flock
   {
-    short int l_type;
-    short int l_whence;
-    __off_t l_start;
-    __off_t l_len;
-    __pid_t l_pid;
+    short int l_type;	/* Type of lock: F_RDLCK, F_WRLCK, or F_UNLCK.  */
+    short int l_whence;	/* Where `l_start' is relative to (like `lseek').  */
+#ifndef __USE_FILE_OFFSET64
+    __off_t l_start;	/* Offset where the lock begins.  */
+    __off_t l_len;	/* Size of the locked area; zero means until EOF.  */
+#else
+    __off64_t l_start;	/* Offset where the lock begins.  */
+    __off64_t l_len;	/* Size of the locked area; zero means until EOF.  */
+#endif
+    __pid_t l_pid;	/* Process holding the lock.  */
   };
 
+#ifdef __USE_LARGEFILE64
+struct flock64
+  {
+    short int l_type;	/* Type of lock: F_RDLCK, F_WRLCK, or F_UNLCK.  */
+    short int l_whence;	/* Where `l_start' is relative to (like `lseek').  */
+    __off64_t l_start;	/* Offset where the lock begins.  */
+    __off64_t l_len;	/* Size of the locked area; zero means until EOF.  */
+    __pid_t l_pid;	/* Process holding the lock.  */
+  };
+#endif
 
 /* Define some more compatibility macros to be backward compatible with
    BSD systems which did not managed to hide these kernel macros.  */
 #ifdef	__USE_BSD
-#define	FAPPEND		O_APPEND
-#define	FFSYNC		O_FSYNC
-#define	FASYNC		O_ASYNC
-#define	FNONBLOCK	O_NONBLOCK
-#define	FNDELAY		O_NDELAY
+# define FAPPEND	O_APPEND
+# define FFSYNC		O_FSYNC
+# define FASYNC		O_ASYNC
+# define FNONBLOCK	O_NONBLOCK
+# define FNDELAY	O_NDELAY
 #endif /* Use BSD.  */
diff --git a/sysdeps/unix/sysv/linux/bits/resource.h b/sysdeps/unix/sysv/linux/bits/resource.h
index 05cae83244..9ee6ea5b27 100644
--- a/sysdeps/unix/sysv/linux/bits/resource.h
+++ b/sysdeps/unix/sysv/linux/bits/resource.h
@@ -1,5 +1,5 @@
 /* Bit values & structures for resource limits.  Linux version.
-   Copyright (C) 1994, 1996 Free Software Foundation, Inc.
+   Copyright (C) 1994, 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
@@ -18,6 +18,7 @@
    Boston, MA 02111-1307, USA.  */
 
 #include <asm/resource.h>
+#include <bits/types.h>
 
 /* Transmute defines to enumerations.  The macro re-definitions are
    necessary because some programs want to test for operating system
@@ -103,13 +104,33 @@ enum __rlimit_resource
 #define RLIM_INFINITY RLIM_INFINITY
 };
 
+/* Type for resource quantity measurement.  */
+#ifndef __USE_FILE_OFFSET64
+typedef __rlim_t rlim_t;
+#else
+typedef __rlim64_t rlim_t;
+#endif
+#ifdef __USE_LARGEFILE64
+typedef __rlim64_t rlim64_t;
+#endif
+
 struct rlimit
-{
-  /* The current (soft) limit.  */
-  long int rlim_cur;
-  /* The hard limit.  */
-  long int rlim_max;
-};
+  {
+    /* The current (soft) limit.  */
+    rlim_t rlim_cur;
+    /* The hard limit.  */
+    rlim_t rlim_max;
+  };
+
+#ifdef __USE_LARGEFILE64
+struct rlimit64
+  {
+    /* The current (soft) limit.  */
+    rlim64_t rlim_cur;
+    /* The hard limit.  */
+    rlim64_t rlim_max;
+ };
+#endif
 
 /* Whose usage statistics do you want?  */
 enum __rusage_who
@@ -131,46 +152,46 @@ enum __rusage_who
 
 /* Structure which says how much of each resource has been used.  */
 struct rusage
-{
-  /* Total amount of user time used.  */
-  struct timeval ru_utime;
-  /* Total amount of system time used.  */
-  struct timeval ru_stime;
-  /* Maximum resident set size (in kilobytes).  */
-  long int ru_maxrss;
-  /* Amount of sharing of text segment memory
-     with other processes (kilobyte-seconds).  */
-  long int ru_ixrss;
-  /* Amount of data segment memory used (kilobyte-seconds).  */
-  long int ru_idrss;
-  /* Amount of stack memory used (kilobyte-seconds).  */
-  long int ru_isrss;
-  /* Number of soft page faults (i.e. those serviced by reclaiming
-     a page from the list of pages awaiting reallocation.  */
-  long int ru_minflt;
-  /* Number of hard page faults (i.e. those that required I/O).  */
-  long int ru_majflt;
-  /* Number of times a process was swapped out of physical memory.  */
-  long int ru_nswap;
-  /* Number of input operations via the file system.  Note: This
-     and `ru_oublock' do not include operations with the cache.  */
-  long int ru_inblock;
-  /* Number of output operations via the file system.  */
-  long int ru_oublock;
-  /* Number of IPC messages sent.  */
-  long int ru_msgsnd;
-  /* Number of IPC messages received.  */
-  long int ru_msgrcv;
-  /* Number of signals delivered.  */
-  long int ru_nsignals;
-  /* Number of voluntary context switches, i.e. because the process
-     gave up the process before it had to (usually to wait for some
-     resource to be available).  */
-  long int ru_nvcsw;
-  /* Number of involuntary context switches, i.e. a higher priority process
-     became runnable or the current process used up its time slice.  */
-  long int ru_nivcsw;
-};
+  {
+    /* Total amount of user time used.  */
+    struct timeval ru_utime;
+    /* Total amount of system time used.  */
+    struct timeval ru_stime;
+    /* Maximum resident set size (in kilobytes).  */
+    long int ru_maxrss;
+    /* Amount of sharing of text segment memory
+       with other processes (kilobyte-seconds).  */
+    long int ru_ixrss;
+    /* Amount of data segment memory used (kilobyte-seconds).  */
+    long int ru_idrss;
+    /* Amount of stack memory used (kilobyte-seconds).  */
+    long int ru_isrss;
+    /* Number of soft page faults (i.e. those serviced by reclaiming
+       a page from the list of pages awaiting reallocation.  */
+    long int ru_minflt;
+    /* Number of hard page faults (i.e. those that required I/O).  */
+    long int ru_majflt;
+    /* Number of times a process was swapped out of physical memory.  */
+    long int ru_nswap;
+    /* Number of input operations via the file system.  Note: This
+       and `ru_oublock' do not include operations with the cache.  */
+    long int ru_inblock;
+    /* Number of output operations via the file system.  */
+    long int ru_oublock;
+    /* Number of IPC messages sent.  */
+    long int ru_msgsnd;
+    /* Number of IPC messages received.  */
+    long int ru_msgrcv;
+    /* Number of signals delivered.  */
+    long int ru_nsignals;
+    /* Number of voluntary context switches, i.e. because the process
+       gave up the process before it had to (usually to wait for some
+       resource to be available).  */
+    long int ru_nvcsw;
+    /* Number of involuntary context switches, i.e. a higher priority process
+       became runnable or the current process used up its time slice.  */
+    long int ru_nivcsw;
+  };
 
 /* Priority limits.  */
 #define PRIO_MIN	-20	/* Minimum priority a process can have.  */
diff --git a/sysdeps/unix/sysv/linux/bits/stat.h b/sysdeps/unix/sysv/linux/bits/stat.h
index 1c6e5f84ca..aab025890c 100644
--- a/sysdeps/unix/sysv/linux/bits/stat.h
+++ b/sysdeps/unix/sysv/linux/bits/stat.h
@@ -39,18 +39,29 @@ struct stat
   {
     __dev_t st_dev;			/* Device.  */
     unsigned short int __pad1;
+#ifndef __USE_FILE_OFFSET64
     __ino_t st_ino;			/* File serial number.	*/
+#else
+    __ino64_t st_ino;			/* File serial number.	*/
+#endif
     __mode_t st_mode;			/* File mode.  */
     __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.*/
     __dev_t st_rdev;			/* Device number, if device.  */
     unsigned short int __pad2;
+#ifndef __USE_FILE_OFFSET64
     __off_t st_size;			/* Size of file, in bytes.  */
+#else
+    __off64_t st_size;			/* Size of file, in bytes.  */
+#endif
     unsigned long int st_blksize;	/* Optimal block size for I/O.  */
-#define	_STATBUF_ST_BLKSIZE		/* Tell code we have this member.  */
 
-    unsigned long int st_blocks;	/* Number of 512-byte blocks allocated.  */
+#ifndef __USE_FILE_OFFSET64
+    __blkcnt_t st_blocks;		/* Number 512-byte blocks allocated. */
+#else
+    __blkcnt64_t st_blocks;		/* Number 512-byte blocks allocated. */
+#endif
     __time_t st_atime;			/* Time of last access.  */
     unsigned long int __unused1;
     __time_t st_mtime;			/* Time of last modification.  */
@@ -61,6 +72,36 @@ struct stat
     unsigned long int __unused5;
   };
 
+#ifdef __USE_LARGEFILE64
+struct stat64
+  {
+    __dev_t st_dev;			/* Device.  */
+    unsigned short int __pad1;
+
+    __ino64_t st_ino;			/* File serial number.	*/
+    __mode_t st_mode;			/* File mode.  */
+    __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.*/
+    __dev_t st_rdev;			/* Device number, if device.  */
+    unsigned short int __pad2;
+    __off64_t st_size;			/* Size of file, in bytes.  */
+    unsigned long int st_blksize;	/* Optimal block size for I/O.  */
+
+    __blkcnt64_t st_blocks;		/* Number 512-byte blocks allocated. */
+    __time_t st_atime;			/* Time of last access.  */
+    unsigned long int __unused1;
+    __time_t st_mtime;			/* Time of last modification.  */
+    unsigned long int __unused2;
+    __time_t st_ctime;			/* Time of last status change.  */
+    unsigned long int __unused3;
+    unsigned long int __unused4;
+    unsigned long int __unused5;
+  };
+#endif
+
+#define	_STATBUF_ST_BLKSIZE		/* Tell code we have this member.  */
+
 /* Encoding of the file mode.  */
 
 #define	__S_IFMT	0170000	/* These bits determine file type.  */
diff --git a/sysdeps/unix/sysv/linux/bits/statfs.h b/sysdeps/unix/sysv/linux/bits/statfs.h
index 8b9501423c..c79c80e84c 100644
--- a/sysdeps/unix/sysv/linux/bits/statfs.h
+++ b/sysdeps/unix/sysv/linux/bits/statfs.h
@@ -23,20 +23,44 @@
 #ifndef _BITS_STATFS_H
 #define _BITS_STATFS_H
 
-#include <bits/types.h>  /* for __fsid_t */
+#include <bits/types.h>  /* for __fsid_t and __fsblkcnt_t*/
 
 struct statfs
   {
     int f_type;
     int f_bsize;
-    int f_blocks;
-    int f_bfree;
-    int f_bavail;
-    int f_files;
-    int f_ffree;
+#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;
     int f_namelen;
     int f_spare[6];
   };
 
+#ifdef __USE_LARGEFILE64
+struct statfs64
+  {
+    int f_type;
+    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;
+    int f_namelen;
+    int f_spare[6];
+  };
+#endif
+
 #endif	/* bits/statfs.h */
diff --git a/sysdeps/unix/sysv/linux/bits/types.h b/sysdeps/unix/sysv/linux/bits/types.h
index 34f4682b3c..daa94336de 100644
--- a/sysdeps/unix/sysv/linux/bits/types.h
+++ b/sysdeps/unix/sysv/linux/bits/types.h
@@ -65,6 +65,8 @@ 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 struct
   {
@@ -100,4 +102,25 @@ typedef struct
 
 typedef int __key_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/getsysstats.c b/sysdeps/unix/sysv/linux/getsysstats.c
index 2b855c7a84..dd1c77a99e 100644
--- a/sysdeps/unix/sysv/linux/getsysstats.c
+++ b/sysdeps/unix/sysv/linux/getsysstats.c
@@ -1,5 +1,5 @@
-/* getsysstats - Determine various system internal values, Linux version.
-   Copyright (C) 1996 Free Software Foundation, Inc.
+/* Determine various system internal values, Linux version.
+   Copyright (C) 1996, 1997 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
 
@@ -30,6 +30,7 @@
 
 /* Determine the path to the /proc filesystem if available.  */
 static char *
+internal_function
 get_proc_path (char *buffer, size_t bufsize)
 {
   FILE *fp;
@@ -115,6 +116,7 @@ weak_alias (__get_nprocs, get_nprocs_conf)
 /* General function to get information about memory status from proc
    filesystem.  */
 static int
+internal_function
 phys_pages_info (const char *format)
 {
   FILE *fp;
diff --git a/sysdeps/unix/sysv/linux/if_index.c b/sysdeps/unix/sysv/linux/if_index.c
index 36863db486..2e0bc5bf8f 100644
--- a/sysdeps/unix/sysv/linux/if_index.c
+++ b/sysdeps/unix/sysv/linux/if_index.c
@@ -28,6 +28,7 @@
 /* Try to get a socket to talk to the kernel.  */
 #if defined SIOGIFINDEX || defined SIOGIFNAME
 static int
+internal_function
 opensock (void)
 {
   /* Cache the last AF that worked, to avoid many redundant calls to
diff --git a/sysdeps/unix/sysv/linux/llseek.c b/sysdeps/unix/sysv/linux/llseek.c
index a1284db6be..31dd86f232 100644
--- a/sysdeps/unix/sysv/linux/llseek.c
+++ b/sysdeps/unix/sysv/linux/llseek.c
@@ -1,5 +1,5 @@
 /* Long-long seek operation.
-   Copyright (C) 1996 Free Software Foundation, Inc.
+   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
@@ -25,7 +25,7 @@ extern int __sys_llseek (int fd, off_t offset_hi, off_t offset_lo,
 
 /* Seek to OFFSET on FD, starting from WHENCE.  */
 loff_t
-llseek (int fd, loff_t offset, int whence)
+__llseek (int fd, loff_t offset, int whence)
 {
   loff_t result;
 
@@ -33,3 +33,5 @@ llseek (int fd, loff_t offset, int whence)
 				 (off_t) (offset & 0xffffffff),
 				 &result, whence) ?: result);
 }
+weak_alias (__llseek, llseek)
+weak_alias (__llseek, lseek64)
diff --git a/sysdeps/unix/sysv/linux/lseek64.c b/sysdeps/unix/sysv/linux/lseek64.c
new file mode 100644
index 0000000000..d81e98fb51
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/lseek64.c
@@ -0,0 +1 @@
+/* We don't need a definition since the llseek function is what we need.  */
diff --git a/sysdeps/unix/sysv/linux/mips/bits/fcntl.h b/sysdeps/unix/sysv/linux/mips/bits/fcntl.h
index 2586140fdc..09d6fb6d4c 100644
--- a/sysdeps/unix/sysv/linux/mips/bits/fcntl.h
+++ b/sysdeps/unix/sysv/linux/mips/bits/fcntl.h
@@ -18,7 +18,7 @@
    Boston, MA 02111-1307, USA.  */
 
 #ifndef _FCNTL_H
-#error "Never use <bits/fcntl.h> directly; include <fcntl.h> instead."
+# error "Never use <bits/fcntl.h> directly; include <fcntl.h> instead."
 #endif
 
 #include <sys/types.h>
@@ -26,8 +26,8 @@
 
 /* In GNU, read and write are bits (unlike BSD).  */
 #ifdef __USE_GNU
-#define O_READ		O_RDONLY	/* Open for reading.  */
-#define O_WRITE		O_WRONLY	/* Open for writing.  */
+# define O_READ		O_RDONLY	/* Open for reading.  */
+# define O_WRITE	O_WRONLY	/* Open for writing.  */
 #endif
 /* open/fcntl - O_SYNC is only implemented on blocks devices and on files
    located on an ext2 file system */
@@ -47,25 +47,36 @@
 
 #define O_NDELAY	O_NONBLOCK
 
-#define F_DUPFD		0	/* dup */
-#define F_GETFD		1	/* get f_flags */
-#define F_SETFD		2	/* set f_flags */
-#define F_GETFL		3	/* more flags (cloexec) */
-#define F_SETFL		4
-#define F_GETLK		14
-#define F_SETLK		6
-#define F_SETLKW	7
-
-#define F_SETOWN	24	/*  for sockets. */
-#define F_GETOWN	23	/*  for sockets. */
+/* XXX missing */
+#define O_LARGEFILE	0
+
+/* Values for the second argument to `fcntl'.  */
+#define F_DUPFD		0	/* Duplicate file descriptor.  */
+#define F_GETFD		1	/* Get file descriptor flags.  */
+#define F_SETFD		2	/* Set file descriptor flags.  */
+#define F_GETFL		3	/* Get file status flags.  */
+#define F_SETFL		4	/* Set file status flags.  */
+#define F_GETLK		14	/* Get record locking info.  */
+#define F_SETLK		6	/* Set record locking info (non-blocking).  */
+#define F_SETLKW	7	/* Set record locking info (blocking).  */
+
+/* XXX missing */
+#define F_GETLK64	14	/* Get record locking info.  */
+#define F_SETLK64	6	/* Set record locking info (non-blocking).  */
+#define F_SETLKW64	7	/* Set record locking info (blocking).  */
+
+#ifdef __USE_BSD
+# define F_SETOWN	5	/* Get owner of socket (receiver of SIGIO).  */
+# define F_GETOWN	6	/* Set owner of socket (receiver of SIGIO).  */
+#endif
 
 /* for F_[GET|SET]FL */
 #define FD_CLOEXEC	1	/* actually anything with low bit set goes */
 
-/* for posix fcntl() and lockf() */
-#define F_RDLCK		0
-#define F_WRLCK		1
-#define F_UNLCK		2
+/* For posix fcntl() and `l_type' field of a `struct flock' for lockf().  */
+#define F_RDLCK		0	/* Read lock.  */
+#define F_WRLCK		1	/* Write lock.  */
+#define F_UNLCK		2	/* Remove lock.  */
 
 /* for old implementation of bsd flock () */
 #define F_EXLCK		4	/* or 3 */
@@ -78,23 +89,42 @@
 				   blocking */
 #define LOCK_UN		8	/* remove lock */
 
-typedef struct flock {
-	short l_type;
-	short l_whence;
-	__off_t l_start;
-	__off_t l_len;
-	long  l_sysid;			/* XXX */
-	__pid_t l_pid;
-	long  pad[4];			/* XXX */
-} flock_t;
+typedef struct flock
+  {
+    short int l_type;	/* Type of lock: F_RDLCK, F_WRLCK, or F_UNLCK.  */
+    short int l_whence;	/* Where `l_start' is relative to (like `lseek').  */
+#ifndef __USE_FILE_OFFSET64
+    __off_t l_start;	/* Offset where the lock begins.  */
+    __off_t l_len;	/* Size of the locked area; zero means until EOF.  */
+#else
+    __off64_t l_start;	/* Offset where the lock begins.  */
+    __off64_t l_len;	/* Size of the locked area; zero means until EOF.  */
+#endif
+    long int l_sysid;	/* XXX */
+    __pid_t l_pid;	/* Process holding the lock.  */
+    long int pad[4];	/* XXX */
+  } flock_t;
+
+#ifdef __USE_LARGEFILE64
+struct flock64
+  {
+    short int l_type;	/* Type of lock: F_RDLCK, F_WRLCK, or F_UNLCK.  */
+    short int l_whence;	/* Where `l_start' is relative to (like `lseek').  */
+    __off64_t l_start;	/* Offset where the lock begins.  */
+    __off64_t l_len;	/* Size of the locked area; zero means until EOF.  */
+    long int l_sysid;	/* XXX */
+    __pid_t l_pid;	/* Process holding the lock.  */
+    long int pad[4];	/* XXX */
+  };
+#endif
 
 
 /* Define some more compatibility macros to be backward compatible with
    BSD systems which did not managed to hide these kernel macros.  */
 #ifdef	__USE_BSD
-#define	FAPPEND		O_APPEND
-#define	FFSYNC		O_FSYNC
-#define FASYNC		O_ASYNC
-#define	FNONBLOCK	O_NONBLOCK
-#define	FNDELAY		O_NDELAY
+# define FAPPEND	O_APPEND
+# define FFSYNC		O_FSYNC
+# define FASYNC		O_ASYNC
+# define FNONBLOCK	O_NONBLOCK
+# define FNDELAY	O_NDELAY
 #endif /* Use BSD.  */
diff --git a/sysdeps/unix/sysv/linux/mips/bits/stat.h b/sysdeps/unix/sysv/linux/mips/bits/stat.h
index a797b34c38..f27a75eb9a 100644
--- a/sysdeps/unix/sysv/linux/mips/bits/stat.h
+++ b/sysdeps/unix/sysv/linux/mips/bits/stat.h
@@ -39,14 +39,22 @@ struct stat
   {
     unsigned long int st_dev;
     long int st_pad1[3];
+#ifndef __USE_FILE_OFFSET64
     __ino_t st_ino;		/* File serial number.		*/
+#else
+    __ino64_t st_ino;		/* File serial number.		*/
+#endif
     __mode_t st_mode;		/* File mode.  */
     __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.*/
     unsigned long int st_rdev;	/* Device number, if device.  */
     long int st_pad2[2];
+#ifndef __USE_FILE_OFFSET64
     __off_t st_size;		/* Size of file, in bytes.  */
+#else
+    __off64_t st_size;		/* Size of file, in bytes.  */
+#endif
     /* SVR4 added this extra long to allow for expansion of off_t.  */
     long int st_pad3;
     /*
@@ -60,8 +68,11 @@ struct stat
     __time_t st_ctime;		/* Time of last status change.  */
     long int __reserved2;
     long int st_blksize;	/* Optimal block size for I/O.  */
-#define	_STATBUF_ST_BLKSIZE	/* Tell code we have this member.  */
-    long int st_blocks;		/* Number of 512-byte blocks allocated.  */
+#ifndef __USE_FILE_OFFSET64
+    __blkcnt_t st_blocks;	/* Number of 512-byte blocks allocated.  */
+#else
+    __blkcnt64_t st_blocks;	/* Number of 512-byte blocks allocated.  */
+#endif
     char st_fstype[16];		/* Filesystem type name */
     long int st_pad4[8];
     /* Linux specific fields */
@@ -69,6 +80,42 @@ struct stat
     unsigned int st_gen;
   };
 
+#ifdef __USE_LARGEFILE64
+struct stat64
+  {
+    unsigned long int st_dev;
+    long int st_pad1[3];
+    __ino64_t st_ino;		/* File serial number.		*/
+    __mode_t st_mode;		/* File mode.  */
+    __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.*/
+    unsigned long int st_rdev;	/* Device number, if device.  */
+    long int st_pad2[2];
+    __off64_t st_size;		/* Size of file, in bytes.  */
+    /* SVR4 added this extra long to allow for expansion of off_t.  */
+    long int st_pad3;
+    /*
+     * Actually this should be timestruc_t st_atime, st_mtime and
+     * st_ctime but we don't have it under Linux.
+     */
+    __time_t st_atime;		/* Time of last access.  */
+    long int __reserved0;
+    __time_t st_mtime;		/* Time of last modification.  */
+    long int __reserved1;
+    __time_t st_ctime;		/* Time of last status change.  */
+    long int __reserved2;
+    long int st_blksize;	/* Optimal block size for I/O.  */
+    __blkcnt64_t st_blocks;	/* Number of 512-byte blocks allocated.  */
+    char st_fstype[16];		/* Filesystem type name */
+    long int st_pad4[8];
+    /* Linux specific fields */
+    unsigned int st_flags;
+    unsigned int st_gen;
+  };
+#endif
+
+#define	_STATBUF_ST_BLKSIZE	/* Tell code we have this member.  */
 
 /* Encoding of the file mode.  */
 
diff --git a/sysdeps/unix/sysv/linux/mips/bits/statfs.h b/sysdeps/unix/sysv/linux/mips/bits/statfs.h
index 3b2306147c..2727b27257 100644
--- a/sysdeps/unix/sysv/linux/mips/bits/statfs.h
+++ b/sysdeps/unix/sysv/linux/mips/bits/statfs.h
@@ -23,22 +23,52 @@
 #ifndef _BITS_STATFS_H
 #define _BITS_STATFS_H
 
+#include <bits/types.h>  /* for __fsid_t and __fsblkcnt_t*/
+
 struct statfs
   {
     long int f_type;
 #define f_fstyp f_type
     long int f_bsize;
     long int f_frsize;	/* Fragment size - unsupported */
-    long int f_blocks;
-    long int f_bfree;
-    long int f_files;
-    long int f_ffree;
+#ifndef __USE_FILE_OFFSET64
+    __fsblkcnt_t f_blocks;
+    __fsblkcnt_t f_bfree;
+    __fsblkcnt_t f_files;
+    __fsblkcnt_t f_ffree;
+    __fsblkcnt_t f_bavail;
+#else
+    __fsblkcnt64_t f_blocks;
+    __fsblkcnt64_t f_bfree;
+    __fsblkcnt64_t f_files;
+    __fsblkcnt64_t f_ffree;
+    __fsblkcnt64_t f_bavail;
+#endif
+
+	/* Linux specials */
+    __fsid_t f_fsid;
+    long int f_namelen;
+    long int f_spare[6];
+  };
+
+#ifdef __USE_LARGEFILE64
+struct statfs64
+  {
+    long int f_type;
+#define f_fstyp f_type
+    long int f_bsize;
+    long int f_frsize;	/* Fragment size - unsupported */
+    __fsblkcnt64_t f_blocks;
+    __fsblkcnt64_t f_bfree;
+    __fsblkcnt64_t f_files;
+    __fsblkcnt64_t f_ffree;
+    __fsblkcnt64_t f_bavail;
 
 	/* Linux specials */
-    long int f_bavail;
     __fsid_t f_fsid;
     long int f_namelen;
     long int f_spare[6];
   };
+#endif
 
 #endif	/* bits/statfs.h */
diff --git a/sysdeps/unix/sysv/linux/poll.c b/sysdeps/unix/sysv/linux/poll.c
index b92139aab4..f6e71b79b6 100644
--- a/sysdeps/unix/sysv/linux/poll.c
+++ b/sysdeps/unix/sysv/linux/poll.c
@@ -25,7 +25,7 @@ extern int __syscall_poll __P ((struct pollfd *fds, unsigned int nfds,
 weak_extern (__syscall_poll)
 
 static int __emulate_poll __P ((struct pollfd *fds, unsigned long int nfds,
-				int timeout));
+				int timeout)) internal_function;
 
 /* The real implementation.  */
 int
@@ -58,5 +58,6 @@ poll (fds, nfds, timeout)
 
 
 /* Get the emulation code.  */
-#define poll(fds, nfds, timeout) static __emulate_poll (fds, nfds, timeout)
+#define poll(fds, nfds, timeout) \
+  static internal_function __emulate_poll (fds, nfds, timeout)
 #include <sysdeps/unix/bsd/poll.c>
diff --git a/sysdeps/unix/sysv/linux/readv.c b/sysdeps/unix/sysv/linux/readv.c
index 2c215ce920..10cd519609 100644
--- a/sysdeps/unix/sysv/linux/readv.c
+++ b/sysdeps/unix/sysv/linux/readv.c
@@ -24,7 +24,7 @@
 
 extern ssize_t __syscall_readv __P ((int, __const struct iovec *, int));
 static ssize_t __atomic_readv_replacement __P ((int, __const struct iovec *,
-						int));
+						int)) internal_function;
 
 
 /* Not all versions of the kernel support the large number of records.  */
@@ -56,5 +56,5 @@ __readv (fd, vector, count)
 }
 weak_alias (__readv, readv)
 
-#define __readv static __atomic_readv_replacement
+#define __readv static internal_function __atomic_readv_replacement
 #include <sysdeps/posix/readv.c>
diff --git a/sysdeps/unix/sysv/linux/sparc/bits/fcntl.h b/sysdeps/unix/sysv/linux/sparc/bits/fcntl.h
index ca4d34c14e..9e8c589b9a 100644
--- a/sysdeps/unix/sysv/linux/sparc/bits/fcntl.h
+++ b/sysdeps/unix/sysv/linux/sparc/bits/fcntl.h
@@ -24,8 +24,8 @@
 
 /* In GNU, read and write are bits (unlike BSD). */
 #ifdef __USE_GNU
-#define O_READ          O_RDONLY /* Open for reading. */
-#define O_WRITE         O_WRONLY /* Open for writing. */
+# define O_READ		O_RDONLY /* Open for reading. */
+# define O_WRITE	O_WRONLY /* Open for writing. */
 #endif
 
 /* open/fcntl - O_SYNC is only implemented on blocks devices and on files
@@ -44,24 +44,35 @@
 #define O_NDELAY	(0x0004 | O_NONBLOCK)
 #define O_NOCTTY	0x8000	/* not fcntl */
 
-#define F_DUPFD		0	/* dup */
-#define F_GETFD		1	/* get f_flags */
-#define F_SETFD		2	/* set f_flags */
-#define F_GETFL		3	/* more flags (cloexec) */
-#define F_SETFL		4
-#define F_GETOWN	5	/*  for sockets. */
-#define F_SETOWN	6	/*  for sockets. */
-#define F_GETLK		7
-#define F_SETLK		8
-#define F_SETLKW	9
+/* XXX missing */
+#define O_LARGEFILE	0
+
+/* Values for the second argument to `fcntl'.  */
+#define F_DUPFD		0	/* Duplicate file descriptor.  */
+#define F_GETFD		1	/* Get file descriptor flags.  */
+#define F_SETFD		2	/* Set file descriptor flags.  */
+#define F_GETFL		3	/* Get file status flags.  */
+#define F_SETFL		4	/* Set file status flags.  */
+#ifdef __USE_BSD
+# define F_GETOWN	5	/* Get owner of socket (receiver of SIGIO).  */
+# define F_SETOWN	6	/* Set owner of socket (receiver of SIGIO).  */
+#endif
+#define F_GETLK		7	/* Get record locking info.  */
+#define F_SETLK		8	/* Set record locking info (non-blocking).  */
+#define F_SETLKW	9	/* Set record locking info (blocking).  */
+
+/* XXX missing */
+#define F_GETLK64	7	/* Get record locking info.  */
+#define F_SETLK64	8	/* Set record locking info (non-blocking).  */
+#define F_SETLKW64	9	/* Set record locking info (blocking).  */
 
 /* for F_[GET|SET]FL */
 #define FD_CLOEXEC	1	/* actually anything with low bit set goes */
 
-/* for posix fcntl() and lockf() */
-#define F_RDLCK		1
-#define F_WRLCK		2
-#define F_UNLCK		3
+/* For posix fcntl() and `l_type' field of a `struct flock' for lockf().  */
+#define F_RDLCK		1	/* Read lock.  */
+#define F_WRLCK		2	/* Write lock.  */
+#define F_UNLCK		3	/* Remove lock.  */
 
 /* for old implementation of bsd flock () */
 #define F_EXLCK		4	/* or 3 */
@@ -76,22 +87,39 @@
 
 struct flock
   {
-    short int l_type;
-    short int l_whence;
-    __off_t l_start;
-    __off_t l_len;
-    __pid_t l_pid;
+    short int l_type;	/* Type of lock: F_RDLCK, F_WRLCK, or F_UNLCK.  */
+    short int l_whence;	/* Where `l_start' is relative to (like `lseek').  */
+#ifndef __USE_FILE_OFFSET64
+    __off_t l_start;	/* Offset where the lock begins.  */
+    __off_t l_len;	/* Size of the locked area; zero means until EOF.  */
+#else
+    __off64_t l_start;	/* Offset where the lock begins.  */
+    __off64_t l_len;	/* Size of the locked area; zero means until EOF.  */
+#endif
+    __pid_t l_pid;	/* Process holding the lock.  */
     short int __unused;
   };
 
+#ifdef __USE_LARGEFILE64
+struct flock64
+  {
+    short int l_type;	/* Type of lock: F_RDLCK, F_WRLCK, or F_UNLCK.  */
+    short int l_whence;	/* Where `l_start' is relative to (like `lseek').  */
+    __off64_t l_start;	/* Offset where the lock begins.  */
+    __off64_t l_len;	/* Size of the locked area; zero means until EOF.  */
+    __pid_t l_pid;	/* Process holding the lock.  */
+    short int __unused;
+  };
+#endif
+
 /* Define some more compatibility macros to be backward compatible with
    BSD systems which did not managed to hide these kernel macros.  */
 #ifdef	__USE_BSD
-#define	FAPPEND		O_APPEND
-#define	FFSYNC		O_FSYNC
-#define	FASYNC		O_ASYNC
-#define	FNONBLOCK	O_NONBLOCK
-#define	FNDELAY		O_NDELAY
+# define FAPPEND	O_APPEND
+# define FFSYNC		O_FSYNC
+# define FASYNC		O_ASYNC
+# define FNONBLOCK	O_NONBLOCK
+# define FNDELAY	O_NDELAY
 #endif /* Use BSD.  */
 
 #endif
diff --git a/sysdeps/unix/sysv/linux/sparc/bits/ioctls.h b/sysdeps/unix/sysv/linux/sparc/bits/ioctls.h
index 46867d8e41..b33493ee46 100644
--- a/sysdeps/unix/sysv/linux/sparc/bits/ioctls.h
+++ b/sysdeps/unix/sysv/linux/sparc/bits/ioctls.h
@@ -33,10 +33,10 @@
 #undef  TCSETS
 #undef  TCSETSW
 #undef  TCSETSF
-#define TCGETS	_IOR ('T', 8, struct __kernel_termios)
-#define TCSETS	_IOW ('T', 9, struct __kernel_termios)
-#define TCSETSW	_IOW ('T', 10, struct __kernel_termios)
-#define TCSETSF	_IOW ('T', 11, struct __kernel_termios)
+#define TCGETS	_IOR ('T', 8, char[36])
+#define TCSETS	_IOW ('T', 9, char[36])
+#define TCSETSW	_IOW ('T', 10, char[36])
+#define TCSETSF	_IOW ('T', 11, char[36])
 
 #include <linux/sockios.h>
 
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/bits/types.h b/sysdeps/unix/sysv/linux/sparc/sparc64/bits/types.h
index 462f7c2998..a417928863 100644
--- a/sysdeps/unix/sysv/linux/sparc/sparc64/bits/types.h
+++ b/sysdeps/unix/sysv/linux/sparc/sparc64/bits/types.h
@@ -27,9 +27,9 @@
 
 /* Convenience types.  */
 typedef unsigned char __u_char;
-typedef unsigned short __u_short;
+typedef unsigned short int __u_short;
 typedef unsigned int __u_int;
-typedef unsigned long __u_long;
+typedef unsigned long int __u_long;
 typedef unsigned long int __u_quad_t;
 typedef long int __quad_t;
 typedef signed char __int8_t;
@@ -45,13 +45,15 @@ typedef __quad_t *__qaddr_t;
 typedef __u_long __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_int __ino_t;		/* Type of file serial numbers.  */
+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 long long int __ssize_t;	/* Type of a byte count, or error.  */
+typedef long int __rlim_t;		/* Type of resource counts.  */
+typedef long int __rlim64_t;		/* Type of resource counts (LFS).  */
 
 typedef struct
   {
@@ -92,4 +94,19 @@ typedef struct
 
 typedef int __key_t;
 
+
+/* Types from the Large File Support interface.  */
+
+/* Type to count number os disk blocks.  */
+typedef long int __blkcnt_t;
+typedef __quad_t __blkcnt64_t;
+
+/* Type to count file system blocks.  */
+typedef unsigned int __fsblkcnt_t;
+typedef __u_quad_t __fsblkcnt64_t;
+
+/* Type to count file system inodes.  */
+typedef unsigned long int __fsfilcnt_t;
+typedef __u_quad_t __fsfilcnt64_t;
+
 #endif /* bits/types.h */
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/kernel_stat.h b/sysdeps/unix/sysv/linux/sparc/sparc64/kernel_stat.h
index fcb752e3ec..dd509a7e8a 100644
--- a/sysdeps/unix/sysv/linux/sparc/sparc64/kernel_stat.h
+++ b/sysdeps/unix/sysv/linux/sparc/sparc64/kernel_stat.h
@@ -2,7 +2,7 @@
 struct kernel_stat
   {
     unsigned int st_dev;
-    unsigned int st_ino;
+    unsigned long int st_ino;
     unsigned int st_mode;
     short int st_nlink;
     unsigned int st_uid;
@@ -18,5 +18,5 @@ struct kernel_stat
     unsigned long int __unused2;
   };
 
-#define _HAVE___UNUSED1 
-#define _HAVE___UNUSED2 
+#define _HAVE___UNUSED1
+#define _HAVE___UNUSED2
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/setjmp.S b/sysdeps/unix/sysv/linux/sparc/sparc64/setjmp.S
index fcc5cb5a48..65a1d34836 100644
--- a/sysdeps/unix/sysv/linux/sparc/sparc64/setjmp.S
+++ b/sysdeps/unix/sysv/linux/sparc/sparc64/setjmp.S
@@ -29,21 +29,15 @@
 
 /* int _setjmp(jmp_buf) */
 
-.weak _setjmp
-ENTRY(_setjmp)
-
+ENTRY(__setjmp)
 	ba	__sigsetjmp_local
 	 set	0, %o1
-
-END(setjmp)
+END(__setjmp)
 
 /* int setjmp(jmp_buf) */
 
-.weak setjmp
 ENTRY(setjmp)
-
 	set	1, %o1
-
 END(setjmp)
 
 /* int __sigsetjmp(jmp_buf, savemask)  */
@@ -65,3 +59,6 @@ __sigsetjmp_local:
 	 mov	%g1, %o0
 
 END(__sigsetjmp)
+
+weak_alias(__setjmp, _setjmp)
+weak_extern(setjmp)
diff --git a/sysdeps/unix/sysv/linux/sys/mman.h b/sysdeps/unix/sysv/linux/sys/mman.h
index c8f512c00c..129702e33c 100644
--- a/sysdeps/unix/sysv/linux/sys/mman.h
+++ b/sysdeps/unix/sysv/linux/sys/mman.h
@@ -44,8 +44,18 @@ __BEGIN_DECLS
 
 extern __caddr_t __mmap __P ((__caddr_t __addr, size_t __len, int __prot,
 			      int __flags, int __fd, __off_t __offset));
+#ifndef __USE_FILE_OFFSET64
 extern __caddr_t mmap __P ((__caddr_t __addr, size_t __len, int __prot,
 			    int __flags, int __fd, __off_t __offset));
+#else
+extern __caddr_t mmap __P ((__caddr_t __addr, size_t __len, int __prot,
+			    int __flags, int __fd, __off_t __offset))
+     __asm__ ("mmap64");
+#endif
+#ifdef __USE_LARGEFILE64
+extern __caddr_t mmap64 __P ((__caddr_t __addr, size_t __len, int __prot,
+			      int __flags, int __fd, __off64_t __offset));
+#endif
 
 /* Deallocate any mapping for the region starting at ADDR and extending LEN
    bytes.  Returns 0 if successful, -1 for errors (and sets errno).  */
diff --git a/sysdeps/unix/sysv/linux/sys/param.h b/sysdeps/unix/sysv/linux/sys/param.h
index d5f6239cd2..c2a56a2c29 100644
--- a/sysdeps/unix/sysv/linux/sys/param.h
+++ b/sysdeps/unix/sysv/linux/sys/param.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1995, 1996 Free Software Foundation, Inc.
+/* 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
@@ -28,7 +28,7 @@
 
 #define	NBBY		CHAR_BIT
 #ifndef	NGROUPS
-#define	NGROUPS		NGROUPS_MAX
+# define NGROUPS		NGROUPS_MAX
 #endif
 #define	MAXSYMLINKS	5
 #define	CANBSIZ		MAX_CANON
@@ -47,7 +47,7 @@
 
 /* Macros for counting and rounding.  */
 #ifndef howmany
-#define	howmany(x, y)	(((x)+((y)-1))/(y))
+# define howmany(x, y)	(((x)+((y)-1))/(y))
 #endif
 #define	roundup(x, y)	((((x)+((y)-1))/(y))*(y))
 #define powerof2(x)	((((x)-1)&(x))==0)
diff --git a/sysdeps/unix/sysv/linux/writev.c b/sysdeps/unix/sysv/linux/writev.c
index 31e794fb04..3b3c5b65fc 100644
--- a/sysdeps/unix/sysv/linux/writev.c
+++ b/sysdeps/unix/sysv/linux/writev.c
@@ -24,7 +24,7 @@
 
 extern ssize_t __syscall_writev __P ((int, const struct iovec *, int));
 static ssize_t __atomic_writev_replacement __P ((int, const struct iovec *,
-						 int));
+						 int)) internal_function;
 
 
 /* Not all versions of the kernel support the large number of records.  */
@@ -56,5 +56,5 @@ __writev (fd, vector, count)
 }
 weak_alias (__writev, writev)
 
-#define __writev static __atomic_writev_replacement
+#define __writev static internal_function __atomic_writev_replacement
 #include <sysdeps/posix/writev.c>
diff --git a/sysdeps/unix/sysv/sysv4/i386/bits/stat.h b/sysdeps/unix/sysv/sysv4/i386/bits/stat.h
index 9b6fed083d..f3f4473032 100644
--- a/sysdeps/unix/sysv/sysv4/i386/bits/stat.h
+++ b/sysdeps/unix/sysv/sysv4/i386/bits/stat.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1993, 1996 Free Software Foundation, Inc.
+/* Copyright (C) 1993, 1996, 1997 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Brendan Kehoe (brendan@zen.org).
 
@@ -58,7 +58,7 @@ struct stat
     long st_blksize;		/* Optimal block size for I/O.  */
 #define	_STATBUF_ST_BLKSIZE	/* Tell code we have this member.  */
 
-    long st_blocks;		/* Number of 512-byte blocks allocated.  */
+    __blkcnt_t st_blocks;	/* Number of 512-byte blocks allocated.  */
     char st_fstype[16];		/* The type of this filesystem.  */
     int st_aclcnt;
     unsigned long st_level;
diff --git a/sysdeps/unix/sysv/sysv4/solaris2/bits/stat.h b/sysdeps/unix/sysv/sysv4/solaris2/bits/stat.h
index ea5f1f4279..82ab37fd93 100644
--- a/sysdeps/unix/sysv/sysv4/solaris2/bits/stat.h
+++ b/sysdeps/unix/sysv/sysv4/solaris2/bits/stat.h
@@ -52,7 +52,7 @@ struct stat
     __time_t st_ctime;		/* Time of last status change.  */
     unsigned long int st_ctime_usec;
 
-    long st_blksize;		/* Optimal block size for I/O.  */
+    __blkcnt_t st_blksize;	/* Optimal block size for I/O.  */
 #define	_STATBUF_ST_BLKSIZE	/* Tell code we have this member.  */
 
     long st_blocks;		/* Number of 512-byte blocks allocated.  */