summaryrefslogtreecommitdiff
path: root/sysdeps
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>1995-09-08 17:02:25 +0000
committerUlrich Drepper <drepper@redhat.com>1995-09-08 17:02:25 +0000
commitd2f5be2a1235061b46c51d7530264d086eca46ef (patch)
tree486fbdc7e9d3f2417c26242e36894a54ea6c90a8 /sysdeps
parentd586354e51250d2aaf83149cf7d15f81e276f038 (diff)
Document new files for Linux i386/ELF port.
Fri Sep 8 16:32:12 1995 Ulrich Drepper <drepper@gnu.ai.mit.edu> * sysdeps/unix/sysv/linux/Implies, sysdeps/unix/sysv/linux/Makefile, sysdeps/unix/sysv/linux/Subdirs, sysdeps/unix/sysv/linux/accept.S, sysdeps/unix/sysv/linux/adjtime.c, sysdeps/unix/sysv/linux/adjtimex.S, sysdeps/unix/sysv/linux/bind.S, sysdeps/unix/sysv/linux/connect.S, sysdeps/unix/sysv/linux/direct.h, sysdeps/unix/sysv/linux/dl-machine.h, sysdeps/unix/sysv/linux/errnos.h, sysdeps/unix/sysv/linux/fork.S, sysdeps/unix/sysv/linux/gethostid.c, sysdeps/unix/sysv/linux/gethostname.C, sysdeps/unix/sysv/linux/getpeername.S, sysdeps/unix/sysv/linux/getpgid.S, sysdeps/unix/sysv/linux/getpgrp.S, sysdeps/unix/sysv/linux/getsockname.S, sysdeps/unix/sysv/linux/getsockopt.S, sysdeps/unix/sysv/linux/gtty.S, sysdeps/unix/sysv/linux/listen.S, sysdeps/unix/sysv/linux/local_lim.h, sysdeps/unix/sysv/linux/madvise.c, sysdeps/unix/sysv/linux/msgctl.c, sysdeps/unix/sysv/linux/msgget.c, sysdeps/unix/sysv/linux/msgrcv.c, sysdeps/unix/sysv/linux/msgsnd.c, sysdeps/unix/sysv/linux/pipe.S, sysdeps/unix/sysv/linux/poll.c, sysdeps/unix/sysv/linux/readv.c, sysdeps/unix/sysv/linux/recv.S, sysdeps/unix/sysv/linux/recvfrom.S, sysdeps/unix/sysv/linux/recvmsg.S, sysdeps/unix/sysv/linux/semctl.c, sysdeps/unix/sysv/linux/semget.c, sysdeps/unix/sysv/linux/semop.c, sysdeps/unix/sysv/linux/send.S, sysdeps/unix/sysv/linux/sendmsg.S, sysdeps/unix/sysv/linux/sendto.S, sysdeps/unix/sysv/linux/setegid.c, sysdeps/unix/sysv/linux/seteuid.c, sysdeps/unix/sysv/linux/sethostid.c, sysdeps/unix/sysv/linux/setpgid.c, sysdeps/unix/sysv/linux/setpgrp.c, sysdeps/unix/sysv/linux/setsid.S, sysdeps/unix/sysv/linux/setsockopt.S, sysdeps/unix/sysv/linux/settimeofday.S, sysdeps/unix/sysv/linux/shmat.c, sysdeps/unix/sysv/linux/shmctl.c, sysdeps/unix/sysv/linux/shmdt.c, sysdeps/unix/sysv/linux/shmget.c, sysdeps/unix/sysv/linux/shutdown.S, sysdeps/unix/sysv/linux/sigaction.S, sysdeps/unix/sysv/linux/signal.S, sysdeps/unix/sysv/linux/sigpending.S, sysdeps/unix/sysv/linux/sigset.h, sysdeps/unix/sysv/linux/sockaddrcom.h, sysdeps/unix/sysv/linux/socketpair.S, sysdeps/unix/sysv/linux/speed.c, sysdeps/unix/sysv/linux/statbuf.h, sysdeps/unix/sysv/linux/stty.S, sysdeps/unix/sysv/linux/syscall.h, sysdeps/unix/sysv/linux/sysconf.c, sysdeps/unix/sysv/linux/tcdrain.c, sysdeps/unix/sysv/linux/tcflow.c, sysdeps/unix/sysv/linux/tcflush.c, sysdeps/unix/sysv/linux/tcgetattr.c, sysdeps/unix/sysv/linux/tcsetattr.c, sysdeps/unix/sysv/linux/termbits.h, sysdeps/unix/sysv/linux/ualarm.c, sysdeps/unix/sysv/linux/ulimit.c, sysdeps/unix/sysv/linux/usleep.c, sysdeps/unix/sysv/linux/utsnamelen.h, sysdeps/unix/sysv/linux/vfork.c, sysdeps/unix/sysv/linux/wait.c, sysdeps/unix/sysv/linux/wait4.S, sysdeps/unix/sysv/linux/waitpid.c, sysdeps/unix/sysv/linux/writev.c: New Linux/ELF specific, architecture independent files. sysdeps/unix/sysv/linux/i386/Dist, sysdeps/unix/sysv/linux/i386/Makefile, sysdeps/unix/sysv/linux/i386/brk.S, sysdeps/unix/sysv/linux/i386/fcntlbits.h, sysdeps/unix/sysv/linux/i386/fpu_control.c, sysdeps/unix/sysv/linux/i386/fpu_control.h, sysdeps/unix/sysv/linux/i386/fstat.S, sysdeps/unix/sysv/linux/i386/fxstat.S, sysdeps/unix/sysv/linux/i386/ieee_fpu.c, sysdeps/unix/sysv/linux/i386/init-first.S, sysdeps/unix/sysv/linux/i386/ipc.S, sysdeps/unix/sysv/linux/i386/lstat.S, sysdeps/unix/sysv/linux/i386/lxstat.S, sysdeps/unix/sysv/linux/i386/mknod.S, sysdeps/unix/sysv/linux/i386/mmap.S, sysdeps/unix/sysv/linux/i386/sbrk.S, sysdeps/unix/sysv/linux/i386/setfpucw.c, sysdeps/unix/sysv/linux/i386/signum.h, sysdeps/unix/sysv/linux/i386/socket.S, sysdeps/unix/sysv/linux/i386/stat.S, sysdeps/unix/sysv/linux/i386/syscall.S, sysdeps/unix/sysv/linux/i386/sysdep.S, sysdeps/unix/sysv/linux/i386/sysdep.h, sysdeps/unix/sysv/linux/i386/xmknod.S, sysdeps/unix/sysv/linux/i386/xstat.S: New Linux i386/ELF specific files. sysdeps/unix/sysv/linux/sys/ipc_buf.h, sysdeps/unix/sysv/linux/sys/mman.h, sysdeps/unix/sysv/linux/sys/msq_buf.h, sysdeps/unix/sysv/linux/sys/sem_buf.h, sysdeps/unix/sysv/linux/sys/shm_buf.h, sysdeps/unix/sysv/linux/sys/socketcall.h, sysdeps/unix/sysv/linux/sys/timex.h: New Linux/ELF specific, architecture independent header files.
Diffstat (limited to 'sysdeps')
-rw-r--r--sysdeps/unix/sysv/linux/Implies7
-rw-r--r--sysdeps/unix/sysv/linux/Makefile21
-rw-r--r--sysdeps/unix/sysv/linux/Subdirs1
-rw-r--r--sysdeps/unix/sysv/linux/accept.S (renamed from sysdeps/unix/sysv/sysv4/linux/accept.S)0
-rw-r--r--sysdeps/unix/sysv/linux/adjtime.c69
-rw-r--r--sysdeps/unix/sysv/linux/adjtimex.S22
-rw-r--r--sysdeps/unix/sysv/linux/bind.S (renamed from sysdeps/unix/sysv/sysv4/linux/bind.S)0
-rw-r--r--sysdeps/unix/sysv/linux/connect.S (renamed from sysdeps/unix/sysv/sysv4/linux/connect.S)0
-rw-r--r--sysdeps/unix/sysv/linux/direct.h43
-rw-r--r--sysdeps/unix/sysv/linux/dl-machine.h214
-rw-r--r--sysdeps/unix/sysv/linux/errnos.h1
-rw-r--r--sysdeps/unix/sysv/linux/fork.S (renamed from sysdeps/unix/sysv/sysv4/linux/waitpid.S)6
-rw-r--r--sysdeps/unix/sysv/linux/gethostid.c96
-rw-r--r--sysdeps/unix/sysv/linux/gethostname.c53
-rw-r--r--sysdeps/unix/sysv/linux/getpeername.S (renamed from sysdeps/unix/sysv/sysv4/linux/getpeername.S)0
-rw-r--r--sysdeps/unix/sysv/linux/getpgid.S22
-rw-r--r--sysdeps/unix/sysv/linux/getpgrp.S22
-rw-r--r--sysdeps/unix/sysv/linux/getsockname.S (renamed from sysdeps/unix/sysv/sysv4/linux/getsockname.S)0
-rw-r--r--sysdeps/unix/sysv/linux/getsockopt.S2
-rw-r--r--sysdeps/unix/sysv/linux/gtty.S22
-rw-r--r--sysdeps/unix/sysv/linux/i386/Dist1
-rw-r--r--sysdeps/unix/sysv/linux/i386/Makefile7
-rw-r--r--sysdeps/unix/sysv/linux/i386/brk.S60
-rw-r--r--sysdeps/unix/sysv/linux/i386/fcntlbits.h26
-rw-r--r--sysdeps/unix/sysv/linux/i386/fpu_control.c20
-rw-r--r--sysdeps/unix/sysv/linux/i386/fpu_control.h100
-rw-r--r--sysdeps/unix/sysv/linux/i386/fstat.S4
-rw-r--r--sysdeps/unix/sysv/linux/i386/fxstat.S4
-rw-r--r--sysdeps/unix/sysv/linux/i386/ieee_fpu.c22
-rw-r--r--sysdeps/unix/sysv/linux/i386/init-first.S84
-rw-r--r--sysdeps/unix/sysv/linux/i386/ipc.S22
-rw-r--r--sysdeps/unix/sysv/linux/i386/lstat.S4
-rw-r--r--sysdeps/unix/sysv/linux/i386/lxstat.S4
-rw-r--r--sysdeps/unix/sysv/linux/i386/mknod.S39
-rw-r--r--sysdeps/unix/sysv/linux/i386/mmap.S45
-rw-r--r--sysdeps/unix/sysv/linux/i386/sbrk.S82
-rw-r--r--sysdeps/unix/sysv/linux/i386/setfpucw.c43
-rw-r--r--sysdeps/unix/sysv/linux/i386/signum.h66
-rw-r--r--sysdeps/unix/sysv/linux/i386/socket.S (renamed from sysdeps/unix/sysv/sysv4/linux/i386/socket.S)12
-rw-r--r--sysdeps/unix/sysv/linux/i386/stat.S38
-rw-r--r--sysdeps/unix/sysv/linux/i386/syscall.S (renamed from sysdeps/unix/sysv/sysv4/linux/i386/syscall.S)4
-rw-r--r--sysdeps/unix/sysv/linux/i386/sysdep.S (renamed from sysdeps/unix/sysv/sysv4/linux/i386/sysdep.S)13
-rw-r--r--sysdeps/unix/sysv/linux/i386/sysdep.h135
-rw-r--r--sysdeps/unix/sysv/linux/i386/xmknod.S49
-rw-r--r--sysdeps/unix/sysv/linux/i386/xstat.S51
-rw-r--r--sysdeps/unix/sysv/linux/listen.S (renamed from sysdeps/unix/sysv/sysv4/linux/listen.S)0
-rw-r--r--sysdeps/unix/sysv/linux/local_lim.h31
-rw-r--r--sysdeps/unix/sysv/linux/madvise.c1
-rw-r--r--sysdeps/unix/sysv/linux/msgctl.c32
-rw-r--r--sysdeps/unix/sysv/linux/msgget.c32
-rw-r--r--sysdeps/unix/sysv/linux/msgrcv.c38
-rw-r--r--sysdeps/unix/sysv/linux/msgsnd.c30
-rw-r--r--sysdeps/unix/sysv/linux/pipe.S24
-rw-r--r--sysdeps/unix/sysv/linux/poll.c1
-rw-r--r--sysdeps/unix/sysv/linux/readv.c1
-rw-r--r--sysdeps/unix/sysv/linux/recv.S2
-rw-r--r--sysdeps/unix/sysv/linux/recvfrom.S2
-rw-r--r--sysdeps/unix/sysv/linux/recvmsg.S2
-rw-r--r--sysdeps/unix/sysv/linux/semctl.c33
-rw-r--r--sysdeps/unix/sysv/linux/semget.c33
-rw-r--r--sysdeps/unix/sysv/linux/semop.c31
-rw-r--r--sysdeps/unix/sysv/linux/send.S2
-rw-r--r--sysdeps/unix/sysv/linux/sendmsg.S2
-rw-r--r--sysdeps/unix/sysv/linux/sendto.S2
-rw-r--r--sysdeps/unix/sysv/linux/setegid.c1
-rw-r--r--sysdeps/unix/sysv/linux/seteuid.c36
-rw-r--r--sysdeps/unix/sysv/linux/sethostid.c2
-rw-r--r--sysdeps/unix/sysv/linux/setpgid.S22
-rw-r--r--sysdeps/unix/sysv/linux/setpgrp.c25
-rw-r--r--sysdeps/unix/sysv/linux/setsid.S (renamed from sysdeps/unix/sysv/sysv4/linux/setsid.S)0
-rw-r--r--sysdeps/unix/sysv/linux/setsockopt.S2
-rw-r--r--sysdeps/unix/sysv/linux/settimeofday.S24
-rw-r--r--sysdeps/unix/sysv/linux/shmat.c37
-rw-r--r--sysdeps/unix/sysv/linux/shmctl.c31
-rw-r--r--sysdeps/unix/sysv/linux/shmdt.c30
-rw-r--r--sysdeps/unix/sysv/linux/shmget.c33
-rw-r--r--sysdeps/unix/sysv/linux/shutdown.S2
-rw-r--r--sysdeps/unix/sysv/linux/sigaction.S24
-rw-r--r--sysdeps/unix/sysv/linux/signal.S8
-rw-r--r--sysdeps/unix/sysv/linux/sigpending.S1
-rw-r--r--sysdeps/unix/sysv/linux/sigset.h1
-rw-r--r--sysdeps/unix/sysv/linux/sockaddrcom.h37
-rw-r--r--sysdeps/unix/sysv/linux/socketpair.S (renamed from sysdeps/unix/sysv/sysv4/linux/socketpair.S)0
-rw-r--r--sysdeps/unix/sysv/linux/speed.c103
-rw-r--r--sysdeps/unix/sysv/linux/statbuf.h72
-rw-r--r--sysdeps/unix/sysv/linux/stty.S22
-rw-r--r--sysdeps/unix/sysv/linux/sys/ipc_buf.h84
-rw-r--r--sysdeps/unix/sysv/linux/sys/mman.h112
-rw-r--r--sysdeps/unix/sysv/linux/sys/msq_buf.h54
-rw-r--r--sysdeps/unix/sysv/linux/sys/sem_buf.h65
-rw-r--r--sysdeps/unix/sysv/linux/sys/shm_buf.h56
-rw-r--r--sysdeps/unix/sysv/linux/sys/socketcall.h46
-rw-r--r--sysdeps/unix/sysv/linux/sys/timex.h30
-rw-r--r--sysdeps/unix/sysv/linux/syscall.h59
-rw-r--r--sysdeps/unix/sysv/linux/sysconf.c1
-rw-r--r--sysdeps/unix/sysv/linux/tcdrain.c31
-rw-r--r--sysdeps/unix/sysv/linux/tcflow.c1
-rw-r--r--sysdeps/unix/sysv/linux/tcflush.c1
-rw-r--r--sysdeps/unix/sysv/linux/tcgetattr.c31
-rw-r--r--sysdeps/unix/sysv/linux/tcsetattr.c1
-rw-r--r--sysdeps/unix/sysv/linux/termbits.h209
-rw-r--r--sysdeps/unix/sysv/linux/ualarm.c1
-rw-r--r--sysdeps/unix/sysv/linux/ulimit.c73
-rw-r--r--sysdeps/unix/sysv/linux/usleep.c1
-rw-r--r--sysdeps/unix/sysv/linux/utsnamelen.h24
-rw-r--r--sysdeps/unix/sysv/linux/vfork.c1
-rw-r--r--sysdeps/unix/sysv/linux/wait.c1
-rw-r--r--sysdeps/unix/sysv/linux/wait4.S (renamed from sysdeps/unix/sysv/sysv4/linux/wait4.S)0
-rw-r--r--sysdeps/unix/sysv/linux/waitpid.c32
-rw-r--r--sysdeps/unix/sysv/linux/writev.c1
-rw-r--r--sysdeps/unix/sysv/sysv4/linux/i386/sysdep.h86
-rw-r--r--sysdeps/unix/sysv/sysv4/linux/rename.S1
112 files changed, 3256 insertions, 94 deletions
diff --git a/sysdeps/unix/sysv/linux/Implies b/sysdeps/unix/sysv/linux/Implies
new file mode 100644
index 0000000000..141aab485c
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/Implies
@@ -0,0 +1,7 @@
+# Linux has not yet (as of 1.3.18) the canonical set of <sys/mman.h>
+# system calls. msync() and madvice() are missing, so their stubs
+# are found here. I think later version will have them ones.
+unix/mman
+
+# Linux has network support in the kernel.
+unix/inet
diff --git a/sysdeps/unix/sysv/linux/Makefile b/sysdeps/unix/sysv/linux/Makefile
new file mode 100644
index 0000000000..702ad047a3
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/Makefile
@@ -0,0 +1,21 @@
+ifeq ($(subdir), io)
+sysdep_routines := $(sysdep_routines) fxstat lxstat xstat
+endif
+
+ifeq ($(subdir), misc)
+sysdep_routines := $(sysdep_routines) xmknod
+endif
+
+#ifeq ($(subdir), posix)
+#sysdep_routines := $(sysdep_routines) setpgrp
+#endif
+
+ifeq ($(subdir), time)
+sysdep_routines := $(sysdep_routines) adjtimex
+endif
+
+ifeq ($(subdir), sysvipc)
+sysdep_routines := $(sysdep_routines) ipc
+endif
+
+headers := $(headers) sys/socketcall.h sys/timex.h
diff --git a/sysdeps/unix/sysv/linux/Subdirs b/sysdeps/unix/sysv/linux/Subdirs
new file mode 100644
index 0000000000..ea1a9e9d3a
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/Subdirs
@@ -0,0 +1 @@
+sysvipc
diff --git a/sysdeps/unix/sysv/sysv4/linux/accept.S b/sysdeps/unix/sysv/linux/accept.S
index 5936a0185b..5936a0185b 100644
--- a/sysdeps/unix/sysv/sysv4/linux/accept.S
+++ b/sysdeps/unix/sysv/linux/accept.S
diff --git a/sysdeps/unix/sysv/linux/adjtime.c b/sysdeps/unix/sysv/linux/adjtime.c
new file mode 100644
index 0000000000..3673cd9164
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/adjtime.c
@@ -0,0 +1,69 @@
+/* Copyright (C) 1995 Free Software Foundation, Inc.
+
+The GNU C Library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Library General Public License as
+published by the Free Software Foundation; either version 2 of the
+License, or (at your option) any later version.
+
+The GNU C Library is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+Library General Public License for more details.
+
+You should have received a copy of the GNU Library General Public
+License along with the GNU C Library; see the file COPYING.LIB. If
+not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+Boston, MA 02111-1307, USA. */
+
+#include <errno.h>
+#include <limits.h>
+#include <sys/time.h>
+#include <sys/timex.h>
+
+#define MAX_SEC (LONG_MAX / 1000000L - 2)
+#define MIN_SEC (LONG_MIN / 1000000L + 2)
+
+int
+__adjtime (itv, otv)
+ const struct timeval *itv;
+ struct timeval *otv;
+{
+ struct timex tntx;
+
+ if (itv)
+ {
+ struct timeval tmp;
+
+ /* We will do some check here. */
+ tmp.tv_sec = itv->tv_sec + itv->tv_usec / 1000000L;
+ tmp.tv_usec = itv->tv_usec % 1000000L;
+ if (tmp.tv_sec > MAX_SEC || tmp.tv_sec < MIN_SEC)
+ {
+ errno = EINVAL;
+ return -1;
+ }
+ tntx.offset = tmp.tv_usec + tmp.tv_sec * 1000000L;
+ tntx.mode = ADJ_OFFSET_SINGLESHOT;
+ }
+ else
+ tntx.mode = 0;
+
+ if (__adjtimex (&tntx) < 0) return -1;
+
+ if (otv)
+ {
+ if (tntx.offset < 0)
+ {
+ otv->tv_usec = -(-tntx.offset % 1000000);
+ otv->tv_sec = -(-tntx.offset / 1000000);
+ }
+ else
+ {
+ otv->tv_usec = tntx.offset % 1000000;
+ otv->tv_sec = tntx.offset / 1000000;
+ }
+ }
+ return 0;
+}
+
+weak_alias (__adjtime, adjtime)
diff --git a/sysdeps/unix/sysv/linux/adjtimex.S b/sysdeps/unix/sysv/linux/adjtimex.S
new file mode 100644
index 0000000000..de680acffb
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/adjtimex.S
@@ -0,0 +1,22 @@
+/* Copyright (C) 1995 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., 675 Mass Ave,
+Cambridge, MA 02139, USA. */
+
+#include <sysdep.h>
+
+SYSCALL__ (adjtimex, 1)
+ ret
diff --git a/sysdeps/unix/sysv/sysv4/linux/bind.S b/sysdeps/unix/sysv/linux/bind.S
index fc82b65a2f..fc82b65a2f 100644
--- a/sysdeps/unix/sysv/sysv4/linux/bind.S
+++ b/sysdeps/unix/sysv/linux/bind.S
diff --git a/sysdeps/unix/sysv/sysv4/linux/connect.S b/sysdeps/unix/sysv/linux/connect.S
index 3433043d8c..3433043d8c 100644
--- a/sysdeps/unix/sysv/sysv4/linux/connect.S
+++ b/sysdeps/unix/sysv/linux/connect.S
diff --git a/sysdeps/unix/sysv/linux/direct.h b/sysdeps/unix/sysv/linux/direct.h
new file mode 100644
index 0000000000..ef88147d81
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/direct.h
@@ -0,0 +1,43 @@
+/* Copyright (C) 1992, 1993 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., 675 Mass Ave,
+Cambridge, MA 02139, USA. */
+
+#ifndef _BSDDIR_H
+#define _BSDDIR_H 1
+
+#include <limits.h>
+
+/* This is what system V calls a "struct dirent". */
+
+struct direct
+ {
+ unsigned long int d_fileno;
+ long int d_off;
+ unsigned short int d_reclen;
+ char d_name[NAME_MAX + 1];
+ };
+
+#include <stddef.h>
+
+/* We calculate the length of the name by taking the length of the whole
+ `struct direct' record, subtracting the size of everything before the
+ name, and subtracting one for the terminating null. */
+
+#define D_NAMLEN(d) \
+ ((d)->d_reclen - offsetof (struct direct, d_name) - 1)
+
+#endif
diff --git a/sysdeps/unix/sysv/linux/dl-machine.h b/sysdeps/unix/sysv/linux/dl-machine.h
new file mode 100644
index 0000000000..2ed6c670e5
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/dl-machine.h
@@ -0,0 +1,214 @@
+/* Machine-dependent ELF dynamic relocation inline functions.
+ i386/Linux version.
+Copyright (C) 1995 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., 675 Mass Ave,
+Cambridge, MA 02139, USA. */
+
+#define ELF_MACHINE_NAME "i386"
+
+#include <assert.h>
+#include <string.h>
+#include <link.h>
+#include <syscall.h>
+#include <sys/mman.h>
+
+/* Return nonzero iff E_MACHINE is compatible with the running host. */
+static inline int
+elf_machine_matches_host (Elf32_Half e_machine)
+{
+ switch (e_machine)
+ {
+ case EM_386:
+ case EM_486:
+ return 1;
+ default:
+ return 0;
+ }
+}
+
+
+/* Return the run-time address of the _GLOBAL_OFFSET_TABLE_.
+ Must be inlined in a function which uses global data. */
+static inline Elf32_Addr *
+elf_machine_got (void)
+{
+ register Elf32_Addr *got asm ("%ebx");
+ return got;
+}
+
+
+/* Return the run-time load address of the shared object. */
+static inline Elf32_Addr
+elf_machine_load_address (void)
+{
+ Elf32_Addr addr;
+ asm (" call here\n"
+ "here: popl %0\n"
+ " subl $here, %0"
+ : "=r" (addr));
+ return addr;
+}
+/* The `subl' insn above will contain an R_386_32 relocation entry
+ intended to insert the run-time address of the label `here'.
+ This will be the first relocation in the text of the dynamic linker;
+ we skip it to avoid trying to modify read-only text in this early stage. */
+#define ELF_MACHINE_BEFORE_RTLD_RELOC(dynamic_info) \
+ ++(const Elf32_Rel *) (dynamic_info)[DT_REL]->d_un.d_ptr; \
+ (dynamic_info)[DT_RELSZ]->d_un.d_val -= sizeof (Elf32_Rel)
+
+/* Perform the relocation specified by RELOC and SYM (which is fully resolved).
+ MAP is the object containing the reloc. */
+
+static inline void
+elf_machine_rel (struct link_map *map,
+ const Elf32_Rel *reloc,
+ Elf32_Addr sym_loadaddr, const Elf32_Sym *sym)
+{
+ Elf32_Addr *const reloc_addr = (void *) (map->l_addr + reloc->r_offset);
+ const Elf32_Addr sym_value = sym_loadaddr + sym->st_value;
+
+ switch (ELF32_R_TYPE (reloc->r_info))
+ {
+ case R_386_COPY:
+ memcpy (reloc_addr, (void *) sym_value, sym->st_size);
+ break;
+ case R_386_GLOB_DAT:
+ case R_386_JMP_SLOT:
+ *reloc_addr = sym_value;
+ break;
+ case R_386_32:
+ if (map->l_type == lt_interpreter)
+ {
+ /* Undo the relocation done here during bootstrapping. Now we will
+ relocate it anew, possibly using a binding found in the user
+ program or a loaded library rather than the dynamic linker's
+ built-in definitions used while loading those libraries. */
+ const Elf32_Sym *const dlsymtab
+ = (void *) (map->l_addr + map->l_info[DT_SYMTAB]->d_un.d_ptr);
+ *reloc_addr -= (map->l_addr +
+ dlsymtab[ELF32_R_SYM (reloc->r_info)].st_value);
+ }
+ *reloc_addr += sym_value;
+ break;
+ case R_386_RELATIVE:
+ if (map->l_type != lt_interpreter) /* Already done in dynamic linker. */
+ *reloc_addr += map->l_addr;
+ break;
+ case R_386_PC32:
+ *reloc_addr = sym_value - (Elf32_Addr) reloc_addr;
+ break;
+ default:
+ assert (! "unexpected dynamic reloc type");
+ break;
+ }
+}
+
+static inline void
+elf_machine_lazy_rel (struct link_map *map, const Elf32_Rel *reloc)
+{
+ Elf32_Addr *const reloc_addr = (void *) (map->l_addr + reloc->r_offset);
+ switch (ELF32_R_TYPE (reloc->r_info))
+ {
+ case R_386_JMP_SLOT:
+ *reloc_addr += map->l_addr;
+ break;
+ default:
+ assert (! "unexpected PLT reloc type");
+ break;
+ }
+}
+
+/* The i386 never uses Elf32_Rela relocations. */
+#define ELF_MACHINE_NO_RELA 1
+
+
+/* Set up the loaded object described by L so its unrelocated PLT
+ entries will jump to the on-demand fixup code in dl-runtime.c. */
+
+static inline void
+elf_machine_runtime_setup (struct link_map *l)
+{
+ Elf32_Addr *got;
+ extern void _dl_runtime_resolve (Elf32_Word);
+
+ /* The GOT entries for functions in the PLT have not yet been filled
+ in. Their initial contents will arrange when called to push an
+ offset into the .rel.plt section, push _GLOBAL_OFFSET_TABLE_[1],
+ and then jump to _GLOBAL_OFFSET_TABLE[2]. */
+ got = (Elf32_Addr *) (l->l_addr + l->l_info[DT_PLTGOT]->d_un.d_ptr);
+ got[1] = (Elf32_Addr) l; /* Identify this shared object. */
+ /* This function will get called to fix up the GOT entry indicated by
+ the offset on the stack, and then jump to the resolved address. */
+ got[2] = (Elf32_Addr) &_dl_runtime_resolve;
+}
+
+
+/* Mask identifying addresses reserved for the user program,
+ where the dynamic linker should not map anything. */
+#define ELF_MACHINE_USER_ADDRESS_MASK 0xf8000000UL
+
+
+
+/* Initial entry point code for the dynamic linker.
+ The C function `_dl_start' is the real entry point;
+ its return value is the user program's entry point. */
+
+#define RTLD_START asm ("\
+.text\n\
+.globl _start\n\
+.globl _dl_start_user\n\
+_start:\n\
+ call _dl_start\n\
+_dl_start_user:\n\
+ # Save the user entry point address in %edi.\n\
+ movl %eax, %edi\n\
+ # Point %ebx at the GOT.
+ call 0f\n\
+0: popl %ebx\n\
+ addl $_GLOBAL_OFFSET_TABLE_+[.-0b], %ebx\n\
+ # See if we were run as a command with the executable file\n\
+ # name as an extra leading argument.\n\
+ movl rtld_command@GOT(%ebx), %eax\n\
+ movl (%eax),%eax\n\
+ testl %eax,%eax\n\
+ jz 0f\n\
+ # Pop the original argument count, decrement it, and replace\n\
+ # the original first argument pointer with the new count.\n\
+ popl %eax\n\
+ decl %eax\n\
+ movl %eax,(%esp)\n\
+ # Call _dl_init_next to return the address of an initializer\n\
+ # function to run.\n\
+0: call _dl_init_next@PLT\n\
+ # Check for zero return, when out of initializers.\n\
+ testl %eax,%eax\n\
+ jz 1f\n\
+ # Call the shared object initializer function.\n\
+ # NOTE: We depend only on the registers (%ebx and %edi)\n\
+ # and the return address pushed by this call;\n\
+ # the initializer is called with the stack just\n\
+ # as it appears on entry, and it is free to move\n\
+ # the stack around, as long as it winds up jumping to\n\
+ # the return address on the top of the stack.\n\
+ call *%eax\n\
+ # Loop to call _dl_init_next for the next initializer.\n\
+ jmp 0b\n\
+1: # Pass our finalizer function to the user in %edx, as per ELF ABI.\n\
+ movl _dl_fini@GOT(%ebx), %edx\n\
+ # Jump to the user's entry point.\n\
+ jmp *%edi\n\
+");
diff --git a/sysdeps/unix/sysv/linux/errnos.h b/sysdeps/unix/sysv/linux/errnos.h
new file mode 100644
index 0000000000..be1e4d3feb
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/errnos.h
@@ -0,0 +1 @@
+#include <linux/errno.h>
diff --git a/sysdeps/unix/sysv/sysv4/linux/waitpid.S b/sysdeps/unix/sysv/linux/fork.S
index 20d9d669bb..a49a4bcebd 100644
--- a/sysdeps/unix/sysv/sysv4/linux/waitpid.S
+++ b/sysdeps/unix/sysv/linux/fork.S
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991, 1992, 1995 Free Software Foundation, Inc.
+/* Copyright (C) 1991, 1992, 1994, 1995 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,7 +18,7 @@ Cambridge, MA 02139, USA. */
#include <sysdep.h>
-SYSCALL__ (waitpid, 3)
+SYSCALL__ (fork, 0)
ret
-weak_alias (__waitpid, waitpid)
+weak_alias (__fork, fork)
diff --git a/sysdeps/unix/sysv/linux/gethostid.c b/sysdeps/unix/sysv/linux/gethostid.c
new file mode 100644
index 0000000000..94f4a1ece7
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/gethostid.c
@@ -0,0 +1,96 @@
+/* Copyright (C) 1995 Free Software Foundation, Inc.
+
+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 <fcntl.h>
+#include <unistd.h>
+
+#define HOSTIDFILE "/var/adm/hostid"
+
+#ifdef SET_PROCEDURE
+int
+sethostid (id)
+ long int id;
+{
+ int fd;
+ ssize_t written;
+
+ /* Test for appropriate rights to set host ID. */
+ if (geteuid () || getuid ())
+ {
+ errno = EPERM;
+ return -1;
+ }
+
+ /* Open file for writing. Everybody is allowed to read this file. */
+ fd = __open (HOSTIDFILE, O_CREAT|O_WRONLY, 0644);
+ if (fd < 0)
+ return -1;
+
+ written = __write (fd, &id, sizeof (id));
+
+ __close (fd);
+
+ return written != sizeof (id) ? -1 : 0;
+}
+
+#else
+# include <sys/param.h>
+# include <resolv/netdb.h>
+# include <netinet/in.h>
+
+long int
+gethostid ()
+{
+ char hostname[MAXHOSTNAMELEN + 1];
+ struct hostent *hp;
+ unsigned long id;
+ struct in_addr in;
+ int fd;
+
+ /* First try to get the ID from a former invocation of sethostid. */
+ fd = __open (HOSTIDFILE, O_RDONLY);
+ if (fd >= 0)
+ {
+ ssize_t n = __read (fd, &id, sizeof (id));
+
+ __close (fd);
+
+ if (n == sizeof (id))
+ return id;
+ }
+
+ /* Getting from the file was not succesful. An intelligent guess for
+ a unique number of a host is its IP address. Return this. */
+ if (gethostname (hostname, MAXHOSTNAMELEN) < 0 || hostname[0] == '\0')
+ /* This also fails. Return and arbitrary value. */
+ return 0;
+
+ /* To get the IP address we need to knoe the host name. */
+ hp = gethostbyname (hostname);
+ if (hp == NULL)
+ return 0;
+
+ in.s_addr = 0;
+ memcpy (&in, hp->h_addr,
+ sizeof (in) < hp->h_length ? sizeof (in) : hp->h_length);
+
+ /* For the return value to be not exactly the IP address we do some
+ bit fiddling. */
+ return in.s_addr << 16 | in.s_addr >> 16;
+}
+#endif
diff --git a/sysdeps/unix/sysv/linux/gethostname.c b/sysdeps/unix/sysv/linux/gethostname.c
new file mode 100644
index 0000000000..4b7720d414
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/gethostname.c
@@ -0,0 +1,53 @@
+/* Copyright (C) 1992, 1995 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., 675 Mass Ave,
+Cambridge, MA 02139, USA. */
+
+#include <errno.h>
+#include <string.h>
+#include <unistd.h>
+#include <sys/utsname.h>
+
+/* Put the name of the current host in no more than LEN bytes of NAME.
+ The result is null-terminated if LEN is large enough for the full
+ name and the terminator. */
+int
+__gethostname (name, len)
+ char *name;
+ size_t len;
+{
+ struct utsname buf;
+
+ if (name == NULL)
+ {
+ errno = EINVAL;
+ return -1;
+ }
+
+ if (uname (&buf))
+ return -1;
+
+ if (strlen (buf.nodename) + 1 > len)
+ {
+ errno = EINVAL;
+ return -1;
+ }
+
+ strcpy (name, buf.nodename);
+ return 0;
+}
+
+weak_alias (__gethostname, gethostname)
diff --git a/sysdeps/unix/sysv/sysv4/linux/getpeername.S b/sysdeps/unix/sysv/linux/getpeername.S
index 8429fcdf76..8429fcdf76 100644
--- a/sysdeps/unix/sysv/sysv4/linux/getpeername.S
+++ b/sysdeps/unix/sysv/linux/getpeername.S
diff --git a/sysdeps/unix/sysv/linux/getpgid.S b/sysdeps/unix/sysv/linux/getpgid.S
new file mode 100644
index 0000000000..3151296b3c
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/getpgid.S
@@ -0,0 +1,22 @@
+/* Copyright (C) 1995 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., 675 Mass Ave,
+Cambridge, MA 02139, USA. */
+
+#include <sysdep.h>
+
+SYSCALL (getpgid, 1)
+ ret
diff --git a/sysdeps/unix/sysv/linux/getpgrp.S b/sysdeps/unix/sysv/linux/getpgrp.S
new file mode 100644
index 0000000000..75e8d342cc
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/getpgrp.S
@@ -0,0 +1,22 @@
+/* Copyright (C) 1995 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., 675 Mass Ave,
+Cambridge, MA 02139, USA. */
+
+#include <sysdep.h>
+
+SYSCALL (getpgrp, 0)
+ ret
diff --git a/sysdeps/unix/sysv/sysv4/linux/getsockname.S b/sysdeps/unix/sysv/linux/getsockname.S
index 6782707f88..6782707f88 100644
--- a/sysdeps/unix/sysv/sysv4/linux/getsockname.S
+++ b/sysdeps/unix/sysv/linux/getsockname.S
diff --git a/sysdeps/unix/sysv/linux/getsockopt.S b/sysdeps/unix/sysv/linux/getsockopt.S
new file mode 100644
index 0000000000..6ce92a6330
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/getsockopt.S
@@ -0,0 +1,2 @@
+#define socket getsockopt
+#include <socket.S>
diff --git a/sysdeps/unix/sysv/linux/gtty.S b/sysdeps/unix/sysv/linux/gtty.S
new file mode 100644
index 0000000000..1cff6b251c
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/gtty.S
@@ -0,0 +1,22 @@
+/* Copyright (C) 1995 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., 675 Mass Ave,
+Cambridge, MA 02139, USA. */
+
+#include <sysdep.h>
+
+SYSCALL (gtty, 2)
+ ret
diff --git a/sysdeps/unix/sysv/linux/i386/Dist b/sysdeps/unix/sysv/linux/i386/Dist
new file mode 100644
index 0000000000..91365adfc4
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/i386/Dist
@@ -0,0 +1 @@
+fxstat.S lxstat.S xmknod.S xstat.S
diff --git a/sysdeps/unix/sysv/linux/i386/Makefile b/sysdeps/unix/sysv/linux/i386/Makefile
new file mode 100644
index 0000000000..76d295e048
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/i386/Makefile
@@ -0,0 +1,7 @@
+ifeq ($(subdir), misc)
+sysdep_routines := $(sysdep_routines) fpu_control setfpucw
+
+extra-libs := $(extra-libs) libieee
+libieee-routines := ieee_fpu
+libieee-inhibit-o := .so .po
+endif
diff --git a/sysdeps/unix/sysv/linux/i386/brk.S b/sysdeps/unix/sysv/linux/i386/brk.S
new file mode 100644
index 0000000000..ef2f55db97
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/i386/brk.S
@@ -0,0 +1,60 @@
+/* Copyright (C) 1991, 1992, 1993, 1995 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., 675 Mass Ave,
+Cambridge, MA 02139, USA. */
+
+#include <sysdep.h>
+
+.data
+.globl C_SYMBOL_NAME(__curbrk)
+C_LABEL(__curbrk)
+#ifdef PIC
+ .long 0
+#else
+# ifdef HAVE_GNU_LD
+ .long C_SYMBOL_NAME(_end)
+# else
+ .long C_SYMBOL_NAME(end)
+# endif
+#endif
+
+.text
+.globl C_SYMBOL_NAME(syscall_error)
+
+ENTRY (__brk)
+ movl %ebx, %edx
+ movl $SYS_ify(brk), %eax
+ movl 4(%esp), %ebx
+ int $0x80
+ movl %edx, %ebx
+
+ cmpl 4(%esp), %eax
+ jne JUMPTARGET(syscall_error)
+
+#ifdef PIC
+ /* Standard PIC nonsense to store into `__curbrk' through the GOT. */
+ call here
+here: popl %ecx
+ addl $_GLOBAL_OFFSET_TABLE_+[.-here], %ecx
+ movl C_SYMBOL_NAME(__curbrk@GOT)(%ecx), %ecx
+ movl %eax, (%ecx)
+#else
+ movl %eax, C_SYMBOL_NAME(__curbrk)
+#endif
+ xorl %eax, %eax
+ ret
+
+weak_alias (__brk, brk)
diff --git a/sysdeps/unix/sysv/linux/i386/fcntlbits.h b/sysdeps/unix/sysv/linux/i386/fcntlbits.h
new file mode 100644
index 0000000000..8d92ac02b0
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/i386/fcntlbits.h
@@ -0,0 +1,26 @@
+/* O_*, F_*, FD_* bit values for Linux.
+Copyright (C) 1995 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 _FCNTLBITS_H
+#define _FCNTLBITS_H 1
+
+#include <sys/types.h>
+#include <linux/fcntl.h>
+
+#endif /* fcntlbits.h */
diff --git a/sysdeps/unix/sysv/linux/i386/fpu_control.c b/sysdeps/unix/sysv/linux/i386/fpu_control.c
new file mode 100644
index 0000000000..79933b90eb
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/i386/fpu_control.c
@@ -0,0 +1,20 @@
+/* Default control word for ix86 FPU.
+Copyright (C) 1995 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. */
+
+unsigned short ___fpu_control = 0;
diff --git a/sysdeps/unix/sysv/linux/i386/fpu_control.h b/sysdeps/unix/sysv/linux/i386/fpu_control.h
new file mode 100644
index 0000000000..28f3eeba7b
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/i386/fpu_control.h
@@ -0,0 +1,100 @@
+/* Copyright (C) 1993 Free Software Foundation, Inc.
+This file is part of the GNU C Library.
+Contributed by Olaf Flebbe.
+
+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 _FPU_CONTROL_H
+#define _FPU_CONTROL_H
+
+/* Here is the dirty part. Settup up your 387 through the control word
+ * (cw) register.
+ *
+ * 15-13 12 11-10 9-8 7-6 5 4 3 2 1 0
+ * | reserved | IC | RC | PC | reserved | PM | UM | OM | ZM | DM | IM
+ *
+ * IM: Invalid operation mask
+ * DM: Denormalized operand mask
+ * ZM: Zero-divide mask
+ * OM: Overflow mask
+ * UM: Underflow mask
+ * PM: Precision (inexact result) mask
+ *
+ * Mask bit is 1 means no interrupt.
+ *
+ * PC: Precision control
+ * 11 - round to extended precision
+ * 10 - round to double precision
+ * 00 - round to single precision
+ *
+ * RC: Rounding control
+ * 00 - rounding to nearest
+ * 01 - rounding down (toward - infinity)
+ * 10 - rounding up (toward + infinity)
+ * 11 - rounding toward zero
+ *
+ * IC: Infinity control
+ * That is for 8087 and 80287 only.
+ *
+ * The hardware default is 0x037f. I choose 0x1372.
+ */
+
+#include <features.h>
+
+/* masking of interrupts */
+#define _FPU_MASK_IM 0x01
+#define _FPU_MASK_DM 0x02
+#define _FPU_MASK_ZM 0x04
+#define _FPU_MASK_OM 0x08
+#define _FPU_MASK_UM 0x10
+#define _FPU_MASK_PM 0x20
+
+/* precision control */
+#define _FPU_EXTENDED 0x300 /* RECOMMENDED */
+#define _FPU_DOUBLE 0x200
+#define _FPU_SINGLE 0x0 /* DO NOT USE */
+
+/* rounding control */
+#define _FPU_RC_NEAREST 0x0 /* RECOMMENDED */
+#define _FPU_RC_DOWN 0x400
+#define _FPU_RC_UP 0x800
+#define _FPU_RC_ZERO 0xC00
+
+#define _FPU_RESERVED 0xF0C0 /* Reserved bits in cw */
+
+
+/* Now two recommended cw */
+
+/* Linux default:
+ - extended precision
+ - rounding to nearest
+ - exceptions on overflow, zero divide and NaN */
+#define _FPU_DEFAULT 0x1372
+
+/* IEEE: same as above, but exceptions */
+#define _FPU_IEEE 0x137f
+
+/* private namespace. It should only be used in init-first.o. */
+extern unsigned short __fpu_control;
+
+__BEGIN_DECLS
+
+/* called in init-first.o. It can be used to manipulate 387 control word. */
+extern void __setfpucw __P ((unsigned short));
+
+__END_DECLS
+
+#endif /* fpu_control.h */
diff --git a/sysdeps/unix/sysv/linux/i386/fstat.S b/sysdeps/unix/sysv/linux/i386/fstat.S
new file mode 100644
index 0000000000..434ad4ad64
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/i386/fstat.S
@@ -0,0 +1,4 @@
+#define __stat __fstat
+#define stat fstat
+#define __xstat __fxstat
+#include "stat.S"
diff --git a/sysdeps/unix/sysv/linux/i386/fxstat.S b/sysdeps/unix/sysv/linux/i386/fxstat.S
new file mode 100644
index 0000000000..c4db088abe
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/i386/fxstat.S
@@ -0,0 +1,4 @@
+#define __xstat __fxstat
+#define _xstat _fxstat
+#define stat fstat
+#include "xstat.S"
diff --git a/sysdeps/unix/sysv/linux/i386/ieee_fpu.c b/sysdeps/unix/sysv/linux/i386/ieee_fpu.c
new file mode 100644
index 0000000000..4a0bf31e7c
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/i386/ieee_fpu.c
@@ -0,0 +1,22 @@
+/* Default control word for ix86 FPU.
+Copyright (C) 1995 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 <fpu_control.h>
+
+unsigned short ___fpu_control = _FPU_IEEE;
diff --git a/sysdeps/unix/sysv/linux/i386/init-first.S b/sysdeps/unix/sysv/linux/i386/init-first.S
new file mode 100644
index 0000000000..3c0c185fb7
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/i386/init-first.S
@@ -0,0 +1,84 @@
+/* Initialization code run first thing by the ELF startup code.
+ For i386/Linux.
+Copyright (C) 1995 Free Software Foundation, Inc.
+This file is part of the GNU C Library.
+
+The GNU C Library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Library General Public License as
+published by the Free Software Foundation; either version 2 of the
+License, or (at your option) any later version.
+
+The GNU C Library is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+Library General Public License for more details.
+
+You should have received a copy of the GNU Library General Public
+License along with the GNU C Library; see the file COPYING.LIB. If
+not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+Boston, MA 02111-1307, USA. */
+
+#include <sysdep.h>
+
+ .text
+
+ /* Called from start.S. Not: there is no value in %ebx. */
+
+ENTRY (__libc_init_first)
+
+ /* Make sure we are not using iBSC2 personality. */
+ movl $SYS_ify (personality), %eax
+ xorl %ebx, %ebx
+ int $0x80
+
+#ifdef PIC
+ /* Set control work of FPU. */
+ call .L0
+.L0: popl %ebx
+ addl $_GLOBAL_OFFSET_TABLE_+[.-.L0], %ebx
+ movzwl C_SYMBOL_NAME(___fpu_control@GOT)(%ebx), %eax
+#else
+ movzwl ___fpu_control, %eax
+#endif
+ pushl %eax
+ call JUMPTARGET(__setfpucw)
+ addl $4, %esp
+
+ /* That is all for now. */
+ ret
+
+
+ /* This is only a dummy function for the list below. */
+ .type _dummy_exit, @function
+C_LABEL(_dummy_exit)
+ ret
+
+
+ .section .init,"ax",@progbits
+ movl 16(%ebp), %edx /* envp */
+ movl 12(%ebp), %ecx /* argv */
+ movl 8(%ebp), %eax /* argc */
+ pushl %edx
+ pushl %ecx
+ pushl %eax
+
+ call JUMPTARGET(__libc_init)
+
+ addl $12, %esp
+
+
+ /* Make sure __libc_subinit section is always present. */
+ .section __libc_subinit, "a", @progbits
+ .align 4
+ .type __elf_set___libc_subinit_element__dummy_exit__, @object
+ .size __elf_set___libc_subinit_element__dummy_exit__, 4
+__elf_set___libc_subinit_element__dummy_exit__:
+ .long _dummy_exit
+
+ /* Make sure __libc_atexit section is always present. */
+ .section __libc_atexit, "a", @progbits
+ .align 4
+ .type __elf_set___libc_atexit_element__dummy_exit__, @object
+ .size __elf_set___libc_atexit_element__dummy_exit__, 4
+__elf_set___libc_atexit_element__dummy_exit__:
+ .long _dummy_exit
diff --git a/sysdeps/unix/sysv/linux/i386/ipc.S b/sysdeps/unix/sysv/linux/i386/ipc.S
new file mode 100644
index 0000000000..bb523a20dc
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/i386/ipc.S
@@ -0,0 +1,22 @@
+/* Copyright (C) 1995 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., 675 Mass Ave,
+Cambridge, MA 02139, USA. */
+
+#include <sysdep.h>
+
+SYSCALL__ (ipc, 5)
+ ret
diff --git a/sysdeps/unix/sysv/linux/i386/lstat.S b/sysdeps/unix/sysv/linux/i386/lstat.S
new file mode 100644
index 0000000000..9135c6bfe1
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/i386/lstat.S
@@ -0,0 +1,4 @@
+#define __stat __lstat
+#define stat lstat
+#define __xstat __lxstat
+#include "stat.S"
diff --git a/sysdeps/unix/sysv/linux/i386/lxstat.S b/sysdeps/unix/sysv/linux/i386/lxstat.S
new file mode 100644
index 0000000000..fee635be78
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/i386/lxstat.S
@@ -0,0 +1,4 @@
+#define __xstat __lxstat
+#define _xstat _lxstat
+#define stat lstat
+#include "xstat.S"
diff --git a/sysdeps/unix/sysv/linux/i386/mknod.S b/sysdeps/unix/sysv/linux/i386/mknod.S
new file mode 100644
index 0000000000..7faf89d74b
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/i386/mknod.S
@@ -0,0 +1,39 @@
+/* Copyright (C) 1995 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., 675 Mass Ave,
+Cambridge, MA 02139, USA. */
+
+#include <sysdep.h>
+
+/* In Linux the `mknod' call is actually done by a emulation of the
+ `xmknod' system call, which takes an additional first argument
+ giving a version number for the interface. This macro gives the
+ Linux version number that corresponds to the modern interface. */
+#define _MKNOD_VER 1
+
+ENTRY (__mknod)
+ movl 12(%esp), %edx
+ movl 8(%esp), %ecx
+ movl 4(%esp), %eax
+ pushl %edx
+ pushl %ecx
+ pushl %eax
+ pushl $_MKNOD_VER /* Push extra first arg to syscall. */
+ call JUMPTARGET(__xmknod)
+ addl $16, %esp /* Correct version parameter offset. */
+ ret
+
+weak_alias (__mknod, mknod)
diff --git a/sysdeps/unix/sysv/linux/i386/mmap.S b/sysdeps/unix/sysv/linux/i386/mmap.S
new file mode 100644
index 0000000000..96ea870846
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/i386/mmap.S
@@ -0,0 +1,45 @@
+/* Copyright (C) 1995 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., 675 Mass Ave,
+Cambridge, MA 02139, USA. */
+
+#include <sysdep.h>
+
+.globl syscall_error
+
+ENTRY (__mmap)
+
+ /* Save registers. */
+ movl %ebx, %edx
+
+ movl $SYS_ify(mmap), %eax /* System call number in %eax. */
+
+ lea 4(%esp), %ebx /* Address of args is 1st arg. */
+
+ /* Do the system call trap. */
+ int $0x80
+
+ /* Restore registers. */
+ movl %edx, %ebx
+
+ /* %eax is < 0 if there was an error. */
+ testl %eax, %eax
+ jl JUMPTARGET(syscall_error)
+
+ /* Successful; return the syscall's value. */
+ ret
+
+weak_alias (__mmap, mmap)
diff --git a/sysdeps/unix/sysv/linux/i386/sbrk.S b/sysdeps/unix/sysv/linux/i386/sbrk.S
new file mode 100644
index 0000000000..7a0e940cfe
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/i386/sbrk.S
@@ -0,0 +1,82 @@
+/* Copyright (C) 1995 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., 675 Mass Ave,
+Cambridge, MA 02139, USA. */
+
+#include <sysdep.h>
+
+.data
+.globl C_SYMBOL_NAME(__curbrk)
+
+.text
+.globl C_SYMBOL_NAME(syscall_error)
+
+ENTRY (__sbrk)
+
+ movl %ebx, %edx
+
+#ifdef PIC
+ /* Standard PIC nonsense to access `__curbrk' through the GOT. */
+ call .L0
+.L0: popl %ecx
+ addl $_GLOBAL_OFFSET_TABLE_+[.-.L0], %ecx
+
+ movl C_SYMBOL_NAME(__curbrk@GOT)(%ecx), %ecx
+ movl (%ecx), %ebx
+ movl %ebx, %eax
+ testl %ebx, %ebx
+ jne .L1
+
+ /* We have to initialize `__curbrk' first. */
+ movl $SYS_ify(brk), %eax
+ int $0x80
+
+ movl %eax, (%ecx)
+ movl %eax, %ebx
+ .align 16, 0x90
+
+.L1:
+#else
+ movl C_SYMBOL_NAME(__curbrk), %ebx
+ movl %ebx, %eax
+#endif
+
+ addl 4(%esp), %ebx
+ cmpl %ebx, %eax
+ je .L2
+
+ movl $SYS_ify(brk), %eax
+ int $0x80
+
+ cmpl %eax, %ebx
+ jne .L3
+
+#ifdef PIC
+ xchgl %eax, (%ecx)
+#else
+ xchgl %eax, C_SYMBOL_NAME(__curbrk)
+#endif
+
+.L2:
+ movl %edx, %ebx
+ ret
+
+ .align 16
+.L3:
+ movl %edx, %ebx
+ jmp JUMPTARGET(syscall_error)
+
+weak_alias (__sbrk, sbrk)
diff --git a/sysdeps/unix/sysv/linux/i386/setfpucw.c b/sysdeps/unix/sysv/linux/i386/setfpucw.c
new file mode 100644
index 0000000000..329573df6a
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/i386/setfpucw.c
@@ -0,0 +1,43 @@
+/* Copyright (C) 1993 Free Software Foundation, Inc.
+This file is part of the GNU C Library.
+Contributed by Olaf Flebbe.
+
+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 <fpu_control.h>
+
+void
+__setfpucw (fpu_control)
+ unsigned short fpu_control;
+{
+ volatile unsigned short cw;
+
+ /* If user supplied _fpu_control, use it ! */
+ if (!fpu_control)
+ {
+ /* use linux defaults */
+ fpu_control = _FPU_DEFAULT;
+ }
+ /* Get Control Word */
+ __asm__ volatile ("fnstcw %0" : "=m" (cw) : );
+
+ /* mask in */
+ cw &= _FPU_RESERVED;
+ cw = cw | (fpu_control & ~_FPU_RESERVED);
+
+ /* set cw */
+ __asm__ volatile ("fldcw %0" :: "m" (cw));
+}
diff --git a/sysdeps/unix/sysv/linux/i386/signum.h b/sysdeps/unix/sysv/linux/i386/signum.h
new file mode 100644
index 0000000000..8e4f270204
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/i386/signum.h
@@ -0,0 +1,66 @@
+/* Signal number definitions. Linux version.
+Copyright (C) 1995 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., 675 Mass Ave,
+Cambridge, MA 02139, USA. */
+
+#ifdef _SIGNAL_H
+
+/* Fake signal functions. */
+#define SIG_ERR ((__sighandler_t) -1) /* Error return. */
+#define SIG_DFL ((__sighandler_t) 0) /* Default action. */
+#define SIG_IGN ((__sighandler_t) 1) /* Ignore signal. */
+
+
+/* Signals. */
+#define SIGHUP 1 /* Hangup (POSIX). */
+#define SIGINT 2 /* Interrupt (ANSI). */
+#define SIGQUIT 3 /* Quit (POSIX). */
+#define SIGILL 4 /* Illegal instruction (ANSI). */
+#define SIGTRAP 5 /* Trace trap (POSIX). */
+#define SIGABRT SIGIOT /* Abort (ANSI). */
+#define SIGIOT 6 /* IOT trap (4.2 BSD). */
+#define SIGBUS 7 /* BUS error (4.2 BSD). */
+#define SIGFPE 8 /* Floating-point exception (ANSI). */
+#define SIGKILL 9 /* Kill, unblockable (POSIX). */
+#define SIGUSR1 10 /* User-defined signal 1 (POSIX). */
+#define SIGSEGV 11 /* Segmentation violation (ANSI). */
+#define SIGUSR2 12 /* User-defined signal 2 (POSIX). */
+#define SIGPIPE 13 /* Broken pipe (POSIX). */
+#define SIGALRM 14 /* Alarm clock (POSIX). */
+#define SIGTERM 15 /* Termination (ANSI). */
+#define SIGSTKFLT 16 /* ??? */
+#define SIGCLD SIGCHLD /* Same as SIGCHLD (System V). */
+#define SIGCHLD 17 /* Child status has changed (POSIX). */
+#define SIGCONT 18 /* Continue (POSIX). */
+#define SIGSTOP 19 /* Stop, unblockable (POSIX). */
+#define SIGTSTP 20 /* Keyboard stop (POSIX). */
+#define SIGTTIN 21 /* Background read from tty (POSIX). */
+#define SIGTTOU 22 /* Background write to tty (POSIX). */
+#define SIGURG 23 /* Urgent condition on socket (4.2 BSD). */
+#define SIGXCPU 24 /* CPU limit exceeded (4.2 BSD). */
+#define SIGXFSZ 25 /* File size limit exceeded (4.2 BSD). */
+#define SIGVTALRM 26 /* Virtual alarm clock (4.2 BSD). */
+#define SIGPROF 27 /* Profiling alarm clock (4.2 BSD). */
+#define SIGWINCH 28 /* Window size change (4.3 BSD, Sun). */
+#define SIGPOLL SIGIO /* Pollable event occured (System V). */
+#define SIGIO 29 /* I/O now possible (4.2 BSD). */
+#define SIGPWR 30 /* Power failure restart (System V). */
+#define SIGUNUSED 31
+
+#endif /* <signal.h> included. */
+
+#define _NSIG 32 /* Biggest signal number + 1. */
diff --git a/sysdeps/unix/sysv/sysv4/linux/i386/socket.S b/sysdeps/unix/sysv/linux/i386/socket.S
index 7b8dd75ed8..3d3a67213b 100644
--- a/sysdeps/unix/sysv/sysv4/linux/i386/socket.S
+++ b/sysdeps/unix/sysv/linux/i386/socket.S
@@ -19,6 +19,9 @@ Cambridge, MA 02139, USA. */
#include <sysdep.h>
#include <sys/socketcall.h>
+#define P(a, b) P2(a, b)
+#define P2(a, b) a##b
+
.globl syscall_error
/* The socket-oriented system calls are handled unusally in Linux.
@@ -29,15 +32,16 @@ Cambridge, MA 02139, USA. */
The .S files for the other calls just #define socket and #include this. */
-ENTRY (socket)
+.globl P(__,socket)
+ENTRY (P(__,socket))
/* Save registers. */
movl %ebx, %edx
- movl $SYS_socketcall, %eax /* System call number in %eax. */
+ movl $SYS_ify(socketcall), %eax /* System call number in %eax. */
/* Use ## so `socket' is a separate token that might be #define'd. */
- movl $SYS_##socket, %ebx /* Subcode is first arg to syscall. */
+ movl $P(SOCKOP_,socket), %ebx /* Subcode is first arg to syscall. */
lea 8(%esp), %ecx /* Address of args is 2nd arg. */
/* Do the system call trap. */
@@ -52,3 +56,5 @@ ENTRY (socket)
/* Successful; return the syscall's value. */
ret
+
+weak_alias (P(__,socket), socket)
diff --git a/sysdeps/unix/sysv/linux/i386/stat.S b/sysdeps/unix/sysv/linux/i386/stat.S
new file mode 100644
index 0000000000..73204bf254
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/i386/stat.S
@@ -0,0 +1,38 @@
+/* Copyright (C) 1995 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., 675 Mass Ave,
+Cambridge, MA 02139, USA. */
+
+#include <sysdep.h>
+
+/* In Linux the `stat' call is actually done by emulating a `xstat' system
+ call, which takes an additional first argument giving a version number
+ for `struct stat'. Likewise for `fstat' and `lstat' there are `fxstat'
+ and `lxstat' emulations. This macro gives the Linux version number that
+ corresponds to the definition of `struct stat' in <statbuf.h>. */
+#define _STAT_VER 1
+
+ENTRY (__stat)
+ movl 8(%esp), %eax
+ movl 4(%esp), %ecx
+ pushl %eax
+ pushl %ecx
+ pushl $_STAT_VER /* Push extra first arg to syscall. */
+ call JUMPTARGET(__xstat)/* Jump to xstat implementation. */
+ addl $12, %esp
+ ret
+
+weak_alias (__stat, stat)
diff --git a/sysdeps/unix/sysv/sysv4/linux/i386/syscall.S b/sysdeps/unix/sysv/linux/i386/syscall.S
index efe6d36086..6e6aa5d3c8 100644
--- a/sysdeps/unix/sysv/sysv4/linux/i386/syscall.S
+++ b/sysdeps/unix/sysv/linux/i386/syscall.S
@@ -18,12 +18,14 @@ Cambridge, MA 02139, USA. */
#include <sysdep.h>
-ASM_GLOBAL_DIRECTIVE syscall_error
+.globl syscall_error
ENTRY (syscall)
popl %ecx /* Pop return address into %ecx. */
popl %eax /* Pop syscall number into %eax. */
pushl %ecx /* Push back return address. */
DO_CALL (5) /* Frob the args and do the system call. */
+ movl (%esp), %ecx
+ pushl %ecx
testl %eax, %eax /* Check %eax for error. */
jl JUMPTARGET(syscall_error) /* Jump to error handler if negative. */
ret /* Return to caller. */
diff --git a/sysdeps/unix/sysv/sysv4/linux/i386/sysdep.S b/sysdeps/unix/sysv/linux/i386/sysdep.S
index 5cf29ec0cf..b873c958bb 100644
--- a/sysdeps/unix/sysv/sysv4/linux/i386/sysdep.S
+++ b/sysdeps/unix/sysv/linux/i386/sysdep.S
@@ -20,8 +20,21 @@ Cambridge, MA 02139, USA. */
The code for Linux is almost identical to the canonical Unix/i386
code, except that the error number in %eax is negated. */
+.globl __syscall_error
__syscall_error:
negl %eax
#define __syscall_error __syscall_error_1
#include <sysdeps/unix/i386/sysdep.S>
+
+/* Because the Linux version is in fact i386/ELF and the start.? file
+ for this system (sysdeps/i386/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 please is here. */
+ .data
+ .globl errno
+errno:
+ .long 0
diff --git a/sysdeps/unix/sysv/linux/i386/sysdep.h b/sysdeps/unix/sysv/linux/i386/sysdep.h
new file mode 100644
index 0000000000..7fe4d414e3
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/i386/sysdep.h
@@ -0,0 +1,135 @@
+/* Copyright (C) 1992, 1993, 1995 Free Software Foundation, Inc.
+This file is part of the GNU C Library.
+Contributed by Ulrich Drepper, <drepper@gnu.ai.mit.edu>, August 1995.
+
+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., 675 Mass Ave,
+Cambridge, MA 02139, USA. */
+
+/* In the Linux/ELF world, C symbols are asm symbols. */
+#define NO_UNDERSCORES
+
+/* There is some commonality. */
+#include <sysdeps/unix/i386/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. */
+#undef SYS_ify
+#ifdef __STDC__
+# define SYS_ify(syscall_name) __NR_##syscall_name
+#else
+# define SYS_ify(syscall_name) __NR_/**/syscall_name
+#endif
+
+
+#ifdef ASSEMBLER
+
+/* Linux uses a negative return value to indicate syscall errors, unlike
+ most Unices, which use the condition codes' carry flag. */
+#undef PSEUDO
+#define PSEUDO(name, syscall_name, args) \
+ .text; \
+ .globl syscall_error; \
+ ENTRY (name) \
+ movl $SYS_ify (syscall_name), %eax; \
+ DO_CALL (args); \
+ testl %eax, %eax; \
+ jl JUMPTARGET (syscall_error)
+
+/* We define our own ENTRY macro because the alignment should be 16 for ELF. */
+#undef ENTRY
+#define ENTRY(name) \
+ ASM_GLOBAL_DIRECTIVE C_SYMBOL_NAME (name); \
+ ASM_TYPE_DIRECTIVE (C_SYMBOL_NAME (name), @function) \
+ .align 16; \
+ C_LABEL (name)
+
+/* Linux takes system call arguments in registers:
+
+ syscall number %eax call-clobbered
+ arg 1 %ebx call-saved
+ arg 2 %ecx call-clobbered
+ arg 3 %edx call-clobbered
+ arg 4 %esi call-saved
+ arg 5 %edi call-saved
+
+ The stack layout upon entering the function is:
+
+ 20(%esp) Arg# 5
+ 16(%esp) Arg# 4
+ 12(%esp) Arg# 3
+ 8(%esp) Arg# 2
+ 4(%esp) Arg# 1
+ (%esp) Return address
+
+ (Of course a function with say 3 arguments does not have entries for
+ arguments 4 and 5.)
+
+ The following code tries hard to be optimal. A general assuption
+ (which is true accoriding to the data books I have) is that
+
+ 2 * xchg is more expensive than pushl + movl + popl
+
+ Beside this a neat trick is used. The calling conventions for Linux
+ tell that among the registers used for parameters %ecx and %edx need
+ not be saved. Beside this we may clobber this registers even when
+ they are not used for parameter passing.
+
+ As a result one can see below that we save the content of the %ebx
+ register in the %edx register when we have less than 3 arguments
+ (2 * movl is less expensive than pushl + popl).
+
+ Second unlike for the other registers we don't save the content of
+ %ecx and %edx when we have than 1 and 2 registers resp. */
+
+#undef DO_CALL
+#define DO_CALL(args) \
+ DOARGS_##args \
+ int $0x80; \
+ UNDOARGS_##args
+
+#define DOARGS_0 /* No arguments to frob. */
+#define UNDOARGS_0 /* No arguments to unfrob. */
+#define _DOARGS_0(n) /* No arguments to frob. */
+#define _UNDOARGS_0 /* No arguments to unfrob. */
+
+#define DOARGS_1 movl %ebx, %edx; movl 4(%esp), %ebx; DOARGS_0
+#define UNDOARGS_1 UNDOARGS_0; movl %edx, %ebx
+#define _DOARGS_1(n) pushl %ebx; movl n+4(%esp), %ebx; _DOARGS_0 (n)
+#define _UNDOARGS_1 _UNDOARGS_0; popl %ebx
+
+#define DOARGS_2 movl 8(%esp), %ecx; DOARGS_1
+#define UNDOARGS_2 UNDOARGS_1
+#define _DOARGS_2(n) movl n(%esp), %ecx; _DOARGS_1 (n-4)
+#define _UNDOARGS_2 _UNDOARGS_1
+
+#define DOARGS_3 _DOARGS_3 (12)
+#define UNDOARGS_3 _UNDOARGS_3
+#define _DOARGS_3(n) movl n(%esp), %edx; _DOARGS_2 (n-4)
+#define _UNDOARGS_3 _UNDOARGS_2
+
+#define DOARGS_4 _DOARGS_4 (16)
+#define UNDOARGS_4 _UNDOARGS_4
+#define _DOARGS_4(n) pushl %esi; movl n+4(%esp), %esi; _DOARGS_3 (n)
+#define _UNDOARGS_4 _UNDOARGS_3; popl %esi
+
+#define DOARGS_5 _DOARGS_5 (20)
+#define UNDOARGS_5 _UNDOARGS_5
+#define _DOARGS_5(n) pushl %edi; movl n+4(%esp), %edi; _DOARGS_4 (n)
+#define _UNDOARGS_5 _UNDOARGS_4; popl %edi
+
+
+#endif /* ASSEMBLER */
diff --git a/sysdeps/unix/sysv/linux/i386/xmknod.S b/sysdeps/unix/sysv/linux/i386/xmknod.S
new file mode 100644
index 0000000000..fde3165d01
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/i386/xmknod.S
@@ -0,0 +1,49 @@
+/* Copyright (C) 1995 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., 675 Mass Ave,
+Cambridge, MA 02139, USA. */
+
+#include <sysdep.h>
+#include <errnos.h>
+
+.globl syscall_error
+ENTRY (__xmknod)
+ popl %ecx /* Pop return address into %eax. */
+ popl %edx /* Pop version number into %edx. */
+ pushl %ecx /* Push back the return address. */
+
+ movl $SYS_ify(mknod), %eax
+ /* Load syscall number for prev_stat in %eax. */
+ cmpl $1, %edx /* Version 1 xstat call? */
+ je .L1 /* Yes, do syscall. */
+
+ movl $-EINVAL, %eax /* Load error code into %eax. */
+ jmp .L2
+
+.L1: DO_CALL (3) /* Do the syscall. */
+
+ movl (%esp), %ecx
+ testl %eax, %eax /* Check for error. */
+ jl .L2
+
+ jmp *%ecx /* Return success. */
+
+.L2: pushl %ecx
+ jmp JUMPTARGET(syscall_error)
+ /* Yes, then branch to error handling. */
+
+/* For compatibility with Linux libc. */
+weak_alias (__xmknod, _xmknod)
diff --git a/sysdeps/unix/sysv/linux/i386/xstat.S b/sysdeps/unix/sysv/linux/i386/xstat.S
new file mode 100644
index 0000000000..34822beda6
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/i386/xstat.S
@@ -0,0 +1,51 @@
+/* Copyright (C) 1995 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., 675 Mass Ave,
+Cambridge, MA 02139, USA. */
+
+#include <sysdep.h>
+#include <errnos.h>
+
+#define SYS_expand(name) SYS_ify(name)
+
+.globl syscall_error
+ENTRY (__xstat)
+ popl %ecx /* Pop return address into %eax. */
+ popl %edx /* Pop version number into %edx. */
+ pushl %ecx /* Push back the return address. */
+
+ movl $SYS_expand(stat), %eax
+ /* Load syscall number for prev_stat in %eax. */
+ cmpl $1, %edx /* Version 1 xstat call? */
+ je .L1 /* Yes, do syscall. */
+
+ movl $-EINVAL, %eax /* Load error code into %eax. */
+ jmp .L2
+
+.L1: DO_CALL (2) /* Do the syscall. */
+
+ movl (%esp), %ecx
+ testl %eax, %eax /* Check for error. */
+ jl .L2
+
+ jmp *%ecx /* Return success. */
+
+.L2: pushl %ecx
+ jmp JUMPTARGET(syscall_error)
+ /* Yes, then branch to error handling. */
+
+/* For compatibility with Linux libc. */
+weak_alias (__xstat, _xstat)
diff --git a/sysdeps/unix/sysv/sysv4/linux/listen.S b/sysdeps/unix/sysv/linux/listen.S
index d2cbec60a0..d2cbec60a0 100644
--- a/sysdeps/unix/sysv/sysv4/linux/listen.S
+++ b/sysdeps/unix/sysv/linux/listen.S
diff --git a/sysdeps/unix/sysv/linux/local_lim.h b/sysdeps/unix/sysv/linux/local_lim.h
new file mode 100644
index 0000000000..bfc65bd6fd
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/local_lim.h
@@ -0,0 +1,31 @@
+/* Minimum guaranteed maximum values for system limits. Hurd version.
+
+Copyright (C) 1993, 1994 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., 675 Mass Ave,
+Cambridge, MA 02139, USA. */
+
+/* Linux has a fixed limit of supplementary groups allocated with a
+ process. This value is determined by the size of the `groups'
+ member of the `task_struct' structure in <linux/sched.h>. */
+
+#define NGROUPS_MAX 32
+
+
+/* Maximum size of file names. Not all file system types support
+ this size but it is only a maximum value. */
+
+#define NAME_MAX 255
diff --git a/sysdeps/unix/sysv/linux/madvise.c b/sysdeps/unix/sysv/linux/madvise.c
new file mode 100644
index 0000000000..72b7d76543
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/madvise.c
@@ -0,0 +1 @@
+#include <sysdeps/stub/madvise.c>
diff --git a/sysdeps/unix/sysv/linux/msgctl.c b/sysdeps/unix/sysv/linux/msgctl.c
new file mode 100644
index 0000000000..cd64d15cbe
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/msgctl.c
@@ -0,0 +1,32 @@
+/* Copyright (C) 1995 Free Software Foundation, Inc.
+This file is part of the GNU C Library.
+Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, August 1995.
+
+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/msg.h>
+
+/* Allows to control internal state and destruction of message queue
+ objects. */
+
+int
+msgctl (msqid, cmd, buf)
+ int msqid;
+ int cmd;
+ struct msqid_ds *buf;
+{
+ return __ipc (IPCOP_msgctl, msqid, cmd, 0, buf);
+}
diff --git a/sysdeps/unix/sysv/linux/msgget.c b/sysdeps/unix/sysv/linux/msgget.c
new file mode 100644
index 0000000000..b1c29d6780
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/msgget.c
@@ -0,0 +1,32 @@
+/* Copyright (C) 1995 Free Software Foundation, Inc.
+This file is part of the GNU C Library.
+Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, August 1995.
+
+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/msg.h>
+#include <stdlib.h> /* for definition of NULL */
+
+/* Return descriptor for message queue associated with KEY. The MSGFLG
+ parameter describes how to proceed with clashing of key values. */
+
+int
+msgget (key, msgflg)
+ key_t key;
+ int msgflg;
+{
+ return __ipc (IPCOP_msgget, key, msgflg, 0, NULL);
+}
diff --git a/sysdeps/unix/sysv/linux/msgrcv.c b/sysdeps/unix/sysv/linux/msgrcv.c
new file mode 100644
index 0000000000..21c6b75cac
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/msgrcv.c
@@ -0,0 +1,38 @@
+/* Copyright (C) 1995 Free Software Foundation, Inc.
+This file is part of the GNU C Library.
+Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, August 1995.
+
+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/msg.h>
+
+int
+msgrcv (msqid, msgp, msgsz, msgtyp, msgflg)
+ int msqid;
+ void *msgp;
+ size_t msgsz;
+ long msgtyp;
+ int msgflg;
+{
+ /* The problem here is that Linux' calling convention only allows up to
+ fives parameters to a system call. */
+ struct ipc_kludge tmp;
+
+ tmp.msgp = msgp;
+ tmp.msgtyp = msgtyp;
+
+ return __ipc (IPCOP_msgrcv, msqid, msgsz, msgflg, &tmp);
+}
diff --git a/sysdeps/unix/sysv/linux/msgsnd.c b/sysdeps/unix/sysv/linux/msgsnd.c
new file mode 100644
index 0000000000..6d2d3ef26b
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/msgsnd.c
@@ -0,0 +1,30 @@
+/* Copyright (C) 1995 Free Software Foundation, Inc.
+This file is part of the GNU C Library.
+Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, August 1995.
+
+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/msg.h>
+
+int
+msgsnd (msqid, msgp, msgsz, msgflg)
+ int msqid;
+ void *msgp;
+ size_t msgsz;
+ int msgflg;
+{
+ return __ipc (IPCOP_msgsnd, msqid, msgsz, msgflg, msgp);
+}
diff --git a/sysdeps/unix/sysv/linux/pipe.S b/sysdeps/unix/sysv/linux/pipe.S
new file mode 100644
index 0000000000..cd050b36e8
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/pipe.S
@@ -0,0 +1,24 @@
+/* Copyright (C) 1995 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., 675 Mass Ave,
+Cambridge, MA 02139, USA. */
+
+#include <sysdep.h>
+
+SYSCALL__ (pipe, 1)
+ ret
+
+weak_alias (__pipe, pipe)
diff --git a/sysdeps/unix/sysv/linux/poll.c b/sysdeps/unix/sysv/linux/poll.c
new file mode 100644
index 0000000000..ff43a76a63
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/poll.c
@@ -0,0 +1 @@
+#include <sysdeps/stub/poll.c>
diff --git a/sysdeps/unix/sysv/linux/readv.c b/sysdeps/unix/sysv/linux/readv.c
new file mode 100644
index 0000000000..baa976da6d
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/readv.c
@@ -0,0 +1 @@
+#include <sysdeps/posix/readv.c>
diff --git a/sysdeps/unix/sysv/linux/recv.S b/sysdeps/unix/sysv/linux/recv.S
new file mode 100644
index 0000000000..f1081cc431
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/recv.S
@@ -0,0 +1,2 @@
+#define socket recv
+#include <socket.S>
diff --git a/sysdeps/unix/sysv/linux/recvfrom.S b/sysdeps/unix/sysv/linux/recvfrom.S
new file mode 100644
index 0000000000..febaa9ef55
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/recvfrom.S
@@ -0,0 +1,2 @@
+#define socket recvfrom
+#include <socket.S>
diff --git a/sysdeps/unix/sysv/linux/recvmsg.S b/sysdeps/unix/sysv/linux/recvmsg.S
new file mode 100644
index 0000000000..ffadd30195
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/recvmsg.S
@@ -0,0 +1,2 @@
+#define socket recvmsg
+#include <socket.S>
diff --git a/sysdeps/unix/sysv/linux/semctl.c b/sysdeps/unix/sysv/linux/semctl.c
new file mode 100644
index 0000000000..dd0e7b9484
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/semctl.c
@@ -0,0 +1,33 @@
+/* Copyright (C) 1995 Free Software Foundation, Inc.
+This file is part of the GNU C Library.
+Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, August 1995.
+
+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/sem.h>
+
+/* Return identifier for array of NSEMS semaphores associated with
+ KEY. */
+
+int
+semctl (semid, semnum, cmd, arg)
+ int semid;
+ int semnum;
+ int cmd;
+ union semun arg;
+{
+ return __ipc (IPCOP_semctl, semid, semnum, cmd, &arg);
+}
diff --git a/sysdeps/unix/sysv/linux/semget.c b/sysdeps/unix/sysv/linux/semget.c
new file mode 100644
index 0000000000..6320e4720e
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/semget.c
@@ -0,0 +1,33 @@
+/* Copyright (C) 1995 Free Software Foundation, Inc.
+This file is part of the GNU C Library.
+Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, August 1995.
+
+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/sem.h>
+#include <stdlib.h> /* for definition of NULL */
+
+/* Return identifier for array of NSEMS semaphores associated with
+ KEY. */
+
+int
+semget (key, nsems, semflg)
+ key_t key;
+ int nsems;
+ int semflg;
+{
+ return __ipc (IPCOP_semget, key, nsems, semflg, NULL);
+}
diff --git a/sysdeps/unix/sysv/linux/semop.c b/sysdeps/unix/sysv/linux/semop.c
new file mode 100644
index 0000000000..57f074e90e
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/semop.c
@@ -0,0 +1,31 @@
+/* Copyright (C) 1995 Free Software Foundation, Inc.
+This file is part of the GNU C Library.
+Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, August 1995.
+
+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/sem.h>
+
+/* Perform user-defined atomical operation of array of semaphores. */
+
+int
+semop (semid, sops, nsops)
+ int semid;
+ struct sembuf *sops;
+ unsigned int nsops;
+{
+ return __ipc (IPCOP_semop, semid, (int) nsops, 0, sops);
+}
diff --git a/sysdeps/unix/sysv/linux/send.S b/sysdeps/unix/sysv/linux/send.S
new file mode 100644
index 0000000000..52293c6524
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/send.S
@@ -0,0 +1,2 @@
+#define socket send
+#include <socket.S>
diff --git a/sysdeps/unix/sysv/linux/sendmsg.S b/sysdeps/unix/sysv/linux/sendmsg.S
new file mode 100644
index 0000000000..65f2c3eb98
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/sendmsg.S
@@ -0,0 +1,2 @@
+#define socket sendmsg
+#include <socket.S>
diff --git a/sysdeps/unix/sysv/linux/sendto.S b/sysdeps/unix/sysv/linux/sendto.S
new file mode 100644
index 0000000000..aa637ce9c9
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/sendto.S
@@ -0,0 +1,2 @@
+#define socket sendto
+#include <socket.S>
diff --git a/sysdeps/unix/sysv/linux/setegid.c b/sysdeps/unix/sysv/linux/setegid.c
new file mode 100644
index 0000000000..1b29a6ffb2
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/setegid.c
@@ -0,0 +1 @@
+#include <sysdeps/unix/bsd/setegid.c>
diff --git a/sysdeps/unix/sysv/linux/seteuid.c b/sysdeps/unix/sysv/linux/seteuid.c
new file mode 100644
index 0000000000..850f3c5656
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/seteuid.c
@@ -0,0 +1,36 @@
+/* Copyright (C) 1995 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., 675 Mass Ave,
+Cambridge, MA 02139, USA. */
+
+#include <errno.h>
+#include <unistd.h>
+#include <sys/types.h>
+
+int
+__seteuid (uid)
+ uid_t uid;
+{
+ if (uid == (uid_t) ~0)
+ {
+ errno = EINVAL;
+ return -1;
+ }
+
+ return __setreuid (-1, uid);
+}
+
+weak_alias (__seteuid, seteuid)
diff --git a/sysdeps/unix/sysv/linux/sethostid.c b/sysdeps/unix/sysv/linux/sethostid.c
new file mode 100644
index 0000000000..eb71b74a1d
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/sethostid.c
@@ -0,0 +1,2 @@
+#define SET_PROCEDURE 1
+#include "gethostid.c"
diff --git a/sysdeps/unix/sysv/linux/setpgid.S b/sysdeps/unix/sysv/linux/setpgid.S
new file mode 100644
index 0000000000..ba8140fb53
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/setpgid.S
@@ -0,0 +1,22 @@
+/* Copyright (C) 1995 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., 675 Mass Ave,
+Cambridge, MA 02139, USA. */
+
+#include <sysdep.h>
+
+SYSCALL (setpgid, 2)
+ ret
diff --git a/sysdeps/unix/sysv/linux/setpgrp.c b/sysdeps/unix/sysv/linux/setpgrp.c
new file mode 100644
index 0000000000..4497e07018
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/setpgrp.c
@@ -0,0 +1,25 @@
+/* Copyright (C) 1995 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., 675 Mass Ave,
+Cambridge, MA 02139, USA. */
+
+#include <unistd.h>
+
+int
+setpgrp ()
+{
+ return setpgid (0, 0);
+}
diff --git a/sysdeps/unix/sysv/sysv4/linux/setsid.S b/sysdeps/unix/sysv/linux/setsid.S
index 4930c56dcf..4930c56dcf 100644
--- a/sysdeps/unix/sysv/sysv4/linux/setsid.S
+++ b/sysdeps/unix/sysv/linux/setsid.S
diff --git a/sysdeps/unix/sysv/linux/setsockopt.S b/sysdeps/unix/sysv/linux/setsockopt.S
new file mode 100644
index 0000000000..33d57179ca
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/setsockopt.S
@@ -0,0 +1,2 @@
+#define socket setsockopt
+#include <socket.S>
diff --git a/sysdeps/unix/sysv/linux/settimeofday.S b/sysdeps/unix/sysv/linux/settimeofday.S
new file mode 100644
index 0000000000..4f86a26ac4
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/settimeofday.S
@@ -0,0 +1,24 @@
+/* Copyright (C) 1995 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., 675 Mass Ave,
+Cambridge, MA 02139, USA. */
+
+#include <sysdep.h>
+
+SYSCALL__ (settimeofday, 2)
+ ret
+
+weak_alias (__settimeofday, settimeofday)
diff --git a/sysdeps/unix/sysv/linux/shmat.c b/sysdeps/unix/sysv/linux/shmat.c
new file mode 100644
index 0000000000..1efef29215
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/shmat.c
@@ -0,0 +1,37 @@
+/* Copyright (C) 1995 Free Software Foundation, Inc.
+This file is part of the GNU C Library.
+Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, August 1995.
+
+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/sem.h>
+
+/* Attach the shared memory segment associated with SHMID to the data
+ segment of the calling process. SHMADDR and SHMFLG determine how
+ and where the segment is attached. */
+
+char *
+shmat (shmid, shmaddr, shmflg)
+ int shmid;
+ char *shmaddr;
+ int shmflg;
+{
+ int retval;
+ unsigned long raddr;
+
+ retval = __ipc (IPCOP_shmat, shmid, shmflg, (int) &raddr, shmaddr);
+ return retval < 0 ? (char *) retval : (char *) raddr;
+}
diff --git a/sysdeps/unix/sysv/linux/shmctl.c b/sysdeps/unix/sysv/linux/shmctl.c
new file mode 100644
index 0000000000..81192a8996
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/shmctl.c
@@ -0,0 +1,31 @@
+/* Copyright (C) 1995 Free Software Foundation, Inc.
+This file is part of the GNU C Library.
+Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, August 1995.
+
+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/shm.h>
+
+/* Provide operations to control over shared memory segments. */
+
+int
+shmctl (shmid, cmd, buf)
+ int shmid;
+ int cmd;
+ struct shmid_ds *buf;
+{
+ return __ipc (IPCOP_shmctl, shmid, cmd, 0, buf);
+}
diff --git a/sysdeps/unix/sysv/linux/shmdt.c b/sysdeps/unix/sysv/linux/shmdt.c
new file mode 100644
index 0000000000..1e5bbe13b1
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/shmdt.c
@@ -0,0 +1,30 @@
+/* Copyright (C) 1995 Free Software Foundation, Inc.
+This file is part of the GNU C Library.
+Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, August 1995.
+
+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/shm.h>
+
+/* Detach shared memory segment starting at address specified by SHMADDR
+ from the caller's data segment. */
+
+int
+shmdt (shmaddr)
+ char *shmaddr;
+{
+ return __ipc (IPCOP_shmdt, 0, 0, 0, shmaddr);
+}
diff --git a/sysdeps/unix/sysv/linux/shmget.c b/sysdeps/unix/sysv/linux/shmget.c
new file mode 100644
index 0000000000..f0b2b6531d
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/shmget.c
@@ -0,0 +1,33 @@
+/* Copyright (C) 1995 Free Software Foundation, Inc.
+This file is part of the GNU C Library.
+Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, August 1995.
+
+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/shm.h>
+#include <stdlib.h> /* for definition of NULL */
+
+/* Return an identifier for an shared memory segment of at least size SIZE
+ which is associated with KEY. */
+
+int
+shmget (key, size, shmflg)
+ key_t key;
+ int size;
+ int shmflg;
+{
+ return __ipc (IPCOP_shmget, key, size, shmflg, NULL);
+}
diff --git a/sysdeps/unix/sysv/linux/shutdown.S b/sysdeps/unix/sysv/linux/shutdown.S
new file mode 100644
index 0000000000..6cc95d50f9
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/shutdown.S
@@ -0,0 +1,2 @@
+#define socket shutdown
+#include <socket.S>
diff --git a/sysdeps/unix/sysv/linux/sigaction.S b/sysdeps/unix/sysv/linux/sigaction.S
new file mode 100644
index 0000000000..0618d6ea95
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/sigaction.S
@@ -0,0 +1,24 @@
+/* Copyright (C) 1995 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., 675 Mass Ave,
+Cambridge, MA 02139, USA. */
+
+#include <sysdep.h>
+
+SYSCALL__ (sigaction, 3)
+ ret
+
+weak_alias (__sigaction, sigaction)
diff --git a/sysdeps/unix/sysv/linux/signal.S b/sysdeps/unix/sysv/linux/signal.S
new file mode 100644
index 0000000000..68582a68f7
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/signal.S
@@ -0,0 +1,8 @@
+#include <sysdeps/unix/sysv/signal.S>
+
+/* Used in siginterrupt() */
+
+ .data
+ .globl _sigintr
+_sigintr:
+ .long 0
diff --git a/sysdeps/unix/sysv/linux/sigpending.S b/sysdeps/unix/sysv/linux/sigpending.S
new file mode 100644
index 0000000000..574ea3a282
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/sigpending.S
@@ -0,0 +1 @@
+#include <sysdeps/unix/sysv/sco3.2.4/sigpending.S>
diff --git a/sysdeps/unix/sysv/linux/sigset.h b/sysdeps/unix/sysv/linux/sigset.h
new file mode 100644
index 0000000000..e9bbb9652a
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/sigset.h
@@ -0,0 +1 @@
+#include <sysdeps/generic/sigset.h>
diff --git a/sysdeps/unix/sysv/linux/sockaddrcom.h b/sysdeps/unix/sysv/linux/sockaddrcom.h
new file mode 100644
index 0000000000..768d05be35
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/sockaddrcom.h
@@ -0,0 +1,37 @@
+/* Definition of `struct sockaddr_*' common members. Generic/4.2 BSD version.
+Copyright (C) 1995 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., 675 Mass Ave,
+Cambridge, MA 02139, USA. */
+
+#ifndef _SOCKADDRCOM_H
+#define _SOCKADDRCOM_H 1
+
+/* This prevents including the file <linux/socket.h>. */
+#define _LINUX_SOCKET_H
+#define _LINUX_TYPES_H
+
+/* This macro is used to declare the initial common members
+ of the data types used for socket addresses, `struct sockaddr',
+ `struct sockaddr_in', `struct sockaddr_un', etc. */
+
+#define __SOCKADDR_COMMON(sa_prefix) \
+ unsigned short int sa_prefix##family
+
+#define __SOCKADDR_COMMON_SIZE (sizeof (unsigned short int))
+
+
+#endif /* sockaddrcom.h */
diff --git a/sysdeps/unix/sysv/sysv4/linux/socketpair.S b/sysdeps/unix/sysv/linux/socketpair.S
index da71c57dea..da71c57dea 100644
--- a/sysdeps/unix/sysv/sysv4/linux/socketpair.S
+++ b/sysdeps/unix/sysv/linux/socketpair.S
diff --git a/sysdeps/unix/sysv/linux/speed.c b/sysdeps/unix/sysv/linux/speed.c
new file mode 100644
index 0000000000..84811deba6
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/speed.c
@@ -0,0 +1,103 @@
+/* `struct termios' speed frobnication functions. Linux version.
+Copyright (C) 1991, 1992, 1993, 1995 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., 675 Mass Ave,
+Cambridge, MA 02139, USA. */
+
+#include <stddef.h>
+#include <errno.h>
+#include <termios.h>
+
+static const speed_t speeds[] =
+ {
+ 0,
+ 50,
+ 75,
+ 110,
+ 134,
+ 150,
+ 200,
+ 300,
+ 600,
+ 1200,
+ 1800,
+ 2400,
+ 4800,
+ 9600,
+ 19200,
+ 38400,
+ 38400, /* Mention this twice here is a trick. */
+ 57600,
+ 115200,
+ 230400,
+ };
+
+
+/* Return the output baud rate stored in *TERMIOS_P. */
+speed_t
+cfgetospeed (termios_p)
+ const struct termios *termios_p;
+{
+ speed_t retval = termios_p->c_cflag & (CBAUD | CBAUDEX);
+
+ if (retval & CBAUDEX)
+ {
+ retval &= ~CBAUDEX;
+ retval |= CBAUD + 1;
+ }
+
+ return retval;
+}
+
+/* Return the input baud rate stored in *TERMIOS_P.
+ For Linux there is no difference between input and output speed. */
+strong_alias (cfgetospeed, cfgetispeed);
+
+/* Set the output baud rate stored in *TERMIOS_P to SPEED. */
+int
+cfsetospeed (termios_p, speed)
+ struct termios *termios_p;
+ speed_t speed;
+{
+ register unsigned int i;
+
+ if (termios_p == NULL)
+ {
+ errno = EINVAL;
+ return -1;
+ }
+
+ /* This allows either B1200 or 1200 to work. XXX
+ Do we really want to try to support this, given that
+ fetching the speed must return one or the other? */
+
+ for (i = 0; i < sizeof (speeds) / sizeof (speeds[0]); ++i)
+ if (i == speed || speeds[i] == speed)
+ {
+ termios_p->c_cflag &= ~(CBAUD | CBAUDEX);
+ termios_p->c_cflag |= (i & CBAUD);
+ if (i & ~CBAUD)
+ termios_p->c_cflag |= CBAUDEX;
+ return 0;
+ }
+
+ errno = EINVAL;
+ return -1;
+}
+
+/* Set the input baud rate stored in *TERMIOS_P to SPEED.
+ For Linux there is no difference between input and output speed. */
+strong_alias (cfsetospeed, cfsetispeed);
diff --git a/sysdeps/unix/sysv/linux/statbuf.h b/sysdeps/unix/sysv/linux/statbuf.h
new file mode 100644
index 0000000000..ad81704ae5
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/statbuf.h
@@ -0,0 +1,72 @@
+/* Copyright (C) 1992, 1995 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., 675 Mass Ave,
+Cambridge, MA 02139, USA. */
+
+#ifndef _STATBUF_H
+#define _STATBUF_H
+
+struct stat
+ {
+ short int st_dev; /* Device. */
+ unsigned short __pad1;
+ unsigned long int st_ino; /* File serial number. */
+ unsigned short int st_mode; /* File mode. */
+ unsigned short int st_nlink; /* Link count. */
+ unsigned short int st_uid; /* User ID of the file's owner. */
+ unsigned short int st_gid; /* Group ID of the file's group.*/
+ unsigned short int st_rdev; /* Device number, if device. */
+ unsigned short int __pad2;
+ long int st_size; /* Size of file, in bytes. */
+ unsigned long int st_blksize; /* Optimal block size for I/O. */
+#define _STATBUF_ST_BLKSIZE /* Tell code we have this member. */
+
+ unsigned long int st_blocks; /* Number of 512-byte blocks allocated. */
+ long int st_atime; /* Time of last access. */
+ unsigned long int __unused1;
+ long int st_mtime; /* Time of last modification. */
+ unsigned long int __unused2;
+ long int st_ctime; /* Time of last status change. */
+ unsigned long int __unused3;
+ unsigned long int __unused4;
+ unsigned long int __unused5;
+ };
+
+/* 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. */
+
+/* These don't actually exist on System V, but having them doesn't hurt. */
+#define __S_IFLNK 0120000 /* Symbolic link. */
+#define __S_IFSOCK 0140000 /* Socket. */
+
+/* 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. */
+
+#endif /* statbuf.h */
diff --git a/sysdeps/unix/sysv/linux/stty.S b/sysdeps/unix/sysv/linux/stty.S
new file mode 100644
index 0000000000..6c04c2af38
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/stty.S
@@ -0,0 +1,22 @@
+/* Copyright (C) 1995 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., 675 Mass Ave,
+Cambridge, MA 02139, USA. */
+
+#include <sysdep.h>
+
+SYSCALL (stty, 2)
+ ret
diff --git a/sysdeps/unix/sysv/linux/sys/ipc_buf.h b/sysdeps/unix/sysv/linux/sys/ipc_buf.h
new file mode 100644
index 0000000000..767fc9ade9
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/sys/ipc_buf.h
@@ -0,0 +1,84 @@
+/* Copyright (C) 1995 Free Software Foundation, Inc.
+This file is part of the GNU C Library.
+Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, August 1995.
+
+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_IPC_BUF_H
+#define _SYS_IPC_BUF_H
+
+#include <features.h>
+#include <sys/types.h>
+
+/* Mode bits for `msgget', `semget', and `shmget'. */
+#define IPC_CREAT 01000 /* create key if key does not exist */
+#define IPC_EXCL 02000 /* fail if key exists */
+#define IPC_NOWAIT 04000 /* return error on wait */
+
+/* Control commands for `msgctl', `semctl', and `shmctl'. */
+#define IPC_RMID 0 /* remove identifier */
+#define IPC_SET 1 /* set `ipc_perm' options */
+#define IPC_STAT 2 /* get `ipc_perm' options */
+#define IPC_INFO 3 /* see ipcs */
+
+
+__BEGIN_DECLS
+
+/* Special key values. */
+#define IPC_PRIVATE ((key_t) 0) /* private key */
+
+
+/* Data structure used to pass permission information to IPC operations. */
+struct ipc_perm
+{
+ key_t __key; /* key */
+ __uid_t uid; /* owner's user ID */
+ __gid_t gid; /* owner's group ID */
+ __uid_t cuid; /* creator's user ID */
+ __gid_t cgid; /* creator's group ID */
+ __mode_t mode; /* read/write permission */
+ unsigned short int __seq; /* sequence number */
+};
+
+
+/* Kludge to work around Linux' restriction of only up to five
+ arguments to a system call. */
+struct ipc_kludge
+{
+ void *msgp;
+ long msgtyp;
+};
+
+/* The actual system call: all functions are multiplexed by this. */
+extern int __ipc __P ((int __call, int __first, int __second, int __third,
+ void *__ptr));
+
+/* 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
+
+__END_DECLS
+
+#endif /* sys/ipc_buf.h */
diff --git a/sysdeps/unix/sysv/linux/sys/mman.h b/sysdeps/unix/sysv/linux/sys/mman.h
new file mode 100644
index 0000000000..b05738d8e4
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/sys/mman.h
@@ -0,0 +1,112 @@
+/* Definitions for BSD-style memory management. Linux version.
+Copyright (C) 1994, 1995 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., 675 Mass Ave,
+Cambridge, MA 02139, USA. */
+
+/* These are the bits used by 4.4 BSD and its derivatives. On systems
+ (such as GNU) where these facilities are not system services but can be
+ emulated in the C library, these are the definitions we emulate. */
+
+#ifndef _SYS_MMAN_H
+
+#define _SYS_MMAN_H 1
+#include <features.h>
+
+#include <gnu/types.h>
+#define __need_size_t
+#include <stddef.h>
+
+
+/* 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_NONE 0x00 /* No access. */
+#define PROT_READ 0x01 /* Pages can be read. */
+#define PROT_WRITE 0x02 /* Pages can be written. */
+#define PROT_EXEC 0x04 /* Pages can be executed. */
+
+
+/* Flags contain mapping type, sharing type and options. */
+
+/* Mapping type (must choose one and only one of these). */
+#define MAP_FILE 0x0000 /* Mapped from a file or device. */
+#define MAP_ANON 0x0020 /* Allocated from anonymous virtual memory. */
+#define MAP_TYPE 0x000f /* Mask for type field. */
+
+/* Sharing types (must choose one and only one of these). */
+#define MAP_COPY MAP_PRIVATE /* Virtual copy of region at mapping time. */
+#define MAP_SHARED 0x0001 /* Share changes. */
+#define MAP_PRIVATE 0x0002 /* Changes private; copy pages on write. */
+
+/* Other flags. */
+#define MAP_FIXED 0x0010 /* Map address must be exactly as requested. */
+#define MAP_NOEXTEND 0x0000 /* For MAP_FILE, don't change file size.
+ Not available on Linux??? */
+#define MAP_HASSEMPHORE 0x0000 /* Region may contain semaphores.
+ Not available on Linux??? */
+#define MAP_INHERIT 0x0000 /* Region is retained after exec.
+ Not available on Linux??? */
+
+/* Advice to `madvise'. */
+#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. */
+
+#include <sys/cdefs.h>
+
+__BEGIN_DECLS
+/* Map addresses starting near ADDR and extending for LEN bytes. from
+ OFFSET into the file FD describes according to PROT and FLAGS. If ADDR
+ is nonzero, it is the desired mapping address. If the MAP_FIXED bit is
+ set in FLAGS, the mapping will be at ADDR exactly (which must be
+ page-aligned); otherwise the system chooses a convenient nearby address.
+ The return value is the actual mapping address chosen or (caddr_t) -1
+ for errors (in which case `errno' is set). A successful `mmap' call
+ deallocates any previous mapping for the affected region. */
+
+__caddr_t __mmap __P ((__caddr_t __addr, size_t __len,
+ int __prot, int __flags, int __fd, __off_t __offset));
+__caddr_t mmap __P ((__caddr_t __addr, size_t __len,
+ int __prot, int __flags, int __fd, __off_t __offset));
+
+/* Deallocate any mapping for the region starting at ADDR and extending LEN
+ bytes. Returns 0 if successful, -1 for errors (and sets errno). */
+int __munmap __P ((__caddr_t __addr, size_t __len));
+int munmap __P ((__caddr_t __addr, size_t __len));
+
+/* Change the memory protection of the region starting at ADDR and
+ extending LEN bytes to PROT. Returns 0 if successful, -1 for errors
+ (and sets errno). */
+int mprotect __P ((__caddr_t __addr, size_t __len, int __prot));
+
+/* Synchronize the region starting at ADDR and extending LEN bytes with the
+ file it maps. Filesystem operations on a file being mapped are
+ unpredictable before this is done. */
+int msync __P ((__caddr_t __addr, size_t __len));
+
+/* Advise the system about particular usage patterns the program follows
+ for the region starting at ADDR and extending LEN bytes. */
+int madvise __P ((__caddr_t __addr, size_t __len, int __advice));
+
+__END_DECLS
+
+
+#endif /* sys/mman.h */
diff --git a/sysdeps/unix/sysv/linux/sys/msq_buf.h b/sysdeps/unix/sysv/linux/sys/msq_buf.h
new file mode 100644
index 0000000000..92a52d515d
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/sys/msq_buf.h
@@ -0,0 +1,54 @@
+/* Copyright (C) 1995 Free Software Foundation, Inc.
+This file is part of the GNU C Library.
+Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, August 1995.
+
+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_MSQ_BUF_H
+#define _SYS_MSQ_BUF_H
+
+#include <features.h>
+#include <sys/types.h>
+
+/* 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 */
+
+
+__BEGIN_DECLS
+
+/* Structure of record for one message inside the kernel.
+ The type `struct __msg' is opaque. */
+struct msqid_ds
+{
+ struct ipc_perm msg_perm; /* structure describing operation permission */
+ struct msg *__msg_first; /* pointer to first message on queue */
+ struct msg *__msg_last; /* pointer to last message on queue */
+ __time_t msg_stime; /* time of last msgsnd command */
+ __time_t msg_rtime; /* time of last msgrcv command */
+ __time_t msg_ctime; /* time of last change */
+ struct wait_queue *__wwait; /* ??? */
+ struct wait_queue *__rwait; /* ??? */
+ unsigned short int __msg_cbytes;/* current number of bytes on queue */
+ unsigned short int msg_qnum; /* number of messages currently on queue */
+ unsigned short int msg_qbytes;/* max number of bytes allowed on queue */
+ __pid_t msg_lspid; /* pid of last msgsnd() */
+ __pid_t msg_lrpid; /* pid of last msgrcv() */
+};
+
+__END_DECLS
+
+#endif /* sys/msq_buf.h */
diff --git a/sysdeps/unix/sysv/linux/sys/sem_buf.h b/sysdeps/unix/sysv/linux/sys/sem_buf.h
new file mode 100644
index 0000000000..d93002ad6e
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/sys/sem_buf.h
@@ -0,0 +1,65 @@
+/* Copyright (C) 1995 Free Software Foundation, Inc.
+This file is part of the GNU C Library.
+Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, August 1995.
+
+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_SEM_BUF_H
+#define _SYS_SEM_BUF_H
+
+#include <features.h>
+#include <sys/types.h>
+
+/* Flags for `semop'. */
+#define SEM_UNDO 0x1000 /* undo the operation on exit */
+
+/* Commands for `semctl'. */
+#define GETPID 11 /* get sempid */
+#define GETVAL 12 /* get semval */
+#define GETALL 13 /* get all semval's */
+#define GETNCNT 14 /* get semncnt */
+#define GETZCNT 15 /* get semzcnt */
+#define SETVAL 16 /* set semval */
+#define SETALL 17 /* set all semval's */
+
+
+__BEGIN_DECLS
+
+/* Data structure describing a set of semaphores. */
+struct semid_ds
+{
+ struct ipc_perm sem_perm; /* operation permisson struct */
+ __time_t sem_otime; /* last semop() time */
+ __time_t sem_ctime; /* last time changed by semctl() */
+ struct sem *__sembase; /* ptr to first semaphore in array */
+ struct sem_queue *__sem_pending; /* pending operations */
+ struct sem_queue *__sem_pending_last; /* last pending operation */
+ struct sem_undo *__undo; /* ondo requests on this array */
+ unsigned short int sem_nsems; /* number of semaphores in set */
+};
+
+/* Union used for argument for `semctl'. */
+union semun
+{
+ int val; /* value for SETVAL */
+ struct semid_ds *buf; /* buffer for IPC_STAT & IPC_SET */
+ unsigned short int *array; /* array for GETALL & SETALL */
+ struct seminfo *__buf; /* buffer for IPC_INFO */
+};
+
+__END_DECLS
+
+#endif /* sys/sem_buf.h */
diff --git a/sysdeps/unix/sysv/linux/sys/shm_buf.h b/sysdeps/unix/sysv/linux/sys/shm_buf.h
new file mode 100644
index 0000000000..fa1e8235d8
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/sys/shm_buf.h
@@ -0,0 +1,56 @@
+/* Copyright (C) 1995 Free Software Foundation, Inc.
+This file is part of the GNU C Library.
+Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, August 1995.
+
+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_SHM_BUF_H
+#define _SYS_SHM_BUF_H
+
+#include <features.h>
+#include <sys/types.h>
+
+/* Flags for `shmat'. */
+#define SHM_RDONLY 010000 /* attach read-only else read-write */
+#define SHM_RND 020000 /* round attach address to SHMLBA */
+#define SHM_REMAP 040000 /* take-over region on attach */
+
+/* Commands for `shmctl'. */
+#define SHM_LOCK 11 /* lock segment (root only) */
+#define SHM_UNLOCK 12 /* unlock segment (root only) */
+
+
+__BEGIN_DECLS
+
+/* Data structure describing a set of semaphores. */
+struct shmid_ds
+{
+ struct ipc_perm sem_perm; /* operation permisson struct */
+ int shm_segsz; /* size of segment in bytes */
+ __time_t sem_atime; /* time of last shmat() */
+ __time_t sem_dtime; /* time of last shmdt() */
+ __time_t sem_ctime; /* time of last change by shmctl() */
+ __pid_t shm_cpid; /* pid of creator */
+ __pid_t shm_lpid; /* pid of last shmop */
+ unsigned short int shm_nattch; /* number of current attaches */
+ unsigned short int __shm_npages; /* size of segment (pages) */
+ unsigned long int *__shm_pages; /* array of ptrs to frames -> SHMMAX */
+ struct vm_area_struct *__attaches; /* descriptors for attaches */
+};
+
+__END_DECLS
+
+#endif /* sys/shm_buf.h */
diff --git a/sysdeps/unix/sysv/linux/sys/socketcall.h b/sysdeps/unix/sysv/linux/sys/socketcall.h
new file mode 100644
index 0000000000..4bfd71264c
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/sys/socketcall.h
@@ -0,0 +1,46 @@
+/* ID for functions called via socketcall system call.
+ Copyright (C) 1995 Free Software Foundation, Inc.
+
+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_SOCKETCALL_H
+#define _SYS_SOCKETCALL_H
+
+/* Define unique numbers for the operations permitted on socket. Linux
+ uses a single system call for all these functions. The relevant code
+ file is /usr/include/linux/net.h.
+ We cannot use a enum here because the values are used in assembler
+ code. */
+
+#define SOCKOP_socket 1
+#define SOCKOP_bind 2
+#define SOCKOP_connect 3
+#define SOCKOP_listen 4
+#define SOCKOP_accept 5
+#define SOCKOP_getsockname 6
+#define SOCKOP_getpeername 7
+#define SOCKOP_socketpair 8
+#define SOCKOP_send 9
+#define SOCKOP_recv 10
+#define SOCKOP_sendto 11
+#define SOCKOP_recvfrom 12
+#define SOCKOP_shutdown 13
+#define SOCKOP_setsockopt 14
+#define SOCKOP_getsockopt 15
+#define SOCKOP_sendmsg 16
+#define SOCKOP_recvmsg 17
+
+#endif
diff --git a/sysdeps/unix/sysv/linux/sys/timex.h b/sysdeps/unix/sysv/linux/sys/timex.h
new file mode 100644
index 0000000000..fad47cd607
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/sys/timex.h
@@ -0,0 +1,30 @@
+/* Copyright (C) 1995 Free Software Foundation, Inc.
+
+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_TIMEX_H
+#define _SYS_TIMEX_H
+
+#include <features.h>
+#include <linux/timex.h>
+
+__BEGIN_DECLS
+
+extern int __adjtimex __P ((struct timex *__ntx));
+
+__END_DECLS
+
+#endif /* sys/timex.h */
diff --git a/sysdeps/unix/sysv/linux/syscall.h b/sysdeps/unix/sysv/linux/syscall.h
new file mode 100644
index 0000000000..fe6cfcf84c
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/syscall.h
@@ -0,0 +1,59 @@
+/* Copyright (C) 1995 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., 675 Mass Ave,
+Cambridge, MA 02139, USA. */
+
+#ifndef _SYSCALL_H
+#define _SYSCALL_H
+
+/* This file should list the numbers of the system the system knows.
+ But instead of duplicating this we use the information available
+ from the kernel sources. */
+#include <asm/unistd.h>
+
+/* Among the system calls defined there are
+ _dup2
+ _mkdir
+ _rmdir
+ _readlink
+ _symlink
+ _rename
+ _swapon
+ _access
+ _select
+ _getgroups
+ _setgroups
+ _getitimer
+ _setitimer
+ _setdomainname
+ _getrlimit
+ _setrlimit
+ _getrusage
+ _getpriority
+ _setpriority
+ _truncate
+ _ftruncate
+ _setpgid
+ _fchmod
+ _fchdir
+ _fchown
+ _setregid
+ _setreuid
+ _vhangup
+ (This is a hack for the autoconf mechanism. Don't change a single
+ character, esp white spaces, unless you know what you are doing!) */
+
+#endif
diff --git a/sysdeps/unix/sysv/linux/sysconf.c b/sysdeps/unix/sysv/linux/sysconf.c
new file mode 100644
index 0000000000..e366d04a8b
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/sysconf.c
@@ -0,0 +1 @@
+#include <sysdeps/posix/sysconf.c>
diff --git a/sysdeps/unix/sysv/linux/tcdrain.c b/sysdeps/unix/sysv/linux/tcdrain.c
new file mode 100644
index 0000000000..67c7573cf9
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/tcdrain.c
@@ -0,0 +1,31 @@
+/* Copyright (C) 1995 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., 675 Mass Ave,
+Cambridge, MA 02139, USA. */
+
+#include <termios.h>
+#include <sys/ioctl.h>
+
+/* Wait for pending output to be written on FD. */
+int
+__tcdrain (fd)
+ int fd;
+{
+ /* With an argument of 1, TCSBRK for output to be drain. */
+ return __ioctl (fd, TCSBRK, 1);
+}
+
+weak_alias (__tcdrain, tcdrain)
diff --git a/sysdeps/unix/sysv/linux/tcflow.c b/sysdeps/unix/sysv/linux/tcflow.c
new file mode 100644
index 0000000000..5be68e2ea2
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/tcflow.c
@@ -0,0 +1 @@
+#include <sysdeps/unix/bsd/sun/sunos4/tcflow.c>
diff --git a/sysdeps/unix/sysv/linux/tcflush.c b/sysdeps/unix/sysv/linux/tcflush.c
new file mode 100644
index 0000000000..78e09b2f75
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/tcflush.c
@@ -0,0 +1 @@
+#include <sysdeps/unix/bsd/sun/sunos4/tcflush.c>
diff --git a/sysdeps/unix/sysv/linux/tcgetattr.c b/sysdeps/unix/sysv/linux/tcgetattr.c
new file mode 100644
index 0000000000..3f12348478
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/tcgetattr.c
@@ -0,0 +1,31 @@
+/* Copyright (C) 1992, 1995 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., 675 Mass Ave,
+Cambridge, MA 02139, USA. */
+
+#include <termios.h>
+#include <sys/ioctl.h>
+
+/* Put the state of FD into *TERMIOS_P. */
+int
+__tcgetattr (fd, termios_p)
+ int fd;
+ struct termios *termios_p;
+{
+ return __ioctl (fd, TCGETS, termios_p);
+}
+
+weak_alias (__tcgetattr, tcgetattr)
diff --git a/sysdeps/unix/sysv/linux/tcsetattr.c b/sysdeps/unix/sysv/linux/tcsetattr.c
new file mode 100644
index 0000000000..ef5009d1c8
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/tcsetattr.c
@@ -0,0 +1 @@
+#include <sysdeps/unix/bsd/sun/sunos4/tcsetattr.c>
diff --git a/sysdeps/unix/sysv/linux/termbits.h b/sysdeps/unix/sysv/linux/termbits.h
new file mode 100644
index 0000000000..8a71334ba0
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/termbits.h
@@ -0,0 +1,209 @@
+/* termios type and macro definitions. Linux version.
+Copyright (C) 1993, 1994, 1995 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., 675 Mass Ave,
+Cambridge, MA 02139, USA. */
+
+/* Type of terminal control flag masks. */
+typedef unsigned int tcflag_t;
+
+/* Type of control characters. */
+typedef unsigned char cc_t;
+
+/* Type of baud rate specifiers. */
+typedef unsigned int speed_t;
+
+/* Terminal control structure. */
+struct termios
+{
+ /* Input modes. */
+ tcflag_t c_iflag;
+#define IGNBRK 0x0001 /* Ignore break condition. */
+#define BRKINT 0x0002 /* Signal interrupt on break. */
+#define IGNPAR 0x0004 /* Ignore characters with parity errors. */
+#define PARMRK 0x0008 /* Mark parity and framing errors. */
+#define INPCK 0x0010 /* Enable input parity check. */
+#define ISTRIP 0x0020 /* Strip 8th bit off characters. */
+#define INLCR 0x0040 /* Map NL to CR on input. */
+#define IGNCR 0x0080 /* Ignore CR. */
+#define ICRNL 0x0100 /* Map CR to NL on input. */
+#ifdef __USE_BSD
+#define IUCLC 0x0200 /* Map upper case to lower case on input. */
+#endif
+#define IXON 0x0400 /* Enable start/stop output control. */
+#define IXOFF 0x1000 /* Enable start/stop input control. */
+#ifdef __USE_BSD
+#define IXANY 0x0800 /* Any character will restart after stop. */
+#define IMAXBEL 0x2000 /* Ring bell when input queue is full. */
+#endif
+
+ /* Output modes. */
+ tcflag_t c_oflag;
+#define OPOST 0x0001 /* Perform output processing. */
+#ifdef __USE_BSD
+#define OLCUC 0x00000002 /* Map lower case to upper case on output. */
+#define ONLCR 0x00000004 /* Map NL to CR-NL on output. */
+#define OCRNL 0x00000008
+#define ONOCR 0x00000010
+#define ONLRET 0x00000020
+#define OFILL 0x00000040
+#define OFDEL 0x00000080
+#define NLDLY 0x00000100
+#define NL0 0
+#define NL1 0x00000100
+#define CRDLY 0x00000600
+#define CR0 0
+#define CR1 0x00000200
+#define CR2 0x00000400
+#define CR3 0x00000600
+#define TABDLY 0x00001800
+#define TAB0 0
+#define TAB1 0x00000800
+#define TAB2 0x00001000
+#define XTABS 0x00001800
+#define TAB3 XTABS
+#define BSDLY 0x00002000
+#define BS0 0
+#define BS1 0x00002000
+#define VTDLY 0x00004000
+#define VT0 0
+#define VT1 0x00004000
+#define FFDLY 0x00008000
+#define FF0 0
+#define FF1 0x00008000
+#define PAGEOUT 0x00010000
+#define WRAP 0x00020000
+#endif
+
+ /* Control modes. */
+ tcflag_t c_cflag;
+#define CSIZE (CS5|CS6|CS7|CS8) /* Number of bits per byte (mask). */
+#define CS5 0 /* 5 bits per byte. */
+#define CS6 0x00000010 /* 6 bits per byte. */
+#define CS7 0x00000020 /* 7 bits per byte. */
+#define CS8 0x00000030 /* 8 bits per byte. */
+#define CSTOPB 0x00000040 /* Two stop bits instead of one. */
+#define CREAD 0x00000080 /* Enable receiver. */
+#define PARENB 0x00000100 /* Parity enable. */
+#define PARODD 0x00000200 /* Odd parity instead of even. */
+#define HUPCL 0x00000400 /* Hang up on last close. */
+#define CLOCAL 0x00000800 /* Ignore modem status lines. */
+#ifdef __USE_BSD
+#define CRTSCTS 0x08000000
+#define CBAUD 0x0000000f /* Mask for speed from c_cflag. */
+#define CBAUDEX 0x00010000 /* Mask for extended speed from c_cflag. */
+#endif
+
+ /* Input and output baud rates. These are encoded in c_cflag. */
+#define B0 0x000000000
+#define B50 0x000000001
+#define B75 0x000000002
+#define B110 0x000000003
+#define B134 0x000000004
+#define B150 0x000000005
+#define B200 0x000000006
+#define B300 0x000000007
+#define B600 0x000000008
+#define B1200 0x000000009
+#define B1800 0x00000000a
+#define B2400 0x00000000b
+#define B4800 0x00000000c
+#define B9600 0x00000000d
+#define B19200 0x00000000e
+#define B38400 0x00000000f
+#ifdef __USE_BSD
+#define EXTA 0x00000000e
+#define EXTB 0x00000000f
+#endif
+#define B57600 0x000010001
+#define B115200 0x000010002
+#define B230400 0x000010003
+
+ /* Local modes. */
+ tcflag_t c_lflag;
+#ifdef __USE_BSD
+#define ECHOKE 0x00000800 /* Visual erase for KILL. */
+#endif
+#define ECHOE 0x00000010 /* Visual erase for ERASE. */
+#define ECHOK 0x00000020 /* Echo NL after KILL. */
+#define ECHO 0x00000008 /* Enable echo. */
+#define ECHONL 0x00000040 /* Echo NL even if ECHO is off. */
+#ifdef __USE_BSD
+#define ECHOPRT 0x00000400 /* Hardcopy visual erase. */
+#define ECHOCTL 0x00000200 /* Echo control characters as ^X. */
+#endif
+#define ISIG 0x00000001 /* Enable signals. */
+#define ICANON 0x00000002 /* Do erase and kill processing. */
+#define IEXTEN 0x00008000 /* Enable DISCARD and LNEXT. */
+#define TOSTOP 0x00000100 /* Send SIGTTOU for background output. */
+#ifdef __USE_BSD
+#define PENDIN 0x00004000 /* Retype pending input (state). */
+#endif
+#define NOFLSH 0x00000080 /* Disable flush after interrupt. */
+
+ cc_t c_line; /* Line discipline (?) */
+
+ /* Control characters. */
+#define VEOF 4 /* End-of-file character [ICANON]. */
+#define VEOL 5 /* End-of-line character [ICANON]. */
+#ifdef __USE_BSD
+#define VEOL2 6 /* Second EOL character [ICANON]. */
+#define VSWTCH 7 /* ??? */
+#endif
+#define VERASE 2 /* Erase character [ICANON]. */
+#ifdef __USE_BSD
+#define VWERASE 14 /* Word-erase character [ICANON]. */
+#endif
+#define VKILL 3 /* Kill-line character [ICANON]. */
+#ifdef __USE_BSD
+#define VREPRINT 12 /* Reprint-line character [ICANON]. */
+#endif
+#define VINTR 0 /* Interrupt character [ISIG]. */
+#define VQUIT 1 /* Quit character [ISIG]. */
+#define VSUSP 10 /* Suspend character [ISIG]. */
+#ifdef __USE_BSD
+#define VDSUSP 11 /* Delayed suspend character [ISIG]. */
+#endif
+#define VSTART 8 /* Start (X-ON) character [IXON, IXOFF]. */
+#define VSTOP 9 /* Stop (X-OFF) character [IXON, IXOFF]. */
+#ifdef __USE_BSD
+#define VLNEXT 15 /* Literal-next character [IEXTEN]. */
+#define VDISCARD 13 /* Discard character [IEXTEN]. */
+#endif
+#define VMIN VEOF /* Minimum number of bytes read at once [!ICANON]. */
+#define VTIME VEOL /* Time-out value (tenths of a second) [!ICANON]. */
+#define NCCS 19
+ cc_t c_cc[NCCS];
+};
+
+#define _IOT_termios /* Hurd ioctl type field. */ \
+ _IOT (_IOTS (cflag_t), 4, _IOTS (cc_t), NCCS, _IOTS (speed_t), 2)
+
+/* Values for the OPTIONAL_ACTIONS argument to `tcsetattr'. */
+#define TCSANOW 0 /* Change immediately. */
+#define TCSADRAIN 1 /* Change when pending output is written. */
+#define TCSAFLUSH 2 /* Flush pending input before changing. */
+
+/* Values for the QUEUE_SELECTOR argument to `tcflush'. */
+#define TCIFLUSH 0 /* Discard data received but not yet read. */
+#define TCOFLUSH 1 /* Discard data written but not yet sent. */
+#define TCIOFLUSH 2 /* Discard all pending data. */
+
+/* Values for the ACTION argument to `tcflow'. */
+#define TCOOFF 0 /* Suspend output. */
+#define TCOON 1 /* Restart suspended output. */
+#define TCIOFF 2 /* Send a STOP character. */
+#define TCION 3 /* Send a START character. */
diff --git a/sysdeps/unix/sysv/linux/ualarm.c b/sysdeps/unix/sysv/linux/ualarm.c
new file mode 100644
index 0000000000..5522f58892
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/ualarm.c
@@ -0,0 +1 @@
+#include <sysdeps/unix/bsd/ualarm.c>
diff --git a/sysdeps/unix/sysv/linux/ulimit.c b/sysdeps/unix/sysv/linux/ulimit.c
new file mode 100644
index 0000000000..2b1193085a
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/ulimit.c
@@ -0,0 +1,73 @@
+/* Copyright (C) 1991, 1992, 1994, 1995 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., 675 Mass Ave,
+Cambridge, MA 02139, USA. */
+
+#include <ansidecl.h>
+#include <sysdep.h>
+#include <sys/resource.h>
+#include <unistd.h>
+#include <errno.h>
+
+/* Function depends on CMD:
+ 1 = Return the limit on the size of a file, in units of 512 bytes.
+ 2 = Set the limit on the size of a file to NEWLIMIT. Only the
+ super-user can increase the limit.
+ 3 = illegal due to shared libraries; normally is
+ (Return the maximum possible address of the data segment.)
+ 4 = Return the maximum number of files that the calling process
+ can open.
+ Returns -1 on errors. */
+long int
+__ulimit (cmd, newlimit)
+ int cmd;
+ long int newlimit;
+{
+ int status;
+
+ switch (cmd)
+ {
+ case 1:
+ {
+ /* Get limit on file size. */
+ struct rlimit fsize;
+
+ status = getrlimit(RLIMIT_FSIZE, &fsize);
+ if (status < 0)
+ return -1;
+
+ /* Convert from bytes to 512 byte units. */
+ return fsize.rlim_cur / 512;
+ }
+ case 2:
+ /* Set limit on file size. */
+ {
+ struct rlimit fsize;
+ fsize.rlim_cur = newlimit * 512;
+ fsize.rlim_max = newlimit * 512;
+
+ return setrlimit(RLIMIT_FSIZE, &fsize);
+ }
+ case 4:
+ return sysconf(_SC_OPEN_MAX);
+
+ default:
+ errno = EINVAL;
+ return -1;
+ }
+}
+
+weak_alias (__ulimit, ulimit);
diff --git a/sysdeps/unix/sysv/linux/usleep.c b/sysdeps/unix/sysv/linux/usleep.c
new file mode 100644
index 0000000000..d08c6b6594
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/usleep.c
@@ -0,0 +1 @@
+#include <sysdeps/unix/bsd/usleep.c>
diff --git a/sysdeps/unix/sysv/linux/utsnamelen.h b/sysdeps/unix/sysv/linux/utsnamelen.h
new file mode 100644
index 0000000000..c16c3852fb
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/utsnamelen.h
@@ -0,0 +1,24 @@
+/* Copyright (C) 1995 Free Software Foundation, Inc.
+
+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. */
+
+/* Length of the entries in `struct utsname' is 65. */
+#define _UTSNAME_LENGTH 65
+
+/* Linux provides as additional information in the `struct utsname'
+ the name of the current domain. Define _UTSNAME_DOMAIN_LENGTH
+ to a value != 0 to activate this entry. */
+#define _UTSNAME_DOMAIN_LENGTH _UTSNAME_LENGTH
diff --git a/sysdeps/unix/sysv/linux/vfork.c b/sysdeps/unix/sysv/linux/vfork.c
new file mode 100644
index 0000000000..9b4dd5f121
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/vfork.c
@@ -0,0 +1 @@
+#include <sysdeps/generic/vfork.c>
diff --git a/sysdeps/unix/sysv/linux/wait.c b/sysdeps/unix/sysv/linux/wait.c
new file mode 100644
index 0000000000..63cf60c64a
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/wait.c
@@ -0,0 +1 @@
+#include <sysdeps/posix/wait.c>
diff --git a/sysdeps/unix/sysv/sysv4/linux/wait4.S b/sysdeps/unix/sysv/linux/wait4.S
index e4c322341d..e4c322341d 100644
--- a/sysdeps/unix/sysv/sysv4/linux/wait4.S
+++ b/sysdeps/unix/sysv/linux/wait4.S
diff --git a/sysdeps/unix/sysv/linux/waitpid.c b/sysdeps/unix/sysv/linux/waitpid.c
new file mode 100644
index 0000000000..d4ee06bf1b
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/waitpid.c
@@ -0,0 +1,32 @@
+/* Copyright (C) 1991, 1992, 1995 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., 675 Mass Ave,
+Cambridge, MA 02139, USA. */
+
+#include <sysdep.h>
+#include <stdlib.h>
+#include <sys/wait.h>
+
+__pid_t
+__waitpid (pid, stat_loc, options)
+ __pid_t pid;
+ int *stat_loc;
+ int options;
+{
+ return __wait4 (pid, stat_loc, options, NULL);
+}
+
+weak_alias (__waitpid, waitpid)
diff --git a/sysdeps/unix/sysv/linux/writev.c b/sysdeps/unix/sysv/linux/writev.c
new file mode 100644
index 0000000000..0dc6a76014
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/writev.c
@@ -0,0 +1 @@
+#include <sysdeps/posix/writev.c>
diff --git a/sysdeps/unix/sysv/sysv4/linux/i386/sysdep.h b/sysdeps/unix/sysv/sysv4/linux/i386/sysdep.h
deleted file mode 100644
index d0c1c10dba..0000000000
--- a/sysdeps/unix/sysv/sysv4/linux/i386/sysdep.h
+++ /dev/null
@@ -1,86 +0,0 @@
-/* Copyright (C) 1992, 1993, 1995 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., 675 Mass Ave,
-Cambridge, MA 02139, USA. */
-
-/* In the Linux/ELF world, C symbols are asm symbols. */
-#define NO_UNDERSCORES
-
-/* There is some commonality. */
-#include <sysdeps/unix/i386/sysdep.h>
-
-#ifdef ASSEMBLER
-
-/* Linux uses a negative return value to indicate syscall errors, unlike
- most Unices, which use the condition codes' carry flag. */
-#undef PSEUDO
-#define PSEUDO(name, syscall_name, args) \
- .text; \
- .globl __syscall_error; \
- ENTRY (name) \
- movl $SYS_##syscall_name, %eax; \
- DO_CALL (args) \
- testl %eax, %eax; \
- jl JUMPTARGET(__syscall_error)
-
-
-/* Linux takes system call arguments in registers:
-
- syscall number %eax call-clobbered
- arg 1 %ebx call-saved
- arg 2 %ecx call-clobbered
- arg 3 %edx call-clobbered
- arg 4 %esi call-saved
- arg 5 %edi call-saved
-
- The stack layout upon entering the function is:
-
- 24(%esp) Arg# 5
- 20(%esp) Arg# 4
- 16(%esp) Arg# 3
- 12(%esp) Arg# 2
- 8(%esp) Arg# 1
- 4(%esp) Return address
- (%esp)
-
- (Of course a function with e.g. 3 argumentS does not have entries for
- arguments 4 and 5.)
-
- We put the arguments into registers from the stack, and save the
- call-saved registers, by using the 386 `xchg' instruction to swap the
- values in both directions. */
-
-#undef DO_CALL
-#define DO_CALL(args) \
- DOARGS_##args \
- int $0x80; \
- UNDOARGS_##args \
-
-#define DOARGS_0 /* No arguments to frob. */
-#define UNDOARGS_0 /* No arguments to unfrob. */
-#define DOARGS_1 xchg 8(%esp), %ebx; DOARGS_0 /* Save %ebx on stack. */
-#define UNDOARGS_1 xchg 8(%esp), %ebx; UNDOARGS_0 /* Restore %ebx */
-#define DOARGS_2 movel 12(%esp), %ecx; DOARGS_1
-#define UNDOARGS_2 UNDOARGS_1 /* %ecx is clobbered. */
-#define DOARGS_3 movel 16(%esp), %edx; DOARGS_2
-#define UNDOARGS_3 UNDOARGS_2 /* %edx is clobbered. */
-#define DOARGS_4 xchg 20(%esp), %esi; DOARGS_3 /* Save %esi on stack. */
-#define UNDOARGS_4 xchg 20(%esp), %esi; UNDOARGS_3 /* Restore %esi. */
-#define DOARGS_5 xchg 24(%esp), %edi; DOARGS_3 /* Save %edi on stack. */
-#define UNDOARGS_5 xchg 24(%esp), %edi; UNDOARGS_3 /* Restore %edi. */
-
-
-#endif /* ASSEMBLER */
diff --git a/sysdeps/unix/sysv/sysv4/linux/rename.S b/sysdeps/unix/sysv/sysv4/linux/rename.S
deleted file mode 100644
index a5a8dfeeef..0000000000
--- a/sysdeps/unix/sysv/sysv4/linux/rename.S
+++ /dev/null
@@ -1 +0,0 @@
-#include <sysdeps/unix/bsd/rename.S>