about summary refs log tree commit diff
path: root/sysdeps/unix
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2002-07-11 21:44:15 +0000
committerUlrich Drepper <drepper@redhat.com>2002-07-11 21:44:15 +0000
commit7bf75551f0e18568435901a4362466a08646aca2 (patch)
treef5d5b8eafb90ead88967afefbfd395a6fae0e3f3 /sysdeps/unix
parent3e0dd85b103492e6b91e8e3bf60a997b04eb967f (diff)
downloadglibc-7bf75551f0e18568435901a4362466a08646aca2.tar.gz
glibc-7bf75551f0e18568435901a4362466a08646aca2.tar.xz
glibc-7bf75551f0e18568435901a4362466a08646aca2.zip
Update.
2002-07-09  Martin Schwidefsky  <schwidefsky@de.ibm.com>

	* sysdeps/s390/bits/byteswap.h: Unified 31/64 bit byteswap.h.
	* sysdeps/s390/s390-32/bits/byteswap.h: Remove.
	* sysdeps/s390/s390-64/bits/byteswap.h: Remove.
	* sysdeps/s390/bits/link.h: Unified 31/64 bit link.h.
	* sysdeps/s390/s390-32/bits/link.h: Remove.
	* sysdeps/s390/s390-64/bits/link.h: Remove.
	* sysdeps/s390/bits/setjmp.h: Unified 31/64 bit setjmp.h.
	* sysdeps/s390/s390-32/bits/setjmp.h: Remove.
	* sysdeps/s390/s390-64/bits/setjmp.h: Remove.
	* sysdeps/s390/bits/wordsize.h: New file.
	* sysdeps/unix/sysv/linux/s390/bits/elfclass.h: Unified 31/64 bit
	elfclass.h.
	* sysdeps/unix/sysv/linux/s390/s390-64/bits/elfclass.h: Remove.
	* sysdeps/unix/sysv/linux/s390/bits/fcntl.h: Unified 31/64 bit fcntl.h.
	* sysdeps/unix/sysv/linux/s390/s390-32/bits/fcntl.h: Remove.
	* sysdeps/unix/sysv/linux/s390/s390-64/bits/fcntl.h: Remove.
	* sysdeps/unix/sysv/linux/s390/bits/ipc.h: Unified 31/64 bit ipc.h.
	* sysdeps/unix/sysv/linux/s390/s390-64/bits/ipc.h: Remove.
	* sysdeps/unix/sysv/linux/s390/bits/mman.h: Unified 31/64 bit mman.h.
	* sysdeps/unix/sysv/linux/s390/s390-32/bits/mman.h: Remove.
	* sysdeps/unix/sysv/linux/s390/s390-64/bits/mman.h: Remove.
	* sysdeps/unix/sysv/linux/s390/bits/msq.h: Unified 31/64 bit msq.h.
	* ysdeps/unix/sysv/linux/s390/s390-64/bits/msq.h: Remove.
	* sysdeps/unix/sysv/linux/s390/bits/resource.h: Unified 31/64 bit
	resource.h.
	* sysdeps/unix/sysv/linux/s390/s390-32/bits/resource.h: Remove.
	* sysdeps/unix/sysv/linux/s390/s390-64/bits/resource.h: Remove.
	* sysdeps/unix/sysv/linux/s390/bits/sem.h: Unified 31/64 bit sem.h.
	* sysdeps/unix/sysv/linux/s390/s390-64/bits/sem.h: Remove.
	* sysdeps/unix/sysv/linux/s390/bits/shm.h: Unified 31/64 bit shm.h.
	* sysdeps/unix/sysv/linux/s390/s390-64/bits/shm.h: Remove.
	* sysdeps/unix/sysv/linux/s390/bits/sigaction.h: Unified 31/64 bit
	sigaction.h.
	* sysdeps/unix/sysv/linux/s390/s390-64/bits/sigaction.h: Remove.
	* sysdeps/unix/sysv/linux/s390/bits/siginfo.h: Unified 31/64 bit
	siginfo.h.
	* sysdeps/unix/sysv/linux/s390/s390-64/bits/siginfo.h: Remove.
	* sysdeps/unix/sysv/linux/s390/s390-64/bits/sigstack.h: Remove.
	* sysdeps/unix/sysv/linux/s390/bits/socket.h: Unified 31/64 bit
	socket.h.
	* sysdeps/unix/sysv/linux/s390/s390-64/bits/socket.h: Remove.
	* sysdeps/unix/sysv/linux/s390/bits/stat.h: Unified 31/64 bit stat.h.
	* sysdeps/unix/sysv/linux/s390/s390-32/bits/stat.h: Remove.
	* sysdeps/unix/sysv/linux/s390/s390-64/bits/stat.h: Remove.
	* sysdeps/unix/sysv/linux/s390/bits/types.h: Unified 31/64 bit types.h.
	* sysdeps/unix/sysv/linux/s390/s390-64/bits/types.h: Remove.
	* sysdeps/unix/sysv/linux/s390/net/route.h: New file.
	* sysdeps/unix/sysv/linux/s390/sys/procfs.h: Unified 31/64 bit
	procfs.h.
	* sysdeps/unix/sysv/linux/s390/s390-32/sys/procfs.h: Remove.
	* sysdeps/unix/sysv/linux/s390/s390-64/sys/procfs.h: Remove.
	* sysdeps/unix/sysv/linux/s390/sys/ucontext.h: Unified 31/64 bit
	ucontext.h.
	* sysdeps/unix/sysv/linux/s390/s390-32/sys/ucontext.h: Remove.
	* sysdeps/unix/sysv/linux/s390/s390-64/sys/ucontext.h: Remove.
Diffstat (limited to 'sysdeps/unix')
-rw-r--r--sysdeps/unix/sysv/linux/s390/bits/elfclass.h (renamed from sysdeps/unix/sysv/linux/s390/s390-64/bits/elfclass.h)7
-rw-r--r--sysdeps/unix/sysv/linux/s390/bits/fcntl.h (renamed from sysdeps/unix/sysv/linux/s390/s390-32/bits/fcntl.h)60
-rw-r--r--sysdeps/unix/sysv/linux/s390/bits/ipc.h (renamed from sysdeps/unix/sysv/linux/s390/s390-64/bits/ipc.h)35
-rw-r--r--sysdeps/unix/sysv/linux/s390/bits/mman.h (renamed from sysdeps/unix/sysv/linux/s390/s390-32/bits/mman.h)3
-rw-r--r--sysdeps/unix/sysv/linux/s390/bits/msq.h (renamed from sysdeps/unix/sysv/linux/s390/s390-64/bits/msq.h)38
-rw-r--r--sysdeps/unix/sysv/linux/s390/bits/resource.h (renamed from sysdeps/unix/sysv/linux/s390/s390-32/bits/resource.h)36
-rw-r--r--sysdeps/unix/sysv/linux/s390/bits/sem.h (renamed from sysdeps/unix/sysv/linux/s390/s390-64/bits/sem.h)15
-rw-r--r--sysdeps/unix/sysv/linux/s390/bits/shm.h (renamed from sysdeps/unix/sysv/linux/s390/s390-64/bits/shm.h)23
-rw-r--r--sysdeps/unix/sysv/linux/s390/bits/sigaction.h (renamed from sysdeps/unix/sysv/linux/s390/s390-64/bits/sigaction.h)57
-rw-r--r--sysdeps/unix/sysv/linux/s390/bits/siginfo.h (renamed from sysdeps/unix/sysv/linux/s390/s390-64/bits/siginfo.h)19
-rw-r--r--sysdeps/unix/sysv/linux/s390/bits/socket.h (renamed from sysdeps/unix/sysv/linux/s390/s390-64/bits/socket.h)16
-rw-r--r--sysdeps/unix/sysv/linux/s390/bits/stat.h (renamed from sysdeps/unix/sysv/linux/s390/s390-32/bits/stat.h)104
-rw-r--r--sysdeps/unix/sysv/linux/s390/bits/types.h (renamed from sysdeps/unix/sysv/linux/s390/s390-64/bits/types.h)110
-rw-r--r--sysdeps/unix/sysv/linux/s390/s390-64/bits/fcntl.h174
-rw-r--r--sysdeps/unix/sysv/linux/s390/s390-64/bits/mman.h94
-rw-r--r--sysdeps/unix/sysv/linux/s390/s390-64/bits/resource.h201
-rw-r--r--sysdeps/unix/sysv/linux/s390/s390-64/bits/sigstack.h59
-rw-r--r--sysdeps/unix/sysv/linux/s390/s390-64/bits/stat.h107
-rw-r--r--sysdeps/unix/sysv/linux/s390/s390-64/sys/procfs.h118
-rw-r--r--sysdeps/unix/sysv/linux/s390/s390-64/sys/ucontext.h84
-rw-r--r--sysdeps/unix/sysv/linux/s390/sys/procfs.h (renamed from sysdeps/unix/sysv/linux/s390/s390-32/sys/procfs.h)7
-rw-r--r--sysdeps/unix/sysv/linux/s390/sys/ucontext.h (renamed from sysdeps/unix/sysv/linux/s390/s390-32/sys/ucontext.h)8
22 files changed, 382 insertions, 993 deletions
diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/bits/elfclass.h b/sysdeps/unix/sysv/linux/s390/bits/elfclass.h
index e78ba8256a..dd3d028093 100644
--- a/sysdeps/unix/sysv/linux/s390/s390-64/bits/elfclass.h
+++ b/sysdeps/unix/sysv/linux/s390/bits/elfclass.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2001 Free Software Foundation, Inc.
+/* Copyright (C) 2001, 2002 Free Software Foundation, Inc.
    Contributed by Martin Schwidefsky (schwidefsky@de.ibm.com).
    This file is part of the GNU C Library.
 
@@ -29,6 +29,11 @@
 
 #define __ELF_NATIVE_CLASS __WORDSIZE
 
+#if __WORDSIZE == 64
 /* 64 bit Linux for S/390 is exceptional as it has .hash section with
    64 bit entries.  */
 typedef uint64_t Elf_Symndx;
