aboutsummaryrefslogtreecommitdiff
path: root/sysdeps/unix/sysv/linux/s390/s390-32
diff options
context:
space:
mode:
Diffstat (limited to 'sysdeps/unix/sysv/linux/s390/s390-32')
-rw-r--r--sysdeps/unix/sysv/linux/s390/s390-32/Dist9
-rw-r--r--sysdeps/unix/sysv/linux/s390/s390-32/Makefile12
-rw-r--r--sysdeps/unix/sysv/linux/s390/s390-32/Versions28
-rw-r--r--sysdeps/unix/sysv/linux/s390/s390-32/alphasort64.c1
-rw-r--r--sysdeps/unix/sysv/linux/s390/s390-32/bits/fcntl.h179
-rw-r--r--sysdeps/unix/sysv/linux/s390/s390-32/bits/mman.h93
-rw-r--r--sysdeps/unix/sysv/linux/s390/s390-32/bits/resource.h205
-rw-r--r--sysdeps/unix/sysv/linux/s390/s390-32/bits/stat.h134
-rw-r--r--sysdeps/unix/sysv/linux/s390/s390-32/chown.c118
-rw-r--r--sysdeps/unix/sysv/linux/s390/s390-32/clone.S66
-rw-r--r--sysdeps/unix/sysv/linux/s390/s390-32/fchown.c1
-rw-r--r--sysdeps/unix/sysv/linux/s390/s390-32/fcntl.c1
-rw-r--r--sysdeps/unix/sysv/linux/s390/s390-32/fxstat.c1
-rw-r--r--sysdeps/unix/sysv/linux/s390/s390-32/getdents64.c1
-rw-r--r--sysdeps/unix/sysv/linux/s390/s390-32/getegid.c1
-rw-r--r--sysdeps/unix/sysv/linux/s390/s390-32/geteuid.c1
-rw-r--r--sysdeps/unix/sysv/linux/s390/s390-32/getgid.c1
-rw-r--r--sysdeps/unix/sysv/linux/s390/s390-32/getgroups.c1
-rw-r--r--sysdeps/unix/sysv/linux/s390/s390-32/getresgid.c1
-rw-r--r--sysdeps/unix/sysv/linux/s390/s390-32/getresuid.c1
-rw-r--r--sysdeps/unix/sysv/linux/s390/s390-32/getrlimit.c1
-rw-r--r--sysdeps/unix/sysv/linux/s390/s390-32/getrlimit64.c1
-rw-r--r--sysdeps/unix/sysv/linux/s390/s390-32/getuid.c1
-rw-r--r--sysdeps/unix/sysv/linux/s390/s390-32/lchown.c75
-rw-r--r--sysdeps/unix/sysv/linux/s390/s390-32/lockf64.c1
-rw-r--r--sysdeps/unix/sysv/linux/s390/s390-32/lxstat.c1
-rw-r--r--sysdeps/unix/sysv/linux/s390/s390-32/mmap.S72
-rw-r--r--sysdeps/unix/sysv/linux/s390/s390-32/mmap64.S101
-rw-r--r--sysdeps/unix/sysv/linux/s390/s390-32/msgctl.c1
-rw-r--r--sysdeps/unix/sysv/linux/s390/s390-32/oldgetrlimit64.c1
-rw-r--r--sysdeps/unix/sysv/linux/s390/s390-32/readdir64.c1
-rw-r--r--sysdeps/unix/sysv/linux/s390/s390-32/readdir64_r.c1
-rw-r--r--sysdeps/unix/sysv/linux/s390/s390-32/register-dump.h130
-rw-r--r--sysdeps/unix/sysv/linux/s390/s390-32/scandir64.c1
-rw-r--r--sysdeps/unix/sysv/linux/s390/s390-32/semctl.c1
-rw-r--r--sysdeps/unix/sysv/linux/s390/s390-32/setegid.c1
-rw-r--r--sysdeps/unix/sysv/linux/s390/s390-32/seteuid.c1
-rw-r--r--sysdeps/unix/sysv/linux/s390/s390-32/setfsgid.c1
-rw-r--r--sysdeps/unix/sysv/linux/s390/s390-32/setfsuid.c1
-rw-r--r--sysdeps/unix/sysv/linux/s390/s390-32/setgid.c1
-rw-r--r--sysdeps/unix/sysv/linux/s390/s390-32/setgroups.c2
-rw-r--r--sysdeps/unix/sysv/linux/s390/s390-32/setregid.c1
-rw-r--r--sysdeps/unix/sysv/linux/s390/s390-32/setresgid.c1
-rw-r--r--sysdeps/unix/sysv/linux/s390/s390-32/setresuid.c1
-rw-r--r--sysdeps/unix/sysv/linux/s390/s390-32/setreuid.c1
-rw-r--r--sysdeps/unix/sysv/linux/s390/s390-32/setrlimit.c1
-rw-r--r--sysdeps/unix/sysv/linux/s390/s390-32/setuid.c2
-rw-r--r--sysdeps/unix/sysv/linux/s390/s390-32/shmctl.c1
-rw-r--r--sysdeps/unix/sysv/linux/s390/s390-32/socket.S98
-rw-r--r--sysdeps/unix/sysv/linux/s390/s390-32/sys/procfs.h118
-rw-r--r--sysdeps/unix/sysv/linux/s390/s390-32/sys/ucontext.h76
-rw-r--r--sysdeps/unix/sysv/linux/s390/s390-32/syscall.S51
-rw-r--r--sysdeps/unix/sysv/linux/s390/s390-32/syscalls.list4
-rw-r--r--sysdeps/unix/sysv/linux/s390/s390-32/sysdep.S104
-rw-r--r--sysdeps/unix/sysv/linux/s390/s390-32/sysdep.h212
-rw-r--r--sysdeps/unix/sysv/linux/s390/s390-32/versionsort64.c1
-rw-r--r--sysdeps/unix/sysv/linux/s390/s390-32/xstat.c1
57 files changed, 1924 insertions, 0 deletions
diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/Dist b/sysdeps/unix/sysv/linux/s390/s390-32/Dist
new file mode 100644
index 0000000..d0740c1
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/s390/s390-32/Dist
@@ -0,0 +1,9 @@
+clone.S
+oldgetrlimit64.c
+setresuid.c
+setresgid.c
+setfsuid.c
+setfsgid.c
+sys/elf.h
+sys/procfs.h
+sys/user.h
diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/Makefile b/sysdeps/unix/sysv/linux/s390/s390-32/Makefile
new file mode 100644
index 0000000..2115e40
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/s390/s390-32/Makefile
@@ -0,0 +1,12 @@
+ifeq ($(subdir),misc)
+sysdep_routines += setfsgid setfsuid setresgid setresuid
+sysdep_headers += sys/elf.h
+endif
+
+ifeq ($(subdir),csu)
+CFLAGS-initfini.s += -DWEAK_GMON_START
+endif
+
+ifeq ($(subdir),resource)
+sysdep_routines += oldgetrlimit64
+endif
diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/Versions b/sysdeps/unix/sysv/linux/s390/s390-32/Versions
new file mode 100644
index 0000000..5a56361
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/s390/s390-32/Versions
@@ -0,0 +1,28 @@
+libc {
+ GLIBC_2.0 {
+ # Exception handling support functions from libgcc
+ __register_frame; __register_frame_table; __deregister_frame;
+ __register_frame_info; __deregister_frame_info; __frame_state_for;
+ __register_frame_info_table;
+ }
+ GLIBC_2.2 {
+ # functions used in other libraries
+ __xstat64; __fxstat64; __lxstat64;
+
+ # a*
+ alphasort64;
+
+ # New rlimit interface
+ getrlimit; setrlimit; getrlimit64;
+
+ # r*
+ readdir64; readdir64_r;
+
+ # s*
+ scandir64;
+
+ # v*
+ versionsort64;
+ }
+}
+
diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/alphasort64.c b/sysdeps/unix/sysv/linux/s390/s390-32/alphasort64.c
new file mode 100644
index 0000000..0b5ae47
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/s390/s390-32/alphasort64.c
@@ -0,0 +1 @@
+#include <sysdeps/unix/sysv/linux/i386/alphasort64.c>
diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/bits/fcntl.h b/sysdeps/unix/sysv/linux/s390/s390-32/bits/fcntl.h
new file mode 100644
index 0000000..0ae79d7
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/s390/s390-32/bits/fcntl.h
@@ -0,0 +1,179 @@
+/* O_*, F_*, FD_* bit values for Linux.
+ Copyright (C) 2000, 2001 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU 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 _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
+
+#ifdef __USE_GNU
+# define O_DIRECT 040000 /* Direct disk access. */
+# define O_DIRECTORY 0200000 /* Must be a directory. */
+# define O_NOFOLLOW 0400000 /* Do not follow links. */
+#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
+
+#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). */
+#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). */
+
+#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
+
+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
+ __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 4 /* Don't need these pages. */
+# define POSIX_FADV_NOREUSE 5 /* Data will be accessed once. */
+#endif
diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/bits/mman.h b/sysdeps/unix/sysv/linux/s390/s390-32/bits/mman.h
new file mode 100644
index 0000000..d7fc58a
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/s390/s390-32/bits/mman.h
@@ -0,0 +1,93 @@
+/* Definitions for POSIX memory map interface. Linux/s390 version.
+ Copyright (C) 2000, 2001 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU 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 _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_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 1 /* Sync memory asynchronously. */
+#define MS_SYNC 4 /* Synchronous memory sync. */
+#define MS_INVALIDATE 2 /* Invalidate the caches. */
+
+/* Flags for `mlockall'. */
+#define MCL_CURRENT 1 /* Lock all currently mapped pages. */
+#define MCL_FUTURE 2 /* 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-32/bits/resource.h b/sysdeps/unix/sysv/linux/s390/s390-32/bits/resource.h
new file mode 100644
index 0000000..b04764e
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/s390/s390-32/bits/resource.h
@@ -0,0 +1,205 @@
+/* Bit values & structures for resource limits. Linux version.
+ Copyright (C) 2000, 2001 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU 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 _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 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
+
+ RLIMIT_NLIMITS = 10,
+ RLIM_NLIMITS = RLIMIT_NLIMITS
+#define RLIMIT_NLIMITS RLIMIT_NLIMITS
+#define RLIM_NLIMITS RLIM_NLIMITS
+};
+
+/* Value to indicate that there is no limit. */
+#ifndef __USE_FILE_OFFSET64
+# define RLIM_INFINITY ((unsigned long int) (~0UL))
+#else
+# define RLIM_INFINITY 0xffffffffffffffffuLL
+#endif
+
+#ifdef __USE_LARGEFILE64
+# define RLIM64_INFINITY 0xffffffffffffffffuLL
+#endif
+
+/* We can represent all limits. */
+#define RLIM_SAVED_MAX RLIM_INFINITY
+#define RLIM_SAVED_CUR 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. */
+ 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-32/bits/stat.h b/sysdeps/unix/sysv/linux/s390/s390-32/bits/stat.h
new file mode 100644
index 0000000..a40159b
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/s390/s390-32/bits/stat.h
@@ -0,0 +1,134 @@
+/* Copyright (C) 1992,95,96,97,98,99,2000,2001 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU 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 _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_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. */
+
+/* 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. */
+
+
+struct stat
+ {
+ __dev_t st_dev; /* Device. */
+ unsigned int __pad1;
+#ifndef __USE_FILE_OFFSET64
+ __ino_t st_ino; /* File serial number. */
+#else
+ __ino_t __st_ino; /* 32bit 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 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
+ __blksize_t st_blksize; /* Optimal block size for I/O. */
+
+#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. */
+ unsigned long int __unused2;
+ __time_t st_ctime; /* Time of last status change. */
+ unsigned long int __unused3;
+#ifndef __USE_FILE_OFFSET64
+ unsigned long int __unused4;
+ unsigned long int __unused5;
+#else
+ __ino64_t st_ino; /* File serial number. */
+#endif
+ };
+
+#ifdef __USE_LARGEFILE64
+struct stat64
+ {
+ __dev_t st_dev; /* Device. */
+ unsigned int __pad1;
+
+ __ino_t __st_ino; /* 32bit 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 int __pad2;
+ __off64_t st_size; /* Size of file, in bytes. */
+ __blksize_t 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;
+ __ino64_t st_ino; /* File serial number. */
+ };
+#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. Note that these macros always evaluate to zero. But
+ they do it by enforcing the correct use of the macros. */
+#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-32/chown.c b/sysdeps/unix/sysv/linux/s390/s390-32/chown.c
new file mode 100644
index 0000000..682f2dd
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/s390/s390-32/chown.c
@@ -0,0 +1,118 @@
+/* Copyright (C) 2000, 2001 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with the GNU C Library; see the file COPYING.LIB. If not,
+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+#include <errno.h>
+#include <unistd.h>
+
+#include <sysdep.h>
+#include <sys/syscall.h>
+#include <shlib-compat.h>
+#include <bp-checks.h>
+
+#include <linux/posix_types.h>
+#include "kernel-features.h"
+
+/*
+ In Linux 2.1.x the chown functions have been changed. A new function lchown
+ was introduced. The new chown now follows symlinks - the old chown and the
+ new lchown do not follow symlinks.
+ The new lchown function has the same number as the old chown had and the
+ new chown has a new number. When compiling with headers from Linux > 2.1.8x
+ it's impossible to run this libc with older kernels. In these cases libc
+ has therefore to route calls to chown to the old chown function.
+*/
+
+extern int __syscall_chown (const char *__file,
+ __kernel_uid_t __owner, __kernel_gid_t __group);
+
+/* Running under Linux > 2.1.80. */
+
+#ifdef __NR_chown32
+extern int __syscall_chown32 (const char *__file,
+ __kernel_uid32_t owner, __kernel_gid32_t group);
+# if __ASSUME_32BITUIDS == 0
+/* This variable is shared with all files that need to check for 32bit
+ uids. */
+extern int __libc_missing_32bit_uids;
+# endif
+#endif /* __NR_chown32 */
+
+int
+__real_chown (const char *file, uid_t owner, gid_t group)
+{
+ static int __libc_old_chown;
+ int result;
+
+ if (!__libc_old_chown)
+ {
+ int saved_errno = errno;
+#ifdef __NR_chown32
+ if (__libc_missing_32bit_uids <= 0)
+ {
+ int result;
+ int saved_errno = errno;
+
+ result = INLINE_SYSCALL (chown32, 3, CHECK_STRING (file), owner, group);
+ if (result == 0 || errno != ENOSYS)
+ return result;
+
+ __set_errno (saved_errno);
+ __libc_missing_32bit_uids = 1;
+ }
+#endif /* __NR_chown32 */
+ if (((owner + 1) > (uid_t) ((__kernel_uid_t) -1U))
+ || ((group + 1) > (gid_t) ((__kernel_gid_t) -1U)))
+ {
+ __set_errno (EINVAL);
+ return -1;
+ }
+
+ result = INLINE_SYSCALL (chown, 3, CHECK_STRING (file), owner, group);
+
+ if (result >= 0 || errno != ENOSYS)
+ return result;
+
+ __set_errno (saved_errno);
+ __libc_old_chown = 1;
+ }
+
+ return __lchown (file, owner, group);
+}
+
+
+#if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_1)
+/* Compiling for compatibiity. */
+int
+__chown_is_lchown (const char *file, uid_t owner, gid_t group)
+{
+ return __lchown (file, owner, group);
+}
+#endif
+
+#if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_1)
+strong_alias (__chown_is_lchown, _chown_is_lchown)
+compat_symbol (libc, __chown_is_lchown, __chown, GLIBC_2_0);
+compat_symbol (libc, _chown_is_lchown, chown, GLIBC_2_0);
+
+strong_alias (__real_chown, _real_chown)
+versioned_symbol (libc, __real_chown, __chown, GLIBC_2_1);
+versioned_symbol (libc, _real_chown, chown, GLIBC_2_1);
+#else
+strong_alias (__real_chown, __chown)
+weak_alias (__real_chown, chown)
+#endif
diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/clone.S b/sysdeps/unix/sysv/linux/s390/s390-32/clone.S
new file mode 100644
index 0000000..433246f
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/s390/s390-32/clone.S
@@ -0,0 +1,66 @@
+/* Copyright (C) 2000, 2001 Free Software Foundation, Inc.
+ Contributed by Martin Schwidefsky (schwidefsky@de.ibm.com).
+
+ 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. */
+
+/* clone is even more special than fork as it mucks with stacks
+ and invokes a function in the right context after its all over. */
+
+#include <sysdep.h>
+#define _ERRNO_H 1
+#include <bits/errno.h>
+
+/*int __clone(int (*fn)(void *arg), void *child_stack, int flags, void *arg);*/
+/* sys_clone(void *child_stack, unsigned long flags) */
+
+ .text
+ENTRY(__clone)
+ /* Sanity check arguments & move registers */
+ ltr %r1,%r2 /* no NULL function pointers */
+ lhi %r2,-EINVAL
+ jz SYSCALL_ERROR_LABEL
+ ltr %r3,%r3 /* no NULL stack pointers */
+ jz SYSCALL_ERROR_LABEL
+ /* move child_stack and flags, then call SVC */
+ lr %r2,%r3
+ lr %r3,%r4
+ svc SYS_ify(clone)
+ ltr %r2,%r2 /* check return code */
+ jm SYSCALL_ERROR_LABEL
+ jz thread_start
+ br %r14
+
+thread_start:
+ /* fn is in gpr 1, arg in gpr 5 */
+ lr %r2,%r5 /* set first parameter to void *arg */
+ sr %r11,%r11 /* terminate the stack frame */
+ ahi %r15,-96 /* make room on the stack for the save area */
+ basr %r14,%r1 /* jump to fn */
+#ifdef PIC
+ basr %r12,0
+.L0: lr %r1,%r12
+ al %r12,.L1-.L0(%r12)
+ al %r1,.L2-.L0(%r1)
+ br %r1 /* branch to _exit -> thread termination */
+.L1: .long _GLOBAL_OFFSET_TABLE_ - .L0
+.L2: .long _exit@PLT - .L0
+#else
+ basr %r1,0
+.L0: al %r1,.L1-.L0(0,%r1)
+ br %r1 /* branch to _exit -> thread termination */
+.L1: .long _exit - .L0
+#endif
+PSEUDO_END (__clone)
diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/fchown.c b/sysdeps/unix/sysv/linux/s390/s390-32/fchown.c
new file mode 100644
index 0000000..3a69ecc
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/s390/s390-32/fchown.c
@@ -0,0 +1 @@
+#include <sysdeps/unix/sysv/linux/i386/fchown.c>
diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/fcntl.c b/sysdeps/unix/sysv/linux/s390/s390-32/fcntl.c
new file mode 100644
index 0000000..ea951bc
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/s390/s390-32/fcntl.c
@@ -0,0 +1 @@
+#include <sysdeps/unix/sysv/linux/i386/fcntl.c>
diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/fxstat.c b/sysdeps/unix/sysv/linux/s390/s390-32/fxstat.c
new file mode 100644
index 0000000..4f219f0
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/s390/s390-32/fxstat.c
@@ -0,0 +1 @@
+#include <sysdeps/unix/sysv/linux/i386/fxstat.c>
diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/getdents64.c b/sysdeps/unix/sysv/linux/s390/s390-32/getdents64.c
new file mode 100644
index 0000000..0c75fb5
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/s390/s390-32/getdents64.c
@@ -0,0 +1 @@
+#include <sysdeps/unix/sysv/linux/i386/getdents64.c>
diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/getegid.c b/sysdeps/unix/sysv/linux/s390/s390-32/getegid.c
new file mode 100644
index 0000000..37b4b4a
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/s390/s390-32/getegid.c
@@ -0,0 +1 @@
+#include <sysdeps/unix/sysv/linux/i386/getegid.c>
diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/geteuid.c b/sysdeps/unix/sysv/linux/s390/s390-32/geteuid.c
new file mode 100644
index 0000000..ebcb555
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/s390/s390-32/geteuid.c
@@ -0,0 +1 @@
+#include <sysdeps/unix/sysv/linux/i386/geteuid.c>
diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/getgid.c b/sysdeps/unix/sysv/linux/s390/s390-32/getgid.c
new file mode 100644
index 0000000..0a4d606
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/s390/s390-32/getgid.c
@@ -0,0 +1 @@
+#include <sysdeps/unix/sysv/linux/i386/getgid.c>
diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/getgroups.c b/sysdeps/unix/sysv/linux/s390/s390-32/getgroups.c
new file mode 100644
index 0000000..20a7166
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/s390/s390-32/getgroups.c
@@ -0,0 +1 @@
+#include <sysdeps/unix/sysv/linux/i386/getgroups.c>
diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/getresgid.c b/sysdeps/unix/sysv/linux/s390/s390-32/getresgid.c
new file mode 100644
index 0000000..b703a41
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/s390/s390-32/getresgid.c
@@ -0,0 +1 @@
+#include <sysdeps/unix/sysv/linux/i386/getresgid.c>
diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/getresuid.c b/sysdeps/unix/sysv/linux/s390/s390-32/getresuid.c
new file mode 100644
index 0000000..0b14cef
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/s390/s390-32/getresuid.c
@@ -0,0 +1 @@
+#include <sysdeps/unix/sysv/linux/i386/getresuid.c>
diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/getrlimit.c b/sysdeps/unix/sysv/linux/s390/s390-32/getrlimit.c
new file mode 100644
index 0000000..fc06dbd
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/s390/s390-32/getrlimit.c
@@ -0,0 +1 @@
+#include <sysdeps/unix/sysv/linux/i386/getrlimit.c>
diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/getrlimit64.c b/sysdeps/unix/sysv/linux/s390/s390-32/getrlimit64.c
new file mode 100644
index 0000000..fef018f
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/s390/s390-32/getrlimit64.c
@@ -0,0 +1 @@
+#include <sysdeps/unix/sysv/linux/i386/getrlimit64.c>
diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/getuid.c b/sysdeps/unix/sysv/linux/s390/s390-32/getuid.c
new file mode 100644
index 0000000..d682c79
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/s390/s390-32/getuid.c
@@ -0,0 +1 @@
+#include <sysdeps/unix/sysv/linux/i386/getuid.c>
diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/lchown.c b/sysdeps/unix/sysv/linux/s390/s390-32/lchown.c
new file mode 100644
index 0000000..acee703
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/s390/s390-32/lchown.c
@@ -0,0 +1,75 @@
+/* Copyright (C) 2000, 2001 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with the GNU C Library; see the file COPYING.LIB. If not,
+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+#include <errno.h>
+#include <unistd.h>
+
+#include <sysdep.h>
+#include <sys/syscall.h>
+#include <bp-checks.h>
+
+#include <linux/posix_types.h>
+#include "kernel-features.h"
+
+extern int __syscall_lchown (const char *__unbounded __file,
+ __kernel_uid_t __owner, __kernel_gid_t __group);
+
+# ifdef __NR_lchown32
+extern int __syscall_lchown32 (const char *__unbounded __file,
+ __kernel_uid32_t __owner,
+ __kernel_gid32_t __group);
+# if __ASSUME_32BITUIDS == 0
+/* This variable is shared with all files that need to check for 32bit
+ uids. */
+extern int __libc_missing_32bit_uids;
+# endif
+# endif /* __NR_lchown32 */
+
+int
+__lchown (const char *file, uid_t owner, gid_t group)
+{
+# if __ASSUME_32BITUIDS > 0
+ return INLINE_SYSCALL (lchown32, 3, CHECK_STRING (file), owner, group);
+# else
+# ifdef __NR_lchown32
+ if (__libc_missing_32bit_uids <= 0)
+ {
+ int result;
+ int saved_errno = errno;
+
+ result = INLINE_SYSCALL (lchown32, 3, CHECK_STRING (file), owner, group);
+ if (result == 0 || errno != ENOSYS)
+ return result;
+
+ __set_errno (saved_errno);
+ __libc_missing_32bit_uids = 1;
+ }
+# endif /* __NR_lchown32 */
+
+ if (((owner + 1) > (uid_t) ((__kernel_uid_t) -1U))
+ || ((group + 1) > (gid_t) ((__kernel_gid_t) -1U)))
+ {
+ __set_errno (EINVAL);
+ return -1;
+ }
+
+ return INLINE_SYSCALL (lchown, 3, CHECK_STRING (file), owner, group);
+# endif
+}
+
+weak_alias (__lchown, lchown)
diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/lockf64.c b/sysdeps/unix/sysv/linux/s390/s390-32/lockf64.c
new file mode 100644
index 0000000..a88f5a7
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/s390/s390-32/lockf64.c
@@ -0,0 +1 @@
+#include <sysdeps/unix/sysv/linux/i386/lockf64.c>
diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/lxstat.c b/sysdeps/unix/sysv/linux/s390/s390-32/lxstat.c
new file mode 100644
index 0000000..0efa0ae
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/s390/s390-32/lxstat.c
@@ -0,0 +1 @@
+#include <sysdeps/unix/sysv/linux/i386/lxstat.c>
diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/mmap.S b/sysdeps/unix/sysv/linux/s390/s390-32/mmap.S
new file mode 100644
index 0000000..f101408
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/s390/s390-32/mmap.S
@@ -0,0 +1,72 @@
+/* Copyright (C) 2000, 2001 Free Software Foundation, Inc.
+ Contributed by Martin Schwidefsky (schwidefsky@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 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>
+
+#define EINVAL 22
+
+ .text
+ENTRY(__mmap)
+ /* Save registers and setup stack frame. */
+ stm %r6,%r15,24(%r15)
+ lr %r1,%r15
+ ahi %r15,-120 /* buy stack space */
+ st %r1,0(%r15) /* store back chain */
+
+ /* Store parameters on stack, because old_mmap/mmap2
+ * take only one parameter: a pointer to the parameter area
+ */
+ st %r6,0x70(%r15) /* Store 'fd'. */
+ st %r5,0x6C(%r15) /* Store 'flags'. */
+ st %r4,0x68(%r15) /* Store 'prot'. */
+ st %r3,0x64(%r15) /* Store 'length'. */
+ st %r2,0x60(%r15) /* Store 'start'. */
+ l %r1,216(%r15) /* Load offset. */
+
+#ifdef __ASSUME_MMAP2_SYSCALL
+ /* I don't think it is worthwhile trying to use mmap2 whenever
+ * it is available. Only use it when we are sure the syscall
+ * exists. */
+ tml %r1,0x0fff /* Offset page aligned ? */
+ lhi %r2,-EINVAL
+ jnz 1f /* No -> EINVAL. */
+ srl %r1,12 /* mmap2 takes the offset in pages. */
+ st %r1,0x74(%r15) /* Store page offset. */
+ la %r2,0x60(%r15) /* Load address of parameter list. */
+ svc SYS_ify(mmap2) /* Do the system call trap. */
+#else
+ st %r1,0x74(%r15) /* Store offset unmodified. */
+ la %r2,0x60(%r15) /* Load address of parameter list. */
+ svc SYS_ify(mmap) /* Do the system call trap. */
+#endif
+
+1: l %r15,0(%r15) /* Load back chain. */
+ lm %r6,%r15,24(%r15) /* Load registers. */
+
+ /* check gpr 2 for error */
+ lhi %r0,-4096
+ clr %r2,%r0
+ jnl SYSCALL_ERROR_LABEL
+
+ /* Successful; return the syscall's value. */
+ br %r14
+
+PSEUDO_END (__mmap)
+
+weak_alias (__mmap, mmap)
diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/mmap64.S b/sysdeps/unix/sysv/linux/s390/s390-32/mmap64.S
new file mode 100644
index 0000000..f53fe4c
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/s390/s390-32/mmap64.S
@@ -0,0 +1,101 @@
+/* Copyright (C) 2000, 2001 Free Software Foundation, Inc.
+ Contributed by Martin Schwidefsky (schwidefsky@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 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>
+
+#define EINVAL 22
+#define ENOSYS 38
+
+ .text
+ENTRY(__mmap64)
+ /* Save registers and setup stack frame. */
+ stm %r6,%r15,24(%r15)
+ lr %r1,%r15
+ ahi %r15,-120 /* Buy stack space. */
+ st %r1,0(%r15) /* Store back chain. */
+
+ /* Store parameters on stack, because mmap2 and old_mmap
+ * take only one parameter: a pointer to the parameter area. */
+ st %r6,0x70(%r15) /* Store 'fd'. */
+ st %r5,0x6C(%r15) /* Store 'flags'. */
+ st %r4,0x68(%r15) /* Store 'prot'. */
+ st %r3,0x64(%r15) /* Store 'length'. */
+ st %r2,0x60(%r15) /* Store 'start'. */
+
+#ifdef __NR_mmap2
+ lm %r0,%r1,216(%r15) /* Load 64 bit offset. */
+ tml %r1,0x0fff /* Offset page aligned ? */
+ jnz 2f /* No -> EINVAL. */
+ srdl %r0,12 /* mmap2 takes the offset in pages. */
+ ltr %r0,%r0 /* Offset > 2^44 ? */
+ jnz 2f
+ st %r1,0x74(%r15) /* Store page offset. */
+
+ la %r2,0x60(%r15) /* Load address of parameter list. */
+ svc SYS_ify(mmap2) /* Do the system call trap. */
+
+#ifndef __ASSUME_MMAP2_SYSCALL
+ chi %r0,-ENOSYS
+ je 1f
+#endif
+
+ l %r15,0(%r15) /* Load back chain. */
+ lm %r6,%r15,24(%r15) /* Load registers. */
+
+ /* Check gpr 2 for error. */
+ lhi %r0,-4096
+ clr %r2,%r0
+ jnl SYSCALL_ERROR_LABEL
+
+ /* Successful; return the syscall's value. */
+ br %r14
+
+#endif
+
+#if !defined __ASSUME_MMAP2_SYSCALL || !defined __NR_mmap2
+1: lm %r0,%r1,216(%r15) /* Load 64 bit offset. */
+ st %r1,0x74(%r15) /* Store lower word of offset. */
+ ltr %r0,%r0 /* Offset > 2^32 ? */
+ jnz 2f
+ alr %r1,%r3 /* Add length to offset. */
+ brc 3,2f /* Carry -> EINVAL. */
+
+ la %r2,0x60(%r15) /* Load address of parameter list. */
+ svc SYS_ify(mmap) /* Do the system call trap. */
+
+ l %r15,0(%r15) /* Load back chain. */
+ lm %r6,%r15,24(%r15) /* Load registers. */
+
+ /* Check gpr 2 for error. */
+ lhi %r0,-4096
+ clr %r2,%r0
+ jnl SYSCALL_ERROR_LABEL
+
+ /* Successful; return the syscall's value. */
+ br %r14
+#endif
+
+2: lhi %r2,-EINVAL
+ l %r15,0(%r15) /* Load back chain. */
+ lm %r6,%r15,24(%r15) /* Load registers. */
+ j SYSCALL_ERROR_LABEL
+
+PSEUDO_END (__mmap64)
+
+weak_alias (__mmap64, mmap64)
diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/msgctl.c b/sysdeps/unix/sysv/linux/s390/s390-32/msgctl.c
new file mode 100644
index 0000000..9f9b843
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/s390/s390-32/msgctl.c
@@ -0,0 +1 @@
+#include <sysdeps/unix/sysv/linux/i386/msgctl.c>
diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/oldgetrlimit64.c b/sysdeps/unix/sysv/linux/s390/s390-32/oldgetrlimit64.c
new file mode 100644
index 0000000..4c27e95
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/s390/s390-32/oldgetrlimit64.c
@@ -0,0 +1 @@
+#include <sysdeps/unix/sysv/linux/i386/oldgetrlimit64.c>
diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/readdir64.c b/sysdeps/unix/sysv/linux/s390/s390-32/readdir64.c
new file mode 100644
index 0000000..2ea26dd
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/s390/s390-32/readdir64.c
@@ -0,0 +1 @@
+#include <sysdeps/unix/sysv/linux/i386/readdir64.c>
diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/readdir64_r.c b/sysdeps/unix/sysv/linux/s390/s390-32/readdir64_r.c
new file mode 100644
index 0000000..9f54f89
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/s390/s390-32/readdir64_r.c
@@ -0,0 +1 @@
+#include <sysdeps/unix/sysv/linux/i386/readdir64_r.c>
diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/register-dump.h b/sysdeps/unix/sysv/linux/s390/s390-32/register-dump.h
new file mode 100644
index 0000000..0bd9599
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/s390/s390-32/register-dump.h
@@ -0,0 +1,130 @@
+/* Dump registers.
+ Copyright (C) 2000, 2001 Free Software Foundation, Inc.
+ Contributed by Martin Schwidefsky (schwidefsky@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 Library General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with the GNU C Library; see the file COPYING.LIB. If not,
+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+#include <sys/uio.h>
+#include <stdio-common/_itoa.h>
+
+/* We will print the register dump in this format:
+
+ GPR0: XXXXXXXX GPR1: XXXXXXXX GPR2: XXXXXXXX GPR3: XXXXXXXX
+ GPR4: XXXXXXXX GPR5: XXXXXXXX GPR6: XXXXXXXX GPR7: XXXXXXXX
+ GPR8: XXXXXXXX GPR9: XXXXXXXX GPRA: XXXXXXXX GPRB: XXXXXXXX
+ GPRC: XXXXXXXX GPRD: XXXXXXXX GPRE: XXXXXXXX GPRF: XXXXXXXX
+
+ PSW.MASK: XXXXXXXX PSW.ADDR: XXXXXXXX
+
+ ST(0) XXXX XXXXXXXXXXXXXXXX ST(1) XXXX XXXXXXXXXXXXXXXX
+ ST(2) XXXX XXXXXXXXXXXXXXXX ST(3) XXXX XXXXXXXXXXXXXXXX
+ ST(4) XXXX XXXXXXXXXXXXXXXX ST(5) XXXX XXXXXXXXXXXXXXXX
+ ST(6) XXXX XXXXXXXXXXXXXXXX ST(7) XXXX XXXXXXXXXXXXXXXX
+
+ */
+
+static void
+hexvalue (unsigned long int value, char *buf, size_t len)
+{
+ char *cp = _itoa_word (value, buf + len, 16, 0);
+ while (cp > buf)
+ *--cp = '0';
+}
+
+static void
+register_dump (int fd, struct sigcontext *ctx)
+{
+ char regs[19][8];
+ struct iovec iov[40];
+ size_t nr = 0;
+
+#define ADD_STRING(str) \
+ iov[nr].iov_base = (char *) str; \
+ iov[nr].iov_len = strlen (str); \
+ ++nr
+#define ADD_MEM(str, len) \
+ iov[nr].iov_base = str; \
+ iov[nr].iov_len = len; \
+ ++nr
+
+ /* Generate strings of register contents. */
+ hexvalue (ctx->sregs->regs.gprs[0], regs[0], 8);
+ hexvalue (ctx->sregs->regs.gprs[1], regs[1], 8);
+ hexvalue (ctx->sregs->regs.gprs[2], regs[2], 8);
+ hexvalue (ctx->sregs->regs.gprs[3], regs[3], 8);
+ hexvalue (ctx->sregs->regs.gprs[4], regs[4], 8);
+ hexvalue (ctx->sregs->regs.gprs[5], regs[5], 8);
+ hexvalue (ctx->sregs->regs.gprs[6], regs[6], 8);
+ hexvalue (ctx->sregs->regs.gprs[7], regs[7], 8);
+ hexvalue (ctx->sregs->regs.gprs[8], regs[8], 8);
+ hexvalue (ctx->sregs->regs.gprs[9], regs[9], 8);
+ hexvalue (ctx->sregs->regs.gprs[10], regs[10], 8);
+ hexvalue (ctx->sregs->regs.gprs[11], regs[11], 8);
+ hexvalue (ctx->sregs->regs.gprs[12], regs[12], 8);
+ hexvalue (ctx->sregs->regs.gprs[13], regs[13], 8);
+ hexvalue (ctx->sregs->regs.gprs[14], regs[14], 8);
+ hexvalue (ctx->sregs->regs.gprs[15], regs[15], 8);
+ hexvalue (ctx->sregs->regs.psw.mask, regs[16], 8);
+ hexvalue (ctx->sregs->regs.psw.addr, regs[17], 8);
+
+ /* Generate the output. */
+ ADD_STRING ("Register dump:\n\n GPR0: ");
+ ADD_MEM (regs[0], 8);
+ ADD_STRING (" GPR1: ");
+ ADD_MEM (regs[1], 8);
+ ADD_STRING (" GPR2: ");
+ ADD_MEM (regs[2], 8);
+ ADD_STRING (" GPR3: ");
+ ADD_MEM (regs[3], 8);
+ ADD_STRING ("\n GPR4: ");
+ ADD_MEM (regs[4], 8);
+ ADD_STRING (" GPR5: ");
+ ADD_MEM (regs[5], 8);
+ ADD_STRING (" GPR6: ");
+ ADD_MEM (regs[6], 8);
+ ADD_STRING (" GPR7: ");
+ ADD_MEM (regs[7], 8);
+ ADD_STRING ("\n GPR8: ");
+ ADD_MEM (regs[8], 8);
+ ADD_STRING (" GPR9: ");
+ ADD_MEM (regs[9], 8);
+ ADD_STRING (" GPRA: ");
+ ADD_MEM (regs[10], 8);
+ ADD_STRING (" GPRB: ");
+ ADD_MEM (regs[11], 8);
+ ADD_STRING ("\n GPRC: ");
+ ADD_MEM (regs[12], 8);
+ ADD_STRING (" GPRD: ");
+ ADD_MEM (regs[13], 8);
+ ADD_STRING (" GPRE: ");
+ ADD_MEM (regs[14], 8);
+ ADD_STRING (" GPRF: ");
+ ADD_MEM (regs[15], 8);
+ ADD_STRING ("\n\n PSW.MASK: ");
+ ADD_MEM (regs[16], 8);
+ ADD_STRING (" PSW.ADDR: ");
+ ADD_MEM (regs[17], 8);
+ ADD_STRING (" TRAP: ");
+ ADD_MEM (regs[18], 4);
+ ADD_STRING ("\n");
+
+ /* Write the stuff out. */
+ writev (fd, iov, nr);
+}
+
+
+#define REGISTER_DUMP register_dump (fd, &ctx)
diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/scandir64.c b/sysdeps/unix/sysv/linux/s390/s390-32/scandir64.c
new file mode 100644
index 0000000..506fd88
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/s390/s390-32/scandir64.c
@@ -0,0 +1 @@
+#include <sysdeps/unix/sysv/linux/i386/scandir64.c>
diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/semctl.c b/sysdeps/unix/sysv/linux/s390/s390-32/semctl.c
new file mode 100644
index 0000000..e9b1a48
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/s390/s390-32/semctl.c
@@ -0,0 +1 @@
+#include <sysdeps/unix/sysv/linux/i386/semctl.c>
diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/setegid.c b/sysdeps/unix/sysv/linux/s390/s390-32/setegid.c
new file mode 100644
index 0000000..2e3a54c
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/s390/s390-32/setegid.c
@@ -0,0 +1 @@
+#include <sysdeps/unix/sysv/linux/i386/setegid.c>
diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/seteuid.c b/sysdeps/unix/sysv/linux/s390/s390-32/seteuid.c
new file mode 100644
index 0000000..18e41d0
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/s390/s390-32/seteuid.c
@@ -0,0 +1 @@
+#include <sysdeps/unix/sysv/linux/i386/seteuid.c>
diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/setfsgid.c b/sysdeps/unix/sysv/linux/s390/s390-32/setfsgid.c
new file mode 100644
index 0000000..0886712
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/s390/s390-32/setfsgid.c
@@ -0,0 +1 @@
+#include <sysdeps/unix/sysv/linux/i386/setfsgid.c>
diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/setfsuid.c b/sysdeps/unix/sysv/linux/s390/s390-32/setfsuid.c
new file mode 100644
index 0000000..a9f22eb
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/s390/s390-32/setfsuid.c
@@ -0,0 +1 @@
+#include <sysdeps/unix/sysv/linux/i386/setfsuid.c>
diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/setgid.c b/sysdeps/unix/sysv/linux/s390/s390-32/setgid.c
new file mode 100644
index 0000000..377021d
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/s390/s390-32/setgid.c
@@ -0,0 +1 @@
+#include <sysdeps/unix/sysv/linux/i386/setgid.c>
diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/setgroups.c b/sysdeps/unix/sysv/linux/s390/s390-32/setgroups.c
new file mode 100644
index 0000000..0e70862
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/s390/s390-32/setgroups.c
@@ -0,0 +1,2 @@
+/* We also have to rewrite the kernel gid_t to the user land type. */
+#include <sysdeps/unix/sysv/linux/i386/setgroups.c>
diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/setregid.c b/sysdeps/unix/sysv/linux/s390/s390-32/setregid.c
new file mode 100644
index 0000000..99c57ad
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/s390/s390-32/setregid.c
@@ -0,0 +1 @@
+#include <sysdeps/unix/sysv/linux/i386/setregid.c>
diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/setresgid.c b/sysdeps/unix/sysv/linux/s390/s390-32/setresgid.c
new file mode 100644
index 0000000..daca1a4
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/s390/s390-32/setresgid.c
@@ -0,0 +1 @@
+#include <sysdeps/unix/sysv/linux/i386/setresgid.c>
diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/setresuid.c b/sysdeps/unix/sysv/linux/s390/s390-32/setresuid.c
new file mode 100644
index 0000000..3aeabe9
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/s390/s390-32/setresuid.c
@@ -0,0 +1 @@
+#include <sysdeps/unix/sysv/linux/i386/setresuid.c>
diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/setreuid.c b/sysdeps/unix/sysv/linux/s390/s390-32/setreuid.c
new file mode 100644
index 0000000..8ad6122
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/s390/s390-32/setreuid.c
@@ -0,0 +1 @@
+#include <sysdeps/unix/sysv/linux/i386/setreuid.c>
diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/setrlimit.c b/sysdeps/unix/sysv/linux/s390/s390-32/setrlimit.c
new file mode 100644
index 0000000..bfaef74
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/s390/s390-32/setrlimit.c
@@ -0,0 +1 @@
+#include <sysdeps/unix/sysv/linux/i386/setrlimit.c>
diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/setuid.c b/sysdeps/unix/sysv/linux/s390/s390-32/setuid.c
new file mode 100644
index 0000000..c8fa23e
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/s390/s390-32/setuid.c
@@ -0,0 +1,2 @@
+#include <sysdeps/unix/sysv/linux/i386/setuid.c>
+
diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/shmctl.c b/sysdeps/unix/sysv/linux/s390/s390-32/shmctl.c
new file mode 100644
index 0000000..7eac638
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/s390/s390-32/shmctl.c
@@ -0,0 +1 @@
+#include <sysdeps/unix/sysv/linux/i386/shmctl.c>
diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/socket.S b/sysdeps/unix/sysv/linux/s390/s390-32/socket.S
new file mode 100644
index 0000000..9bed2f7
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/s390/s390-32/socket.S
@@ -0,0 +1,98 @@
+/* Copyright (C) 2000, 2001 Free Software Foundation, Inc.
+ Contributed by Martin Schwidefsky (schwidefsky@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 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 <socketcall.h>
+
+/* &%/$&!! preprocessor */
+#define P(a, b) P2(a, b)
+#define P2(a, b) a##b
+
+ .text
+/* The socket-oriented system calls are handled unusally in Linux.
+ They are all gated through the single `socketcall' system call number.
+ `socketcall' takes two arguments: the first is the subcode, specifying
+ which socket function is being called; and the second is a pointer to
+ the arguments to the specific function.
+
+ The .S files for the other calls just #define socket and #include this. */
+
+#ifndef __socket
+#ifndef NO_WEAK_ALIAS
+#define __socket P(__,socket)
+#else
+#define __socket socket
+#endif
+#endif
+
+#ifndef NARGS /* the socket.o object is compiled directly ... */
+#define NARGS 3
+#endif
+
+.globl __socket
+ENTRY(__socket)
+
+ /* Save registers and setup stack. */
+ stm %r6,%r15,24(%r15) /* save registers */
+ lr %r1,%r15
+ l %r0,4(0,%r15) /* load eos */
+ ahi %r15,-120 /* buy stack space */
+ st %r1,0(0,%r15) /* store back chain */
+ st %r0,4(0,%r15) /* store eos */
+
+ /* Reorder arguments */
+#if (NARGS >= 6)
+ mvc 0x74(4,%r15),216(%r15) /* move between parameter lists */
+#endif
+#if (NARGS >= 5)
+ st %r6,0x70(0,%r15) /* store into parameter list */
+#endif
+#if (NARGS >= 4)
+ st %r5,0x6C(0,%r15) /* store into parameter list */
+#endif
+#if (NARGS >= 3)
+ st %r4,0x68(0,%r15) /* store into parameter list */
+#endif
+#if (NARGS >= 2)
+ st %r3,0x64(0,%r15) /* store into parameter list */
+ st %r2,0x60(0,%r15)
+#endif
+ /* load subcode for socket syscall */
+ lhi %r2,P(SOCKOP_,socket)
+ la %r3,0x60(0,%r15) /* load address of parameter list */
+
+ /* Do the system call trap. */
+ svc SYS_ify(socketcall)
+
+ l %r15,0(0,%r15) /* load back chain */
+ lm %r6,15,24(%r15) /* load registers */
+
+ /* gpr2 is < 0 if there was an error. */
+ lhi %r0,-125
+ clr %r2,%r0
+ jnl SYSCALL_ERROR_LABEL
+
+ /* Successful; return the syscall's value. */
+ br %r14
+
+PSEUDO_END (__socket)
+
+#ifndef NO_WEAK_ALIAS
+weak_alias (__socket, socket)
+#endif
diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/sys/procfs.h b/sysdeps/unix/sysv/linux/s390/s390-32/sys/procfs.h
new file mode 100644
index 0000000..968d085
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/s390/s390-32/sys/procfs.h
@@ -0,0 +1,118 @@
+/* Copyright (C) 2000, 2001 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU 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 _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 short int pr_uid;
+ unsigned short 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-32/sys/ucontext.h b/sysdeps/unix/sysv/linux/s390/s390-32/sys/ucontext.h
new file mode 100644
index 0000000..cb1869c
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/s390/s390-32/sys/ucontext.h
@@ -0,0 +1,76 @@
+/* Copyright (C) 2000, 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 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 _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 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. */
+#define NGREG 36
+#define NUM_FPRS 16
+typedef greg_t gregset_t[NGREG];
+
+typedef union
+{
+ double d;
+ float f;
+} fpreg_t;
+
+/* Register set for the floating-point registers. */
+typedef struct {
+ unsigned int fpc;
+ fpreg_t fprs[NUM_FPRS];
+} fpregset_t;
+
+/* Context to describe whole processor state. */
+typedef struct
+ {
+ int version;
+ gregset_t gregs;
+ fpregset_t fpregs;
+ } mcontext_t;
+
+/* Userlevel context. */
+struct ucontext
+ {
+ unsigned long int uc_flags;
+ struct ucontext *uc_links;
+ __sigset_t uc_sigmask;
+ stack_t uc_stack;
+ mcontext_t uc_mcontext;
+ long int uc_filler[170];
+ };
+
+
+#endif /* sys/ucontext.h */
diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/syscall.S b/sysdeps/unix/sysv/linux/s390/s390-32/syscall.S
new file mode 100644
index 0000000..5a0674a
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/s390/s390-32/syscall.S
@@ -0,0 +1,51 @@
+/* Copyright (C) 2000, 2001 Free Software Foundation, Inc.
+ Contributed by Martin Schwidefsky (schwidefsky@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 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>
+
+/* Please consult the file sysdeps/unix/sysv/linux/s390/sysdep.h for
+ more information about the value -4095 used below.*/
+
+ENTRY (syscall)
+ /* Save registers and setup stack. */
+ stm %r6,%r15,24(%r15) /* save registers */
+ lr %r1,%r15
+ l %r0,4(0,%r15) /* load eos */
+ ahi %r15,-96 /* buy stack space */
+ st %r1,0(0,%r15) /* store back chain */
+ st %r0,4(0,%r15) /* store eos */
+
+ lr %r1,%r2 /* move syscall number */
+ lr %r2,%r3 /* first parameter */
+ lr %r3,%r4 /* second parameter */
+ lr %r4,%r5 /* third parameter */
+ lr %r5,%r6 /* fourth parameter */
+ l %r6,192(%r15) /* fifth parameter */
+ basr %r7,0
+.L0: ex %r1,.L1-.L0(%r7) /* lsb of R1 is subsituted as SVC number */
+
+ l %r15,0(0,%r15) /* load back chain */
+ lm %r6,15,24(%r15) /* load registers */
+
+ lhi %r0,-4095
+ clr %r2,%r0 /* check R2 for error */
+ jnl SYSCALL_ERROR_LABEL
+ br %r14 /* return to caller */
+.L1: .word 0x0A00 /* opcode for SVC 0 */
+PSEUDO_END (syscall)
diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/syscalls.list b/sysdeps/unix/sysv/linux/s390/s390-32/syscalls.list
new file mode 100644
index 0000000..913f051
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/s390/s390-32/syscalls.list
@@ -0,0 +1,4 @@
+# File name Caller Syscall name Args Strong name Weak names
+
+oldgetrlimit EXTRA getrlimit i:ip __old_getrlimit getrlimit@GLIBC_2.0
+oldsetrlimit EXTRA setrlimit i:ip __old_setrlimit setrlimit@GLIBC_2.0
diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/sysdep.S b/sysdeps/unix/sysv/linux/s390/s390-32/sysdep.S
new file mode 100644
index 0000000..15b822a
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/s390/s390-32/sysdep.S
@@ -0,0 +1,104 @@
+/* Copyright (C) 2000, 2001 Free Software Foundation, Inc.
+ Contributed by Martin Schwidefsky (schwidefsky@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 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>
+
+/* Because the Linux version is in fact m68k/ELF and the start.? file
+ for this system (sysdeps/m68k/elf/start.S) is also used by The Hurd
+ and therefore this files must not contain the definition of the
+ `errno' variable (I don't know why, ask Roland), we have to define
+ it somewhere else.
+
+ ...and this place is here. */
+ .bss
+ .globl errno
+ .type errno,@object
+ .size errno,4
+errno:
+ .space 4
+weak_alias (errno, _errno)
+
+/* The following code is only used in the shared library when we
+ compile the reentrant version. Otherwise each system call defines
+ each own version. */
+
+/* The syscall stubs jump here when they detect an error. */
+
+#undef CALL_MCOUNT
+#define CALL_MCOUNT
+
+ .text
+ENTRY(__syscall_error)
+#ifndef PIC
+#ifndef _LIBC_REENTRANT
+ lcr %r2,%r2
+ basr %r1,0
+.L0: l %r1,.L1-.L0(%r1)
+ st %r2,0(0,%r1)
+ lhi %r2,-1
+ br %r14
+.L1: .long errno
+#else
+ stm %r11,%r15,44(%r15)
+ lr %r0,%r15
+ ahi %r15,-96
+ st %r0,0(%r15)
+ lcr %r11,%r2
+ basr %r13,0
+.L0: l %r1,.L1-.L0(%r13)
+ basr %r14,%r1
+ st %r11,0(%r2)
+ lhi %r2,-1
+ l %r15,0(%r15)
+ lm %r11,%r15,44(%r15)
+ br %r14
+.L1: .long __errno_location
+#endif
+#else
+#ifndef _LIBC_REENTRANT
+ basr %r1,0
+.L0: al %r1,.L1-.L0(%r1)
+ l %r1,errno@GOT12(%r1)
+ lcr %r2,%r2
+ st %r2,0(0,%r1)
+ lhi %r2,-1
+ br %r14
+.L1: .long _GLOBAL_OFFSET_TABLE_-0b
+#else
+ stm %r11,%r15,44(%r15)
+ lr %r0,%r15
+ ahi %r15,-96
+ st %r0,0(%r15)
+ lcr %r11,%r2
+ basr %r13,0
+.L0: l %r12,.L1-.L0(%r13)
+ ar %r12,%r13
+ l %r14,.L2-.L0(%r13)
+ bas %r14,0(%r14,%r13)
+ st %r11,0(0,%r2)
+ lhi %r2,-1
+ l %r15,0(%r15)
+ lm %r11,%r15,44(%r15)
+ br %r14
+.L1: .long _GLOBAL_OFFSET_TABLE_ - .L0
+.L2: .long __errno_location@PLT - .L0
+#endif
+#endif
+
+END (__syscall_error)
diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/sysdep.h b/sysdeps/unix/sysv/linux/s390/s390-32/sysdep.h
new file mode 100644
index 0000000..507867b
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/s390/s390-32/sysdep.h
@@ -0,0 +1,212 @@
+/* Copyright (C) 2000, 2001 Free Software Foundation, Inc.
+ Contributed by Martin Schwidefsky (schwidefsky@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 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 _LINUX_S390_SYSDEP_H
+#define _LINUX_S390_SYSDEP_H
+
+#include <sysdeps/s390/s390-32/sysdep.h>
+#include <sysdeps/unix/sysdep.h>
+
+/* For Linux we can use the system call table in the header file
+ /usr/include/asm/unistd.h
+ of the kernel. But these symbols do not follow the SYS_* syntax
+ so we have to redefine the `SYS_ify' macro here. */
+/* in newer 2.1 kernels __NR_syscall is missing so we define it here */
+#define __NR_syscall 0
+
+#undef SYS_ify
+#define SYS_ify(syscall_name) __NR_##syscall_name
+
+/* ELF-like local names start with `.L'. */
+#undef L
+#define L(name) .L##name
+
+#ifdef __ASSEMBLER__
+
+/* Linux uses a negative return value to indicate syscall errors, unlike
+ most Unices, which use the condition codes' carry flag.
+
+ Since version 2.1 the return value of a system call might be negative
+ even if the call succeeded. E.g., the `lseek' system call might return
+ a large offset. Therefore we must not anymore test for < 0, but test
+ for a real error by making sure the value in gpr2 is a real error
+ number. Linus said he will make sure the no syscall returns a value
+ in -1 .. -4095 as a valid result so we can savely test with -4095. */
+
+#define SYSCALL_ERROR_LABEL 0f
+
+#undef PSEUDO
+#define PSEUDO(name, syscall_name, args) \
+ .text; \
+ ENTRY (name) \
+ DO_CALL (args, syscall_name); \
+ lhi %r4,-4095 ; \
+ clr %r2,%r4 ; \
+ jnl SYSCALL_ERROR_LABEL ; \
+ L(pseudo_end):
+
+#undef PSEUDO_END
+#define PSEUDO_END(name) \
+ SYSCALL_ERROR_HANDLER; \
+ END (name)
+
+#ifndef _LIBC_REENTRANT
+#ifndef PIC
+#define SYSCALL_ERROR_HANDLER \
+0: lcr %r2,%r2 ; \
+ basr %r1,0 ; \
+1: l %r1,2f-1b(%r1) \
+ st %r2,0(%r1) \
+ lhi %r2,-1 \
+ br %r14 \
+2: .long errno
+#else
+#define SYSCALL_ERROR_HANDLER \
+0: basr %r1,0 ; \
+1: al %r1,2f-1b(%r1) ; \
+ l %r1,errno@GOT12(%r1) ; \
+ lcr %r2,%r2 ; \
+ st %r2,0(%r1) ; \
+ lhi %r2,-1 ; \
+ br %r14 ; \
+2: .long _GLOBAL_OFFSET_TABLE_-1b
+#endif /* PIC */
+#else
+#define SYSCALL_ERROR_HANDLER \
+0: basr %r1,0 ; \
+1: al %r1,2f-1b(%r1) ; \
+ br %r1 ; \
+2: .long __syscall_error@PLT-1b
+#endif /* _LIBC_REENTRANT */
+
+/* Linux takes system call arguments in registers:
+
+ syscall number 1 call-clobbered
+ arg 1 2 call-clobbered
+ arg 2 3 call-clobbered
+ arg 3 4 call-clobbered
+ arg 4 5 call-clobbered
+ arg 5 6 call-saved
+
+ (Of course a function with say 3 arguments does not have entries for
+ arguments 4 and 5.)
+ S390 does not need to do ANY stack operations to get its parameters
+ right.
+ */
+
+#define DO_CALL(args, syscall) \
+ svc SYS_ify (syscall)
+
+#define ret \
+ br 14
+
+#endif /* __ASSEMBLER__ */
+
+#undef INLINE_SYSCALL
+#define INLINE_SYSCALL(name, nr, args...) \
+ ({ \
+ DECLARGS_##nr(args) \
+ int err; \
+ asm volatile ( \
+ LOADARGS_##nr \
+ "svc %b1\n\t" \
+ "lr %0,%%r2\n\t" \
+ : "=d" (err) \
+ : "I" (__NR_##name) ASMFMT_##nr \
+ : "memory", "cc", "2", "3", "4", "5", "6"); \
+ if (err >= 0xfffff001) \
+ { \
+ __set_errno(-err); \
+ err = 0xffffffff; \
+ } \
+ (int) err; })
+
+#define DECLARGS_0()
+#define DECLARGS_1(arg1) \
+ unsigned int gpr2 = (unsigned int) (arg1);
+#define DECLARGS_2(arg1, arg2) \
+ DECLARGS_1(arg1) \
+ unsigned int gpr3 = (unsigned int) (arg2);
+#define DECLARGS_3(arg1, arg2, arg3) \
+ DECLARGS_2(arg1, arg2) \
+ unsigned int gpr4 = (unsigned int) (arg3);
+#define DECLARGS_4(arg1, arg2, arg3, arg4) \
+ DECLARGS_3(arg1, arg2, arg3) \
+ unsigned int gpr5 = (unsigned int) (arg4);
+#define DECLARGS_5(arg1, arg2, arg3, arg4, arg5) \
+ DECLARGS_4(arg1, arg2, arg3, arg4) \
+ unsigned int gpr6 = (unsigned int) (arg5);
+
+#define LOADARGS_0
+#define LOADARGS_1 "L 2,%2\n\t"
+#define LOADARGS_2 LOADARGS_1 "L 3,%3\n\t"
+#define LOADARGS_3 LOADARGS_2 "L 4,%4\n\t"
+#define LOADARGS_4 LOADARGS_3 "L 5,%5\n\t"
+#define LOADARGS_5 LOADARGS_4 "L 6,%6\n\t"
+
+#define ASMFMT_0
+#define ASMFMT_1 , "m" (gpr2)
+#define ASMFMT_2 , "m" (gpr2), "m" (gpr3)
+#define ASMFMT_3 , "m" (gpr2), "m" (gpr3), "m" (gpr4)
+#define ASMFMT_4 , "m" (gpr2), "m" (gpr3), "m" (gpr4), "m" (gpr5)
+#define ASMFMT_5 , "m" (gpr2), "m" (gpr3), "m" (gpr4), "m" (gpr5), "m" (gpr6)
+
+#if 0
+#undef INLINE_SYSCALL
+#define INLINE_SYSCALL(name, nr, args...) \
+ ({ \
+ DECLARGS_##nr(args) \
+ asm volatile ( \
+ "svc %b1\n\t" \
+ : "+d" (gpr2) \
+ : "I" (__NR_##name) ASMFMT_##nr : "memory", "cc"); \
+ if (gpr2 >= 0xfffff001) \
+ { \
+ __set_errno(-gpr2); \
+ gpr2 = 0xffffffff; \
+ } \
+ (int) gpr2; })
+
+#define DECLARGS_0() \
+ register unsigned int gpr2 asm("2");
+#define DECLARGS_1(arg1) \
+ register unsigned int gpr2 asm("2") = (unsigned int) (arg1);
+#define DECLARGS_2(arg1, arg2) \
+ DECLARGS_1(arg1) \
+ register unsigned int gpr3 asm("3") = (unsigned int) (arg2);
+#define DECLARGS_3(arg1, arg2, arg3) \
+ DECLARGS_2(arg1, arg2) \
+ register unsigned int gpr4 asm("4") = (unsigned int) (arg3);
+#define DECLARGS_4(arg1, arg2, arg3, arg4) \
+ DECLARGS_3(arg1, arg2, arg3) \
+ register unsigned int gpr5 asm("5") = (unsigned int) (arg4);
+#define DECLARGS_5(arg1, arg2, arg3, arg4, arg5) \
+ DECLARGS_4(arg1, arg2, arg3, arg4) \
+ register unsigned int gpr6 asm("6") = (unsigned int) (arg5);
+
+#define ASMFMT_0
+#define ASMFMT_1
+#define ASMFMT_2 , "d" (gpr3)
+#define ASMFMT_3 , "d" (gpr3), "d" (gpr4)
+#define ASMFMT_4 , "d" (gpr3), "d" (gpr4), "d" (gpr5)
+#define ASMFMT_5 , "d" (gpr3), "d" (gpr4), "d" (gpr5), "d" (gpr6)
+
+#endif /* 0 */
+
+#endif /* _LINUX_S390_SYSDEP_H */
diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/versionsort64.c b/sysdeps/unix/sysv/linux/s390/s390-32/versionsort64.c
new file mode 100644
index 0000000..144b691
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/s390/s390-32/versionsort64.c
@@ -0,0 +1 @@
+#include <sysdeps/unix/sysv/linux/i386/versionsort64.c>
diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/xstat.c b/sysdeps/unix/sysv/linux/s390/s390-32/xstat.c
new file mode 100644
index 0000000..e9869f5
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/s390/s390-32/xstat.c
@@ -0,0 +1 @@
+#include <sysdeps/unix/sysv/linux/i386/xstat.c>