+#else
+/* 32 bit Linux for S/390 has normal .hash section entries with 32 bits.  */
+typedef uint32_t Elf_Symndx;
+#endif
diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/bits/fcntl.h b/sysdeps/unix/sysv/linux/s390/bits/fcntl.h
index 240a3dc6f0..3fd044a934 100644
--- a/sysdeps/unix/sysv/linux/s390/s390-32/bits/fcntl.h
+++ b/sysdeps/unix/sysv/linux/s390/bits/fcntl.h
@@ -1,5 +1,5 @@
 /* O_*, F_*, FD_* bit values for Linux.
-   Copyright (C) 2000, 2001 Free Software Foundation, Inc.
+   Copyright (C) 2000, 2001, 2002 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -21,8 +21,8 @@
 # error "Never use <bits/fcntl.h> directly; include <fcntl.h> instead."
 #endif
 
-
 #include <sys/types.h>
+#include <bits/wordsize.h>
 
 /* open/fcntl - O_SYNC is only implemented on blocks devices and on files
    located on an ext2 file system */
@@ -47,6 +47,15 @@
 # define O_NOFOLLOW	0400000	/* Do not follow links.	 */
 #endif
 
+#ifdef __USE_LARGEFILE64
+# if __WORDSIZE == 64
+/* Not necessary, files are always with 64bit off_t.  */
+#  define O_LARGEFILE	0
+# else
+#  define O_LARGEFILE	0100000
+# endif
+#endif
+
 /* For now Linux has synchronisity options for data and read operations.
    We define the symbols here but let them do the same as O_SYNC since
    this is a superset.	*/
@@ -55,28 +64,34 @@
 # define O_RSYNC	O_SYNC	/* Synchronize read operations.	 */
 #endif
 
-#ifdef __USE_LARGEFILE64
-# define O_LARGEFILE	0100000
-#endif
-
 /* 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.  */
-#ifndef __USE_FILE_OFFSET64
-#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).	*/
+#if __WORDSIZE == 64
+# 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).	*/
+/* Not necessary, we always have 64-bit offsets.  */
+# 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).	*/
 #else
-# define F_GETLK	F_GETLK64  /* Get record locking info.	*/
-# define F_SETLK	F_SETLK64  /* Set record locking info (non-blocking).*/
-# define F_SETLKW	F_SETLKW64 /* Set record locking info (blocking).  */
+# ifndef __USE_FILE_OFFSET64
+#  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).	*/
+# else
+#  define F_GETLK	F_GETLK64  /* Get record locking info.	*/
+#  define F_SETLK	F_SETLK64  /* Set record locking info (non-blocking).*/
+#  define F_SETLKW	F_SETLKW64 /* Set record locking info (blocking).  */
+# endif
+# define F_GETLK64	12	/* Get record locking info.  */
+# define F_SETLK64	13	/* Set record locking info (non-blocking).  */
+# define F_SETLKW64	14	/* Set record locking info (blocking).	*/
 #endif
-#define F_GETLK64	12	/* Get record locking info.  */
-#define F_SETLK64	13	/* Set record locking info (non-blocking).  */
-#define F_SETLKW64	14	/* Set record locking info (blocking).	*/
 
 #if defined __USE_BSD || defined __USE_XOPEN2K
 # define F_SETOWN	8	/* Get owner of socket (receiver of SIGIO).  */
@@ -107,7 +122,7 @@
 #define F_SHLCK		8	/* or 4 */
 
 #ifdef __USE_BSD
-/* operations for bsd flock(), also used by the kernel implementation */
+/* Operations for bsd flock(), also used by the kernel implementation */
 # define LOCK_SH	1	/* shared lock */
 # define LOCK_EX	2	/* exclusive lock */
 # define LOCK_NB	4	/* or'd with one of the above to prevent
@@ -137,7 +152,7 @@ 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
+#if __WORDSIZE == 64 || !defined __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
@@ -174,6 +189,11 @@ struct flock64
 # define POSIX_FADV_RANDOM	1 /* Expect random page references.  */
 # define POSIX_FADV_SEQUENTIAL	2 /* Expect sequential page references.	 */
 # define POSIX_FADV_WILLNEED	3 /* Will need these pages.  */
-# define POSIX_FADV_DONTNEED	4 /* Don't need these pages.  */
-# define POSIX_FADV_NOREUSE	5 /* Data will be accessed once.  */
+# if __WORDSIZE == 64
+#  define POSIX_FADV_DONTNEED	6 /* Don't need these pages.  */
+#  define POSIX_FADV_NOREUSE	7 /* Data will be accessed once.  */
+# else
+#  define POSIX_FADV_DONTNEED	4 /* Don't need these pages.  */
+#  define POSIX_FADV_NOREUSE	5 /* Data will be accessed once.  */
+# endif
 #endif
diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/bits/ipc.h b/sysdeps/unix/sysv/linux/s390/bits/ipc.h
index 0b1bc7ebaa..e3a82d0c40 100644
--- a/sysdeps/unix/sysv/linux/s390/s390-64/bits/ipc.h
+++ b/sysdeps/unix/sysv/linux/s390/bits/ipc.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2001 Free Software Foundation, Inc.
+/* Copyright (C) 2001, 2002 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -20,7 +20,8 @@
 # error "Never use <bits/ipc.h> directly; include <sys/ipc.h> instead."
 #endif
 
-#include <sys/types.h>
+#include <bits/types.h>
+#include <bits/wordsize.h>
 
 /* Mode bits for `msgget', `semget', and `shmget'.  */
 #define IPC_CREAT	01000		/* Create key if key does not exist. */
@@ -47,32 +48,14 @@ struct ipc_perm
     __gid_t gid;			/* Owner's group ID.  */
     __uid_t cuid;			/* Creator's user ID.  */
     __gid_t cgid;			/* Creator's group ID.	*/
+#if __WORDSIZE == 64
     __mode_t mode;			/* Read/write permission.  */
-    unsigned short int __seq;		/* Sequence number.  */
+#else
+    unsigned short int mode;		/* Read/write permission.  */
     unsigned short int __pad1;
+#endif
+    unsigned short int __seq;		/* Sequence number.  */
+    unsigned short int __pad2;
     unsigned long int __unused1;
     unsigned long int __unused2;
   };
-
-
-
-__BEGIN_DECLS
-
-/* The actual system call: all functions are multiplexed by this.  */
-extern int __ipc __P ((int __call, int __first, int __second, int __third,
-		       void *__ptr));
-
-__END_DECLS
-
-/* The codes for the functions to use the multiplexer `__ipc'.	*/
-#define IPCOP_semop	 1
-#define IPCOP_semget	 2
-#define IPCOP_semctl	 3
-#define IPCOP_msgsnd	11
-#define IPCOP_msgrcv	12
-#define IPCOP_msgget	13
-#define IPCOP_msgctl	14
-#define IPCOP_shmat	21
-#define IPCOP_shmdt	22
-#define IPCOP_shmget	23
-#define IPCOP_shmctl	24
diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/bits/mman.h b/sysdeps/unix/sysv/linux/s390/bits/mman.h
index 2926b04064..35a8d18428 100644
--- a/sysdeps/unix/sysv/linux/s390/s390-32/bits/mman.h
+++ b/sysdeps/unix/sysv/linux/s390/bits/mman.h
@@ -1,5 +1,5 @@
 /* Definitions for POSIX memory map interface.  Linux/s390 version.
-   Copyright (C) 2000, 2001 Free Software Foundation, Inc.
+   Copyright (C) 2000, 2001, 2002 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -53,6 +53,7 @@
 /* These are Linux-specific.  */
 #ifdef __USE_MISC
 # define MAP_GROWSDOWN	0x0100		/* Stack-like segment.  */
+# define MAP_GROWSUP	0x0200		/* Register stack-like segment */
 # define MAP_DENYWRITE	0x0800		/* ETXTBSY */
 # define MAP_EXECUTABLE	0x1000		/* Mark it as an executable.  */
 # define MAP_LOCKED	0x2000		/* Lock the mapping.  */
diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/bits/msq.h b/sysdeps/unix/sysv/linux/s390/bits/msq.h
index 6643c83696..ecdd03e170 100644
--- a/sysdeps/unix/sysv/linux/s390/s390-64/bits/msq.h
+++ b/sysdeps/unix/sysv/linux/s390/bits/msq.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2001 Free Software Foundation, Inc.
+/* Copyright (C) 2001, 2002 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -17,31 +17,47 @@
    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>
+#include <bits/types.h>
+#include <bits/wordsize.h>
 
-/* Define options for message queue functions.	*/
+/* Define options for message queue functions.  */
 #define MSG_NOERROR	010000	/* no error if message is too big */
-#define MSG_EXCEPT	020000	/* recv any msg except of specified type */
+#ifdef __USE_GNU
+# define MSG_EXCEPT	020000	/* recv any msg except of specified type */
+#endif
+
+/* Types used in the structure definition.  */
+typedef unsigned long int msgqnum_t;
+typedef unsigned long int msglen_t;
 
 
 /* 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 */
   __time_t msg_stime;		/* time of last msgsnd command */
+#if __WORDSIZE != 64
+  unsigned long int __unused1;
+#endif
   __time_t msg_rtime;		/* time of last msgrcv command */
+#if __WORDSIZE != 64
+  unsigned long int __unused2;
+#endif
   __time_t msg_ctime;		/* time of last change */
-  unsigned long int __msg_cbytes;	/* current number of bytes on queue */
-  unsigned long int msg_qnum;	/* number of messages currently on queue */
-  unsigned long int msg_qbytes;	/* max number of bytes allowed on queue */
+#if __WORDSIZE != 64
+  unsigned long int __unused3;
+#endif
+  unsigned long int __msg_cbytes; /* current number of bytes on queue */
+  msgqnum_t msg_qnum;		/* number of messages currently on queue */
+  msglen_t msg_qbytes;		/* max number of bytes allowed on queue */
   __pid_t msg_lspid;		/* pid of last msgsnd() */
   __pid_t msg_lrpid;		/* pid of last msgrcv() */
-  unsigned long int __unused1;
-  unsigned long int __unused2;
+  unsigned long int __unused4;
+  unsigned long int __unused5;
 };
 
 #ifdef __USE_MISC
diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/bits/resource.h b/sysdeps/unix/sysv/linux/s390/bits/resource.h
index 204c293584..dd0f463fc2 100644
--- a/sysdeps/unix/sysv/linux/s390/s390-32/bits/resource.h
+++ b/sysdeps/unix/sysv/linux/s390/bits/resource.h
@@ -22,6 +22,7 @@
 #endif
 
 #include <bits/types.h>
+#include <bits/wordsize.h>
 
 /* Transmute defines to enumerations.  The macro re-definitions are
    necessary because some programs want to test for operating system
@@ -58,24 +59,24 @@ enum __rlimit_resource
   RLIMIT_RSS = 5,
 #define	RLIMIT_RSS RLIMIT_RSS
 
+  /* Number of processes.  */
+  RLIMIT_NPROC = 6,
+#define RLIMIT_NPROC RLIMIT_NPROC
+
   /* Number of open files.  */
   RLIMIT_NOFILE = 7,
   RLIMIT_OFILE = RLIMIT_NOFILE, /* BSD name for same.  */
 #define RLIMIT_NOFILE RLIMIT_NOFILE
 #define RLIMIT_OFILE RLIMIT_OFILE
 
-  /* Address space limit.  */
-  RLIMIT_AS = 9,
-#define RLIMIT_AS RLIMIT_AS
-
-  /* Number of processes.  */
-  RLIMIT_NPROC = 6,
-#define RLIMIT_NPROC RLIMIT_NPROC
-
   /* Locked-in-memory address space.  */
   RLIMIT_MEMLOCK = 8,
 #define RLIMIT_MEMLOCK RLIMIT_MEMLOCK
 
+  /* Address space limit.  */
+  RLIMIT_AS = 9,
+#define RLIMIT_AS RLIMIT_AS
+
   /* Maximum number of file locks.  */
   RLIMIT_LOCKS = 10,
 #define RLIMIT_LOCKS RLIMIT_LOCKS
@@ -87,14 +88,22 @@ enum __rlimit_resource
 };
 
 /* Value to indicate that there is no limit.  */
-#ifndef __USE_FILE_OFFSET64
-# define RLIM_INFINITY ((unsigned long int) (~0UL))
+#if __WORDSIZE == 64
+# define RLIM_INFINITY ~0UL
 #else
-# define RLIM_INFINITY 0xffffffffffffffffuLL
+# ifndef __USE_FILE_OFFSET64
+#  define RLIM_INFINITY ((unsigned long int) (~0UL))
+# else
+#  define RLIM_INFINITY 0xffffffffffffffffuLL
+# endif
 #endif
 
 #ifdef __USE_LARGEFILE64
-# define RLIM64_INFINITY 0xffffffffffffffffuLL
+# if __WORDSIZE == 64
+#  define RLIM64_INFINITY ~0UL
+# else
+#  define RLIM64_INFINITY 0xffffffffffffffffuLL
+# endif
 #endif
 
 /* We can represent all limits.  */
@@ -103,11 +112,12 @@ enum __rlimit_resource
 
 
 /* Type for resource quantity measurement.  */
-#ifndef __USE_FILE_OFFSET64
+#if __WORDSIZE != 64 && !defined(__USE_FILE_OFFSET64)
 typedef __rlim_t rlim_t;
 #else
 typedef __rlim64_t rlim_t;
 #endif
+
 #ifdef __USE_LARGEFILE64
 typedef __rlim64_t rlim64_t;
 #endif
diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/bits/sem.h b/sysdeps/unix/sysv/linux/s390/bits/sem.h
index 1ab1c85d81..1fb152c3af 100644
--- a/sysdeps/unix/sysv/linux/s390/s390-64/bits/sem.h
+++ b/sysdeps/unix/sysv/linux/s390/bits/sem.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2001 Free Software Foundation, Inc.
+/* Copyright (C) 2001, 2002 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -20,7 +20,8 @@
 # error "Never include <bits/sem.h> directly; use <sys/sem.h> instead."
 #endif
 
-#include <sys/types.h>
+#include <bits/types.h>
+#include <bits/wordsize.h>
 
 /* Flags for `semop'.  */
 #define SEM_UNDO	0x1000		/* undo the operation on exit */
@@ -40,10 +41,16 @@ struct semid_ds
 {
   struct ipc_perm sem_perm;		/* operation permission struct */
   __time_t sem_otime;			/* last semop() time */
-  __time_t sem_ctime;			/* last time changed by semctl() */
-  unsigned long int sem_nsems;		/* number of semaphores in set */
+#if __WORDSIZE != 64
   unsigned long int __unused1;
+#endif
+  __time_t sem_ctime;			/* last time changed by semctl() */
+#if __WORDSIZE != 64
   unsigned long int __unused2;
+#endif
+  unsigned long int sem_nsems;		/* number of semaphores in set */
+  unsigned long int __unused3;
+  unsigned long int __unused4;
 };
 
 /* The user should define a union like the following to use it for arguments
diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/bits/shm.h b/sysdeps/unix/sysv/linux/s390/bits/shm.h
index fa8aa250f8..38e0e92add 100644
--- a/sysdeps/unix/sysv/linux/s390/s390-64/bits/shm.h
+++ b/sysdeps/unix/sysv/linux/s390/bits/shm.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2001 Free Software Foundation, Inc.
+/* Copyright (C) 2001, 2002 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -20,7 +20,8 @@
 # error "Never include <bits/shm.h> directly; use <sys/shm.h> instead."
 #endif
 
-#include <sys/types.h>
+#include <bits/types.h>
+#include <bits/wordsize.h>
 
 /* Permission flag for shmget.	*/
 #define SHM_R		0400		/* or S_IRUGO from <linux/stat.h> */
@@ -36,19 +37,31 @@
 #define SHM_UNLOCK	12		/* unlock segment (root only) */
 
 
+/* Type to count number of attaches.  */
+typedef unsigned long int shmatt_t;
+
 /* Data structure describing a set of semaphores.  */
 struct shmid_ds
   {
     struct ipc_perm shm_perm;		/* operation permission struct */
     size_t shm_segsz;			/* size of segment in bytes */
     __time_t shm_atime;			/* time of last shmat() */
+#if __WORDSIZE != 64
+  unsigned long int __unused1;
+#endif
     __time_t shm_dtime;			/* time of last shmdt() */
+#if __WORDSIZE != 64
+  unsigned long int __unused2;
+#endif
     __time_t shm_ctime;			/* time of last change by shmctl() */
+#if __WORDSIZE != 64
+  unsigned long int __unused3;
+#endif
     __pid_t shm_cpid;			/* pid of creator */
     __pid_t shm_lpid;			/* pid of last shmop */
-    unsigned long int shm_nattch;	/* number of current attaches */
-    unsigned long int __unused1;
-    unsigned long int __unused2;
+    shmatt_t shm_nattch;		/* number of current attaches */
+    unsigned long int __unused4;
+    unsigned long int __unused5;
   };
 
 #ifdef __USE_MISC
diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/bits/sigaction.h b/sysdeps/unix/sysv/linux/s390/bits/sigaction.h
index 38af8d8654..308cb5bd7a 100644
--- a/sysdeps/unix/sysv/linux/s390/s390-64/bits/sigaction.h
+++ b/sysdeps/unix/sysv/linux/s390/bits/sigaction.h
@@ -1,5 +1,5 @@
-/* Definitions for 64 bit S/390 sigaction.  64 bit S/390 version.
-   Copyright (C) 2001 Free Software Foundation, Inc.
+/* Definitions for 31 & 64 bit S/390 sigaction.
+   Copyright (C) 2001, 2002 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -21,6 +21,9 @@
 # error "Never include <bits/sigaction.h> directly; use <signal.h> instead."
 #endif
 
+#include <bits/wordsize.h>
+
+#if __WORDSIZE == 64
 /* Structure describing the action to be taken when a signal arrives.  */
 struct sigaction
   {
@@ -49,19 +52,51 @@ struct sigaction
     /* Additional set of signals to be blocked.	 */
     __sigset_t sa_mask;
   };
+#else
+/* Structure describing the action to be taken when a signal arrives.  */
+struct sigaction
+  {
+    /* Signal handler.  */
+#ifdef __USE_POSIX199309
+    union
+      {
+	/* Used if SA_SIGINFO is not set.  */
+	__sighandler_t sa_handler;
+	/* Used if SA_SIGINFO is set.  */
+	void (*sa_sigaction) (int, siginfo_t *, void *);
+      }
+    __sigaction_handler;
+# define sa_handler	__sigaction_handler.sa_handler
+# define sa_sigaction	__sigaction_handler.sa_sigaction
+#else
+    __sighandler_t sa_handler;
+#endif
+
+    /* Additional set of signals to be blocked.  */
+    __sigset_t sa_mask;
+
+    /* Special flags.  */
+    int sa_flags;
+
+    /* Restore handler.  */
+    void (*sa_restorer) (void);
+  };
+#endif
 
-/* Bits in `sa_flags'.	*/
-#define SA_NOCLDSTOP  0x00000001 /* Don't send SIGCHLD when children stop.  */
-#define SA_SIGINFO    0x00000004
+/* Bits in `sa_flags'.  */
+#define	SA_NOCLDSTOP  1		 /* Don't send SIGCHLD when children stop.  */
+#define SA_NOCLDWAIT  2		 /* Don't create zombie on child death.  */
+#define SA_SIGINFO    4		 /* Invoke signal-catching function with
+				    three arguments instead of one.  */
 #if defined __USE_UNIX98 || defined __USE_MISC
 # define SA_ONSTACK   0x08000000 /* Use signal stack by using `sa_restorer'. */
 # define SA_RESTART   0x10000000 /* Restart syscall on signal return.  */
-# define SA_NODEFER   0x40000000 /* Don't automatically block the signal
-				    when its handler is being executed.	 */
+# define SA_NODEFER   0x40000000 /* Don't automatically block the signal when
+				    its handler is being executed.	 */
 # define SA_RESETHAND 0x80000000 /* Reset to SIG_DFL on entry to handler.  */
 #endif
 #ifdef __USE_MISC
-# define SA_INTERRUPT 0x20000000 /* Historic no-op.  */
+# define SA_INTERRUPT 0x20000000 /* Historical no-op.  */
 
 /* Some aliases for the SA_ constants.	*/
 # define SA_NOMASK    SA_NODEFER
@@ -70,6 +105,6 @@ struct sigaction
 #endif
 
 /* Values for the HOW argument to `sigprocmask'.  */
-#define SIG_BLOCK	   0	/* for blocking signals */
-#define SIG_UNBLOCK	   1	/* for unblocking signals */
-#define SIG_SETMASK	   2	/* for setting the signal mask */
+#define	SIG_BLOCK     0		 /* Block signals.  */
+#define	SIG_UNBLOCK   1		 /* Unblock signals.  */
+#define	SIG_SETMASK   2		 /* Set the set of blocked signals.  */
diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/bits/siginfo.h b/sysdeps/unix/sysv/linux/s390/bits/siginfo.h
index eb69c68d64..1df3732624 100644
--- a/sysdeps/unix/sysv/linux/s390/s390-64/bits/siginfo.h
+++ b/sysdeps/unix/sysv/linux/s390/bits/siginfo.h
@@ -1,5 +1,5 @@
-/* siginfo_t, sigevent and constants.  64 bit S/390 version.
-   Copyright (C) 2001 Free Software Foundation, Inc.
+/* siginfo_t, sigevent and constants.  S/390 version.
+   Copyright (C) 2001, 2002 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -22,6 +22,8 @@
 # error "Never include this file directly.  Use <signal.h> instead"
 #endif
 
+#include <bits/wordsize.h>
+
 #if (!defined __have_sigval_t \
      && (defined _SIGNAL_H || defined __need_siginfo_t \
          || defined __need_sigevent_t))
@@ -40,7 +42,11 @@ typedef union sigval
 # define __have_siginfo_t	1
 
 # define __SI_MAX_SIZE	   128
-# define __SI_PAD_SIZE	   ((__SI_MAX_SIZE / sizeof (int)) - 4)
+# if __WORDSIZE == 64
+#  define __SI_PAD_SIZE     ((__SI_MAX_SIZE / sizeof (int)) - 4)
+# else
+#  define __SI_PAD_SIZE     ((__SI_MAX_SIZE / sizeof (int)) - 3)
+# endif
 
 typedef struct siginfo
   {
@@ -118,6 +124,7 @@ typedef struct siginfo
 # define si_band	_sifields._sigpoll.si_band
 # define si_fd		_sifields._sigpoll.si_fd
 
+
 /* Values for `si_code'.  Positive values are reserved for kernel-generated
    signals.  */
 enum
@@ -256,7 +263,11 @@ enum
 
 /* Structure to transport application-defined values with signals.  */
 # define __SIGEV_MAX_SIZE	64
-# define __SIGEV_PAD_SIZE	((__SIGEV_MAX_SIZE / sizeof (int)) - 4)
+# if __WORDSIZE == 64
+#  define __SIGEV_PAD_SIZE	((__SIGEV_MAX_SIZE / sizeof (int)) - 4)
+# else
+#  define __SIGEV_PAD_SIZE	((__SIGEV_MAX_SIZE / sizeof (int)) - 3)
+# endif
 
 /* Forward declaration of the `pthread_attr_t' type.  */
 struct __pthread_attr_s;
diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/bits/socket.h b/sysdeps/unix/sysv/linux/s390/bits/socket.h
index 3b689563e0..0bdd8db8ae 100644
--- a/sysdeps/unix/sysv/linux/s390/s390-64/bits/socket.h
+++ b/sysdeps/unix/sysv/linux/s390/bits/socket.h
@@ -1,5 +1,5 @@
 /* System-specific socket constants and types.  Linux/s390 version.
-   Copyright (C) 2001 Free Software Foundation, Inc.
+   Copyright (C) 2001, 2002 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -18,12 +18,14 @@
    02111-1307 USA.  */
 
 #ifndef __BITS_SOCKET_H
-#define __BITS_SOCKET_H	1
+#define __BITS_SOCKET_H
 
 #if !defined _SYS_SOCKET_H && !defined _NETINET_IN_H
 # error "Never include <bits/socket.h> directly; use <sys/socket.h> instead."
 #endif
 
+#include <bits/wordsize.h>
+
 #define	__need_size_t
 #define __need_NULL
 #include <stddef.h>
@@ -218,10 +220,18 @@ struct msghdr
     socklen_t msg_namelen;	/* Length of address data.  */
 
     struct iovec *msg_iov;	/* Vector of data to send/receive into.  */
+#if __WORDSIZE == 64
     size_t msg_iovlen;		/* Number of elements in the vector.  */
+#else
+    int msg_iovlen;		/* Number of elements in the vector.  */
+#endif
 
     void *msg_control;		/* Ancillary data (eg BSD filedesc passing). */
+#if __WORDSIZE == 64
     size_t msg_controllen;	/* Ancillary data buffer length.  */
+#else
+    socklen_t msg_controllen;	/* Ancillary data buffer length.  */
+#endif
 
     int msg_flags;		/* Flags on received message.  */
   };
@@ -269,7 +279,7 @@ __cmsg_nxthdr (struct msghdr *__mhdr, struct cmsghdr *__cmsg) __THROW
 
   __cmsg = (struct cmsghdr *) ((unsigned char *) __cmsg
 			       + CMSG_ALIGN (__cmsg->cmsg_len));
-  if ((unsigned char *) (__cmsg + 1) >= ((unsigned char *) __mhdr->msg_control
+  if ((unsigned char *) (__cmsg + 1) > ((unsigned char *) __mhdr->msg_control
 					 + __mhdr->msg_controllen)
       || ((unsigned char *) __cmsg + CMSG_ALIGN (__cmsg->cmsg_len)
 	  > ((unsigned char *) __mhdr->msg_control + __mhdr->msg_controllen)))
diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/bits/stat.h b/sysdeps/unix/sysv/linux/s390/bits/stat.h
index 4e06b059ef..419a4151c1 100644
--- a/sysdeps/unix/sysv/linux/s390/s390-32/bits/stat.h
+++ b/sysdeps/unix/sysv/linux/s390/bits/stat.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1992,95,96,97,98,99,2000,2001 Free Software Foundation, Inc.
+/* Copyright (C) 2000, 2001, 2002 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -20,61 +20,120 @@
 # error "Never include <bits/stat.h> directly; use <sys/stat.h> instead."
 #endif
 
+#include <bits/wordsize.h>
+
+#if __WORDSIZE == 64
 /* Versions of the `struct stat' data structure.  */
-#define _STAT_VER_LINUX_OLD	1
-#define _STAT_VER_KERNEL	1
-#define _STAT_VER_SVR4		2
-#define _STAT_VER_LINUX		3
-#define _STAT_VER		_STAT_VER_LINUX	/* The one defined below.  */
+# define _STAT_VER_KERNEL	0
+# define _STAT_VER_LINUX	1
+# define _STAT_VER		_STAT_VER_LINUX
 
-/* Versions of the `xmknod' interface.  */
-#define _MKNOD_VER_LINUX	1
-#define _MKNOD_VER_SVR4		2
-#define _MKNOD_VER		_MKNOD_VER_LINUX /* The bits defined below.  */
+/* Versions of the `xmknod' interface.	*/
+#define _MKNOD_VER_LINUX	0
+#else
+/* Versions of the `struct stat' data structure.  */
+# define _STAT_VER_LINUX_OLD	1
+# define _STAT_VER_KERNEL	1
+# define _STAT_VER_SVR4		2
+# define _STAT_VER_LINUX	3
+# define _STAT_VER		_STAT_VER_LINUX
 
+/* Versions of the `xmknod' interface.  */
+# define _MKNOD_VER_LINUX	1
+# define _MKNOD_VER_SVR4	2
+# define _MKNOD_VER		_MKNOD_VER_LINUX
+#endif
 
+#if __WORDSIZE == 64
+struct stat
+  {
+    __dev_t st_dev;		/* Device.  */
+    __ino_t st_ino;		/* File serial number.	*/
+    __nlink_t st_nlink;		/* Link count.	*/
+    __mode_t st_mode;		/* File mode.  */
+    __uid_t st_uid;		/* User ID of the file's owner.	*/
+    __gid_t st_gid;		/* Group ID of the file's group.*/
+    int pad0;
+    __dev_t st_rdev;		/* Device number, if device.  */
+    __off_t st_size;		/* Size of file, in bytes.  */
+    __time_t st_atime;		/* Time of last access.	 */
+    long int __reserved0;	/* Reserved for atime.nanoseconds.  */
+    __time_t st_mtime;		/* Time of last modification.  */
+    long int __reserved1;	/* Reserved for mtime.nanoseconds.  */
+    __time_t st_ctime;		/* Time of last status change.	*/
+    long int __reserved2;	/* Reserved for ctime.nanoseconds.  */
+    __blksize_t st_blksize;	/* Optimal block size for I/O.	*/
+    __blkcnt_t st_blocks;	/* Nr. 512-byte blocks allocated.  */
+    long int __unused[3];
+  };
+#else
 struct stat
   {
     __dev_t st_dev;			/* Device.  */
     unsigned int __pad1;
-#ifndef __USE_FILE_OFFSET64
+# ifndef __USE_FILE_OFFSET64
     __ino_t st_ino;			/* File serial number.	*/
-#else
+# else
     __ino_t __st_ino;			/* 32bit file serial number.	*/
-#endif
+# 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 int __pad2;
-#ifndef __USE_FILE_OFFSET64
+# ifndef __USE_FILE_OFFSET64
     __off_t st_size;			/* Size of file, in bytes.  */
-#else
+# else
     __off64_t st_size;			/* Size of file, in bytes.  */
-#endif
+# endif
     __blksize_t st_blksize;		/* Optimal block size for I/O.  */
 
-#ifndef __USE_FILE_OFFSET64
+# ifndef __USE_FILE_OFFSET64
     __blkcnt_t st_blocks;		/* Number 512-byte blocks allocated. */
-#else
+# else
     __blkcnt64_t st_blocks;		/* Number 512-byte blocks allocated. */
-#endif
+# endif
     __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;
-#ifndef __USE_FILE_OFFSET64
+# ifndef __USE_FILE_OFFSET64
     unsigned long int __unused4;
     unsigned long int __unused5;
-#else
+# else
     __ino64_t st_ino;			/* File serial number.	*/
-#endif
+# endif
   };
+#endif
 
 #ifdef __USE_LARGEFILE64
+# if __WORDSIZE == 64
+/* Note stat64 is the same shape as stat.  */
+struct stat64
+  {
+    __dev_t st_dev;		/* Device.  */
+    __ino64_t st_ino;		/* File serial number.	*/
+    __nlink_t st_nlink;		/* Link count.	*/
+    __mode_t st_mode;		/* File mode.  */
+    __uid_t st_uid;		/* User ID of the file's owner.	*/
+    __gid_t st_gid;		/* Group ID of the file's group.*/
+    int pad0;
+    __dev_t st_rdev;		/* Device number, if device.  */
+    __off_t st_size;		/* Size of file, in bytes.  */
+    __time_t st_atime;		/* Time of last access.	 */
+    long int __reserved0;	/* Reserved for atime.nanoseconds.  */
+    __time_t st_mtime;		/* Time of last modification.  */
+    long int __reserved1;	/* Reserved for mtime.nanoseconds.  */
+    __time_t st_ctime;		/* Time of last status change.	*/
+    long int __reserved2;	/* Reserved for ctime.nanoseconds.  */
+    __blksize_t st_blksize;	/* Optimal block size for I/O.	*/
+    __blkcnt64_t st_blocks;	/* Nr. 512-byte blocks allocated.  */
+    long int __unused[3];
+  };
+# else
 struct stat64
   {
     __dev_t st_dev;			/* Device.  */
@@ -99,6 +158,7 @@ struct stat64
     unsigned long int __unused3;
     __ino64_t st_ino;			/* File serial number.		*/
   };
+# endif
 #endif
 
 /* Tell code we have these members.  */
diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/bits/types.h b/sysdeps/unix/sysv/linux/s390/bits/types.h
index cb40434926..693fcee1cf 100644
--- a/sysdeps/unix/sysv/linux/s390/s390-64/bits/types.h
+++ b/sysdeps/unix/sysv/linux/s390/bits/types.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2001 Free Software Foundation, Inc.
+/* Copyright (C) 2001, 2002 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -28,44 +28,61 @@
 #define __need_size_t
 #include <stddef.h>
 
+#include <bits/wordsize.h>
+
 /* Convenience types.  */
 typedef unsigned char __u_char;
-typedef unsigned short int __u_short;
+typedef unsigned short __u_short;
 typedef unsigned int __u_int;
-typedef unsigned long int __u_long;
-typedef unsigned long int __u_quad_t;
-typedef long int __quad_t;
+typedef unsigned long __u_long;
+#if __WORDSIZE == 64
+typedef unsigned long __u_quad_t;
+typedef long __quad_t;
+#else
+# ifdef __GLIBC_HAVE_LONG_LONG
+__extension__ typedef unsigned long long int __u_quad_t;
+__extension__ 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
+#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;
+#if __WORDSIZE == 64
 typedef signed long int __int64_t;
 typedef unsigned long int __uint64_t;
+#else
+# ifdef __GLIBC_HAVE_LONG_LONG
+__extension__ typedef signed long long int __int64_t;
+__extension__ typedef unsigned long long int __uint64_t;
+# endif
+#endif
 typedef __quad_t *__qaddr_t;
 
-typedef __uint64_t __dev_t;		/* Type of device numbers.  */
-typedef __uint32_t __uid_t;		/* Type of user identifications.  */
-typedef __uint32_t __gid_t;		/* Type of group identifications.  */
-typedef __uint64_t __ino_t;		/* Type of file serial numbers.	 */
-typedef __uint64_t __ino64_t;		/*  "" (LFS) */
-typedef __uint32_t __mode_t;		/* Type of file attribute bitmasks.  */
-typedef __uint64_t __nlink_t;		/* Type of file link counts.  */
-typedef __int64_t  __off_t;		/* Type of file sizes and offsets.  */
-typedef __int64_t  __off64_t;		/*  "" (LFS) */
-typedef __int64_t  __loff_t;		/* Type of file sizes and offsets.  */
-typedef __int32_t  __pid_t;		/* Type of process identifications.  */
-typedef __int64_t  __ssize_t;		/* Type of a byte count, or error.  */
-typedef __uint64_t  __rlim_t;		/* Type of resource counts.  */
-typedef __uint64_t  __rlim64_t;		/*  "" (LFS) */
-typedef __int64_t  __blkcnt_t;		/* Type to count nr disk blocks.  */
-typedef __int64_t  __blkcnt64_t;	/*  "" (LFS) */
-typedef __uint64_t __fsblkcnt_t;	/* Type to count file system blocks.  */
-typedef __uint64_t __fsblkcnt64_t;	/*  "" (LFS) */
-typedef __uint64_t __fsfilcnt_t;	/* Type to count file system inodes.  */
-typedef __uint64_t __fsfilcnt64_t;	/*  "" (LFS) */
-typedef __uint32_t __id_t;		/* General type for IDs.  */
+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_long __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 __ssize_t;			/* Type of a byte count, or error.  */
+typedef __u_long __rlim_t;		/* Type of resource counts.  */
+typedef __u_quad_t __rlim64_t;		/* Type of resource counts (LFS).  */
+typedef __u_int __id_t;			/* General type for ID.  */
 
 typedef struct
   {
@@ -73,14 +90,14 @@ typedef struct
   } __fsid_t;				/* Type of file system IDs.  */
 
 /* Everythin' else.  */
-typedef int __daddr_t;			/* Type of a disk address.  */
-typedef char *__caddr_t;		/* Type of a core address.  */
+typedef int __daddr_t;			/* The type of a disk address.  */
+typedef char *__caddr_t;
 typedef long int __time_t;
 typedef unsigned int __useconds_t;
 typedef long int __suseconds_t;
 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. */
 
 /* Clock ID used in clock and timer functions.	*/
 typedef int __clockid_t;
@@ -88,14 +105,42 @@ typedef int __clockid_t;
 /* Timer ID returned by `timer_create'.	 */
 typedef int __timer_t;
 
+
+/* Number of descriptors that can fit in an `fd_set'.  */
+#define __FD_SETSIZE	1024
+
+
+typedef int __key_t;
+
 /* Used in `struct shmid_ds'.  */
+#if __WORDSIZE == 64
 typedef int __ipc_pid_t;
+#else
+typedef unsigned short int __ipc_pid_t;
+#endif
 
-/* type to represent block size. */
+/* Type to represent block size. */
 typedef long int __blksize_t;
 
-/* Number of descriptors that can fit in an `fd_set'.  */
-#define __FD_SETSIZE	1024
+/* 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 __u_long __fsblkcnt_t;
+typedef __u_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_quad_t __ino64_t;
+
+/* Type of file sizes and offsets.  */
+typedef __loff_t __off64_t;
 
 /* Used in XTI.	 */
 typedef int __t_scalar_t;
@@ -107,6 +152,7 @@ typedef long int __intptr_t;
 /* Duplicate info from sys/socket.h.  */
 typedef unsigned int __socklen_t;
 
+
 /* Now add the thread types.  */
 #if defined __USE_POSIX199506 || defined __USE_UNIX98
 # include <bits/pthreadtypes.h>
diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/bits/fcntl.h b/sysdeps/unix/sysv/linux/s390/s390-64/bits/fcntl.h
deleted file mode 100644
index 87605f9bf7..0000000000
--- a/sysdeps/unix/sysv/linux/s390/s390-64/bits/fcntl.h
+++ /dev/null
@@ -1,174 +0,0 @@
-/* O_*, F_*, FD_* bit values for Linux for 64 bit S/390.
-   Copyright (C) 2001 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#ifndef	_FCNTL_H
-# error "Never use <bits/fcntl.h> directly; include <fcntl.h> instead."
-#endif
-
-
-#include <sys/types.h>
-
-/* open/fcntl - O_SYNC is only implemented on blocks devices and on files
-   located on an ext2 file system */
-#define O_ACCMODE	  0003
-#define O_RDONLY	    00
-#define O_WRONLY	    01
-#define O_RDWR		    02
-#define O_CREAT		  0100	/* not fcntl */
-#define O_EXCL		  0200	/* not fcntl */
-#define O_NOCTTY	  0400	/* not fcntl */
-#define O_TRUNC		 01000	/* not fcntl */
-#define O_APPEND	 02000
-#define O_NONBLOCK	 04000
-#define O_NDELAY	O_NONBLOCK
-#define O_SYNC		010000
-#define O_FSYNC		O_SYNC
-#define O_ASYNC		020000
-#define O_DIRECT	040000
-
-#ifdef __USE_GNU
-# define O_DIRECTORY	0200000	/* must be a directory */
-# define O_NOFOLLOW	0400000 /* don't follow links */
-#endif
-
-#ifdef __USE_LARGEFILE64
-/* Not necessary, files are always with 64bit off_t.  */
-# define O_LARGEFILE	0
-#endif
-
-/* For now Linux has synchronisity options for data and read operations.
-   We define the symbols here but let them do the same as O_SYNC since
-   this is a superset.	*/
-#if defined __USE_POSIX199309 || defined __USE_UNIX98
-# define O_DSYNC	O_SYNC	/* Synchronize data.  */
-# define O_RSYNC	O_SYNC	/* Synchronize read operations.	 */
-#endif
-
-/* 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).	*/
-
-/* Not necessary, we always have 64-bit offsets.  */
-#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).	*/
-
-#if defined __USE_BSD || defined __USE_XOPEN2K
-# define F_SETOWN	8	/* Get owner of socket (receiver of SIGIO).  */
-# define F_GETOWN	9	/* Set owner of socket (receiver of SIGIO).  */
-#endif
-
-#ifdef __USE_GNU
-# define F_SETSIG	10	/* Set number of signal to be sent.  */
-# define F_GETSIG	11	/* Get number of signal to be sent.  */
-#endif
-
-#ifdef __USE_GNU
-# define F_SETLEASE	1024	/* Set a lease.	 */
-# define F_GETLEASE	1025	/* Enquire what lease is active.  */
-# define F_NOTIFY	1026	/* Request notfications on a directory.	 */
-#endif
-
-/* For F_[GET|SET]FL.  */
-#define FD_CLOEXEC	1	/* actually anything with low bit set goes */
-
-/* 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 */
-#define F_SHLCK		8	/* or 4 */
-
-#ifdef __USE_BSD
-/* Operations for bsd flock(), also used by the kernel implementation */
-# define LOCK_SH	1	/* shared lock */
-# define LOCK_EX	2	/* exclusive lock */
-# define LOCK_NB	4	/* or'd with one of the above to prevent
-				   blocking */
-# define LOCK_UN	8	/* remove lock */
-#endif
-
-#ifdef __USE_GNU
-# define LOCK_MAND	32	/* This is a mandatory flock:	*/
-# define LOCK_READ	64	/* ... which allows concurrent read operations.	 */
-# define LOCK_WRITE	128	/* ... which allows concurrent write operations.  */
-# define LOCK_RW	192	/* ... Which allows concurrent read & write operations.	 */
-#endif
-
-
-#ifdef __USE_GNU
-/* Types of directory notifications that may be requested with F_NOTIFY.  */
-# define DN_ACCESS	0x00000001	/* File accessed.  */
-# define DN_MODIFY	0x00000002	/* File modified.  */
-# define DN_CREATE	0x00000004	/* File created.  */
-# define DN_DELETE	0x00000008	/* File removed.  */
-# define DN_RENAME	0x00000010	/* File renamed.  */
-# define DN_ATTRIB	0x00000020	/* File changed attibutes.  */
-# define DN_MULTISHOT	0x80000000	/* Don't remove notifier.  */
-#endif
-
-/* We don't need to support __USE_FILE_OFFSET64.  */
-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').  */
-    __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
-#endif /* Use BSD.  */
-
-/* Advise to `posix_fadvise'.  */
-#ifdef __USE_XOPEN2K
-# define POSIX_FADV_NORMAL	0 /* No further special treatment.  */
-# define POSIX_FADV_RANDOM	1 /* Expect random page references.  */
-# define POSIX_FADV_SEQUENTIAL	2 /* Expect sequential page references.	 */
-# define POSIX_FADV_WILLNEED	3 /* Will need these pages.  */
-# define POSIX_FADV_DONTNEED	6 /* Don't need these pages.  */
-# define POSIX_FADV_NOREUSE	7 /* Data will be accessed once.  */
-#endif
diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/bits/mman.h b/sysdeps/unix/sysv/linux/s390/s390-64/bits/mman.h
deleted file mode 100644
index 2da4914243..0000000000
--- a/sysdeps/unix/sysv/linux/s390/s390-64/bits/mman.h
+++ /dev/null
@@ -1,94 +0,0 @@
-/* Definitions for POSIX memory map interface.  64 bit S/390 version.
-   Copyright (C) 2001 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#ifndef _SYS_MMAN_H
-# error "Never use <bits/mman.h> directly; include <sys/mman.h> instead."
-#endif
-
-/* The following definitions basically come from the kernel headers.
-   But the kernel header is not namespace clean.  */
-
-
-/* Protections are chosen from these bits, OR'd together.  The
-   implementation does not necessarily support PROT_EXEC or PROT_WRITE
-   without PROT_READ.  The only guarantees are that no writing will be
-   allowed without PROT_WRITE and no access will be allowed for PROT_NONE. */
-
-#define PROT_READ	  0x1		/* Page can be read.  */
-#define PROT_WRITE	  0x2		/* Page can be written.	 */
-#define PROT_EXEC	  0x4		/* Page can be executed.  */
-#define PROT_NONE	  0x0		/* Page can not be accessed.  */
-
-/* Sharing types (must choose one and only one of these).  */
-#define MAP_SHARED	  0x01		/* Share changes.  */
-#define MAP_PRIVATE	  0x02		/* Changes are private.	 */
-#ifdef __USE_MISC
-# define MAP_TYPE	  0x0f		/* Mask for type of mapping.  */
-#endif
-
-/* Other flags.	 */
-#define MAP_FIXED	  0x10		/* Interpret addr exactly.  */
-#ifdef __USE_MISC
-# define MAP_FILE	  0
-# define MAP_ANONYMOUS	  0x20		/* Don't use a file.  */
-# define MAP_ANON	  MAP_ANONYMOUS
-#endif
-
-/* These are Linux-specific.  */
-#ifdef __USE_MISC
-# define MAP_GROWSDOWN	  0x0100	/* Stack-like segment.	*/
-# define MAP_GROWSUP	  0x0200	/* Register stack-like segment */
-# define MAP_DENYWRITE	  0x0800	/* ETXTBSY */
-# define MAP_EXECUTABLE	  0x1000	/* Mark it as an executable.  */
-# define MAP_LOCKED	  0x2000	/* Lock the mapping.  */
-# define MAP_NORESERVE	  0x4000	/* Don't check for reservations.  */
-#endif
-
-/* Flags to `msync'.  */
-#define MS_ASYNC	  0x1		/* Sync memory asynchronously.	*/
-#define MS_SYNC		  0x4		/* Synchronous memory sync.  */
-#define MS_INVALIDATE	  0x2		/* Invalidate the caches.  */
-
-/* Flags for `mlockall'.  */
-#define MCL_CURRENT	  0x1		/* Lock all currently mapped pages.  */
-#define MCL_FUTURE	  0x2		/* Lock all additions to address
-					   space.  */
-
-/* Flags for `mremap'.	*/
-#ifdef __USE_GNU
-# define MREMAP_MAYMOVE	1
-#endif
-
-/* Advice to `madvise'.	 */
-#ifdef __USE_BSD
-# define MADV_NORMAL	 0	/* No further special treatment.  */
-# define MADV_RANDOM	 1	/* Expect random page references.  */
-# define MADV_SEQUENTIAL 2	/* Expect sequential page references.  */
-# define MADV_WILLNEED	 3	/* Will need these pages.  */
-# define MADV_DONTNEED	 4	/* Don't need these pages.  */
-#endif
-
-/* The POSIX people had to invent similar names for the same things.  */
-#ifdef __USE_XOPEN2K
-# define POSIX_MADV_NORMAL	0 /* No further special treatment.  */
-# define POSIX_MADV_RANDOM	1 /* Expect random page references.  */
-# define POSIX_MADV_SEQUENTIAL	2 /* Expect sequential page references.	 */
-# define POSIX_MADV_WILLNEED	3 /* Will need these pages.  */
-# define POSIX_MADV_DONTNEED	4 /* Don't need these pages.  */
-#endif
diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/bits/resource.h b/sysdeps/unix/sysv/linux/s390/s390-64/bits/resource.h
deleted file mode 100644
index 1df6871813..0000000000
--- a/sysdeps/unix/sysv/linux/s390/s390-64/bits/resource.h
+++ /dev/null
@@ -1,201 +0,0 @@
-/* Bit values & structures for resource limits.  64 bit S/390 version.
-   Copyright (C) 2001, 2002 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#ifndef _SYS_RESOURCE_H
-# error "Never use <bits/resource.h> directly; include <sys/resource.h> instead."
-#endif
-
-#include <bits/types.h>
-
-/* Transmute defines to enumerations.  The macro re-definitions are
-   necessary because some programs want to test for operating system
-   features with #ifdef RUSAGE_SELF.  In ISO C the reflexive
-   definition is a no-op.  */
-
-/* Kinds of resource limit.  */
-enum __rlimit_resource
-{
-  /* Per-process CPU limit, in seconds.	 */
-  RLIMIT_CPU = 0,
-#define RLIMIT_CPU RLIMIT_CPU
-
-  /* Largest file that can be created, in bytes.  */
-  RLIMIT_FSIZE = 1,
-#define	RLIMIT_FSIZE RLIMIT_FSIZE
-
-  /* Maximum size of data segment, in bytes.  */
-  RLIMIT_DATA = 2,
-#define	RLIMIT_DATA RLIMIT_DATA
-
-  /* Maximum size of stack segment, in bytes.  */
-  RLIMIT_STACK = 3,
-#define	RLIMIT_STACK RLIMIT_STACK
-
-  /* Largest core file that can be created, in bytes.  */
-  RLIMIT_CORE = 4,
-#define	RLIMIT_CORE RLIMIT_CORE
-
-  /* Largest resident set size, in bytes.
-     This affects swapping; processes that are exceeding their
-     resident set size will be more likely to have physical memory
-     taken from them.  */
-  RLIMIT_RSS = 5,
-#define	RLIMIT_RSS RLIMIT_RSS
-
-  /* Number of processes.  */
-  RLIMIT_NPROC = 6,
-#define RLIMIT_NPROC RLIMIT_NPROC
-
-  /* Number of open files.  */
-  RLIMIT_NOFILE = 7,
-  RLIMIT_OFILE = RLIMIT_NOFILE, /* BSD name for same.  */
-#define RLIMIT_NOFILE RLIMIT_NOFILE
-#define RLIMIT_OFILE RLIMIT_OFILE
-
-  /* Locked-in-memory address space.  */
-  RLIMIT_MEMLOCK = 8,
-#define RLIMIT_MEMLOCK RLIMIT_MEMLOCK
-
-  /* Address space limit (?) */
-  RLIMIT_AS = 9,
-#define RLIMIT_AS RLIMIT_AS
-
-  /* Maximum number of file locks.  */
-  RLIMIT_LOCKS = 10,
-#define RLIMIT_LOCKS RLIMIT_LOCKS
-
-  RLIMIT_NLIMITS = 11,
-  RLIM_NLIMITS = RLIMIT_NLIMITS
-#define RLIMIT_NLIMITS RLIMIT_NLIMITS
-#define RLIM_NLIMITS RLIM_NLIMITS
-};
-
-/* Value to indicate that there is no limit.  */
-# define RLIM_INFINITY ~0UL
-
-#ifdef __USE_LARGEFILE64
-# define RLIM64_INFINITY ~0UL
-#endif
-
-/* We can represent all limits.	 */
-#define RLIM_SAVED_MAX	RLIM_INFINITY
-#define RLIM_SAVED_CUR	RLIM_INFINITY
-
-
-/* Type for resource quantity measurement.  */
-typedef __rlim64_t rlim_t;
-#ifdef __USE_LARGEFILE64
-typedef __rlim64_t rlim64_t;
-#endif
-
-struct rlimit
-  {
-    /* 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
-{
-  /* The calling process.  */
-  RUSAGE_SELF = 0,
-#define RUSAGE_SELF RUSAGE_SELF
-
-  /* All of its terminated child processes.  */
-  RUSAGE_CHILDREN = -1,
-#define RUSAGE_CHILDREN RUSAGE_CHILDREN
-
-  /* Both.  */
-  RUSAGE_BOTH = -2
-#define RUSAGE_BOTH RUSAGE_BOTH
-};
-
-#define __need_timeval
-#include <bits/time.h>		/* For `struct timeval'.  */
-
-/* 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;
-  };
-
-/* Priority limits.  */
-#define PRIO_MIN	-20	/* Minimum priority a process can have.	 */
-#define PRIO_MAX	20	/* Maximum priority a process can have.	 */
-
-/* The type of the WHICH argument to `getpriority' and `setpriority',
-   indicating what flavor of entity the WHO argument specifies.	 */
-enum __priority_which
-{
-  PRIO_PROCESS = 0,		/* WHO is a process ID.	 */
-#define PRIO_PROCESS PRIO_PROCESS
-  PRIO_PGRP = 1,		/* WHO is a process group ID.  */
-#define PRIO_PGRP PRIO_PGRP
-  PRIO_USER = 2			/* WHO is a user ID.  */
-#define PRIO_USER PRIO_USER
-};
diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/bits/sigstack.h b/sysdeps/unix/sysv/linux/s390/s390-64/bits/sigstack.h
deleted file mode 100644
index e19549acf5..0000000000
--- a/sysdeps/unix/sysv/linux/s390/s390-64/bits/sigstack.h
+++ /dev/null
@@ -1,59 +0,0 @@
-/* sigstack, sigaltstack definitions.  64 bit S/390 version.
-   Copyright (C) 2001 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#ifndef _SIGNAL_H
-# error "Never include this file directly.  Use <signal.h> instead"
-#endif
-
-#ifndef _SIGSTACK_H
-#define _SIGSTACK_H	1
-
-/* Structure describing a signal stack (obsolete).  */
-struct sigstack
-  {
-    __ptr_t ss_sp;		/* Signal stack pointer.  */
-    int ss_onstack;		/* Nonzero if executing on this stack.	*/
-  };
-
-
-/* Possible values for `ss_flags.'.  */
-enum
-{
-  SS_ONSTACK = 1,
-#define SS_ONSTACK	SS_ONSTACK
-  SS_DISABLE
-#define SS_DISABLE	SS_DISABLE
-};
-
-/* Minimum stack size for a signal handler.  */
-#define MINSIGSTKSZ	2048
-
-/* System default stack size.  */
-#define SIGSTKSZ	8192
-
-
-/* Alternate, preferred interface.  */
-typedef struct sigaltstack
-  {
-    __ptr_t ss_sp;
-    int ss_flags;
-    size_t ss_size;
-  } stack_t;
-
-#endif	/* bits/sigstack.h */
diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/bits/stat.h b/sysdeps/unix/sysv/linux/s390/s390-64/bits/stat.h
deleted file mode 100644
index 50ad1b1daf..0000000000
--- a/sysdeps/unix/sysv/linux/s390/s390-64/bits/stat.h
+++ /dev/null
@@ -1,107 +0,0 @@
-/* Copyright (C) 2001 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#ifndef _SYS_STAT_H
-# error "Never include <bits/stat.h> directly; use <sys/stat.h> instead."
-#endif
-
-/* Versions of the `struct stat' data structure.  */
-#define _STAT_VER_KERNEL	0
-#define _STAT_VER_LINUX		1
-#define _STAT_VER		_STAT_VER_LINUX
-
-/* Versions of the `xmknod' interface.	*/
-#define _MKNOD_VER_LINUX	0
-
-struct stat
-  {
-    __dev_t st_dev;		/* Device.  */
-    __ino_t st_ino;		/* File serial number.	*/
-    __nlink_t st_nlink;		/* Link count.	*/
-    __mode_t st_mode;		/* File mode.  */
-    __uid_t st_uid;		/* User ID of the file's owner.	*/
-    __gid_t st_gid;		/* Group ID of the file's group.*/
-    int pad0;
-    __dev_t st_rdev;		/* Device number, if device.  */
-    __off_t st_size;		/* Size of file, in bytes.  */
-    __time_t st_atime;		/* Time of last access.	 */
-    long int __reserved0;	/* Reserved for atime.nanoseconds.  */
-    __time_t st_mtime;		/* Time of last modification.  */
-    long int __reserved1;	/* Reserved for mtime.nanoseconds.  */
-    __time_t st_ctime;		/* Time of last status change.	*/
-    long int __reserved2;	/* Reserved for ctime.nanoseconds.  */
-    __blksize_t st_blksize;	/* Optimal block size for I/O.	*/
-    __blkcnt_t st_blocks;	/* Nr. 512-byte blocks allocated.  */
-    long int __unused[3];
-  };
-
-#ifdef __USE_LARGEFILE64
-/* Note stat64 is the same shape as stat.  */
-struct stat64
-  {
-    __dev_t st_dev;		/* Device.  */
-    __ino64_t st_ino;		/* File serial number.	*/
-    __nlink_t st_nlink;		/* Link count.	*/
-    __mode_t st_mode;		/* File mode.  */
-    __uid_t st_uid;		/* User ID of the file's owner.	*/
-    __gid_t st_gid;		/* Group ID of the file's group.*/
-    int pad0;
-    __dev_t st_rdev;		/* Device number, if device.  */
-    __off_t st_size;		/* Size of file, in bytes.  */
-    __time_t st_atime;		/* Time of last access.	 */
-    long int __reserved0;	/* Reserved for atime.nanoseconds.  */
-    __time_t st_mtime;		/* Time of last modification.  */
-    long int __reserved1;	/* Reserved for mtime.nanoseconds.  */
-    __time_t st_ctime;		/* Time of last status change.	*/
-    long int __reserved2;	/* Reserved for ctime.nanoseconds.  */
-    __blksize_t st_blksize;	/* Optimal block size for I/O.	*/
-    __blkcnt64_t st_blocks;	/* Nr. 512-byte blocks allocated.  */
-    long int __unused[3];
-  };
-#endif
-
-/* Tell code we have these members.  */
-#define	_STATBUF_ST_BLKSIZE
-#define _STATBUF_ST_RDEV
-
-/* Encoding of the file mode.  */
-
-#define	__S_IFMT	0170000	/* These bits determine file type.  */
-
-/* File types.	*/
-#define	__S_IFDIR	0040000	/* Directory.  */
-#define	__S_IFCHR	0020000	/* Character device.  */
-#define	__S_IFBLK	0060000	/* Block device.  */
-#define	__S_IFREG	0100000	/* Regular file.  */
-#define	__S_IFIFO	0010000	/* FIFO.  */
-#define	__S_IFLNK	0120000	/* Symbolic link.  */
-#define	__S_IFSOCK	0140000	/* Socket.  */
-
-/* POSIX.1b objects.  */
-#define __S_TYPEISMQ(buf)  ((buf)->st_mode - (buf)->st_mode)
-#define __S_TYPEISSEM(buf) ((buf)->st_mode - (buf)->st_mode)
-#define __S_TYPEISSHM(buf) ((buf)->st_mode - (buf)->st_mode)
-
-/* Protection bits.  */
-
-#define	__S_ISUID	04000	/* Set user ID on execution.  */
-#define	__S_ISGID	02000	/* Set group ID on execution.  */
-#define	__S_ISVTX	01000	/* Save swapped text after use (sticky).  */
-#define	__S_IREAD	0400	/* Read by owner.  */
-#define	__S_IWRITE	0200	/* Write by owner.  */
-#define	__S_IEXEC	0100	/* Execute by owner.  */
diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/sys/procfs.h b/sysdeps/unix/sysv/linux/s390/s390-64/sys/procfs.h
deleted file mode 100644
index 492b1aa943..0000000000
--- a/sysdeps/unix/sysv/linux/s390/s390-64/sys/procfs.h
+++ /dev/null
@@ -1,118 +0,0 @@
-/* Copyright (C) 2001 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#ifndef _SYS_PROCFS_H
-#define _SYS_PROCFS_H	1
-
-/* This is somewhat modelled after the file of the same name on SVR4
-   systems.  It provides a definition of the core file format for ELF
-   used on Linux.  It doesn't have anything to do with the /proc file
-   system, even though Linux has one.
-
-   Anyway, the whole purpose of this file is for GDB and GDB only.
-   Don't read too much into it.  Don't use it for anything other than
-   GDB unless you know what you are doing.  */
-
-#include <features.h>
-#include <sys/time.h>
-#include <sys/types.h>
-#include <sys/user.h>
-#include <sys/ucontext.h>
-
-__BEGIN_DECLS
-
-typedef greg_t elf_greg_t;
-#define ELF_NGREG NGREG
-typedef gregset_t elf_gregset_t;
-typedef fpreg_t   elf_fpreg_t;
-typedef fpregset_t elf_fpregset_t;
-
-/* Signal info.  */
-struct elf_siginfo
-  {
-    int si_signo;			/* Signal number.  */
-    int si_code;			/* Extra code.  */
-    int si_errno;			/* Errno.  */
-  };
-
-
-/* Definitions to generate Intel SVR4-like core files.  These mostly
-   have the same names as the SVR4 types with "elf_" tacked on the
-   front to prevent clashes with Linux definitions, and the typedef
-   forms have been avoided.  This is mostly like the SVR4 structure,
-   but more Linuxy, with things that Linux does not support and which
-   GDB doesn't really use excluded.  */
-
-struct elf_prstatus
-  {
-    struct elf_siginfo pr_info;		/* Info associated with signal.  */
-    short int pr_cursig;		/* Current signal.  */
-    unsigned long int pr_sigpend;	/* Set of pending signals.  */
-    unsigned long int pr_sighold;	/* Set of held signals.  */
-    __pid_t pr_pid;
-    __pid_t pr_ppid;
-    __pid_t pr_pgrp;
-    __pid_t pr_sid;
-    struct timeval pr_utime;		/* User time.  */
-    struct timeval pr_stime;		/* System time.  */
-    struct timeval pr_cutime;		/* Cumulative user time.  */
-    struct timeval pr_cstime;		/* Cumulative system time.  */
-    elf_gregset_t pr_reg;		/* GP registers.  */
-    int pr_fpvalid;			/* True if math copro being used.  */
-  };
-
-
-#define ELF_PRARGSZ     (80)    /* Number of chars for args.  */
-
-struct elf_prpsinfo
-  {
-    char pr_state;			/* Numeric process state.  */
-    char pr_sname;			/* Char for pr_state.  */
-    char pr_zomb;			/* Zombie.  */
-    char pr_nice;			/* Nice val.  */
-    unsigned long int pr_flag;		/* Flags.  */
-    unsigned int pr_uid;
-    unsigned int pr_gid;
-    int pr_pid, pr_ppid, pr_pgrp, pr_sid;
-    /* Lots missing */
-    char pr_fname[16];			/* Filename of executable.  */
-    char pr_psargs[ELF_PRARGSZ];	/* Initial part of arg list.  */
-  };
-
-/* The rest of this file provides the types for emulation of the
-   Solaris <proc_service.h> interfaces that should be implemented by
-   users of libthread_db.  */
-
-/* Addresses.  */
-typedef void *psaddr_t;
-
-/* Register sets.  Linux has different names.  */
-typedef elf_gregset_t prgregset_t;
-typedef elf_fpregset_t prfpregset_t;
-
-/* We don't have any differences between processes and threads,
-   therefore have only one PID type.  */
-typedef __pid_t lwpid_t;
-
-/* Process status and info.  In the end we do provide typedefs for them.  */
-typedef struct elf_prstatus prstatus_t;
-typedef struct elf_prpsinfo prpsinfo_t;
-
-__END_DECLS
-
-#endif	/* sys/procfs.h */
diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/sys/ucontext.h b/sysdeps/unix/sysv/linux/s390/s390-64/sys/ucontext.h
deleted file mode 100644
index 336178e758..0000000000
--- a/sysdeps/unix/sysv/linux/s390/s390-64/sys/ucontext.h
+++ /dev/null
@@ -1,84 +0,0 @@
-/* Copyright (C) 2001 Free Software Foundation, Inc.
-   Contributed by Denis Joseph Barrow (djbarrow@de.ibm.com).
-   This file is part of the GNU C Library.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#ifndef _SYS_UCONTEXT_H
-#define _SYS_UCONTEXT_H	1
-/* Forward definition to avoid parse errors */
-struct ucontext;
-typedef struct ucontext ucontext_t;
-#include <features.h>
-#include <signal.h>
-
-/* We need the signal context definitions even if they are not used
-   included in <signal.h>.  */
-#include <bits/sigcontext.h>
-
-/* Type for a program status word.  */
-typedef struct
-{
-  unsigned long mask;
-  unsigned long addr;
-} __attribute__ ((aligned(8))) __psw_t;
-
-/* Type for a general-purpose register.  */
-typedef unsigned long greg_t;
-
-/* And the whole bunch of them.  We should have used `struct s390_regs',
-   but to avoid name space pollution and since the tradition says that
-   the register set is an array, we make gregset_t a simple array
-   that has the same size as s390_regs.  This is needed for the
-   elf_prstatus structure.  */
-#define NGREG 27
-/* Must match kernels psw_t alignment.  */
-typedef greg_t gregset_t[NGREG] __attribute__ ((aligned(8)));
-
-typedef union
-  {
-    double  d;
-    float   f;
-  } fpreg_t;
-
-/* Register set for the floating-point registers.  */
-typedef struct
-  {
-    unsigned int fpc;
-    fpreg_t fprs[16];
-  } fpregset_t;
-
-/* Context to describe whole processor state.  */
-typedef struct
-  {
-    __psw_t psw;
-    unsigned long gregs[16];
-    unsigned int aregs[16];
-    fpregset_t fpregs;
-  } mcontext_t;
-
-/* Userlevel context.  */
-struct ucontext
-  {
-    unsigned long int uc_flags;
-    struct ucontext *uc_link;
-    stack_t uc_stack;
-    mcontext_t uc_mcontext;
-    __sigset_t uc_sigmask;
-  };
-
-
-#endif /* sys/ucontext.h */
diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/sys/procfs.h b/sysdeps/unix/sysv/linux/s390/sys/procfs.h
index 112d86d322..e4aaa39fe1 100644
--- a/sysdeps/unix/sysv/linux/s390/s390-32/sys/procfs.h
+++ b/sysdeps/unix/sysv/linux/s390/sys/procfs.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000, 2001 Free Software Foundation, Inc.
+/* Copyright (C) 2000, 2001, 2002 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -86,8 +86,13 @@ struct elf_prpsinfo
     char pr_zomb;			/* Zombie.  */
     char pr_nice;			/* Nice val.  */
     unsigned long int pr_flag;		/* Flags.  */
+#if __WORDSIZE == 64
+    unsigned int pr_uid;
+    unsigned int pr_gid;
+#else
     unsigned short int pr_uid;
     unsigned short int pr_gid;
+#endif
     int pr_pid, pr_ppid, pr_pgrp, pr_sid;
     /* Lots missing */
     char pr_fname[16];			/* Filename of executable.  */
diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/sys/ucontext.h b/sysdeps/unix/sysv/linux/s390/sys/ucontext.h
index dfc7968a83..4e32361c3b 100644
--- a/sysdeps/unix/sysv/linux/s390/s390-32/sys/ucontext.h
+++ b/sysdeps/unix/sysv/linux/s390/sys/ucontext.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000, 2001 Free Software Foundation, Inc.
+/* Copyright (C) 2000, 2001, 2002 Free Software Foundation, Inc.
    Contributed by Denis Joseph Barrow (djbarrow@de.ibm.com).
    This file is part of the GNU C Library.
 
@@ -44,7 +44,11 @@ typedef unsigned long greg_t;
    the register set is an array, we make gregset_t a simple array
    that has the same size as s390_regs.  This is needed for the
    elf_prstatus structure.  */
-#define NGREG 36
+#if __WORDSIZE == 64
+# define NGREG 27
+#else
+# define NGREG 36
+#endif
 /* Must match kernels psw_t alignment.  */
 typedef greg_t gregset_t[NGREG] __attribute__ ((aligned(8)));