aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoland McGrath <roland@gnu.org>1995-02-18 01:27:10 +0000
committerRoland McGrath <roland@gnu.org>1995-02-18 01:27:10 +0000
commit28f540f45bbacd939bfd07f213bcad2bf730b1bf (patch)
tree15f07c4c43d635959c6afee96bde71fb1b3614ee /sysdeps/unix/sysv
downloadglibc-28f540f45bbacd939bfd07f213bcad2bf730b1bf.tar.gz
glibc-28f540f45bbacd939bfd07f213bcad2bf730b1bf.tar.bz2
glibc-28f540f45bbacd939bfd07f213bcad2bf730b1bf.zip
initial import
Diffstat (limited to 'sysdeps/unix/sysv')
-rw-r--r--sysdeps/unix/sysv/Dist3
-rw-r--r--sysdeps/unix/sysv/Makefile42
-rw-r--r--sysdeps/unix/sysv/alarm.S22
-rw-r--r--sysdeps/unix/sysv/direct.h10
-rw-r--r--sysdeps/unix/sysv/fcntlbits.h86
-rw-r--r--sysdeps/unix/sysv/getdents.c37
-rw-r--r--sysdeps/unix/sysv/gethostname.c38
-rw-r--r--sysdeps/unix/sysv/i386/linux/socket.S55
-rw-r--r--sysdeps/unix/sysv/i386/linux/sysdep.S38
-rw-r--r--sysdeps/unix/sysv/i386/linux/sysdep.h57
-rw-r--r--sysdeps/unix/sysv/i386/linux/wait.S31
-rw-r--r--sysdeps/unix/sysv/i386/signal.S31
-rw-r--r--sysdeps/unix/sysv/i386/sigreturn.S27
-rw-r--r--sysdeps/unix/sysv/i386/sysdep.h4
-rw-r--r--sysdeps/unix/sysv/i386/time.S26
-rw-r--r--sysdeps/unix/sysv/irix4/Dist2
-rw-r--r--sysdeps/unix/sysv/irix4/Implies4
-rw-r--r--sysdeps/unix/sysv/irix4/Makefile25
-rw-r--r--sysdeps/unix/sysv/irix4/__handler.S116
-rw-r--r--sysdeps/unix/sysv/irix4/confname.h80
-rw-r--r--sysdeps/unix/sysv/irix4/direct.h15
-rw-r--r--sysdeps/unix/sysv/irix4/dup2.c3
-rw-r--r--sysdeps/unix/sysv/irix4/fcntlbits.h98
-rw-r--r--sysdeps/unix/sysv/irix4/fpathconf.c34
-rw-r--r--sysdeps/unix/sysv/irix4/getgroups.c33
-rw-r--r--sysdeps/unix/sysv/irix4/getpgid.S24
-rw-r--r--sysdeps/unix/sysv/irix4/getpriority.c46
-rw-r--r--sysdeps/unix/sysv/irix4/getrusage.c35
-rw-r--r--sysdeps/unix/sysv/irix4/gettimeofday.c1
-rw-r--r--sysdeps/unix/sysv/irix4/msync.S1
-rw-r--r--sysdeps/unix/sysv/irix4/pathconf.c34
-rw-r--r--sysdeps/unix/sysv/irix4/readv.c1
-rw-r--r--sysdeps/unix/sysv/irix4/reboot.c1
-rw-r--r--sysdeps/unix/sysv/irix4/setgroups.c31
-rw-r--r--sysdeps/unix/sysv/irix4/setpgid.S25
-rw-r--r--sysdeps/unix/sysv/irix4/setpriority.c41
-rw-r--r--sysdeps/unix/sysv/irix4/signal.S22
-rw-r--r--sysdeps/unix/sysv/irix4/signum.h67
-rw-r--r--sysdeps/unix/sysv/irix4/sigreturn.S25
-rw-r--r--sysdeps/unix/sysv/irix4/sigtramp.c54
-rw-r--r--sysdeps/unix/sysv/irix4/start.c68
-rw-r--r--sysdeps/unix/sysv/irix4/statbuf.h61
-rw-r--r--sysdeps/unix/sysv/irix4/swapon.c1
-rw-r--r--sysdeps/unix/sysv/irix4/sys/mman.h101
-rw-r--r--sysdeps/unix/sysv/irix4/sysconf.c35
-rw-r--r--sysdeps/unix/sysv/irix4/sysmp.S22
-rw-r--r--sysdeps/unix/sysv/irix4/syssgi.S22
-rw-r--r--sysdeps/unix/sysv/irix4/time.S1
-rw-r--r--sysdeps/unix/sysv/irix4/uname.S26
-rw-r--r--sysdeps/unix/sysv/irix4/wait.S42
-rw-r--r--sysdeps/unix/sysv/irix4/wait3.S1
-rw-r--r--sysdeps/unix/sysv/irix4/waitpid.c1
-rw-r--r--sysdeps/unix/sysv/irix4/writev.c1
-rw-r--r--sysdeps/unix/sysv/isc2.2/rename.S1
-rw-r--r--sysdeps/unix/sysv/isc3/direct.h1
-rw-r--r--sysdeps/unix/sysv/linux/Implies2
-rw-r--r--sysdeps/unix/sysv/linux/accept.S2
-rw-r--r--sysdeps/unix/sysv/linux/bind.S2
-rw-r--r--sysdeps/unix/sysv/linux/connect.S2
-rw-r--r--sysdeps/unix/sysv/linux/getpeername.S2
-rw-r--r--sysdeps/unix/sysv/linux/getpgrp.S22
-rw-r--r--sysdeps/unix/sysv/linux/getsockname.S2
-rw-r--r--sysdeps/unix/sysv/linux/listen.S2
-rw-r--r--sysdeps/unix/sysv/linux/rename.S1
-rw-r--r--sysdeps/unix/sysv/linux/setsid.S1
-rw-r--r--sysdeps/unix/sysv/linux/socketpair.S2
-rw-r--r--sysdeps/unix/sysv/linux/syscall.h124
-rw-r--r--sysdeps/unix/sysv/linux/wait4.S1
-rw-r--r--sysdeps/unix/sysv/linux/waitpid.S24
-rw-r--r--sysdeps/unix/sysv/local_lim.h32
-rw-r--r--sysdeps/unix/sysv/minix/sigaction.h49
-rw-r--r--sysdeps/unix/sysv/mkdir.c97
-rw-r--r--sysdeps/unix/sysv/nice.S22
-rw-r--r--sysdeps/unix/sysv/pause.S22
-rw-r--r--sysdeps/unix/sysv/poll.S22
-rw-r--r--sysdeps/unix/sysv/rmdir.c78
-rw-r--r--sysdeps/unix/sysv/s_getdents.S22
-rw-r--r--sysdeps/unix/sysv/sco3.2.4/Dist2
-rw-r--r--sysdeps/unix/sysv/sco3.2.4/Makefile3
-rw-r--r--sysdeps/unix/sysv/sco3.2.4/__setpgid.c30
-rw-r--r--sysdeps/unix/sysv/sco3.2.4/confname.h50
-rw-r--r--sysdeps/unix/sysv/sco3.2.4/direct.h22
-rw-r--r--sysdeps/unix/sysv/sco3.2.4/getgroups.c45
-rw-r--r--sysdeps/unix/sysv/sco3.2.4/getpgid.c1
-rw-r--r--sysdeps/unix/sysv/sco3.2.4/pathconf.S24
-rw-r--r--sysdeps/unix/sysv/sco3.2.4/pgrpsys.S1
-rw-r--r--sysdeps/unix/sysv/sco3.2.4/pipestream.c3
-rw-r--r--sysdeps/unix/sysv/sco3.2.4/sco_getgrp.S22
-rw-r--r--sysdeps/unix/sysv/sco3.2.4/setpgid.c1
-rw-r--r--sysdeps/unix/sysv/sco3.2.4/setsid.c1
-rw-r--r--sysdeps/unix/sysv/sco3.2.4/sigaction.S29
-rw-r--r--sysdeps/unix/sysv/sco3.2.4/sigaction.h39
-rw-r--r--sysdeps/unix/sysv/sco3.2.4/sigpending.S22
-rw-r--r--sysdeps/unix/sysv/sco3.2.4/sigprocmask.S24
-rw-r--r--sysdeps/unix/sysv/sco3.2.4/sigsuspend.S1
-rw-r--r--sysdeps/unix/sysv/sco3.2.4/syscall.h107
-rw-r--r--sysdeps/unix/sysv/sco3.2.4/sysconf.S30
-rw-r--r--sysdeps/unix/sysv/sco3.2.4/system.c10
-rw-r--r--sysdeps/unix/sysv/sco3.2.4/uname.S42
-rw-r--r--sysdeps/unix/sysv/sco3.2.4/waitpid.S36
-rw-r--r--sysdeps/unix/sysv/sco3.2/Dist1
-rw-r--r--sysdeps/unix/sysv/sco3.2/Makefile23
-rw-r--r--sysdeps/unix/sysv/sco3.2/__fltused.c3
-rw-r--r--sysdeps/unix/sysv/sco3.2/local_lim.h37
-rw-r--r--sysdeps/unix/sysv/setrlimit.c58
-rw-r--r--sysdeps/unix/sysv/settimeofday.c47
-rw-r--r--sysdeps/unix/sysv/sigaction.c83
-rw-r--r--sysdeps/unix/sysv/signal.S22
-rw-r--r--sysdeps/unix/sysv/signum.h56
-rw-r--r--sysdeps/unix/sysv/statbuf.h61
-rw-r--r--sysdeps/unix/sysv/stime.S22
-rw-r--r--sysdeps/unix/sysv/sysd-stdio.c2
-rw-r--r--sysdeps/unix/sysv/sysv4/Dist7
-rw-r--r--sysdeps/unix/sysv/sysv4/Implies3
-rw-r--r--sysdeps/unix/sysv/sysv4/Makefile36
-rw-r--r--sysdeps/unix/sysv/sysv4/__getpgid.c31
-rw-r--r--sysdeps/unix/sysv/sysv4/__setpgid.c31
-rw-r--r--sysdeps/unix/sysv/sysv4/__waitid.S25
-rw-r--r--sysdeps/unix/sysv/sysv4/dup2.c4
-rw-r--r--sysdeps/unix/sysv/sysv4/fchdir.S2
-rw-r--r--sysdeps/unix/sysv/sysv4/ftruncate.c37
-rw-r--r--sysdeps/unix/sysv/sysv4/getdtsz.c2
-rw-r--r--sysdeps/unix/sysv/sysv4/gethostname.c33
-rw-r--r--sysdeps/unix/sysv/sysv4/getpagesize.c2
-rw-r--r--sysdeps/unix/sysv/sysv4/getpgid.c33
-rw-r--r--sysdeps/unix/sysv/sysv4/i386/Dist1
-rw-r--r--sysdeps/unix/sysv/sysv4/i386/Makefile3
-rw-r--r--sysdeps/unix/sysv/sysv4/i386/fstat.S37
-rw-r--r--sysdeps/unix/sysv/sysv4/i386/lstat.S37
-rw-r--r--sysdeps/unix/sysv/sysv4/i386/mknod.S36
-rw-r--r--sysdeps/unix/sysv/sysv4/i386/stat.S37
-rw-r--r--sysdeps/unix/sysv/sysv4/i386/statbuf.h84
-rw-r--r--sysdeps/unix/sysv/sysv4/i386/sys-sig.S30
-rw-r--r--sysdeps/unix/sysv/sysv4/i386/sysdep.h38
-rw-r--r--sysdeps/unix/sysv/sysv4/i386/vfork.S1
-rw-r--r--sysdeps/unix/sysv/sysv4/pgrpsys.S22
-rw-r--r--sysdeps/unix/sysv/sysv4/pipestream.c2
-rw-r--r--sysdeps/unix/sysv/sysv4/setegid.S2
-rw-r--r--sysdeps/unix/sysv/sysv4/seteuid.S2
-rw-r--r--sysdeps/unix/sysv/sysv4/sethostname.c31
-rw-r--r--sysdeps/unix/sysv/sysv4/setpgid.c35
-rw-r--r--sysdeps/unix/sysv/sysv4/setsid.c34
-rw-r--r--sysdeps/unix/sysv/sysv4/sigaction.c79
-rw-r--r--sysdeps/unix/sysv/sysv4/sigaction.h51
-rw-r--r--sysdeps/unix/sysv/sysv4/sigaltstack.S2
-rw-r--r--sysdeps/unix/sysv/sysv4/siginfo.h58
-rw-r--r--sysdeps/unix/sysv/sysv4/signum.h66
-rw-r--r--sysdeps/unix/sysv/sysv4/sigprocmask.S24
-rw-r--r--sysdeps/unix/sysv/sysv4/sigset.h97
-rw-r--r--sysdeps/unix/sysv/sysv4/sigsuspend.S22
-rw-r--r--sysdeps/unix/sysv/sysv4/solaris2/Makefile6
-rw-r--r--sysdeps/unix/sysv/sysv4/solaris2/direct.h39
-rw-r--r--sysdeps/unix/sysv/sysv4/solaris2/fsync.S29
-rw-r--r--sysdeps/unix/sysv/sysv4/solaris2/signum.h73
-rw-r--r--sysdeps/unix/sysv/sysv4/solaris2/sparc/Dist1
-rw-r--r--sysdeps/unix/sysv/sysv4/solaris2/sparc/Makefile5
-rw-r--r--sysdeps/unix/sysv/sysv4/solaris2/sparc/start.c4
-rw-r--r--sysdeps/unix/sysv/sysv4/solaris2/sparc/sys-sig.S25
-rw-r--r--sysdeps/unix/sysv/sysv4/solaris2/sparc/sysdep.S46
-rw-r--r--sysdeps/unix/sysv/sysv4/solaris2/sparc/sysdep.h51
-rw-r--r--sysdeps/unix/sysv/sysv4/solaris2/statbuf.h82
-rw-r--r--sysdeps/unix/sysv/sysv4/solaris2/utimes.S2
-rw-r--r--sysdeps/unix/sysv/sysv4/sysconf.c181
-rw-r--r--sysdeps/unix/sysv/sysv4/sysconfig.S22
-rw-r--r--sysdeps/unix/sysv/sysv4/sysconfig.h28
-rw-r--r--sysdeps/unix/sysv/sysv4/sysinfo.S22
-rw-r--r--sysdeps/unix/sysv/sysv4/system.c2
-rw-r--r--sysdeps/unix/sysv/sysv4/time.S22
-rw-r--r--sysdeps/unix/sysv/sysv4/utsnamelen.h1
-rw-r--r--sysdeps/unix/sysv/sysv4/waitflags.h34
-rw-r--r--sysdeps/unix/sysv/sysv4/waitpid.c120
-rw-r--r--sysdeps/unix/sysv/sysv_termio.h155
-rw-r--r--sysdeps/unix/sysv/tcdrain.c33
-rw-r--r--sysdeps/unix/sysv/tcflow.c46
-rw-r--r--sysdeps/unix/sysv/tcflush.c44
-rw-r--r--sysdeps/unix/sysv/tcgetattr.c171
-rw-r--r--sysdeps/unix/sysv/tcgetpgrp.c35
-rw-r--r--sysdeps/unix/sysv/tcsendbrk.c43
-rw-r--r--sysdeps/unix/sysv/tcsetattr.c208
-rw-r--r--sysdeps/unix/sysv/tcsetpgrp.c31
-rw-r--r--sysdeps/unix/sysv/times.S24
-rw-r--r--sysdeps/unix/sysv/ulimit.S22
-rw-r--r--sysdeps/unix/sysv/uname.S22
-rw-r--r--sysdeps/unix/sysv/utime.S22
-rw-r--r--sysdeps/unix/sysv/utmp.h23
-rw-r--r--sysdeps/unix/sysv/utsnamelen.h1
186 files changed, 5954 insertions, 0 deletions
diff --git a/sysdeps/unix/sysv/Dist b/sysdeps/unix/sysv/Dist
new file mode 100644
index 0000000000..f70fcf6728
--- /dev/null
+++ b/sysdeps/unix/sysv/Dist
@@ -0,0 +1,3 @@
+sysv_termio.h
+utmp.h
+s_getdents.S
diff --git a/sysdeps/unix/sysv/Makefile b/sysdeps/unix/sysv/Makefile
new file mode 100644
index 0000000000..b40766035d
--- /dev/null
+++ b/sysdeps/unix/sysv/Makefile
@@ -0,0 +1,42 @@
+# Copyright (C) 1992, 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.
+
+ifeq ($(subdir), misc)
+
+sysdep_headers := $(sysdep_headers) termio.h
+generated := $(generated) termio.h
+
+# termio.h is just like sysv_termio.h except it uses the same names for
+# everything that System V termio does. sysv_termio.h is necessary to
+# include in __tcgetatr.c et al, because some of the names in termio.h
+# conflict with termios.h. The C library doesn't actually use termio.h,
+# but we generate it for those application programs which use it.
+$(objpfx)termio.h: $(..)sysdeps/unix/sysv/sysv_termio.h
+ sed < $< > $@-tmp \
+ -e 's/_SYSV_//' \
+ -e 's/^#define[ ]*_T/#define T/'\
+ -e 's/__sysv_termio/termio/'
+ mv $@-tmp $@
+
+endif
+
+ifeq ($(subdir),dirent)
+
+sysdep_routines := $(sysdep_routines) s_getdents
+
+endif
diff --git a/sysdeps/unix/sysv/alarm.S b/sysdeps/unix/sysv/alarm.S
new file mode 100644
index 0000000000..6c002d4ccb
--- /dev/null
+++ b/sysdeps/unix/sysv/alarm.S
@@ -0,0 +1,22 @@
+/* Copyright (C) 1991, 1992 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 (alarm, 1)
+ ret
diff --git a/sysdeps/unix/sysv/direct.h b/sysdeps/unix/sysv/direct.h
new file mode 100644
index 0000000000..dc1d77beed
--- /dev/null
+++ b/sysdeps/unix/sysv/direct.h
@@ -0,0 +1,10 @@
+struct direct
+ {
+ unsigned short int d_fileno;
+ char d_name[14];
+ };
+
+#define D_NAMLEN(d) \
+ ((d)->d_name[13] == '\0' ? strlen ((d)->d_name) : 14)
+
+#define D_RECLEN(d) (sizeof (*(d)))
diff --git a/sysdeps/unix/sysv/fcntlbits.h b/sysdeps/unix/sysv/fcntlbits.h
new file mode 100644
index 0000000000..d7dbd0c20a
--- /dev/null
+++ b/sysdeps/unix/sysv/fcntlbits.h
@@ -0,0 +1,86 @@
+/* O_*, F_*, FD_* bit values for System V.
+Copyright (C) 1991, 1992 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 _FCNTLBITS_H
+
+#define _FCNTLBITS_H 1
+
+
+/* File access modes for `open' and `fcntl'. */
+#define O_RDONLY 0 /* Open read-only. */
+#define O_WRONLY 1 /* Open write-only. */
+#define O_RDWR 2 /* Open read/write. */
+
+
+/* Bits OR'd into the second argument to open. */
+#define O_CREAT 00400 /* Create file if it doesn't exist. */
+#define O_EXCL 02000 /* Fail if file already exists. */
+#define O_TRUNC 01000 /* Truncate file to zero length. */
+#if defined (__USE_BSD) || defined (__USE_SVID)
+#define O_SYNC 00020 /* Synchronous writes. */
+#endif
+
+/* File status flags for `open' and `fcntl'. */
+#define O_APPEND 000010 /* Writes append to the file. */
+#define O_NONBLOCK 000004 /* Non-blocking I/O. */
+
+#ifdef __USE_BSD
+/* System V doesn't support POSIX.1 O_NONBLOCK, but O_NDELAY is close. */
+#define O_NDELAY O_NONBLOCK
+#endif
+
+/* Mask for file access modes. This is system-dependent in case
+ some system ever wants to define some other flavor of access. */
+#define O_ACCMODE (O_RDONLY|O_WRONLY|O_RDWR)
+
+/* Values for the second argument to `fcntl'. */
+#define F_DUPFD 0 /* Duplicate file descriptor. */
+#define F_GETFD 1 /* Get file descriptor flags. */
+#define F_SETFD 2 /* Set file descriptor flags. */
+#define F_GETFL 3 /* Get file status flags. */
+#define F_SETFL 4 /* Set file status flags. */
+#define F_GETLK 5 /* Get record locking info. */
+#define F_SETLK 6 /* Set record locking info. */
+#define F_SETLKW 7 /* Set record locking info, wait. */
+
+/* File descriptor flags used with F_GETFD and F_SETFD. */
+#define FD_CLOEXEC 1 /* Close on exec. */
+
+
+#include <gnu/types.h>
+
+/* The structure describing an advisory lock. This is the type of the third
+ argument to `fcntl' for the F_GETLK, F_SETLK, and F_SETLKW requests. */
+struct flock
+ {
+ short int l_type; /* Type of lock: F_RDLCK, F_WRLCK, or F_UNLCK. */
+ short int l_whence; /* Where `l_start' is relative to (like `lseek'). */
+ __off_t l_start; /* Offset where the lock begins. */
+ __off_t l_len; /* Size of the locked area; zero means until EOF. */
+ short int l_sysid; /* System ID where locking process resides. */
+ short int l_pid; /* Process holding the lock. */
+ };
+
+/* Values for the `l_type' field of a `struct flock'. */
+#define F_RDLCK 1 /* Read lock. */
+#define F_WRLCK 2 /* Write lock. */
+#define F_UNLCK 3 /* Remove lock. */
+
+
+#endif /* fcntlbits.h */
diff --git a/sysdeps/unix/sysv/getdents.c b/sysdeps/unix/sysv/getdents.c
new file mode 100644
index 0000000000..bb6c812647
--- /dev/null
+++ b/sysdeps/unix/sysv/getdents.c
@@ -0,0 +1,37 @@
+/* Copyright (C) 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 <ansidecl.h>
+#include <stddef.h>
+#include <errno.h>
+#include <sys/types.h>
+#include <unistd.h>
+
+extern int __getdents __P ((int fd, char *buf, size_t nbytes));
+
+int
+DEFUN(__getdirentries, (fd, buf, nbytes, basep),
+ int fd AND char *buf AND size_t nbytes AND off_t *basep)
+{
+ if (basep)
+ *basep = __lseek (fd, (off_t) 0, SEEK_CUR);
+
+ return __getdents (fd, buf, nbytes);
+}
+
+weak_alias (__getdirentries, getdirentries)
diff --git a/sysdeps/unix/sysv/gethostname.c b/sysdeps/unix/sysv/gethostname.c
new file mode 100644
index 0000000000..509a3da1d9
--- /dev/null
+++ b/sysdeps/unix/sysv/gethostname.c
@@ -0,0 +1,38 @@
+/* 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 <ansidecl.h>
+#include <errno.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
+DEFUN(__gethostname, (name, len),
+ char *name AND size_t len)
+{
+ struct utsname buf;
+ if (uname (&buf))
+ return -1;
+ strncpy (name, buf.nodename, len);
+ return 0;
+}
+
+weak_alias (__gethostname, gethostname)
diff --git a/sysdeps/unix/sysv/i386/linux/socket.S b/sysdeps/unix/sysv/i386/linux/socket.S
new file mode 100644
index 0000000000..9f59bad095
--- /dev/null
+++ b/sysdeps/unix/sysv/i386/linux/socket.S
@@ -0,0 +1,55 @@
+/* Copyright (C) 1991, 1992 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
+
+/* The socket-oriented system calls are handled unusally in Linux.
+ They are all gated through the single `socketcall' system call number.
+ `socketcall' takes two arguments: the first is the subcode, specifying
+ which socket function is being called; and the second is a pointer to
+ the arguments to specific function.
+
+ The .S files for the other calls just #define socket and #include this. */
+
+ENTRY (socket)
+
+ /* Save registers. */
+ pushl %ebx
+ pushl %ecx
+
+ movl $__NR_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. */
+ lea 12(%esp), %ecx /* Address of args in 2nd arg. */
+
+ /* Do the system call trap. */
+ int $0x80
+
+ /* Restore registers. */
+ popl %ecx
+ popl %ebx
+
+ /* %eax is < 0 if there was an error. */
+ testl %eax, %eax
+ jl syscall_error
+
+ /* Successful; return the syscall's value. */
+ ret
diff --git a/sysdeps/unix/sysv/i386/linux/sysdep.S b/sysdeps/unix/sysv/i386/linux/sysdep.S
new file mode 100644
index 0000000000..ed3a2782a9
--- /dev/null
+++ b/sysdeps/unix/sysv/i386/linux/sysdep.S
@@ -0,0 +1,38 @@
+/* Copyright (C) 1992, 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. */
+
+#include <sysdep.h>
+#define _ERRNO_H
+#include <errnos.h>
+
+/* We jump here when a system call gets an error.
+ The error number is negated in %eax. */
+.globl syscall_error
+syscall_error:
+ negl %eax /* Make it positive. */
+#if defined (EWOULDBLOCK_sys) && EWOULDBLOCK_sys != EAGAIN
+ /* We translate the system's EWOULDBLOCK error into EAGAIN.
+ The GNU C library always defines EWOULDBLOCK==EAGAIN.
+ EWOULDBLOCK_sys is the original number. */
+ cmpl %eax, $EWOULDBLOCK_sys /* Is it the old EWOULDBLOCK? */
+ jne 0f /* Branch if not. */
+ move $EAGAIN, %eax /* Yes; translate it to EAGAIN. */
+#endif
+0: movl %eax, _errno /* Store it in `errno'. */
+ move $-1, %eax /* Return -1. */
+ ret
diff --git a/sysdeps/unix/sysv/i386/linux/sysdep.h b/sysdeps/unix/sysv/i386/linux/sysdep.h
new file mode 100644
index 0000000000..298a0e4c5b
--- /dev/null
+++ b/sysdeps/unix/sysv/i386/linux/sysdep.h
@@ -0,0 +1,57 @@
+/* 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. */
+
+#include <sysdeps/unix/sysdep.h>
+
+#define ENTRY(name) \
+ .globl _##name; \
+ .align 2; \
+ _##name##:
+
+#define PSEUDO(name, syscall_name, args) \
+ .text; \
+ .globl syscall_error; \
+ ENTRY (name) \
+ XCHG_##args
+ movl $SYS_##syscall_name, %eax; \
+ int $0x80; \
+ test %eax, %eax; \
+ jl syscall_error; \
+ XCHG_##args
+
+/* Linux takes system call arguments in registers:
+ 1: %ebx
+ 2: %ecx
+ 3: %edx
+ 4: %esi
+ 5: %edi
+ We put the arguments into registers from the stack,
+ and save the registers, by using the 386 `xchg' instruction
+ to swap the values in both directions. */
+
+#define XCHG_0 /* No arguments to frob. */
+#define XCHG_1 xchg 8(%esp), %ebx; XCHG_0
+#define XCHG_2 xchg 12(%esp), %ecx; XCHG_1
+#define XCHG_3 xchg 16(%esp), %edx; XCHG_2
+#define XCHG_4 xchg 20(%esp), %esi; XCHG_3
+#define XCHG_5 xchg 24(%esp), %edi; XCHG_3
+
+#define r0 %eax /* Normal return-value register. */
+#define r1 %edx /* Secondary return-value register. */
+#define scratch %ecx /* Call-clobbered register for random use. */
+#define MOVE(x,y) movl x, y
diff --git a/sysdeps/unix/sysv/i386/linux/wait.S b/sysdeps/unix/sysv/i386/linux/wait.S
new file mode 100644
index 0000000000..4be64c47c9
--- /dev/null
+++ b/sysdeps/unix/sysv/i386/linux/wait.S
@@ -0,0 +1,31 @@
+/* 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>
+
+ENTRY (__wait)
+ movl 0(%esp), %eax /* Fetch the return address. */
+ movl $-1, 0(%esp) /* First arg is -1. */
+ /* Second arg is our arg at 4(%esp). */
+ pushl $0 /* Third arg is 0. */
+ pushl %eax /* Push the return address. */
+
+ /* Jump to waitpid; it will return to our caller. */
+ jmp ___waitpid
+
+weak_alias (__wait, wait)
diff --git a/sysdeps/unix/sysv/i386/signal.S b/sysdeps/unix/sysv/i386/signal.S
new file mode 100644
index 0000000000..14ef77bdc5
--- /dev/null
+++ b/sysdeps/unix/sysv/i386/signal.S
@@ -0,0 +1,31 @@
+/* Copyright (C) 1992 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>
+
+/* This is just a standard system call, except we need to load %edx
+ with the address of the `__sigreturn' function. */
+
+ .globl syscall_error
+ .globl C_SYMBOL_NAME(__sigreturn)
+ENTRY (signal)
+ lea SYS_signal, %eax
+ lea C_SYMBOL_NAME(__sigreturn), %edx
+ .byte 0x9a, 0, 0, 0, 0, 7, 0 /* lcall $7, $0 -- GAS bug. */
+ jb syscall_error
+ ret
diff --git a/sysdeps/unix/sysv/i386/sigreturn.S b/sysdeps/unix/sysv/i386/sigreturn.S
new file mode 100644
index 0000000000..be1c6b89bf
--- /dev/null
+++ b/sysdeps/unix/sysv/i386/sigreturn.S
@@ -0,0 +1,27 @@
+/* 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. */
+
+#include <sysdep.h>
+
+.text
+ENTRY (__sigreturn)
+ addl $4, %esp /* Pop the return PC. */
+ lcall $0xf, $0 /* Do the magic sigreturn trap. */
+ /* NOTREACHED */
+
+weak_alias (__sigreturn, sigreturn)
diff --git a/sysdeps/unix/sysv/i386/sysdep.h b/sysdeps/unix/sysv/i386/sysdep.h
new file mode 100644
index 0000000000..fedd5ea825
--- /dev/null
+++ b/sysdeps/unix/sysv/i386/sysdep.h
@@ -0,0 +1,4 @@
+/* System V does not precede the asm names of C symbols with a `_'. */
+#define NO_UNDERSCORES
+
+#include <sysdeps/unix/i386/sysdep.h>
diff --git a/sysdeps/unix/sysv/i386/time.S b/sysdeps/unix/sysv/i386/time.S
new file mode 100644
index 0000000000..f492141c06
--- /dev/null
+++ b/sysdeps/unix/sysv/i386/time.S
@@ -0,0 +1,26 @@
+/* Copyright (C) 1991, 1992 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 (time, 1)
+ movl 4(%esp), %edx /* Put passed pointer in %edx. */
+ testl %edx, %edx /* Is it non-nil? */
+ je null
+ movl %eax, (%edx) /* Yes; store the time there. */
+null: ret
diff --git a/sysdeps/unix/sysv/irix4/Dist b/sysdeps/unix/sysv/irix4/Dist
new file mode 100644
index 0000000000..c5dd106b55
--- /dev/null
+++ b/sysdeps/unix/sysv/irix4/Dist
@@ -0,0 +1,2 @@
+syssgi.S sysmp.S
+__handler.S sigtramp.c
diff --git a/sysdeps/unix/sysv/irix4/Implies b/sysdeps/unix/sysv/irix4/Implies
new file mode 100644
index 0000000000..35e1edd830
--- /dev/null
+++ b/sysdeps/unix/sysv/irix4/Implies
@@ -0,0 +1,4 @@
+# Irix 4 has the set of things which are also common to BSD and SVR4.
+unix/common
+# Irix 4 has the canonical set of <sys/mman.h> system calls.
+unix/mman
diff --git a/sysdeps/unix/sysv/irix4/Makefile b/sysdeps/unix/sysv/irix4/Makefile
new file mode 100644
index 0000000000..a7f3ea8ce5
--- /dev/null
+++ b/sysdeps/unix/sysv/irix4/Makefile
@@ -0,0 +1,25 @@
+# Copyright (C) 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.
+
+ifeq ($(subdir),signal)
+sysdep_routines := $(sysdep_routines) sigtramp __handler
+endif
+
+ifeq ($(subdir),misc)
+sysdep_routines := $(sysdep_routines) syssgi sysmp
+endif
diff --git a/sysdeps/unix/sysv/irix4/__handler.S b/sysdeps/unix/sysv/irix4/__handler.S
new file mode 100644
index 0000000000..bd756a4278
--- /dev/null
+++ b/sysdeps/unix/sysv/irix4/__handler.S
@@ -0,0 +1,116 @@
+/* Copyright (C) 1992 Free Software Foundation, Inc.
+ Contributed by Brendan Kehoe (brendan@cs.widener.edu).
+ Also hacked by Ian Lance Taylor (ian@airs.com).
+
+The GNU C Library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Library General Public License as
+published by the Free Software Foundation; either version 2 of the
+License, or (at your option) any later version.
+
+The GNU C Library is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+Library General Public License for more details.
+
+You should have received a copy of the GNU Library General Public
+License along with the GNU C Library; see the file COPYING.LIB. If
+not, write to the Free Software Foundation, Inc., 675 Mass Ave,
+Cambridge, MA 02139, USA. */
+
+#include <sysdep.h>
+
+/* This function saves all the registers, calls the
+ user function, and then executes a sigreturn system call. The
+ sigreturn call wants the address of a sigcontext structure. This
+ is all hideously system dependent and, for all intents and
+ purposes, undocumented.
+
+ When we enter here, a3 holds the user's signal handler. We are
+ supposed to fill in the context given in a2, and then pass it and
+ the first two arguments to the user's function. If the user's
+ function returns, we execute a sigreturn system call.
+
+ The sc_onstack, sc_mask and sc_pc elements of the context are
+ already set by the kernel. For some reason we don't have to save
+ the floating point state or the coprocessor state; the kernel may
+ have saved them for us, or it doesn't use them. */
+
+.set noat
+ENTRY (__handler)
+#if 0
+ /* Store zero and the asm temp reg. */
+ sw $0, 12(a2)
+ sw AT, 16(a2)
+
+ /* Put v1 in sc_regs[3]. */
+ sw v1, 24(a2)
+
+ /* Save the caller saved registers in sc_regs[8..15]. */
+ sw t0, 44(a2)
+ sw t1, 48(a2)
+ sw t2, 52(a2)
+ sw t3, 56(a2)
+ sw t4, 60(a2)
+ sw t5, 64(a2)
+ sw t6, 68(a2)
+ sw t7, 72(a2)
+
+ /* Save the callee saved registers in sc_regs[16..23]. */
+ sw s0, 76(a2)
+ sw s1, 80(a2)
+ sw s2, 84(a2)
+ sw s3, 88(a2)
+ sw s4, 92(a2)
+ sw s5, 96(a2)
+ sw s6, 100(a2)
+ sw s7, 104(a2)
+
+ /* Save the code generator registers in sc_regs[24] & sc_regs[25]. */
+ sw t8, 108(a2)
+ sw t9, 112(a2)
+
+ /* Save the kernel temp regs in sc_regs[26] & sc_regs[27]. */
+ sw k0, 116(a2)
+ sw k1, 120(a2)
+
+ /* Save the global pointer in sc_regs[28]. */
+ sw gp, 124(a2)
+
+ /* ... and also the return address in sc_regs[31]. */
+ sw ra, 136(a2)
+
+ /* Note: we don't save the stack pointer in sc_regs[29];
+ instead, we use the one that was already there. */
+#if 0
+ sw sp, 128(a2)
+#endif
+
+ /* Save the floating pointer in sc_regs[30]. */
+ sw fp, 132(a2)
+
+ /* Save the mul/div stuff in sc_mdlo and sc_mdhi. */
+ mflo t0
+ sw t0, 140(a2)
+ mfhi t0
+ sw t0, 144(a2)
+
+#endif
+ /* Move the stack up six. This will save the context. */
+ addu sp, sp, -24
+ sw a2, 16(sp)
+
+ /* Call their handler with the signal, code, and context; note
+ this will clobber the context. */
+ .set noreorder
+ jal ra, a3
+ nop
+ .set reorder
+
+ /* When we come back, restore the context and pass it right
+ on into sigreturn(). */
+ lw a0, 16(sp)
+
+ /* Do a sigreturn syscall; this doesn't return. */
+ li v0, SYS_sigreturn
+ syscall
+ nop
diff --git a/sysdeps/unix/sysv/irix4/confname.h b/sysdeps/unix/sysv/irix4/confname.h
new file mode 100644
index 0000000000..49d2f9c989
--- /dev/null
+++ b/sysdeps/unix/sysv/irix4/confname.h
@@ -0,0 +1,80 @@
+/* `sysconf', `pathconf', and `confstr' NAME values. Irix 4 version.
+Copyright (C) 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. */
+
+/* Values for the NAME argument to `pathconf' and `fpathconf'. */
+enum
+ {
+ _PC_LINK_MAX = 1,
+ _PC_MAX_CANON,
+ _PC_MAX_INPUT,
+ _PC_NAME_MAX,
+ _PC_PATH_MAX,
+ _PC_PIPE_BUF,
+ _PC_CHOWN_RESTRICTED,
+ _PC_NO_TRUNC,
+ _PC_VDISABLE
+ };
+
+/* Values for the argument to `sysconf'. */
+enum
+ {
+ _SC_ARG_MAX = 1,
+ _SC_CHILD_MAX,
+ _SC_CLK_TCK,
+ _SC_NGROUPS_MAX,
+ _SC_OPEN_MAX,
+ _SC_JOB_CONTROL,
+ _SC_SAVED_IDS,
+ _SC_VERSION,
+
+ /* Above are done by the Irix system call.
+ The rest are done by the C library (or are not really implemented). */
+
+ _SC_STREAM_MAX,
+ _SC_TZNAME_MAX,
+ _SC_PAGESIZE,
+
+ /* Values for the argument to `sysconf'
+ corresponding to _POSIX2_* symbols. */
+ _SC_BC_BASE_MAX,
+ _SC_BC_DIM_MAX,
+ _SC_BC_SCALE_MAX,
+ _SC_BC_STRING_MAX,
+ _SC_COLL_WEIGHTS_MAX,
+ _SC_EQUIV_CLASS_MAX,
+ _SC_EXPR_NEST_MAX,
+ _SC_LINE_MAX,
+ _SC_RE_DUP_MAX,
+
+ _SC_2_VERSION,
+ _SC_2_C_BIND,
+ _SC_2_C_DEV,
+ _SC_2_FORT_DEV,
+ _SC_2_FORT_RUN,
+ _SC_2_SW_DEV,
+ _SC_2_LOCALEDEF
+ };
+
+#ifdef __USE_POSIX2
+/* Values for the NAME argument to `confstr'. */
+enum
+ {
+ _CS_PATH /* The default search path. */
+ };
+#endif
diff --git a/sysdeps/unix/sysv/irix4/direct.h b/sysdeps/unix/sysv/irix4/direct.h
new file mode 100644
index 0000000000..153087fef5
--- /dev/null
+++ b/sysdeps/unix/sysv/irix4/direct.h
@@ -0,0 +1,15 @@
+#ifndef MAXNAMLEN
+#define MAXNAMLEN 255
+#endif
+
+struct direct
+ {
+ unsigned long int d_ino;
+ off_t d_off;
+ unsigned short int d_reclen;
+ char d_name[MAXNAMLEN + 1];
+ };
+
+#define D_NAMLEN(d) (strlen ((d)->d_name))
+
+#define D_RECLEN(d) (d->d_reclen)
diff --git a/sysdeps/unix/sysv/irix4/dup2.c b/sysdeps/unix/sysv/irix4/dup2.c
new file mode 100644
index 0000000000..86720b1b70
--- /dev/null
+++ b/sysdeps/unix/sysv/irix4/dup2.c
@@ -0,0 +1,3 @@
+#include <sysdeps/posix/__dup2.c>
+
+weak_alias (__dup2, dup2)
diff --git a/sysdeps/unix/sysv/irix4/fcntlbits.h b/sysdeps/unix/sysv/irix4/fcntlbits.h
new file mode 100644
index 0000000000..a8bb776cf4
--- /dev/null
+++ b/sysdeps/unix/sysv/irix4/fcntlbits.h
@@ -0,0 +1,98 @@
+/* O_*, F_*, FD_* bit values for SGI Irix 4.
+Copyright (C) 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. */
+
+#ifndef _FCNTLBITS_H
+
+#define _FCNTLBITS_H 1
+
+
+/* File access modes for `open' and `fcntl'. */
+#define O_RDONLY 0 /* Open read-only. */
+#define O_WRONLY 1 /* Open write-only. */
+#define O_RDWR 2 /* Open read/write. */
+
+
+/* Bits OR'd into the second argument to open. */
+#define O_CREAT 00400 /* Create file if it doesn't exist. */
+#define O_EXCL 02000 /* Fail if file already exists. */
+#define O_TRUNC 01000 /* Truncate file to zero length. */
+#ifdef __USE_MISC
+#define O_SYNC 00020 /* Synchronous writes. */
+#define O_ASYNC 00100 /* Send SIGIO to owner when data is ready. */
+#endif
+
+/* File status flags for `open' and `fcntl'. */
+#define O_APPEND 000010 /* Writes append to the file. */
+#ifdef __USE_BSD
+#define O_NDELAY 000004 /* Non-blocking I/O. */
+#endif
+#define O_NONBLOCK 000200 /* POSIX.1 non-blocking I/O. */
+
+/* Mask for file access modes. This is system-dependent in case
+ some system ever wants to define some other flavor of access. */
+#define O_ACCMODE (O_RDONLY|O_WRONLY|O_RDWR)
+
+/* Values for the second argument to `fcntl'. */
+#define F_DUPFD 0 /* Duplicate file descriptor. */
+#define F_GETFD 1 /* Get file descriptor flags. */
+#define F_SETFD 2 /* Set file descriptor flags. */
+#define F_GETFL 3 /* Get file status flags. */
+#define F_SETFL 4 /* Set file status flags. */
+#define F_GETLK 5 /* Get record locking info. */
+#define F_SETLK 6 /* Set record locking info. */
+#define F_SETLKW 7 /* Set record locking info, wait. */
+#ifdef __USE_MISC
+#define F_CHKFL 8 /* Check legality of file flag changes. */
+#define F_ALLOCSP 10
+#define F_FREESP 11
+#define F_SETBSDLK 12 /* Set Berkeley record lock. */
+#define F_SETBSDLKW 13 /* Set Berkeley record lock and wait. */
+#define F_RGETLK 20 /* Get info on a remote lock. */
+#define F_RSETLK 21 /* Set or unlock a remote lock. */
+#define F_RSETLKW 22 /* Set or unlock a remote lock and wait. */
+#define F_GETOWN 10 /* Get owner; only works on sockets. */
+#define F_SETOWN 11 /* Set owner; only works on sockets. */
+#endif
+
+
+/* File descriptor flags used with F_GETFD and F_SETFD. */
+#define FD_CLOEXEC 1 /* Close on exec. */
+
+
+#include <gnu/types.h>
+
+/* The structure describing an advisory lock. This is the type of the third
+ argument to `fcntl' for the F_GETLK, F_SETLK, and F_SETLKW requests. */
+struct flock
+ {
+ short int l_type; /* Type of lock: F_RDLCK, F_WRLCK, or F_UNLCK. */
+ short int l_whence; /* Where `l_start' is relative to (like `lseek'). */
+ __off_t l_start; /* Offset where the lock begins. */
+ __off_t l_len; /* Size of the locked area; zero means until EOF. */
+ short int l_sysid; /* System ID where locking process resides. */
+ short int l_pid; /* Process holding the lock. */
+ };
+
+/* Values for the `l_type' field of a `struct flock'. */
+#define F_RDLCK 1 /* Read lock. */
+#define F_WRLCK 2 /* Write lock. */
+#define F_UNLCK 3 /* Remove lock. */
+
+
+#endif /* fcntlbits.h */
diff --git a/sysdeps/unix/sysv/irix4/fpathconf.c b/sysdeps/unix/sysv/irix4/fpathconf.c
new file mode 100644
index 0000000000..3c9f1750ff
--- /dev/null
+++ b/sysdeps/unix/sysv/irix4/fpathconf.c
@@ -0,0 +1,34 @@
+/* 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. */
+
+#include <ansidecl.h>
+#include <errno.h>
+#include <stddef.h>
+#include <unistd.h>
+#include <sys/syssgi.h>
+
+extern int __syssgi __P ((int, ...));
+
+/* Get file-specific information about descriptor FD. */
+long int
+DEFUN(__fpathconf, (fd, name), int fd AND int name)
+{
+ return __syssgi (SGI_PATHCONF, FPATHCONF, fd, name);
+}
+
+weak_alias (__fpathconf, fpathconf)
diff --git a/sysdeps/unix/sysv/irix4/getgroups.c b/sysdeps/unix/sysv/irix4/getgroups.c
new file mode 100644
index 0000000000..714f66077f
--- /dev/null
+++ b/sysdeps/unix/sysv/irix4/getgroups.c
@@ -0,0 +1,33 @@
+/* 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. */
+
+#include <sys/syssgi.h>
+#include <ansidecl.h>
+#include <sys/types.h>
+#include <grp.h>
+
+extern int __syssgi __P ((int, ...));
+
+/* Set the group set for the current user to GROUPS (N of them). */
+int
+DEFUN(__getgroups, (n, groups), size_t n AND gid_t *groups)
+{
+ return __syssgi (SGI_GETGROUPS, n, groups);
+}
+
+weak_alias (__getgroups, getgroups)
diff --git a/sysdeps/unix/sysv/irix4/getpgid.S b/sysdeps/unix/sysv/irix4/getpgid.S
new file mode 100644
index 0000000000..fbef7a2b27
--- /dev/null
+++ b/sysdeps/unix/sysv/irix4/getpgid.S
@@ -0,0 +1,24 @@
+/* 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. */
+
+#include <sysdep.h>
+
+PSEUDO (__getpgid, bsdgetpgrp, 1)
+ ret
+
+weak_alias (__getpgid, getpgid)
diff --git a/sysdeps/unix/sysv/irix4/getpriority.c b/sysdeps/unix/sysv/irix4/getpriority.c
new file mode 100644
index 0000000000..70a9431890
--- /dev/null
+++ b/sysdeps/unix/sysv/irix4/getpriority.c
@@ -0,0 +1,46 @@
+/* Copyright (C) 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. */
+
+#include <ansidecl.h>
+#include <errno.h>
+#include <sys/resource.h>
+#include <sys/sysmp.h>
+
+extern int __sysmp __P ((int, ...));
+
+/* Return the highest priority of any process specified by WHICH and WHO
+ (see <sys/resource.h>); if WHO is zero, the current process, process group,
+ or user (as specified by WHO) is used. A lower priority number means higher
+ priority. Priorities range from PRIO_MIN to PRIO_MAX. */
+int
+DEFUN(getpriority, (which, who),
+ enum __priority_which which AND int who)
+{
+ switch (which)
+ {
+ case PRIO_PROCESS:
+ return __sysmp (MP_SCHED, MPTS_GTNICE_PROC, who);
+ case PRIO_PGRP:
+ return __sysmp (MP_SCHED, MPTS_GTNICE_PGRP, who);
+ case PRIO_USER:
+ return __sysmp (MP_SCHED, MPTS_GTNICE_USER, who);
+ }
+
+ errno = EINVAL;
+ return -1;
+}
diff --git a/sysdeps/unix/sysv/irix4/getrusage.c b/sysdeps/unix/sysv/irix4/getrusage.c
new file mode 100644
index 0000000000..fdd3a24042
--- /dev/null
+++ b/sysdeps/unix/sysv/irix4/getrusage.c
@@ -0,0 +1,35 @@
+/* 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. */
+
+#include <ansidecl.h>
+#include <sys/resource.h>
+#include <errno.h>
+#include <sys/syssgi.h>
+
+extern int __syssgi __P ((int, ...));
+
+/* Return resource usage information on process indicated by WHO
+ and put it in *USAGE. Returns 0 for success, -1 for failure. */
+int
+DEFUN(__getrusage, (who, usage),
+ enum __rusage_who who AND struct rusage *usage)
+{
+ return __syssgi (SGI_RUSAGE, who, usage);
+}
+
+weak_alias (__getrusage, getrusage)
diff --git a/sysdeps/unix/sysv/irix4/gettimeofday.c b/sysdeps/unix/sysv/irix4/gettimeofday.c
new file mode 100644
index 0000000000..d7055be82e
--- /dev/null
+++ b/sysdeps/unix/sysv/irix4/gettimeofday.c
@@ -0,0 +1 @@
+#include <sysdeps/posix/gettimeofday.c>
diff --git a/sysdeps/unix/sysv/irix4/msync.S b/sysdeps/unix/sysv/irix4/msync.S
new file mode 100644
index 0000000000..75b9f1531d
--- /dev/null
+++ b/sysdeps/unix/sysv/irix4/msync.S
@@ -0,0 +1 @@
+#include <sysdeps/unix/bsd/sun/sunos4/msync.S>
diff --git a/sysdeps/unix/sysv/irix4/pathconf.c b/sysdeps/unix/sysv/irix4/pathconf.c
new file mode 100644
index 0000000000..698e30aab7
--- /dev/null
+++ b/sysdeps/unix/sysv/irix4/pathconf.c
@@ -0,0 +1,34 @@
+/* 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. */
+
+#include <ansidecl.h>
+#include <errno.h>
+#include <stddef.h>
+#include <unistd.h>
+#include <sys/syssgi.h>
+
+extern int __syssgi __P ((int, ...));
+
+/* Get file-specific information about PATH. */
+long int
+DEFUN(__pathconf, (path, name), CONST char *path AND int name)
+{
+ return __syssgi (SGI_PATHCONF, PATHCONF, path, name);
+}
+
+weak_alias (__pathconf, pathconf)
diff --git a/sysdeps/unix/sysv/irix4/readv.c b/sysdeps/unix/sysv/irix4/readv.c
new file mode 100644
index 0000000000..baa976da6d
--- /dev/null
+++ b/sysdeps/unix/sysv/irix4/readv.c
@@ -0,0 +1 @@
+#include <sysdeps/posix/readv.c>
diff --git a/sysdeps/unix/sysv/irix4/reboot.c b/sysdeps/unix/sysv/irix4/reboot.c
new file mode 100644
index 0000000000..d7a3659d2b
--- /dev/null
+++ b/sysdeps/unix/sysv/irix4/reboot.c
@@ -0,0 +1 @@
+#include <sysdeps/stub/reboot.c>
diff --git a/sysdeps/unix/sysv/irix4/setgroups.c b/sysdeps/unix/sysv/irix4/setgroups.c
new file mode 100644
index 0000000000..052df0f830
--- /dev/null
+++ b/sysdeps/unix/sysv/irix4/setgroups.c
@@ -0,0 +1,31 @@
+/* Copyright (C) 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. */
+
+#include <sys/syssgi.h>
+#include <ansidecl.h>
+#include <sys/types.h>
+#include <grp.h>
+
+extern int __syssgi __P ((int, ...));
+
+/* Set the group set for the current user to GROUPS (N of them). */
+int
+DEFUN(setgroups, (n, groups), size_t n AND CONST gid_t *groups)
+{
+ return __syssgi (SGI_SETGROUPS, n, groups);
+}
diff --git a/sysdeps/unix/sysv/irix4/setpgid.S b/sysdeps/unix/sysv/irix4/setpgid.S
new file mode 100644
index 0000000000..9267054fe9
--- /dev/null
+++ b/sysdeps/unix/sysv/irix4/setpgid.S
@@ -0,0 +1,25 @@
+/* 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. */
+
+#include <sysdep.h>
+
+PSEUDO (__setpgid, bsdsetpgrp, 2)
+ ret
+
+weak_alias (__setpgid, setpgid)
+weak_alias (__setpgid, setpgrp)
diff --git a/sysdeps/unix/sysv/irix4/setpriority.c b/sysdeps/unix/sysv/irix4/setpriority.c
new file mode 100644
index 0000000000..a632953423
--- /dev/null
+++ b/sysdeps/unix/sysv/irix4/setpriority.c
@@ -0,0 +1,41 @@
+/* Copyright (C) 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. */
+
+#include <ansidecl.h>
+#include <errno.h>
+#include <sys/resource.h>
+#include <sys/sysmp.h>
+
+int
+DEFUN(setpriority, (which, who, prio),
+ enum __priority_which which AND int who AND int prio)
+{
+ switch (which)
+ {
+ case PRIO_PROCESS:
+ return __sysmp (MP_SCHED, MPTS_RENICE_PROC, who, prio);
+ case PRIO_PGRP:
+ return __sysmp (MP_SCHED, MPTS_RENICE_PGRP, who, prio);
+ case PRIO_USER:
+ return __sysmp (MP_SCHED, MPTS_RENICE_USER, who, prio);
+ }
+
+ errno = EINVAL;
+ return -1;
+}
+
diff --git a/sysdeps/unix/sysv/irix4/signal.S b/sysdeps/unix/sysv/irix4/signal.S
new file mode 100644
index 0000000000..b0c147dadb
--- /dev/null
+++ b/sysdeps/unix/sysv/irix4/signal.S
@@ -0,0 +1,22 @@
+/* Copyright (C) 1991, 1992 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>
+
+PSEUDO (__raw_signal, signal, 3)
+ ret
diff --git a/sysdeps/unix/sysv/irix4/signum.h b/sysdeps/unix/sysv/irix4/signum.h
new file mode 100644
index 0000000000..5d30ebb875
--- /dev/null
+++ b/sysdeps/unix/sysv/irix4/signum.h
@@ -0,0 +1,67 @@
+/* Copyright (C) 1994 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., 675 Mass Ave,
+Cambridge, MA 02139, USA. */
+
+#ifdef _SIGNAL_H
+
+/* This file defines the fake signal functions and signal
+ number constants for SGI Irix 4. */
+
+/* Fake signal functions. */
+#define SIG_ERR ((__sighandler_t) -1)
+#define SIG_DFL ((__sighandler_t) 0)
+#define SIG_IGN ((__sighandler_t) 1)
+
+
+/* Signals. */
+#define SIGHUP 1 /* Hangup (POSIX). */
+#define SIGINT 2 /* Interrupt (ANSI). */
+#define SIGQUIT 3 /* Quit (POSIX). */
+#define SIGILL 4 /* Illegal instruction (ANSI). */
+#define SIGABRT SIGIOT /* Abort (ANSI). */
+#define SIGTRAP 5 /* Trace trap (POSIX). */
+#define SIGIOT 6 /* IOT trap. */
+#define SIGEMT 7 /* EMT trap. */
+#define SIGFPE 8 /* Floating-point exception (ANSI). */
+#define SIGKILL 9 /* Kill, unblockable (POSIX). */
+#define SIGBUS 10 /* Bus error. */
+#define SIGSEGV 11 /* Segmentation violation (ANSI). */
+#define SIGSYS 12 /* Bad argument to system call*/
+#define SIGPIPE 13 /* Broken pipe (POSIX). */
+#define SIGALRM 14 /* Alarm clock (POSIX). */
+#define SIGTERM 15 /* Termination (ANSI). */
+#define SIGUSR1 16 /* User-defined signal 1 (POSIX). */
+#define SIGUSR2 17 /* User-defined signal 2 (POSIX). */
+#define SIGCHLD 18 /* Child status has changed (POSIX). */
+#define SIGCLD SIGCHLD /* Same as SIGCHLD (System V). */
+#define SIGPWR 19 /* Power going down. */
+#define SIGSTOP 20 /* Stop, unblockable (POSIX). */
+#define SIGTSTP 21 /* Keyboard stop (POSIX). */
+#define SIGPOLL 22 /* Same as SIGIO? (SVID). */
+#define SIGIO 23 /* I/O now possible. */
+#define SIGURG 24 /* Urgent condition on socket.*/
+#define SIGWINCH 25 /* Window size change. */
+#define SIGVTALRM 26 /* Virtual alarm clock. */
+#define SIGPROF 27 /* Profiling alarm clock. */
+#define SIGCONT 28 /* Continue (POSIX). */
+#define SIGTTIN 29 /* Background read from tty (POSIX). */
+#define SIGTTOU 30 /* Background write to tty (POSIX). */
+#define SIGXCPU 31 /* CPU limit exceeded. */
+#define SIGXFSZ 32 /* File size limit exceeded. */
+
+#endif /* <signal.h> included. */
+
+#define _NSIG 33 /* Biggest signal number + 1. */
diff --git a/sysdeps/unix/sysv/irix4/sigreturn.S b/sysdeps/unix/sysv/irix4/sigreturn.S
new file mode 100644
index 0000000000..ebb5c1ae44
--- /dev/null
+++ b/sysdeps/unix/sysv/irix4/sigreturn.S
@@ -0,0 +1,25 @@
+/* Copyright (C) 1992, 1995 Free Software Foundation, Inc.
+ Contributed by Brendan Kehoe (brendan@cs.widener.edu).
+
+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>
+
+ENTRY(__sigreturn)
+ li v0, SYS_sigreturn
+ syscall
+
+weak_alias (__sigreturn, sigreturn)
diff --git a/sysdeps/unix/sysv/irix4/sigtramp.c b/sysdeps/unix/sysv/irix4/sigtramp.c
new file mode 100644
index 0000000000..85c2c3a9a9
--- /dev/null
+++ b/sysdeps/unix/sysv/irix4/sigtramp.c
@@ -0,0 +1,54 @@
+/* Copyright (C) 1992 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. */
+
+/* The sigvec system call on MIPS Ultrix takes an additional
+ parameter, which is the address that is actually called when the
+ signal occurs.
+
+ When a signal occurs, we arrange for the kernel to call __handler.
+ That will save the frame and stack pointers into the context, and
+ then jump to this routine. See __handler.S.
+
+ This code is based on sysdeps/unix/bsd/sun4/sigtramp.c, but it's
+ different because since we get passed the user signal handler we
+ don't actually need a trampoline. */
+
+#include <ansidecl.h>
+#include <signal.h>
+#include <stddef.h>
+#include <errno.h>
+
+/* The user's signal handler is called with three arguments. */
+typedef void (*handler_type) (int sig, int code, struct sigcontext *);
+
+/* Defined in signal.S. */
+extern __sighandler_t EXFUN(__raw_signal, (int sig, __sighandler_t func,
+ void (*)(int sig, int code,
+ struct sigcontext *,
+ handler_type)));
+
+extern void EXFUN(__handler, (int sig, int code,
+ struct sigcontext *,
+ handler_type));
+
+__sighandler_t
+DEFUN(signal, (sig, func),
+ int sig AND __sighandler_t func)
+{
+ return __raw_signal (sig, func, __handler);
+}
diff --git a/sysdeps/unix/sysv/irix4/start.c b/sysdeps/unix/sysv/irix4/start.c
new file mode 100644
index 0000000000..4382e6f855
--- /dev/null
+++ b/sysdeps/unix/sysv/irix4/start.c
@@ -0,0 +1,68 @@
+/* Copyright (C) 1991, 1992 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 <errno.h>
+#include <stdlib.h>
+#include <unistd.h>
+
+#ifndef __GNUC__
+ #error This file uses GNU C extensions; you must compile with GCC.
+#endif
+
+/* The first piece of initialized data. */
+int __data_start = 0;
+
+VOLATILE int errno = 0;
+
+#ifndef HAVE_GNU_LD
+#undef environ
+#define __environ environ
+#endif
+
+char **__environ;
+
+extern void EXFUN(__libc_init, (int argc, char **argv, char **envp));
+extern int EXFUN(main, (int argc, char **argv, char **envp));
+
+/* Use the stack pointer to access the arguments. This assumes that
+ we can guess how big the frame will be. */
+register long int sp asm("sp");
+#ifdef __OPTIMIZE__
+#define STACKSIZE 8
+#else
+#define STACKSIZE 10
+#endif
+
+void
+DEFUN_VOID(__start)
+{
+ int argc;
+ char **argv, **envp;
+
+ /* Set up the global pointer. */
+ asm volatile ("la $28,_gp");
+ argc = ((int *) sp)[STACKSIZE];
+ argv = (char **) &((int *) sp)[STACKSIZE + 1];
+ envp = &argv[argc + 1];
+ __environ = envp;
+
+ __libc_init (argc, argv, envp);
+ errno = 0;
+ exit (main (argc, argv, envp));
+}
diff --git a/sysdeps/unix/sysv/irix4/statbuf.h b/sysdeps/unix/sysv/irix4/statbuf.h
new file mode 100644
index 0000000000..8b327bae11
--- /dev/null
+++ b/sysdeps/unix/sysv/irix4/statbuf.h
@@ -0,0 +1,61 @@
+/* Copyright (C) 1992 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
+ {
+ unsigned long st_ino;
+ short int st_dev;
+ unsigned short int st_mode;
+ short int st_nlink;
+ unsigned short int st_uid;
+ unsigned short int st_gid;
+ short int st_rdev;
+ long int st_size;
+ long int st_atime;
+ long int st_mtime;
+ long int st_ctime;
+ };
+
+/* 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/irix4/swapon.c b/sysdeps/unix/sysv/irix4/swapon.c
new file mode 100644
index 0000000000..86a638fdc5
--- /dev/null
+++ b/sysdeps/unix/sysv/irix4/swapon.c
@@ -0,0 +1 @@
+#include <sysdeps/stub/swapon.c>
diff --git a/sysdeps/unix/sysv/irix4/sys/mman.h b/sysdeps/unix/sysv/irix4/sys/mman.h
new file mode 100644
index 0000000000..ac50aab6dd
--- /dev/null
+++ b/sysdeps/unix/sysv/irix4/sys/mman.h
@@ -0,0 +1,101 @@
+/* Definitions for BSD-style memory management. Irix 4 version.
+Copyright (C) 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. */
+
+#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 0x04 /* Pages can be read. */
+#define PROT_WRITE 0x02 /* Pages can be written. */
+#define PROT_EXEC 0x01 /* Pages can be executed. */
+#define PROT_EXECUTE PROT_EXEC
+
+
+/* Sharing types (must choose one and only one of these). */
+#define MAP_SHARED 0x01 /* Share changes. */
+#define MAP_PRIVATE 0x02 /* Changes private; copy pages on write. */
+#define MAP_TYPE 0x0f /* Mask for sharing type. */
+
+/* Other flags. */
+#define MAP_FIXED 0x10 /* Map address must be exactly as requested. */
+#define MAP_RENAME 0x20 /* Rename private pages to file. */
+#define MAP_AUTOGROW 0x40 /* Grow file as pages are written. */
+#define MAP_LOCAL 0x80 /* Copy the mapped region on fork. */
+
+/* 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. */
+
+/* Flags to `msync'. */
+#define MS_ASYNC 0x1 /* Return immediately, don't fsync. */
+#define MS_INVALIDATE 0x2 /* Invalidate caches. */
+
+
+#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));
+
+/* 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));
+
+/* 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, int __flags));
+
+/* 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/irix4/sysconf.c b/sysdeps/unix/sysv/irix4/sysconf.c
new file mode 100644
index 0000000000..a310362239
--- /dev/null
+++ b/sysdeps/unix/sysv/irix4/sysconf.c
@@ -0,0 +1,35 @@
+/* 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. */
+
+#include <ansidecl.h>
+#include <unistd.h>
+#include <sys/syssgi.h>
+
+extern int __syssgi __P ((int, ...));
+
+/* Get the value of the system variable NAME. */
+long int
+DEFUN(__sysconf, (name), int name)
+{
+ if (name == _SC_TZNAME_MAX)
+ return __tzname_max ();
+
+ return __syssgi (SGI_SYSCONF, name);
+}
+
+weak_alias (__sysconf, sysconf)
diff --git a/sysdeps/unix/sysv/irix4/sysmp.S b/sysdeps/unix/sysv/irix4/sysmp.S
new file mode 100644
index 0000000000..438da60d69
--- /dev/null
+++ b/sysdeps/unix/sysv/irix4/sysmp.S
@@ -0,0 +1,22 @@
+/* Copyright (C) 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. */
+
+#include <sysdep.h>
+
+SYSCALL__ (sysmp, 4)
+ ret
diff --git a/sysdeps/unix/sysv/irix4/syssgi.S b/sysdeps/unix/sysv/irix4/syssgi.S
new file mode 100644
index 0000000000..2715d2899c
--- /dev/null
+++ b/sysdeps/unix/sysv/irix4/syssgi.S
@@ -0,0 +1,22 @@
+/* Copyright (C) 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. */
+
+#include <sysdep.h>
+
+SYSCALL__ (syssgi, 2)
+ ret
diff --git a/sysdeps/unix/sysv/irix4/time.S b/sysdeps/unix/sysv/irix4/time.S
new file mode 100644
index 0000000000..23bfe5deac
--- /dev/null
+++ b/sysdeps/unix/sysv/irix4/time.S
@@ -0,0 +1 @@
+#include <sysdeps/unix/sysv/sysv4/time.S>
diff --git a/sysdeps/unix/sysv/irix4/uname.S b/sysdeps/unix/sysv/irix4/uname.S
new file mode 100644
index 0000000000..fe912403b1
--- /dev/null
+++ b/sysdeps/unix/sysv/irix4/uname.S
@@ -0,0 +1,26 @@
+/* Copyright (C) 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. */
+
+#include <sysdep.h>
+
+ENTRY(uname)
+ li a2, 0
+ li a3, 0
+SYSCALL__ (utssys, 1)
+ j ra
+ move v0, zero
diff --git a/sysdeps/unix/sysv/irix4/wait.S b/sysdeps/unix/sysv/irix4/wait.S
new file mode 100644
index 0000000000..9f2afa7997
--- /dev/null
+++ b/sysdeps/unix/sysv/irix4/wait.S
@@ -0,0 +1,42 @@
+/* Copyright (C) 1992, 1995 Free Software Foundation, Inc.
+ Contributed by Brendan Kehoe (brendan@cs.widener.edu).
+
+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>
+
+.set noreorder
+
+ENTRY(__wait)
+ /* Prep it for wait */
+ move a1, zero
+ move a2, zero
+
+ li v0, SYS_wait
+ syscall
+ beq a3, zero, noerror
+ nop
+ j syscall_error
+ nop
+noerror:
+ beq a0, zero, noarg
+ nop
+ sw v1, 0(a0)
+ nop
+noarg:
+ ret
+
+weak_alias (__wait, wait)
diff --git a/sysdeps/unix/sysv/irix4/wait3.S b/sysdeps/unix/sysv/irix4/wait3.S
new file mode 100644
index 0000000000..54065aefdf
--- /dev/null
+++ b/sysdeps/unix/sysv/irix4/wait3.S
@@ -0,0 +1 @@
+#include <sysdeps/unix/bsd/ultrix4/wait3.S>
diff --git a/sysdeps/unix/sysv/irix4/waitpid.c b/sysdeps/unix/sysv/irix4/waitpid.c
new file mode 100644
index 0000000000..8378982ac7
--- /dev/null
+++ b/sysdeps/unix/sysv/irix4/waitpid.c
@@ -0,0 +1 @@
+#include <sysdeps/unix/bsd/bsd4.4/waitpid.c>
diff --git a/sysdeps/unix/sysv/irix4/writev.c b/sysdeps/unix/sysv/irix4/writev.c
new file mode 100644
index 0000000000..0dc6a76014
--- /dev/null
+++ b/sysdeps/unix/sysv/irix4/writev.c
@@ -0,0 +1 @@
+#include <sysdeps/posix/writev.c>
diff --git a/sysdeps/unix/sysv/isc2.2/rename.S b/sysdeps/unix/sysv/isc2.2/rename.S
new file mode 100644
index 0000000000..a4b2c4207c
--- /dev/null
+++ b/sysdeps/unix/sysv/isc2.2/rename.S
@@ -0,0 +1 @@
+#include <sysdeps/unix/common/rename.S>
diff --git a/sysdeps/unix/sysv/isc3/direct.h b/sysdeps/unix/sysv/isc3/direct.h
new file mode 100644
index 0000000000..e6df21246e
--- /dev/null
+++ b/sysdeps/unix/sysv/isc3/direct.h
@@ -0,0 +1 @@
+#include <sysdeps/unix/sysv/sco3.2.4/direct.h>
diff --git a/sysdeps/unix/sysv/linux/Implies b/sysdeps/unix/sysv/linux/Implies
new file mode 100644
index 0000000000..fe7e1fde5e
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/Implies
@@ -0,0 +1,2 @@
+# Linux has the set of things which are also common to BSD and SVR4.
+unix/common
diff --git a/sysdeps/unix/sysv/linux/accept.S b/sysdeps/unix/sysv/linux/accept.S
new file mode 100644
index 0000000000..5936a0185b
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/accept.S
@@ -0,0 +1,2 @@
+#define socket accept
+#include <socket.S>
diff --git a/sysdeps/unix/sysv/linux/bind.S b/sysdeps/unix/sysv/linux/bind.S
new file mode 100644
index 0000000000..fc82b65a2f
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/bind.S
@@ -0,0 +1,2 @@
+#define socket bind
+#include <socket.S>
diff --git a/sysdeps/unix/sysv/linux/connect.S b/sysdeps/unix/sysv/linux/connect.S
new file mode 100644
index 0000000000..3433043d8c
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/connect.S
@@ -0,0 +1,2 @@
+#define socket connect
+#include <socket.S>
diff --git a/sysdeps/unix/sysv/linux/getpeername.S b/sysdeps/unix/sysv/linux/getpeername.S
new file mode 100644
index 0000000000..8429fcdf76
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/getpeername.S
@@ -0,0 +1,2 @@
+#define socket getpeername
+#include <socket.S>
diff --git a/sysdeps/unix/sysv/linux/getpgrp.S b/sysdeps/unix/sysv/linux/getpgrp.S
new file mode 100644
index 0000000000..f8d6e07106
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/getpgrp.S
@@ -0,0 +1,22 @@
+/* Copyright (C) 1991, 1992 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/linux/getsockname.S b/sysdeps/unix/sysv/linux/getsockname.S
new file mode 100644
index 0000000000..6782707f88
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/getsockname.S
@@ -0,0 +1,2 @@
+#define socket getsockname
+#include <socket.S>
diff --git a/sysdeps/unix/sysv/linux/listen.S b/sysdeps/unix/sysv/linux/listen.S
new file mode 100644
index 0000000000..d2cbec60a0
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/listen.S
@@ -0,0 +1,2 @@
+#define socket listen
+#include <socket.S>
diff --git a/sysdeps/unix/sysv/linux/rename.S b/sysdeps/unix/sysv/linux/rename.S
new file mode 100644
index 0000000000..a5a8dfeeef
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/rename.S
@@ -0,0 +1 @@
+#include <sysdeps/unix/bsd/rename.S>
diff --git a/sysdeps/unix/sysv/linux/setsid.S b/sysdeps/unix/sysv/linux/setsid.S
new file mode 100644
index 0000000000..4930c56dcf
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/setsid.S
@@ -0,0 +1 @@
+#include <sysdeps/unix/bsd/bsd4.4/setsid.S>
diff --git a/sysdeps/unix/sysv/linux/socketpair.S b/sysdeps/unix/sysv/linux/socketpair.S
new file mode 100644
index 0000000000..da71c57dea
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/socketpair.S
@@ -0,0 +1,2 @@
+#define socket socketpair
+#include <socket.S>
diff --git a/sysdeps/unix/sysv/linux/syscall.h b/sysdeps/unix/sysv/linux/syscall.h
new file mode 100644
index 0000000000..b94d919e68
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/syscall.h
@@ -0,0 +1,124 @@
+#ifndef _SYSCALL_H
+#define _SYSCALL_H
+
+#define SYS_setup 0 /* Used only by init, to get system going. */
+#define SYS_exit 1
+#define SYS_fork 2
+#define SYS_read 3
+#define SYS_write 4
+#define SYS_open 5
+#define SYS_close 6
+#define SYS_waitpid 7
+#define SYS_creat 8
+#define SYS_link 9
+#define SYS_unlink 10
+#define SYS_execve 11
+#define SYS_chdir 12
+#define SYS_time 13
+#define SYS_mknod 14
+#define SYS_chmod 15
+#define SYS_chown 16
+#define SYS_brk 17
+#define SYS_oldstat 18
+#define SYS_lseek 19
+#define SYS_getpid 20
+#define SYS_mount 21
+#define SYS_umount 22
+#define SYS_setuid 23
+#define SYS_getuid 24
+#define SYS_stime 25
+#define SYS_ptrace 26
+#define SYS_alarm 27
+#define SYS_oldfstat 28
+#define SYS_pause 29
+#define SYS_utime 30
+#define SYS_stty 31
+#define SYS_gtty 32
+#define SYS_access 33
+#define SYS_nice 34
+#define SYS_ftime 35
+#define SYS_sync 36
+#define SYS_kill 37
+#define SYS_rename 38
+#define SYS_mkdir 39
+#define SYS_rmdir 40
+#define SYS_dup 41
+#define SYS_pipe 42
+#define SYS_times 43
+#define SYS_prof 44
+#if 0
+#define SYS_brk 45 /* Where did this bogosity crom from? */
+#endif
+#define SYS_setgid 46
+#define SYS_getgid 47
+#define SYS_signal 48
+#define SYS_geteuid 49
+#define SYS_getegid 50
+#define SYS_acct 51
+#define SYS_phys 52
+#define SYS_lock 53
+#define SYS_ioctl 54
+#define SYS_fcntl 55
+#define SYS_mpx 56
+#define SYS_setpgrp 57
+#define SYS_ulimit 58
+#define SYS_olduname 59
+#define SYS_umask 60
+#define SYS_chroot 61
+#define SYS_ustat 62
+#define SYS_dup2 63
+#define SYS_getppid 64
+#define SYS_getpgrp 65
+#define SYS_setsid 66
+#define SYS_sigaction 67
+#define SYS_siggetmask 68
+#define SYS_sigsetmask 69
+#define SYS_setreuid 70
+#define SYS_setregid 71
+#define SYS_sigsuspend 72
+#define SYS_sigpending 73
+#define SYS_sethostname 74
+#define SYS_setrlimit 75
+#define SYS_getrlimit 76
+#define SYS_getrusage 77
+#define SYS_gettimeofday 78
+#define SYS_settimeofday 79
+#define SYS_getgroups 80
+#define SYS_setgroups 81
+#define SYS_select 82
+#define SYS_symlink 83
+#define SYS_oldlstat 84
+#define SYS_readlink 85
+#define SYS_uselib 86
+#define SYS_swapon 87
+#define SYS_reboot 88
+#define SYS_readdir 89
+#define SYS_mmap 90
+#define SYS_munmap 91
+#define SYS_truncate 92
+#define SYS_ftruncate 93
+#define SYS_fchmod 94
+#define SYS_fchown 95
+#define SYS_getpriority 96
+#define SYS_setpriority 97
+#define SYS_profil 98
+#define SYS_statfs 99
+#define SYS_fstatfs 100
+#define SYS_ioperm 101
+#define SYS_socketcall 102
+#define SYS_syslog 103
+#define SYS_setitimer 104
+#define SYS_getitimer 105
+#define SYS_stat 106
+#define SYS_lstat 107
+#define SYS_fstat 108
+#define SYS_uname 109
+#define SYS_iopl 110
+#define SYS_vhangup 111
+#define SYS_idle 112
+#define SYS_vm86 113
+#define SYS_wait4 114
+#define SYS_swapoff 115
+
+
+#endif /* syscall.h */
diff --git a/sysdeps/unix/sysv/linux/wait4.S b/sysdeps/unix/sysv/linux/wait4.S
new file mode 100644
index 0000000000..e4c322341d
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/wait4.S
@@ -0,0 +1 @@
+#include <sysdeps/unix/bsd/bsd4.4/wait4.S>
diff --git a/sysdeps/unix/sysv/linux/waitpid.S b/sysdeps/unix/sysv/linux/waitpid.S
new file mode 100644
index 0000000000..20d9d669bb
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/waitpid.S
@@ -0,0 +1,24 @@
+/* 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>
+
+SYSCALL__ (waitpid, 3)
+ ret
+
+weak_alias (__waitpid, waitpid)
diff --git a/sysdeps/unix/sysv/local_lim.h b/sysdeps/unix/sysv/local_lim.h
new file mode 100644
index 0000000000..c2b0468ee7
--- /dev/null
+++ b/sysdeps/unix/sysv/local_lim.h
@@ -0,0 +1,32 @@
+/* Copyright (C) 1992 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 NGROUPS_MAX 0 /* No supplementary groups. */
+#define ARG_MAX 5120
+#define CHILD_MAX 25
+#define OPEN_MAX 60
+#define LINK_MAX 1000
+#define MAX_CANON 256
+
+/* For SVR3, this is 14. For SVR4, it is 255, at least on ufs
+ file systems, even though the System V limits.h incorrectly
+ defines it as 14. Giving it a value which is too large
+ is harmless (it is a maximum). */
+#define NAME_MAX 255
+
+#define PATH_MAX 1024
diff --git a/sysdeps/unix/sysv/minix/sigaction.h b/sysdeps/unix/sysv/minix/sigaction.h
new file mode 100644
index 0000000000..9395206407
--- /dev/null
+++ b/sysdeps/unix/sysv/minix/sigaction.h
@@ -0,0 +1,49 @@
+/* Copyright (C) 1992 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, 1992 Free Software Foundation, Inc., 675 Mass Ave,
+Cambridge, MA 02139, USA. */
+
+/* Structure describing the action to be taken when a signal arrives. */
+struct sigaction
+ {
+ /* Signal handler. */
+ __sighandler_t sa_handler;
+
+ /* Additional set of signals to be blocked. */
+ __sigset_t sa_mask;
+
+ /* Special flags. */
+ int sa_flags;
+ };
+
+/* Bits in `sa_flags'. */
+#ifdef __USE_MISC
+#define SA_ONSTACK 0x1 /* Take signal on signal stack. */
+#define SA_RESETHAND 0x2 /* Reset signal handler when signal caught. */
+#define SA_NODEFER 0x4 /* Don't block signal while catching it. */
+#define SA_RESTART 0x8 /* Don't restart syscall on signal return. */
+#define SA_SIGINFO 0x10 /* Extended signal handling. */
+#define SA_NOCLDWAIT 0x20 /* Don't create zombies. */
+#define SA_COMPAT 0x80 /* Internal flag for old signal catchers. */
+#define SA_DISABLE 0x100 /* Disable alternate signal stack. */
+#endif
+#define SA_NOCLDSTOP 0x40 /* Don't send SIGCHLD when children stop. */
+
+
+/* Values for the HOW argument to `sigprocmask'. */
+#define SIG_BLOCK 0 /* Block signals. */
+#define SIG_UNBLOCK 1 /* Unblock signals. */
+#define SIG_SETMASK 2 /* Set the set of blocked signals. */
diff --git a/sysdeps/unix/sysv/mkdir.c b/sysdeps/unix/sysv/mkdir.c
new file mode 100644
index 0000000000..16713f9e48
--- /dev/null
+++ b/sysdeps/unix/sysv/mkdir.c
@@ -0,0 +1,97 @@
+/* Copyright (C) 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 <errno.h>
+#include <stddef.h>
+#include <sys/stat.h>
+#include <sys/types.h>
+#include <stdlib.h>
+#include <sys/wait.h>
+#include <string.h>
+
+/* Create a directory named PATH with protections MODE. */
+int
+DEFUN(__mkdir, (path, mode), CONST char *path AND mode_t mode)
+{
+ char *cmd = __alloca (80 + strlen (path));
+ char *p;
+ int status;
+ mode_t mask;
+ int save;
+ struct stat statbuf;
+
+ if (path == NULL)
+ {
+ errno = EINVAL;
+ return -1;
+ }
+
+ /* Check for some errors. */
+ if (__stat (path, &statbuf) < 0)
+ {
+ if (errno != ENOENT)
+ return -1;
+ /* There is no file by that name. Good. */
+ }
+ else
+ {
+ errno = EEXIST;
+ return -1;
+ }
+
+ /* Race condition, but how else to do it? */
+ mask = __umask (0777);
+ (void) __umask (mask);
+
+ p = cmd;
+ *p++ = 'm';
+ *p++ = 'k';
+ *p++ = 'd';
+ *p++ = 'i';
+ *p++ = 'r';
+ *p++ = ' ';
+
+ mode &= ~mask;
+ *p++ = '-';
+ *p++ = 'm';
+ *p++ = ' ';
+ *p++ = ((mode & 07000) >> 9) + '0';
+ *p++ = ((mode & 0700) >> 6) + '0';
+ *p++ = ((mode & 070) >> 3) + '0';
+ *p++ = ((mode & 07)) + '0';
+ *p++ = ' ';
+
+ strcpy (p, path);
+
+ save = errno;
+ /* If system doesn't set errno, but the mkdir fails, we really
+ have no idea what went wrong. EIO is the vaguest error I
+ can think of, so I'll use that. */
+ errno = EIO;
+ status = system (cmd);
+ if (WIFEXITED (status) && WEXITSTATUS (status) == 0)
+ {
+ errno = save;
+ return 0;
+ }
+ else
+ return -1;
+}
+
+weak_alias (__mkdir, mkdir)
diff --git a/sysdeps/unix/sysv/nice.S b/sysdeps/unix/sysv/nice.S
new file mode 100644
index 0000000000..b04bb410a0
--- /dev/null
+++ b/sysdeps/unix/sysv/nice.S
@@ -0,0 +1,22 @@
+/* Copyright (C) 1992 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 (nice, 1)
+ ret
diff --git a/sysdeps/unix/sysv/pause.S b/sysdeps/unix/sysv/pause.S
new file mode 100644
index 0000000000..82441ff2c0
--- /dev/null
+++ b/sysdeps/unix/sysv/pause.S
@@ -0,0 +1,22 @@
+/* Copyright (C) 1991, 1992 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 (pause, 0)
+ ret
diff --git a/sysdeps/unix/sysv/poll.S b/sysdeps/unix/sysv/poll.S
new file mode 100644
index 0000000000..063236e7b9
--- /dev/null
+++ b/sysdeps/unix/sysv/poll.S
@@ -0,0 +1,22 @@
+/* Copyright (C) 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. */
+
+#include <sysdep.h>
+
+SYSCALL (poll, 3)
+ ret
diff --git a/sysdeps/unix/sysv/rmdir.c b/sysdeps/unix/sysv/rmdir.c
new file mode 100644
index 0000000000..52a130ce3e
--- /dev/null
+++ b/sysdeps/unix/sysv/rmdir.c
@@ -0,0 +1,78 @@
+/* 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 <ansidecl.h>
+#include <errno.h>
+#include <stddef.h>
+#include <sys/stat.h>
+#include <sys/types.h>
+#include <stdlib.h>
+#include <sys/wait.h>
+#include <string.h>
+
+/* Create a directory named PATH with protections MODE. */
+int
+DEFUN(__rmdir, (path), CONST char *path)
+{
+ char *cmd = __alloca (80 + strlen (path));
+ char *p;
+ int status;
+ int save;
+ struct stat statbuf;
+
+ if (path == NULL)
+ {
+ errno = EINVAL;
+ return -1;
+ }
+
+ /* Check for some errors. */
+ if (__stat (path, &statbuf) < 0)
+ return -1;
+ if (!S_ISDIR (statbuf.st_mode))
+ {
+ errno = ENOTDIR;
+ return -1;
+ }
+
+ p = cmd;
+ *p++ = 'r';
+ *p++ = 'm';
+ *p++ = 'd';
+ *p++ = 'i';
+ *p++ = 'r';
+ *p++ = ' ';
+
+ strcpy (p, path);
+
+ save = errno;
+ /* If system doesn't set errno, but the rmdir fails, we really
+ have no idea what went wrong. EIO is the vaguest error I
+ can think of, so I'll use that. */
+ errno = EIO;
+ status = system (cmd);
+ if (WIFEXITED (status) && WEXITSTATUS (status) == 0)
+ {
+ return 0;
+ errno = save;
+ }
+ else
+ return -1;
+}
+
+weak_alias (__rmdir, rmdir)
diff --git a/sysdeps/unix/sysv/s_getdents.S b/sysdeps/unix/sysv/s_getdents.S
new file mode 100644
index 0000000000..6e60c08125
--- /dev/null
+++ b/sysdeps/unix/sysv/s_getdents.S
@@ -0,0 +1,22 @@
+/* Copyright (C) 1992 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__ (getdents, 3)
+ ret
diff --git a/sysdeps/unix/sysv/sco3.2.4/Dist b/sysdeps/unix/sysv/sco3.2.4/Dist
new file mode 100644
index 0000000000..462b9fb1a6
--- /dev/null
+++ b/sysdeps/unix/sysv/sco3.2.4/Dist
@@ -0,0 +1,2 @@
+pgrpsys.S
+sco_getgrp.S
diff --git a/sysdeps/unix/sysv/sco3.2.4/Makefile b/sysdeps/unix/sysv/sco3.2.4/Makefile
new file mode 100644
index 0000000000..23525e527d
--- /dev/null
+++ b/sysdeps/unix/sysv/sco3.2.4/Makefile
@@ -0,0 +1,3 @@
+ifeq (posix,$(subdir))
+sysdep_routines := $(sysdep_routines) pgrpsys sco_getgrp
+endif
diff --git a/sysdeps/unix/sysv/sco3.2.4/__setpgid.c b/sysdeps/unix/sysv/sco3.2.4/__setpgid.c
new file mode 100644
index 0000000000..3c4304c633
--- /dev/null
+++ b/sysdeps/unix/sysv/sco3.2.4/__setpgid.c
@@ -0,0 +1,30 @@
+/* Copyright (C) 1994 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., 675 Mass Ave,
+Cambridge, MA 02139, USA. */
+
+#include <ansidecl.h>
+#include <errno.h>
+#include <unistd.h>
+#include <sys/types.h>
+
+extern int __pgrpsys __P ((int type, ...));
+
+/* Get the process group ID of process PID. */
+int
+DEFUN(__setpgid, (pid, pgid), pid_t pid AND pid_t pgid)
+{
+ return __pgrpsys (2, pid, pgid);
+}
diff --git a/sysdeps/unix/sysv/sco3.2.4/confname.h b/sysdeps/unix/sysv/sco3.2.4/confname.h
new file mode 100644
index 0000000000..0408951863
--- /dev/null
+++ b/sysdeps/unix/sysv/sco3.2.4/confname.h
@@ -0,0 +1,50 @@
+/* `sysconf', `pathconf', and `confstr' NAME values. Generic version.
+Copyright (C) 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. */
+
+/* Values for the NAME argument to `pathconf' and `fpathconf'. */
+#define _PC_LINK_MAX 0
+#define _PC_MAX_CANON 1
+#define _PC_MAX_INPUT 2
+#define _PC_NAME_MAX 3
+#define _PC_PATH_MAX 4
+#define _PC_PIPE_BUF 5
+#define _PC_CHOWN_RESTRICTED 6
+#define _PC_NO_TRUNC 7
+#define _PC_VDISABLE 8
+
+/* Values for the argument to `sysconf'. */
+#define _SC_ARG_MAX 0
+#define _SC_CHILD_MAX 1
+#define _SC_CLK_TCK 2
+#define _SC_NGROUPS_MAX 3
+#define _SC_OPEN_MAX 4
+#define _SC_JOB_CONTROL 5
+#define _SC_SAVED_IDS 6
+#define _SC_VERSION 7
+#define _SC_PASS_MAX 8
+#define _SC_XOPEN_VERSION 9
+#define _SC_TZNAME_MAX 666 /* Not handled by SCO's system call. */
+
+#ifdef __USE_POSIX2
+/* Values for the NAME argument to `confstr'. */
+enum
+ {
+ _CS_PATH /* The default search path. */
+ };
+#endif
diff --git a/sysdeps/unix/sysv/sco3.2.4/direct.h b/sysdeps/unix/sysv/sco3.2.4/direct.h
new file mode 100644
index 0000000000..b3eaa54c8b
--- /dev/null
+++ b/sysdeps/unix/sysv/sco3.2.4/direct.h
@@ -0,0 +1,22 @@
+#ifndef MAXNAMLEN
+#define MAXNAMLEN 512
+#endif
+#define DIRBUF 1048 /* minimum buffer size for call to getdents */
+
+struct direct
+ {
+ unsigned short int d_fileno;
+ short int d_pad;
+ long int d_off;
+ unsigned short int d_reclen;
+ char d_name[1]; /* Actually longer. */
+ };
+
+#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)
diff --git a/sysdeps/unix/sysv/sco3.2.4/getgroups.c b/sysdeps/unix/sysv/sco3.2.4/getgroups.c
new file mode 100644
index 0000000000..68966bc5df
--- /dev/null
+++ b/sysdeps/unix/sysv/sco3.2.4/getgroups.c
@@ -0,0 +1,45 @@
+/* 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. */
+
+#include <ansidecl.h>
+#include <sys/types.h>
+#include <unistd.h>
+#include <limits.h>
+#include <alloca.h>
+
+extern int __sco_getgroups __P ((int size, unsigned short int *list));
+
+int
+DEFUN(__getgroups, (size, list), int size AND gid_t *list)
+{
+ int i;
+ unsigned short int *shortlist;
+
+ if (size <= 0)
+ return __sco_getgroups (size, NULL);
+
+ shortlist = __alloca (size * sizeof (*shortlist));
+
+ size = __sco_getgroups (size, shortlist);
+ for (i = 0; i < size; ++i)
+ list[i] = shortlist[i];
+
+ return size;
+}
+
+weak_alias (__getgroups, getgroups)
diff --git a/sysdeps/unix/sysv/sco3.2.4/getpgid.c b/sysdeps/unix/sysv/sco3.2.4/getpgid.c
new file mode 100644
index 0000000000..3b47d9dee2
--- /dev/null
+++ b/sysdeps/unix/sysv/sco3.2.4/getpgid.c
@@ -0,0 +1 @@
+#include <sysdeps/unix/sysv/sysv4/getpgid.c>
diff --git a/sysdeps/unix/sysv/sco3.2.4/pathconf.S b/sysdeps/unix/sysv/sco3.2.4/pathconf.S
new file mode 100644
index 0000000000..1c4dd9571c
--- /dev/null
+++ b/sysdeps/unix/sysv/sco3.2.4/pathconf.S
@@ -0,0 +1,24 @@
+/* Copyright (C) 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>
+
+SYSCALL__ (pathconf, 2)
+ ret
+
+weak_alias (__pathconf, pathconf)
diff --git a/sysdeps/unix/sysv/sco3.2.4/pgrpsys.S b/sysdeps/unix/sysv/sco3.2.4/pgrpsys.S
new file mode 100644
index 0000000000..2c7d994c28
--- /dev/null
+++ b/sysdeps/unix/sysv/sco3.2.4/pgrpsys.S
@@ -0,0 +1 @@
+#include <sysdeps/unix/sysv/sysv4/pgrpsys.S>
diff --git a/sysdeps/unix/sysv/sco3.2.4/pipestream.c b/sysdeps/unix/sysv/sco3.2.4/pipestream.c
new file mode 100644
index 0000000000..b768e62043
--- /dev/null
+++ b/sysdeps/unix/sysv/sco3.2.4/pipestream.c
@@ -0,0 +1,3 @@
+/* SCO 3.2v4 does have `waitpid'.
+ Avoid unix/pipestream.c, which says we don't. */
+#include <sysdeps/posix/pipestream.c>
diff --git a/sysdeps/unix/sysv/sco3.2.4/sco_getgrp.S b/sysdeps/unix/sysv/sco3.2.4/sco_getgrp.S
new file mode 100644
index 0000000000..e68c300821
--- /dev/null
+++ b/sysdeps/unix/sysv/sco3.2.4/sco_getgrp.S
@@ -0,0 +1,22 @@
+/* Copyright (C) 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. */
+
+#include <sysdep.h>
+
+PSEUDO (__sco_getgroups, getgroups, 2)
+ ret
diff --git a/sysdeps/unix/sysv/sco3.2.4/setpgid.c b/sysdeps/unix/sysv/sco3.2.4/setpgid.c
new file mode 100644
index 0000000000..cc9c4cd61b
--- /dev/null
+++ b/sysdeps/unix/sysv/sco3.2.4/setpgid.c
@@ -0,0 +1 @@
+#include <sysdeps/unix/sysv/sysv4/setpgid.c>
diff --git a/sysdeps/unix/sysv/sco3.2.4/setsid.c b/sysdeps/unix/sysv/sco3.2.4/setsid.c
new file mode 100644
index 0000000000..6337652552
--- /dev/null
+++ b/sysdeps/unix/sysv/sco3.2.4/setsid.c
@@ -0,0 +1 @@
+#include <sysdeps/unix/sysv/sysv4/setsid.c>
diff --git a/sysdeps/unix/sysv/sco3.2.4/sigaction.S b/sysdeps/unix/sysv/sco3.2.4/sigaction.S
new file mode 100644
index 0000000000..dc1bb418d6
--- /dev/null
+++ b/sysdeps/unix/sysv/sco3.2.4/sigaction.S
@@ -0,0 +1,29 @@
+/* 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. */
+
+#include <sysdep.h>
+
+.globl C_SYMBOL_NAME(__sigreturn)
+
+ENTRY (__sigaction)
+ movl $C_SYMBOL_NAME(__sigreturn), %ecx
+ DO_CALL (sigaction, 3)
+ jb syscall_error
+ ret
+
+weak_alias (__sigaction, sigaction)
diff --git a/sysdeps/unix/sysv/sco3.2.4/sigaction.h b/sysdeps/unix/sysv/sco3.2.4/sigaction.h
new file mode 100644
index 0000000000..c6344f0810
--- /dev/null
+++ b/sysdeps/unix/sysv/sco3.2.4/sigaction.h
@@ -0,0 +1,39 @@
+/* The proper definitions for SCO's sigaction.
+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, 1992 Free Software Foundation, Inc., 675 Mass Ave,
+Cambridge, MA 02139, USA. */
+
+/* Structure describing the action to be taken when a signal arrives. */
+struct sigaction
+ {
+ /* Signal handler. */
+ __sighandler_t sa_handler;
+
+ /* Additional set of signals to be blocked. */
+ __sigset_t sa_mask;
+
+ /* Special flags. */
+ int sa_flags;
+ };
+
+/* Bits in `sa_flags'. */
+#define SA_NOCLDSTOP 0x01 /* Don't send SIGCHLD when children stop. */
+
+/* Values for the HOW argument to `sigprocmask'. */
+#define SIG_SETMASK 0 /* Set the set of blocked signals. */
+#define SIG_BLOCK 1 /* Block signals. */
+#define SIG_UNBLOCK 2 /* Unblock signals. */
diff --git a/sysdeps/unix/sysv/sco3.2.4/sigpending.S b/sysdeps/unix/sysv/sco3.2.4/sigpending.S
new file mode 100644
index 0000000000..bc05b2ef6e
--- /dev/null
+++ b/sysdeps/unix/sysv/sco3.2.4/sigpending.S
@@ -0,0 +1,22 @@
+/* Copyright (C) 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. */
+
+#include <sysdep.h>
+
+SYSCALL (sigpending, 1)
+ ret
diff --git a/sysdeps/unix/sysv/sco3.2.4/sigprocmask.S b/sysdeps/unix/sysv/sco3.2.4/sigprocmask.S
new file mode 100644
index 0000000000..ff199158a4
--- /dev/null
+++ b/sysdeps/unix/sysv/sco3.2.4/sigprocmask.S
@@ -0,0 +1,24 @@
+/* Copyright (C) 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>
+
+SYSCALL__ (sigprocmask, 3)
+ ret
+
+weak_alias (__sigprocmask, sigprocmask)
diff --git a/sysdeps/unix/sysv/sco3.2.4/sigsuspend.S b/sysdeps/unix/sysv/sco3.2.4/sigsuspend.S
new file mode 100644
index 0000000000..9bce3878fd
--- /dev/null
+++ b/sysdeps/unix/sysv/sco3.2.4/sigsuspend.S
@@ -0,0 +1 @@
+#include <sysdeps/unix/sysv/sysv4/sigsuspend.S>
diff --git a/sysdeps/unix/sysv/sco3.2.4/syscall.h b/sysdeps/unix/sysv/sco3.2.4/syscall.h
new file mode 100644
index 0000000000..316bd0d0ce
--- /dev/null
+++ b/sysdeps/unix/sysv/sco3.2.4/syscall.h
@@ -0,0 +1,107 @@
+/* From Scott Bartram. */
+
+#ifndef _SYSCALL_H
+#define _SYSCALL_H
+
+#define SYS_access 33
+#define SYS_acct 51
+#define SYS_advfs 70
+#define SYS_alarm 27
+#define SYS_break 17
+#define SYS_brk 17
+#define SYS_chdir 12
+#define SYS_chmod 15
+#define SYS_chown 16
+#define SYS_chroot 61
+#define SYS_chsize 0x0a28
+#define SYS_close 6
+#define SYS_creat 8
+#define SYS_dup 41
+#define SYS_exec 11
+#define SYS_exece 59
+#define SYS_exit 1
+#define SYS_fcntl 62
+#define SYS_fork 2
+#define SYS_fpathconf 0x2f28
+#define SYS_fstat 28
+#define SYS_fstatfs 38
+#define SYS_ftime 0x0b28
+#define SYS_getdents 81
+#define SYS_getgid 47
+#define SYS_getgroups 0x2b28
+#define SYS_getitimer 0x3728
+#define SYS_getmsg 85
+#define SYS_getpid 20
+#define SYS_getuid 24
+#define SYS_gtty 32
+#define SYS_ioctl 54
+#define SYS_kill 37
+#define SYS_link 9
+#define SYS_lock 45
+#define SYS_lseek 19
+#define SYS_lstat 91
+#define SYS_mkdir 80
+#define SYS_mknod 14
+#define SYS_mount 21
+#define SYS_msgsys 49
+#define SYS_nap 0x0c28
+#define SYS_nice 34
+#define SYS_open 5
+#define SYS_pathconf 0x2e28
+#define SYS_pause 29
+#define SYS_pgrpsys 39
+#define SYS_pipe 42
+#define SYS_plock 45
+#define SYS_poll 87
+#define SYS_prof 44
+#define SYS_ptrace 26
+#define SYS_putmsg 86
+#define SYS_rdebug 76
+#define SYS_read 3
+#define SYS_readlink 92
+#define SYS_rename 0x3028
+#define SYS_rfstart 74
+#define SYS_rfstop 77
+#define SYS_rfsys 78
+#define SYS_rmdir 79
+#define SYS_rmount 72
+#define SYS_rumount 73
+#define SYS_seek 19
+#define SYS_select 0x2428
+#define SYS_semsys 53
+#define SYS_setgid 46
+#define SYS_setgroups 0x2c28
+#define SYS_setitimer 0x3828
+#define SYS_setpgrp 39
+#define SYS_setuid 23
+#define SYS_shmsys 52
+#define SYS_sigaction 0x2728
+#define SYS_signal 48
+#define SYS_sigpending 0x2928
+#define SYS_sigprocmask 0x2828
+#define SYS_sigsuspend 0x2a28
+#define SYS_stat 18
+#define SYS_statfs 35
+#define SYS_stime 25
+#define SYS_stty 31
+#define SYS_symlink 90
+#define SYS_sync 36
+#define SYS_sys3b 50
+#define SYS_sysacct 51
+#define SYS_sysconf 0x2d28
+#define SYS_sysfs 84
+#define SYS_sysi86 50
+#define SYS_time 13
+#define SYS_times 43
+#define SYS_uadmin 55
+#define SYS_ulimit 63
+#define SYS_umask 60
+#define SYS_umount 22
+#define SYS_unadvfs 71
+#define SYS_unlink 10
+#define SYS_utime 30
+#define SYS_utssys 57
+#define SYS_wait 7
+#define SYS_write 4
+
+#endif
diff --git a/sysdeps/unix/sysv/sco3.2.4/sysconf.S b/sysdeps/unix/sysv/sco3.2.4/sysconf.S
new file mode 100644
index 0000000000..631e5e977a
--- /dev/null
+++ b/sysdeps/unix/sysv/sco3.2.4/sysconf.S
@@ -0,0 +1,30 @@
+/* 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. */
+
+#include <sysdep.h>
+#include <confname.h>
+
+.globl __tzname_max
+ENTRY (__sysconf)
+ cmpl $_SC_TZNAME_MAX, 4(%esp) /* Is the arg _SC_TZNAME_MAX? */
+ je tzname
+ DO_CALL (sysconf, 1) /* No; use the SCO system call. */
+ ret
+tzname: jmp C_SYMBOL_NAME(__tzname_max) /* Yes; bounce to __tzname_max (). */
+
+weak_alias (__sysconf, sysconf)
diff --git a/sysdeps/unix/sysv/sco3.2.4/system.c b/sysdeps/unix/sysv/sco3.2.4/system.c
new file mode 100644
index 0000000000..06dc066b88
--- /dev/null
+++ b/sysdeps/unix/sysv/sco3.2.4/system.c
@@ -0,0 +1,10 @@
+/* SCO has a bug where `waitpid' will never return if SIGCHLD is blocked.
+ They have acknowledged that this is a bug but I have not seen nor heard
+ of any forthcoming fix. */
+
+#define WAITPID_CANNOT_BLOCK_SIGCHLD
+
+/* SCO 3.2v4 does have `waitpid'.
+ Avoid unix/system.c, which says we don't. */
+
+#include <sysdeps/posix/system.c>
diff --git a/sysdeps/unix/sysv/sco3.2.4/uname.S b/sysdeps/unix/sysv/sco3.2.4/uname.S
new file mode 100644
index 0000000000..a22d18a3e6
--- /dev/null
+++ b/sysdeps/unix/sysv/sco3.2.4/uname.S
@@ -0,0 +1,42 @@
+/* Copyright (C) 1993, 1994 Free Software Foundation, Inc.
+ Contributed by Scott Bartram.
+
+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>
+
+/*
+ before lcall, stack contents should be:
+
+ 4(%esp) -> name
+ 8(%esp) -> unspecified
+ 12(%esp) -> 0
+ */
+
+ENTRY (uname)
+ pushl $0x0 /* Push the discriminator flag. */
+ pushl $0x0 /* Push dummy placeholder. */
+ pushl 12(%esp,1) /* Push NAME (ptr to struct utsname) */
+ subl $0x4, %esp /* Adjust stack pointer. */
+ DO_CALL (utssys, 3)
+ jb error /* Test for error. */
+ addl $0x10, %esp /* Adjust the stack pointer. */
+ xorl %eax, %eax /* Clear return value. */
+ ret
+error: addl $0x10, %esp /* Adjust the stack pointer. */
+ jmp syscall_error
diff --git a/sysdeps/unix/sysv/sco3.2.4/waitpid.S b/sysdeps/unix/sysv/sco3.2.4/waitpid.S
new file mode 100644
index 0000000000..523ef37e53
--- /dev/null
+++ b/sysdeps/unix/sysv/sco3.2.4/waitpid.S
@@ -0,0 +1,36 @@
+/* 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. */
+
+#include <sysdep.h>
+
+ENTRY (__waitpid)
+ /* The `waitpid' system call is distinguished from plain
+ `wait' by setting lots of bits in the processor flags. */
+ pushfl /* Push the flags word. */
+ popl %eax /* Pop it into the accumulator. */
+ orl $0x8c4, %eax /* Set lots of bits. */
+ pushl %eax /* Push the new flags word. */
+ popfl /* Pop it into the flags. */
+ DO_CALL (wait, 2)
+ movl 8(%esp), scratch /* Put status pointer in scratch register. */
+ testl scratch, scratch /* Is it non-nil? */
+ je null
+ movl r1, (scratch) /* Yes; store the status there. */
+null: ret
+
+weak_alias (__waitpid, waitpid)
diff --git a/sysdeps/unix/sysv/sco3.2/Dist b/sysdeps/unix/sysv/sco3.2/Dist
new file mode 100644
index 0000000000..60fab2bdea
--- /dev/null
+++ b/sysdeps/unix/sysv/sco3.2/Dist
@@ -0,0 +1 @@
+__fltused.c
diff --git a/sysdeps/unix/sysv/sco3.2/Makefile b/sysdeps/unix/sysv/sco3.2/Makefile
new file mode 100644
index 0000000000..1be24e85e3
--- /dev/null
+++ b/sysdeps/unix/sysv/sco3.2/Makefile
@@ -0,0 +1,23 @@
+# Copyright (C) 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.
+
+ifeq ($(subdir),misc)
+
+sysdep_routines := $(sysdep_routines) __fltused
+
+endif
diff --git a/sysdeps/unix/sysv/sco3.2/__fltused.c b/sysdeps/unix/sysv/sco3.2/__fltused.c
new file mode 100644
index 0000000000..5d1d67f0b1
--- /dev/null
+++ b/sysdeps/unix/sysv/sco3.2/__fltused.c
@@ -0,0 +1,3 @@
+/* Code compiled by the SCO compiler apparently likes this to be defined. */
+
+int __fltused = 1;
diff --git a/sysdeps/unix/sysv/sco3.2/local_lim.h b/sysdeps/unix/sysv/sco3.2/local_lim.h
new file mode 100644
index 0000000000..6d6c3b0ac8
--- /dev/null
+++ b/sysdeps/unix/sysv/sco3.2/local_lim.h
@@ -0,0 +1,37 @@
+/* Copyright (C) 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 _LOCAL_LIM_H
+#define _LOCAL_LIM_H 1
+
+#define NGROUPS_MAX 8 /* Maximum number of supplementary groups. */
+#define ARG_MAX 5120
+#define CHILD_MAX 25
+#define OPEN_MAX 60
+#define LINK_MAX 1000
+#define MAX_CANON 256
+
+/* For SVR3, this is 14. For SVR4, it is 255, at least on ufs
+ file systems, even though the System V limits.h incorrectly
+ defines it as 14. Giving it a value which is too large
+ is harmless (it is a maximum). */
+#define NAME_MAX 255
+
+#define PATH_MAX 1024
+
+#endif /* local_lim.h */
diff --git a/sysdeps/unix/sysv/setrlimit.c b/sysdeps/unix/sysv/setrlimit.c
new file mode 100644
index 0000000000..be4158e16e
--- /dev/null
+++ b/sysdeps/unix/sysv/setrlimit.c
@@ -0,0 +1,58 @@
+/* setrlimit function for systems with ulimit system call (SYSV).
+
+Copyright (C) 1991, 1992 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. */
+
+/* This only implements those functions which are available via ulimit. */
+
+#include <ansidecl.h>
+#include <sys/resource.h>
+#include <stddef.h>
+#include <errno.h>
+
+/* Set the soft and hard limits for RESOURCE to *RLIMITS.
+ Only the super-user can increase hard limits.
+ Return 0 if successful, -1 if not (and sets errno). */
+int
+DEFUN(setrlimit, (resource, rlimits),
+ enum __rlimit_resource resource AND struct rlimit *rlimits)
+{
+ if (rlimits == NULL)
+ {
+ errno = EINVAL;
+ return -1;
+ }
+
+ switch (resource)
+ {
+ case RLIMIT_FSIZE:
+ return __ulimit(2, rlimits->rlim_cur);
+
+ case RLIMIT_DATA:
+ case RLIMIT_CPU:
+ case RLIMIT_STACK:
+ case RLIMIT_CORE:
+ case RLIMIT_RSS:
+ errno = ENOSYS;
+ return -1;
+
+ default:
+ errno = EINVAL;
+ return -1;
+ }
+}
diff --git a/sysdeps/unix/sysv/settimeofday.c b/sysdeps/unix/sysv/settimeofday.c
new file mode 100644
index 0000000000..1217c6beee
--- /dev/null
+++ b/sysdeps/unix/sysv/settimeofday.c
@@ -0,0 +1,47 @@
+/* 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 <ansidecl.h>
+#include <errno.h>
+#include <sys/time.h>
+
+/* Set the current time of day and timezone information.
+ This call is restricted to the super-user. */
+int
+DEFUN(__settimeofday, (tv, tz),
+ CONST struct timeval *tv AND CONST struct timezone *tz)
+{
+ time_t when;
+
+ if (tv == NULL)
+ {
+ errno = EINVAL;
+ return -1;
+ }
+
+ if (tz != NULL || tv->tv_usec % 1000000 != 0)
+ {
+ errno = ENOSYS;
+ return -1;
+ }
+
+ when = tv->tv_sec + (tv->tv_usec / 1000000);
+ return stime (&when);
+}
+
+weak_alias (__settimeofday, settimeofday)
diff --git a/sysdeps/unix/sysv/sigaction.c b/sysdeps/unix/sysv/sigaction.c
new file mode 100644
index 0000000000..ebb42cf756
--- /dev/null
+++ b/sysdeps/unix/sysv/sigaction.c
@@ -0,0 +1,83 @@
+/* Copyright (C) 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 <errno.h>
+#include <stddef.h>
+#include <signal.h>
+
+
+/* If ACT is not NULL, change the action for SIG to *ACT.
+ If OACT is not NULL, put the old action for SIG in *OACT. */
+int
+DEFUN(__sigaction, (sig, act, oact),
+ int sig AND CONST struct sigaction *act AND struct sigaction *oact)
+{
+ sighandler_t handler;
+ int save;
+
+ if (sig <= 0 || sig >= NSIG)
+ {
+ errno = EINVAL;
+ return -1;
+ }
+
+ if (act == NULL)
+ {
+ if (oact == NULL)
+ return 0;
+ /* Race condition, but this is the only way to do it. */
+ handler = signal (sig, SIG_IGN);
+ if (handler == SIG_ERR)
+ return -1;
+ save = errno;
+ (void) signal (sig, handler);
+ errno = save;
+ }
+ else
+ {
+ int i;
+
+ if (act->sa_flags != 0)
+ {
+ unimplemented:
+ errno = ENOSYS;
+ return -1;
+ }
+
+ for (i = 1; i < NSIG; ++i)
+ if (__sigismember (&act->sa_mask, i))
+ goto unimplemented;
+
+ handler = signal (sig, act->sa_handler);
+ if (handler == SIG_ERR)
+ return -1;
+ }
+
+ if (oact != NULL)
+ {
+ oact->sa_handler = handler;
+ __sigemptyset (&oact->sa_mask);
+ oact->sa_flags = 0;
+ }
+
+ return 0;
+}
+
+weak_alias (__sigaction, sigaction)
diff --git a/sysdeps/unix/sysv/signal.S b/sysdeps/unix/sysv/signal.S
new file mode 100644
index 0000000000..5230b3463d
--- /dev/null
+++ b/sysdeps/unix/sysv/signal.S
@@ -0,0 +1,22 @@
+/* Copyright (C) 1991, 1992 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 (signal, 2)
+ ret
diff --git a/sysdeps/unix/sysv/signum.h b/sysdeps/unix/sysv/signum.h
new file mode 100644
index 0000000000..e28a62a287
--- /dev/null
+++ b/sysdeps/unix/sysv/signum.h
@@ -0,0 +1,56 @@
+/* Signal number definitions. System V version.
+Copyright (C) 1991, 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. */
+
+#ifdef _SIGNAL_H
+
+/* This file defines the fake signal functions and signal
+ number constants for System V release 3. */
+
+/* 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 SIGABRT SIGIOT /* Abort (ANSI). */
+#define SIGTRAP 5 /* Trace trap (POSIX). */
+#define SIGIOT 6 /* IOT trap (4.2 BSD). */
+#define SIGEMT 7 /* EMT trap (4.2 BSD). */
+#define SIGFPE 8 /* Floating-point exception (ANSI). */
+#define SIGKILL 9 /* Kill, unblockable (POSIX). */
+#define SIGBUS 10 /* Bus error (4.2 BSD). */
+#define SIGSEGV 11 /* Segmentation violation (ANSI). */
+#define SIGSYS 12 /* Bad argument to system call (4.2 BSD)*/
+#define SIGPIPE 13 /* Broken pipe (POSIX). */
+#define SIGALRM 14 /* Alarm clock (POSIX). */
+#define SIGTERM 15 /* Termination (ANSI). */
+#define SIGUSR1 16 /* User-defined signal 1 (POSIX). */
+#define SIGUSR2 17 /* User-defined signal 2 (POSIX). */
+#define SIGCHLD 18 /* Child status has changed (POSIX). */
+#define SIGCLD SIGCHLD /* Same as SIGCHLD (System V). */
+#define SIGPWR 19 /* Power failure restart (System V). */
+
+#endif /* <signal.h> included. */
+
+#define _NSIG 20 /* Biggest signal number + 1. */
diff --git a/sysdeps/unix/sysv/statbuf.h b/sysdeps/unix/sysv/statbuf.h
new file mode 100644
index 0000000000..aa2cdfedcd
--- /dev/null
+++ b/sysdeps/unix/sysv/statbuf.h
@@ -0,0 +1,61 @@
+/* Copyright (C) 1992 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;
+ unsigned short int st_ino;
+ unsigned short int st_mode;
+ short int st_nlink;
+ unsigned short int st_uid;
+ unsigned short int st_gid;
+ short int st_rdev;
+ long int st_size;
+ long int st_atime;
+ long int st_mtime;
+ long int st_ctime;
+ };
+
+/* 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/stime.S b/sysdeps/unix/sysv/stime.S
new file mode 100644
index 0000000000..0ffb6bbb7c
--- /dev/null
+++ b/sysdeps/unix/sysv/stime.S
@@ -0,0 +1,22 @@
+/* Copyright (C) 1992 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 (stime, 1)
+ ret
diff --git a/sysdeps/unix/sysv/sysd-stdio.c b/sysdeps/unix/sysv/sysd-stdio.c
new file mode 100644
index 0000000000..35dae27a37
--- /dev/null
+++ b/sysdeps/unix/sysv/sysd-stdio.c
@@ -0,0 +1,2 @@
+#define EINTR_REPEAT
+#include <../sysdeps/generic/sysd-stdio.c>
diff --git a/sysdeps/unix/sysv/sysv4/Dist b/sysdeps/unix/sysv/sysv4/Dist
new file mode 100644
index 0000000000..f603d8b8ff
--- /dev/null
+++ b/sysdeps/unix/sysv/sysv4/Dist
@@ -0,0 +1,7 @@
+sysconfig.h
+sysconfig.S
+pgrpsys.S
+__waitid.S
+siginfo.h
+__getpgid.c __setpgid.c
+sysinfo.S
diff --git a/sysdeps/unix/sysv/sysv4/Implies b/sysdeps/unix/sysv/sysv4/Implies
new file mode 100644
index 0000000000..953822ea48
--- /dev/null
+++ b/sysdeps/unix/sysv/sysv4/Implies
@@ -0,0 +1,3 @@
+# The directory unix/common contains things which are common to both BSD
+# and SVR4.
+unix/common
diff --git a/sysdeps/unix/sysv/sysv4/Makefile b/sysdeps/unix/sysv/sysv4/Makefile
new file mode 100644
index 0000000000..0c149da85c
--- /dev/null
+++ b/sysdeps/unix/sysv/sysv4/Makefile
@@ -0,0 +1,36 @@
+# 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.
+
+ifeq ($(subdir),posix)
+
+sysdep_routines := $(sysdep_routines) sysconfig pgrpsys __waitid
+
+endif
+
+
+ifeq ($(subdir),signal)
+
+sysdep_routines := $(sysdep_routines) sys-sig
+
+endif
+
+ifeq ($(subdir),misc)
+
+sysdep_routines := $(sysdep_routines) sysinfo
+
+endif
diff --git a/sysdeps/unix/sysv/sysv4/__getpgid.c b/sysdeps/unix/sysv/sysv4/__getpgid.c
new file mode 100644
index 0000000000..76a6e80f59
--- /dev/null
+++ b/sysdeps/unix/sysv/sysv4/__getpgid.c
@@ -0,0 +1,31 @@
+/* Copyright (C) 1993 Free Software Foundation, Inc.
+ Contributed by Brendan Kehoe (brendan@zen.org).
+
+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 <errno.h>
+#include <unistd.h>
+#include <sys/types.h>
+
+extern int __pgrpsys __P ((int type, ...));
+
+/* Get the process group ID of process PID. */
+int
+DEFUN(__getpgid, (pid), pid_t pid)
+{
+ return __pgrpsys (4, pid);
+}
diff --git a/sysdeps/unix/sysv/sysv4/__setpgid.c b/sysdeps/unix/sysv/sysv4/__setpgid.c
new file mode 100644
index 0000000000..594e4e9fe6
--- /dev/null
+++ b/sysdeps/unix/sysv/sysv4/__setpgid.c
@@ -0,0 +1,31 @@
+/* Copyright (C) 1993 Free Software Foundation, Inc.
+ Contributed by Brendan Kehoe (brendan@zen.org).
+
+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 <errno.h>
+#include <unistd.h>
+#include <sys/types.h>
+
+extern int __pgrpsys __P ((int type, ...));
+
+/* Get the process group ID of process PID. */
+int
+DEFUN(__setpgid, (pid, pgid), pid_t pid AND pid_t pgid)
+{
+ return __pgrpsys (5, pid, pgid);
+}
diff --git a/sysdeps/unix/sysv/sysv4/__waitid.S b/sysdeps/unix/sysv/sysv4/__waitid.S
new file mode 100644
index 0000000000..845bec85e2
--- /dev/null
+++ b/sysdeps/unix/sysv/sysv4/__waitid.S
@@ -0,0 +1,25 @@
+/* Copyright (C) 1993 Free Software Foundation, Inc.
+ Contributed by Brendan Kehoe (brendan@zen.org).
+
+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>
+
+/* XXX */
+#define SYS_waitid SYS_waitsys
+
+SYSCALL__ (waitid, 3)
+ ret
diff --git a/sysdeps/unix/sysv/sysv4/dup2.c b/sysdeps/unix/sysv/sysv4/dup2.c
new file mode 100644
index 0000000000..c7015fce7e
--- /dev/null
+++ b/sysdeps/unix/sysv/sysv4/dup2.c
@@ -0,0 +1,4 @@
+/* SVR4 uses the POSIX dup2. */
+#include <sysdeps/posix/__dup2.c>
+
+weak_alias (__dup2, dup2)
diff --git a/sysdeps/unix/sysv/sysv4/fchdir.S b/sysdeps/unix/sysv/sysv4/fchdir.S
new file mode 100644
index 0000000000..ef11d55bc0
--- /dev/null
+++ b/sysdeps/unix/sysv/sysv4/fchdir.S
@@ -0,0 +1,2 @@
+/* SVR4 uses the BSD 4.4 fchdir(2) syscall. */
+#include <sysdeps/unix/bsd/bsd4.4/fchdir.S>
diff --git a/sysdeps/unix/sysv/sysv4/ftruncate.c b/sysdeps/unix/sysv/sysv4/ftruncate.c
new file mode 100644
index 0000000000..45f2614257
--- /dev/null
+++ b/sysdeps/unix/sysv/sysv4/ftruncate.c
@@ -0,0 +1,37 @@
+/* ftruncate for SVR4 using the fcntl F_FREESP command.
+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 <ansidecl.h>
+#include <sys/types.h>
+#include <unistd.h>
+#include <fcntl.h>
+#include <string.h>
+
+/* Truncate the file FD refers to to LENGTH bytes. */
+int
+DEFUN(ftruncate, (fd, length),
+ int fd AND off_t length)
+{
+ struct flock fl;
+
+ memset (&fl, 0, sizeof fl);
+ fl.l_type = F_WRLCK;
+ fl.l_start = length;
+ return fcntl (fd, F_FREESP, &fl);
+}
diff --git a/sysdeps/unix/sysv/sysv4/getdtsz.c b/sysdeps/unix/sysv/sysv4/getdtsz.c
new file mode 100644
index 0000000000..c1ae6108fb
--- /dev/null
+++ b/sysdeps/unix/sysv/sysv4/getdtsz.c
@@ -0,0 +1,2 @@
+/* Solaris uses sysconf ala POSIX.1. */
+#include <sysdeps/posix/getdtsz.c>
diff --git a/sysdeps/unix/sysv/sysv4/gethostname.c b/sysdeps/unix/sysv/sysv4/gethostname.c
new file mode 100644
index 0000000000..cce1149e7f
--- /dev/null
+++ b/sysdeps/unix/sysv/sysv4/gethostname.c
@@ -0,0 +1,33 @@
+/* Copyright (C) 1994, 1995 Free Software Foundation, Inc.
+ Contributed by Brendan Kehoe (brendan@zen.org).
+
+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 <errno.h>
+#include <unistd.h>
+#include <sys/types.h>
+#include <sys/systeminfo.h>
+
+extern int __sysinfo __P ((int command, char *buf, long count));
+
+int
+DEFUN(__gethostname, (name, namelen), char *name AND size_t namelen)
+{
+ return __sysinfo (SI_HOSTNAME, name, namelen);
+}
+
+weak_alias (__gethostname, gethostname)
diff --git a/sysdeps/unix/sysv/sysv4/getpagesize.c b/sysdeps/unix/sysv/sysv4/getpagesize.c
new file mode 100644
index 0000000000..6119640758
--- /dev/null
+++ b/sysdeps/unix/sysv/sysv4/getpagesize.c
@@ -0,0 +1,2 @@
+/* Solaris uses sysconf ala POSIX.1. */
+#include <sysdeps/posix/getpagesize.c>
diff --git a/sysdeps/unix/sysv/sysv4/getpgid.c b/sysdeps/unix/sysv/sysv4/getpgid.c
new file mode 100644
index 0000000000..309e2f11e4
--- /dev/null
+++ b/sysdeps/unix/sysv/sysv4/getpgid.c
@@ -0,0 +1,33 @@
+/* Copyright (C) 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 <ansidecl.h>
+#include <errno.h>
+#include <unistd.h>
+#include <sys/types.h>
+
+extern int __pgrpsys __P ((int type, ...));
+
+/* Get the process group ID of process PID. */
+int
+DEFUN(__getpgid, (pid), pid_t pid)
+{
+ return __pgrpsys (4, pid);
+}
+
+weak_alias (__getpgid, getpgid)
diff --git a/sysdeps/unix/sysv/sysv4/i386/Dist b/sysdeps/unix/sysv/sysv4/i386/Dist
new file mode 100644
index 0000000000..69d16ac6bf
--- /dev/null
+++ b/sysdeps/unix/sysv/sysv4/i386/Dist
@@ -0,0 +1 @@
+sys-sig.S
diff --git a/sysdeps/unix/sysv/sysv4/i386/Makefile b/sysdeps/unix/sysv/sysv4/i386/Makefile
new file mode 100644
index 0000000000..56f0a37de1
--- /dev/null
+++ b/sysdeps/unix/sysv/sysv4/i386/Makefile
@@ -0,0 +1,3 @@
+ifeq ($(subdir),signal)
+sysdep_routines := $(sysdep_routines) sys-sig
+endif
diff --git a/sysdeps/unix/sysv/sysv4/i386/fstat.S b/sysdeps/unix/sysv/sysv4/i386/fstat.S
new file mode 100644
index 0000000000..11743b3fc3
--- /dev/null
+++ b/sysdeps/unix/sysv/sysv4/i386/fstat.S
@@ -0,0 +1,37 @@
+/* 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. */
+
+#include <sysdep.h>
+
+/* In SVR4 the `stat' call is actually done by the `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' system calls. This macro gives the SVR4 version number that
+ corresponds to the definition of `struct stat' in <statbuf.h>. */
+#define _STAT_VER 2
+
+.globl syscall_error
+ENTRY (__fstat)
+ popl %eax /* Pop return address into %eax. */
+ pushl $_STAT_VER /* Push extra first arg to syscall. */
+ pushl %eax /* Push back the return address. */
+ DO_CALL (fxstat, 3) /* Do the syscall. */
+ jb syscall_error /* Check for error. */
+ ret /* Return success. */
+
+weak_alias (__fstat, fstat)
diff --git a/sysdeps/unix/sysv/sysv4/i386/lstat.S b/sysdeps/unix/sysv/sysv4/i386/lstat.S
new file mode 100644
index 0000000000..52ffdbadfd
--- /dev/null
+++ b/sysdeps/unix/sysv/sysv4/i386/lstat.S
@@ -0,0 +1,37 @@
+/* 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. */
+
+#include <sysdep.h>
+
+/* In SVR4 the `stat' call is actually done by the `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' system calls. This macro gives the SVR4 version number that
+ corresponds to the definition of `struct stat' in <statbuf.h>. */
+#define _STAT_VER 2
+
+.globl syscall_error
+ENTRY (__lstat)
+ popl %eax /* Pop return address into %eax. */
+ pushl $_STAT_VER /* Push extra first arg to syscall. */
+ pushl %eax /* Push back the return address. */
+ DO_CALL (lxstat, 3) /* Do the syscall. */
+ jb syscall_error /* Check for error. */
+ ret /* Return success. */
+
+weak_alias (__lstat, lstat)
diff --git a/sysdeps/unix/sysv/sysv4/i386/mknod.S b/sysdeps/unix/sysv/sysv4/i386/mknod.S
new file mode 100644
index 0000000000..21f932c921
--- /dev/null
+++ b/sysdeps/unix/sysv/sysv4/i386/mknod.S
@@ -0,0 +1,36 @@
+/* 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. */
+
+#include <sysdep.h>
+
+/* In SVR4 the `mknod' call is actually done by the `xmknod' system call,
+ which takes an additional first argument giving a version number for
+ the interface. This macro gives the SVR4 version number that
+ corresponds to the modern interface. */
+#define _MKNOD_VER 2
+
+.globl syscall_error
+ENTRY (__mknod)
+ popl %eax /* Pop return address into %eax. */
+ pushl $_MKNOD_VER /* Push extra first arg to syscall. */
+ pushl %eax /* Push back the return address. */
+ DO_CALL (xmknod, 3) /* Do the syscall. */
+ jb syscall_error /* Check for error. */
+ ret /* Return success. */
+
+weak_alias (__mknod, mknod)
diff --git a/sysdeps/unix/sysv/sysv4/i386/stat.S b/sysdeps/unix/sysv/sysv4/i386/stat.S
new file mode 100644
index 0000000000..3a5107c267
--- /dev/null
+++ b/sysdeps/unix/sysv/sysv4/i386/stat.S
@@ -0,0 +1,37 @@
+/* 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. */
+
+#include <sysdep.h>
+
+/* In SVR4 the `stat' call is actually done by the `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' system calls. This macro gives the SVR4 version number that
+ corresponds to the definition of `struct stat' in <statbuf.h>. */
+#define _STAT_VER 2
+
+.globl syscall_error
+ENTRY (__stat)
+ popl %eax /* Pop return address into %eax. */
+ pushl $_STAT_VER /* Push extra first arg to syscall. */
+ pushl %eax /* Push back the return address. */
+ DO_CALL (xstat, 3) /* Do the syscall. */
+ jb syscall_error /* Check for error. */
+ ret /* Return success. */
+
+weak_alias (__stat, stat)
diff --git a/sysdeps/unix/sysv/sysv4/i386/statbuf.h b/sysdeps/unix/sysv/sysv4/i386/statbuf.h
new file mode 100644
index 0000000000..6f1bfed850
--- /dev/null
+++ b/sysdeps/unix/sysv/sysv4/i386/statbuf.h
@@ -0,0 +1,84 @@
+/* Copyright (C) 1993 Free Software Foundation, Inc.
+ Contributed by Brendan Kehoe (brendan@zen.org).
+
+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
+
+#include <gnu/types.h>
+
+/* Structure describing file characteristics. */
+struct stat
+ {
+ unsigned long st_dev; /* Device. */
+ long st_filler1[3];
+ unsigned long st_ino; /* File serial number. */
+ unsigned long st_mode; /* File mode. */
+ unsigned long st_nlink; /* Link count. */
+ long st_uid; /* User ID of the file's owner. */
+ long st_gid; /* Group ID of the file's group.*/
+ unsigned long st_rdev; /* Device number, if device. */
+ long st_filler2[2];
+
+ long st_size; /* Size of file, in bytes. */
+ /* SVR4 added this extra long to allow for expansion of off_t. */
+ long st_filler3;
+
+ long st_atime; /* Time of last access. */
+ unsigned long st_atime_usec;
+ long st_mtime; /* Time of last modification. */
+ unsigned long st_mtime_usec;
+ long st_ctime; /* Time of last status change. */
+ unsigned long st_ctime_usec;
+
+ long st_blksize; /* Optimal block size for I/O. */
+#define _STATBUF_ST_BLKSIZE /* Tell code we have this member. */
+
+ long st_blocks; /* Number of 512-byte blocks allocated. */
+ char st_fstype[16]; /* The type of this filesystem. */
+ int st_aclcnt;
+ unsigned long st_level;
+ unsigned long st_flags;
+ unsigned long st_cmwlevel;
+ long st_filler4[4];
+ };
+
+/* 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/sysv4/i386/sys-sig.S b/sysdeps/unix/sysv/sysv4/i386/sys-sig.S
new file mode 100644
index 0000000000..58430e494f
--- /dev/null
+++ b/sysdeps/unix/sysv/sysv4/i386/sys-sig.S
@@ -0,0 +1,30 @@
+/* Copyright (C) 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. */
+
+#include <sysdep.h>
+
+.globl C_SYMBOL_NAME(__sigreturn)
+
+ENTRY (__sigaction_syscall)
+ movl $C_SYMBOL_NAME(__sigreturn), %edx
+ DO_CALL (sigaction, 3)
+ jb syscall_error
+ ret
+
+PSEUDO (__context_syscall, context, 2)
+ ret
diff --git a/sysdeps/unix/sysv/sysv4/i386/sysdep.h b/sysdeps/unix/sysv/sysv4/i386/sysdep.h
new file mode 100644
index 0000000000..1e0cd69f74
--- /dev/null
+++ b/sysdeps/unix/sysv/sysv4/i386/sysdep.h
@@ -0,0 +1,38 @@
+/* Copyright (C) 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. */
+
+#include <sysdeps/unix/sysv/i386/sysdep.h>
+
+/* In SVR4 some system calls can fail with the error ERESTART,
+ and this means the call should be retried. */
+
+#ifndef _ERRNO_H
+#define _ERRNO_H
+#endif
+#include <errnos.h>
+
+#undef PSEUDO
+#define PSEUDO(name, syscall_name, args) \
+ .globl syscall_error; \
+ ENTRY (name) \
+ DO_CALL (syscall_name, args); \
+ jae noerror; \
+ cmpb $ERESTART, %al; \
+ je C_SYMBOL_NAME (name); \
+ jmp syscall_error; \
+ noerror:
diff --git a/sysdeps/unix/sysv/sysv4/i386/vfork.S b/sysdeps/unix/sysv/sysv4/i386/vfork.S
new file mode 100644
index 0000000000..bbe99fbc41
--- /dev/null
+++ b/sysdeps/unix/sysv/sysv4/i386/vfork.S
@@ -0,0 +1 @@
+#include <sysdeps/unix/bsd/i386/vfork.S>
diff --git a/sysdeps/unix/sysv/sysv4/pgrpsys.S b/sysdeps/unix/sysv/sysv4/pgrpsys.S
new file mode 100644
index 0000000000..dcfb487e54
--- /dev/null
+++ b/sysdeps/unix/sysv/sysv4/pgrpsys.S
@@ -0,0 +1,22 @@
+/* Copyright (C) 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. */
+
+#include <sysdep.h>
+
+SYSCALL__ (pgrpsys, 3)
+ ret
diff --git a/sysdeps/unix/sysv/sysv4/pipestream.c b/sysdeps/unix/sysv/sysv4/pipestream.c
new file mode 100644
index 0000000000..6a32f9507c
--- /dev/null
+++ b/sysdeps/unix/sysv/sysv4/pipestream.c
@@ -0,0 +1,2 @@
+/* We deliberately avoid having NO_WAITPID set. */
+#include <sysdeps/posix/pipestream.c>
diff --git a/sysdeps/unix/sysv/sysv4/setegid.S b/sysdeps/unix/sysv/sysv4/setegid.S
new file mode 100644
index 0000000000..f8fd7633a5
--- /dev/null
+++ b/sysdeps/unix/sysv/sysv4/setegid.S
@@ -0,0 +1,2 @@
+/* SVR4 uses the BSD 4.4 setegid() system call. */
+#include <sysdeps/unix/bsd/bsd4.4/setegid.S>
diff --git a/sysdeps/unix/sysv/sysv4/seteuid.S b/sysdeps/unix/sysv/sysv4/seteuid.S
new file mode 100644
index 0000000000..4ff110610f
--- /dev/null
+++ b/sysdeps/unix/sysv/sysv4/seteuid.S
@@ -0,0 +1,2 @@
+/* SVR4 uses the BSD 4.4 seteuid() system call. */
+#include <sysdeps/unix/bsd/bsd4.4/seteuid.S>
diff --git a/sysdeps/unix/sysv/sysv4/sethostname.c b/sysdeps/unix/sysv/sysv4/sethostname.c
new file mode 100644
index 0000000000..4cebc456e1
--- /dev/null
+++ b/sysdeps/unix/sysv/sysv4/sethostname.c
@@ -0,0 +1,31 @@
+/* Copyright (C) 1994 Free Software Foundation, Inc.
+ Contributed by Brendan Kehoe (brendan@zen.org).
+
+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 <errno.h>
+#include <unistd.h>
+#include <sys/types.h>
+#include <sys/systeminfo.h>
+
+extern int __sysinfo __P ((int command, const char *buf, long count));
+
+int
+DEFUN(sethostname, (name, namelen), const char *name AND size_t namelen)
+{
+ return __sysinfo (SI_SET_HOSTNAME, name, namelen);
+}
diff --git a/sysdeps/unix/sysv/sysv4/setpgid.c b/sysdeps/unix/sysv/sysv4/setpgid.c
new file mode 100644
index 0000000000..b9e06dc719
--- /dev/null
+++ b/sysdeps/unix/sysv/sysv4/setpgid.c
@@ -0,0 +1,35 @@
+/* Copyright (C) 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 <ansidecl.h>
+#include <errno.h>
+#include <unistd.h>
+
+extern int __pgrpsys __P ((int type, ...));
+
+/* Set the process group ID of the process matching PID to PGID.
+ If PID is zero, the current process's process group ID is set.
+ If PGID is zero, the process ID of the process is used. */
+int
+DEFUN(__setpgid, (pid, pgid), int pid AND int pgid)
+{
+ return __pgrpsys (5, pid, pgid);
+}
+
+weak_alias (__setpgid, setpgid)
+weak_alias (__setpgid, setpgrp)
diff --git a/sysdeps/unix/sysv/sysv4/setsid.c b/sysdeps/unix/sysv/sysv4/setsid.c
new file mode 100644
index 0000000000..f0d6c8a4cd
--- /dev/null
+++ b/sysdeps/unix/sysv/sysv4/setsid.c
@@ -0,0 +1,34 @@
+/* Copyright (C) 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 <ansidecl.h>
+#include <errno.h>
+#include <unistd.h>
+
+extern int __pgrpsys __P ((int type, ...));
+
+/* Create a new session with the calling process as its leader.
+ The process group IDs of the session and the calling process
+ are set to the process ID of the calling process, which is returned. */
+int
+DEFUN_VOID(__setsid)
+{
+ return __pgrpsys (3);
+}
+
+weak_alias (__setsid, setsid)
diff --git a/sysdeps/unix/sysv/sysv4/sigaction.c b/sysdeps/unix/sysv/sysv4/sigaction.c
new file mode 100644
index 0000000000..68fd7a1846
--- /dev/null
+++ b/sysdeps/unix/sysv/sysv4/sigaction.c
@@ -0,0 +1,79 @@
+/* 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. */
+
+#include <ansidecl.h>
+#include <errno.h>
+#include <signal.h>
+#include <stddef.h>
+
+static __sighandler_t user_handlers[NSIG];
+
+extern int __context_syscall (int, struct sigcontext *);
+extern int __sigaction_syscall (int,
+ const struct sigaction *, struct sigaction *);
+
+static void
+trampoline (int sig, int code, struct sigcontext *context)
+{
+ (*(void (*) (int, int, struct sigcontext *)) user_handlers[sig])
+ (sig, code, context);
+ __context_syscall (1, context);
+}
+
+/* If ACT is not NULL, change the action for SIG to *ACT.
+ If OACT is not NULL, put the old action for SIG in *OACT. */
+int
+DEFUN(__sigaction, (sig, act, oact),
+ int sig AND CONST struct sigaction *act AND struct sigaction *oact)
+{
+ struct sigaction myact;
+ __sighandler_t ohandler;
+
+ if (sig <= 0 || sig >= NSIG)
+ {
+ errno = EINVAL;
+ return -1;
+ }
+
+ ohandler = user_handlers[sig];
+
+ if (act != NULL)
+ {
+ user_handlers[sig] = act->sa_handler;
+ if (act->sa_handler != SIG_DFL && act->sa_handler != SIG_IGN)
+ {
+ myact = *act;
+ act = &myact;
+ act->sa_handler = (__sighandler_t) trampoline;
+ }
+ }
+
+ if (__sigaction_syscall (sig, act, oact) < 0)
+ {
+ /* The syscall got an error. Restore the old handler and return -1. */
+ user_handlers[sig] = ohandler;
+ return -1;
+ }
+
+ if (oact != NULL && oact->sa_handler == (__sighandler_t) trampoline)
+ oact->sa_handler = ohandler;
+
+ return 0;
+}
+
+weak_alias (__sigaction, sigaction)
diff --git a/sysdeps/unix/sysv/sysv4/sigaction.h b/sysdeps/unix/sysv/sysv4/sigaction.h
new file mode 100644
index 0000000000..dbb31f1077
--- /dev/null
+++ b/sysdeps/unix/sysv/sysv4/sigaction.h
@@ -0,0 +1,51 @@
+/* The proper definitions for SVR4's sigaction.
+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, 1992 Free Software Foundation, Inc., 675 Mass Ave,
+Cambridge, MA 02139, USA. */
+
+/* Structure describing the action to be taken when a signal arrives. */
+struct sigaction
+ {
+ /* Special flags. */
+ int sa_flags;
+
+ /* Signal handler. */
+ __sighandler_t sa_handler;
+
+ /* Additional set of signals to be blocked. */
+ __sigset_t sa_mask;
+
+ /* Padding. */
+ int sa_resv[2];
+ };
+
+/* Bits in `sa_flags'. */
+#ifdef __USE_MISC
+#define SA_ONSTACK 0x1 /* Take signal on signal stack. */
+#define SA_RESETHAND 0x2 /* Reset to SIG_DFL on entry to handler. */
+#define SA_RESTART 0x4 /* Don't restart syscall on signal return. */
+#define SA_SIGINFO 0x8 /* Provide additional info to the handler. */
+#define SA_NODEFER 0x10 /* Don't automatically block the signal when
+ its handler is being executed. */
+#define SA_NOCLDWAIT 0x10000 /* Don't save zombie processes. */
+#endif
+#define SA_NOCLDSTOP 0x20000 /* Don't send SIGCHLD when children stop. */
+
+/* Values for the HOW argument to `sigprocmask'. */
+#define SIG_BLOCK 1 /* Block signals. */
+#define SIG_UNBLOCK 2 /* Unblock signals. */
+#define SIG_SETMASK 3 /* Set the set of blocked signals. */
diff --git a/sysdeps/unix/sysv/sysv4/sigaltstack.S b/sysdeps/unix/sysv/sysv4/sigaltstack.S
new file mode 100644
index 0000000000..e7e4060fba
--- /dev/null
+++ b/sysdeps/unix/sysv/sysv4/sigaltstack.S
@@ -0,0 +1,2 @@
+/* SVR4 uses the BSD 4.4 sigaltstack syscall. */
+#include <sysdeps/unix/bsd/bsd4.4/sigaltstk.S>
diff --git a/sysdeps/unix/sysv/sysv4/siginfo.h b/sysdeps/unix/sysv/sysv4/siginfo.h
new file mode 100644
index 0000000000..ce8dd35bf1
--- /dev/null
+++ b/sysdeps/unix/sysv/sysv4/siginfo.h
@@ -0,0 +1,58 @@
+/* Definitions of the siginfo structure.
+ Copyright (C) 1993, 1994 Free Software Foundation, Inc.
+ Contributed by Brendan Kehoe (brendan@zen.org).
+
+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 _SIGINFO_H
+#define _SIGINFO_H 1
+
+#ifdef __USE_SVID
+/* SVR4 puts a ton of other stuff in this structure. For now, we'll just
+ define the two things we really need out of it, and hope for the best. */
+
+/* These define the different states a child can have on exit.
+ We need these to build the status return for things like waitpid. */
+#define EXITED 1
+#define KILLED 2
+#define CORED 3
+#define TRAPPED 4
+#define STOPPED 5
+#define CONTINUED 6
+
+typedef struct __siginfo
+ {
+ int filler1;
+
+ /* Code indicating child's status */
+ int __code;
+
+ int filler2;
+
+ /* The PID of the child. */
+ long __pid;
+
+ int filler3;
+
+ /* The child's status. */
+ int __status;
+
+ int filler4[26];
+
+ } __siginfo_t;
+
+#endif /* __USE_SVID */
+#endif /* siginfo.h */
diff --git a/sysdeps/unix/sysv/sysv4/signum.h b/sysdeps/unix/sysv/sysv4/signum.h
new file mode 100644
index 0000000000..aa3dc7fa25
--- /dev/null
+++ b/sysdeps/unix/sysv/sysv4/signum.h
@@ -0,0 +1,66 @@
+/* Signal number definitions. SVR4 version.
+Copyright (C) 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. */
+
+#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 SIGABRT SIGIOT /* Abort (ANSI). */
+#define SIGTRAP 5 /* Trace trap (POSIX). */
+#define SIGIOT 6 /* IOT trap (4.2 BSD). */
+#define SIGEMT 7 /* EMT trap (4.2 BSD). */
+#define SIGFPE 8 /* Floating-point exception (ANSI). */
+#define SIGKILL 9 /* Kill, unblockable (POSIX). */
+#define SIGBUS 10 /* Bus error (4.2 BSD). */
+#define SIGSEGV 11 /* Segmentation violation (ANSI). */
+#define SIGSYS 12 /* Bad argument to system call (4.2 BSD)*/
+#define SIGPIPE 13 /* Broken pipe (POSIX). */
+#define SIGALRM 14 /* Alarm clock (POSIX). */
+#define SIGTERM 15 /* Termination (ANSI). */
+#define SIGUSR1 16 /* User-defined signal 1 (POSIX). */
+#define SIGUSR2 17 /* User-defined signal 2 (POSIX). */
+#define SIGCHLD 18 /* Child status has changed (POSIX). */
+#define SIGCLD SIGCHLD /* Same as SIGCHLD (System V). */
+#define SIGPWR 19 /* Power failure restart (System V). */
+#define SIGWINCH 20 /* Window size change (4.3 BSD, Sun). */
+#define SIGURG 21 /* Urgent condition on socket (4.2 BSD).*/
+#define SIGPOLL 22 /* Pollable event occurred (System V). */
+#define SIGIO SIGPOLL /* I/O now possible (4.2 BSD). */
+#define SIGSTOP 23 /* Stop, unblockable (POSIX). */
+#define SIGTSTP 24 /* Keyboard stop (POSIX). */
+#define SIGCONT 25 /* Continue (POSIX). */
+#define SIGTTIN 26 /* Background read from tty (POSIX). */
+#define SIGTTOU 27 /* Background write to tty (POSIX). */
+#define SIGVTALRM 28 /* Virtual alarm clock (4.2 BSD). */
+#define SIGPROF 29 /* Profiling alarm clock (4.2 BSD). */
+#define SIGXCPU 30 /* CPU limit exceeded (4.2 BSD). */
+#define SIGXFSZ 31 /* File size limit exceeded (4.2 BSD). */
+
+#endif /* <signal.h> included. */
+
+#define _NSIG 32 /* Biggest signal number + 1. */
diff --git a/sysdeps/unix/sysv/sysv4/sigprocmask.S b/sysdeps/unix/sysv/sysv4/sigprocmask.S
new file mode 100644
index 0000000000..51fddb0bee
--- /dev/null
+++ b/sysdeps/unix/sysv/sysv4/sigprocmask.S
@@ -0,0 +1,24 @@
+/* Copyright (C) 1993, 1995 Free Software Foundation, Inc.
+ Contributed by Brendan Kehoe (brendan@zen.org).
+
+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__ (sigprocmask, 3)
+ ret
+
+weak_alias (__sigprocmask, sigprocmask)
diff --git a/sysdeps/unix/sysv/sysv4/sigset.h b/sysdeps/unix/sysv/sysv4/sigset.h
new file mode 100644
index 0000000000..a007a43470
--- /dev/null
+++ b/sysdeps/unix/sysv/sysv4/sigset.h
@@ -0,0 +1,97 @@
+/* __sig_atomic_t, __sigset_t, and related definitions. SVR4 version.
+Copyright (C) 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, 1992 Free Software Foundation, Inc., 675 Mass Ave,
+Cambridge, MA 02139, USA. */
+
+#ifndef _SIGSET_H_types
+#define _SIGSET_H_types 1
+
+typedef int __sig_atomic_t;
+
+/* A `sigset_t' has a bit for each signal. */
+typedef struct
+ {
+ unsigned long int __sigbits[4];
+ } __sigset_t;
+
+#endif /* ! _SIGSET_H_types */
+
+/* We only want to define these functions if <signal.h> was actually
+ included; otherwise we were included just to define the types. Since we
+ are namespace-clean, it wouldn't hurt to define extra macros. But
+ trouble can be caused by functions being defined (e.g., any global
+ register vars declared later will cause compilation errors). */
+
+#if !defined (_SIGSET_H_fns) && defined (_SIGNAL_H)
+#define _SIGSET_H_fns 1
+
+/* Return a mask that includes SIG only. */
+#define __sigmask(sig) (1 << ((sig) - 1))
+
+
+/* It's easier to assume 8-bit bytes than to get CHAR_BIT. */
+#define __NSSBITS (sizeof (__sigset_t) * 8)
+#define __SSELT(s) ((s) / __NSSBITS)
+#define __SSMASK(s) (1 << ((s) % __NSSBITS))
+
+#ifndef _EXTERN_INLINE
+#define _EXTERN_INLINE extern __inline
+#endif
+
+_EXTERN_INLINE int
+__sigemptyset (__sigset_t *__set)
+{
+ __set->__sigbits[0] = __set->__sigbits[1] =
+ __set->__sigbits[2] = __set->__sigbits[3] = 0L;
+ return 0;
+}
+
+_EXTERN_INLINE int
+__sigfillset (__sigset_t *__set)
+{
+ /* SVR4 has a system call for `sigfillset' (!), and it only sets the bits
+ for signals [1,31]. Setting bits for unimplemented signals seems
+ harmless (and we will find out if it really is). */
+ __set->__sigbits[0] = __set->__sigbits[1] =
+ __set->__sigbits[2] = __set->__sigbits[3] = -1;
+ return 0;
+}
+
+_EXTERN_INLINE int
+__sigaddset (__sigset_t *__set, int __sig)
+{
+ __set->__sigbits[__SSELT (__sig)] |= __SSMASK (__sig);
+ return 0;
+}
+
+_EXTERN_INLINE int
+__sigdelset (__sigset_t *__set, int __sig)
+{
+ __set->__sigbits[__SSELT (__sig)] &= ~__SSMASK (__sig);
+ return 0;
+}
+
+_EXTERN_INLINE int
+__sigismember (__const __sigset_t *__set, int __sig)
+{
+ if (__set->__sigbits[__SSELT (__sig)] & __SSMASK (__sig))
+ return 1;
+ return 0;
+}
+
+#endif /* ! _SIGSET_H_fns */
+
diff --git a/sysdeps/unix/sysv/sysv4/sigsuspend.S b/sysdeps/unix/sysv/sysv4/sigsuspend.S
new file mode 100644
index 0000000000..85d36017b8
--- /dev/null
+++ b/sysdeps/unix/sysv/sysv4/sigsuspend.S
@@ -0,0 +1,22 @@
+/* Copyright (C) 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. */
+
+#include <sysdep.h>
+
+SYSCALL (sigsuspend, 1)
+ ret
diff --git a/sysdeps/unix/sysv/sysv4/solaris2/Makefile b/sysdeps/unix/sysv/sysv4/solaris2/Makefile
new file mode 100644
index 0000000000..3f86c46cc8
--- /dev/null
+++ b/sysdeps/unix/sysv/sysv4/solaris2/Makefile
@@ -0,0 +1,6 @@
+# The linker supplied with Solaris looks in the current directory
+# before searching others. Compiling the various programs that come
+# along the way (e.g., glue-ctype) will fail because it'll try to link
+# with the libc.a being *constructed* in $(objdir). As a work-around,
+# we add this to each native-compile.
+BUILD_CFLAGS := $(BUILD_CFLAGS) -L/lib
diff --git a/sysdeps/unix/sysv/sysv4/solaris2/direct.h b/sysdeps/unix/sysv/sysv4/solaris2/direct.h
new file mode 100644
index 0000000000..f9822dcbc5
--- /dev/null
+++ b/sysdeps/unix/sysv/sysv4/solaris2/direct.h
@@ -0,0 +1,39 @@
+/* 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 the Solaris direct; it's the same as that in
+ sysdeps/unix/sysv/sysv4/direct.h, but it uses the length given by d_namlen,
+ since we can't reliably use tyhe sysv4/direct.h method of computing
+ the length. */
+
+struct direct
+ {
+ unsigned long int d_fileno;
+ long int d_off;
+ unsigned short int d_reclen;
+ char d_name[NAME_MAX + 1];
+ };
+
+#define D_NAMLEN(d) (strlen ((d)->d_name))
+
+#endif
diff --git a/sysdeps/unix/sysv/sysv4/solaris2/fsync.S b/sysdeps/unix/sysv/sysv4/solaris2/fsync.S
new file mode 100644
index 0000000000..aefa3e3af7
--- /dev/null
+++ b/sysdeps/unix/sysv/sysv4/solaris2/fsync.S
@@ -0,0 +1,29 @@
+/* Copyright (C) 1994 Free Software Foundation, Inc.
+ Contributed by Brendan Kehoe (brendan@zen.org).
+
+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>
+
+/* Solaris uses fdsync for the normal fsync. */
+ENTRY(fsync)
+ mov 16, %i1
+ mov SYS_ify(fdsync), %g1
+ ta 8
+ bcs syscall_error
+ nop
+ mov %g0, %o0
+ ret
diff --git a/sysdeps/unix/sysv/sysv4/solaris2/signum.h b/sysdeps/unix/sysv/sysv4/solaris2/signum.h
new file mode 100644
index 0000000000..8219626c3e
--- /dev/null
+++ b/sysdeps/unix/sysv/sysv4/solaris2/signum.h
@@ -0,0 +1,73 @@
+/* Signal number definitions. Solaris 2 version.
+Copyright (C) 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. */
+
+#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 SIGABRT SIGIOT /* Abort (ANSI). */
+#define SIGTRAP 5 /* Trace trap (POSIX). */
+#define SIGIOT 6 /* IOT trap (4.2 BSD). */
+#define SIGEMT 7 /* EMT trap (4.2 BSD). */
+#define SIGFPE 8 /* Floating-point exception (ANSI). */
+#define SIGKILL 9 /* Kill, unblockable (POSIX). */
+#define SIGBUS 10 /* Bus error (4.2 BSD). */
+#define SIGSEGV 11 /* Segmentation violation (ANSI). */
+#define SIGSYS 12 /* Bad argument to system call (4.2 BSD)*/
+#define SIGPIPE 13 /* Broken pipe (POSIX). */
+#define SIGALRM 14 /* Alarm clock (POSIX). */
+#define SIGTERM 15 /* Termination (ANSI). */
+#define SIGUSR1 16 /* User-defined signal 1 (POSIX). */
+#define SIGUSR2 17 /* User-defined signal 2 (POSIX). */
+#define SIGCHLD 18 /* Child status has changed (POSIX). */
+#define SIGCLD SIGCHLD /* Same as SIGCHLD (System V). */
+#define SIGPWR 19 /* Power failure restart (System V). */
+#define SIGWINCH 20 /* Window size change (4.3 BSD, Sun). */
+#define SIGURG 21 /* Urgent condition on socket (4.2 BSD).*/
+#define SIGPOLL 22 /* Pollable event occurred (System V). */
+#define SIGIO SIGPOLL /* I/O now possible (4.2 BSD). */
+#define SIGSTOP 23 /* Stop, unblockable (POSIX). */
+#define SIGTSTP 24 /* Keyboard stop (POSIX). */
+#define SIGCONT 25 /* Continue (POSIX). */
+#define SIGTTIN 26 /* Background read from tty (POSIX). */
+#define SIGTTOU 27 /* Background write to tty (POSIX). */
+#define SIGVTALRM 28 /* Virtual alarm clock (4.2 BSD). */
+#define SIGPROF 29 /* Profiling alarm clock (4.2 BSD). */
+#define SIGXCPU 30 /* CPU limit exceeded (4.2 BSD). */
+#define SIGXFSZ 31 /* File size limit exceeded (4.2 BSD). */
+/* The following signals are new in Solaris 2. */
+#define SIGWAITING 32 /* Process's lwps are blocked. */
+#define SIGLWP 33 /* Special signal used by thread library. */
+#define SIGFREEZE 34 /* Special signal used by CPR. */
+#define SIGTHAW 35 /* Special signal used by CPR. */
+#define _SIGRTMIN 36 /* First (highest-priority) realtime signal. */
+#define _SIGRTMAX 43 /* Last (lowest-priority) realtime signal. */
+
+#endif /* <signal.h> included. */
+
+#define _NSIG 44 /* Biggest signal number + 1. */
diff --git a/sysdeps/unix/sysv/sysv4/solaris2/sparc/Dist b/sysdeps/unix/sysv/sysv4/solaris2/sparc/Dist
new file mode 100644
index 0000000000..69d16ac6bf
--- /dev/null
+++ b/sysdeps/unix/sysv/sysv4/solaris2/sparc/Dist
@@ -0,0 +1 @@
+sys-sig.S
diff --git a/sysdeps/unix/sysv/sysv4/solaris2/sparc/Makefile b/sysdeps/unix/sysv/sysv4/solaris2/sparc/Makefile
new file mode 100644
index 0000000000..7ad4bb1633
--- /dev/null
+++ b/sysdeps/unix/sysv/sysv4/solaris2/sparc/Makefile
@@ -0,0 +1,5 @@
+# This flag is necessary because GCC now tries to call _Q_{mul, etc...}
+# instead of doing the stuff the hard way. For now, printf_fp.o, __vfscanf.o,
+# and difftime.o don't work because of this. The long-term fix is to actually
+# implement what they're doing, but for the short-term, we must do this.
+sysdep-CFLAGS := $(sysdep-CFLAGS) -mhard-quad-float
diff --git a/sysdeps/unix/sysv/sysv4/solaris2/sparc/start.c b/sysdeps/unix/sysv/sysv4/solaris2/sparc/start.c
new file mode 100644
index 0000000000..afdfaaa2e5
--- /dev/null
+++ b/sysdeps/unix/sysv/sysv4/solaris2/sparc/start.c
@@ -0,0 +1,4 @@
+#define NO_SHLIB
+/* Solaris needs start named `_start', not `start'. */
+#define NO_EXPLICIT_START
+#include <sysdeps/unix/sparc/start.c>
diff --git a/sysdeps/unix/sysv/sysv4/solaris2/sparc/sys-sig.S b/sysdeps/unix/sysv/sysv4/solaris2/sparc/sys-sig.S
new file mode 100644
index 0000000000..8baa997e80
--- /dev/null
+++ b/sysdeps/unix/sysv/sysv4/solaris2/sparc/sys-sig.S
@@ -0,0 +1,25 @@
+/* Copyright (C) 1994 Free Software Foundation, Inc.
+ Contributed by Brendan Kehoe (brendan@zen.org).
+
+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>
+
+PSEUDO (__sigaction_syscall, sigaction, 3)
+ ret
+
+PSEUDO (__context_syscall, context, 2)
+ ret
diff --git a/sysdeps/unix/sysv/sysv4/solaris2/sparc/sysdep.S b/sysdeps/unix/sysv/sysv4/solaris2/sparc/sysdep.S
new file mode 100644
index 0000000000..da3cd6b8be
--- /dev/null
+++ b/sysdeps/unix/sysv/sysv4/solaris2/sparc/sysdep.S
@@ -0,0 +1,46 @@
+/* Copyright (C) 1993, 1994 Free Software Foundation, Inc.
+ Contributed by Brendan Kehoe (brendan@zen.org).
+
+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>
+#define _ERRNO_H
+#include <errnos.h>
+
+ENTRY(syscall_error)
+ /* If it was a syscall that got interrupted, but can
+ be restarted, drop EINTR in. */
+ cmp %o0, ERESTART
+ be,a notint
+ mov EINTR, %o0
+
+notint:
+#if defined (EWOULDBLOCK_sys) && EWOULDBLOCK_sys != EAGAIN
+ /* We translate the system's EWOULDBLOCK error into EAGAIN.
+ The GNU C library always defines EWOULDBLOCK==EAGAIN.
+ EWOULDBLOCK_sys is the original number. */
+ cmp %o0, EWOULDBLOCK_sys
+ be,a notblock
+ mov EAGAIN, %o0
+#endif
+
+notblock:/* Store it in errno... */
+ sethi %hi(C_SYMBOL_NAME(errno)), %g1
+ st %o0, [%g1 + %lo(C_SYMBOL_NAME(errno))]
+
+ /* And just kick back a -1. */
+ retl
+ mov -1, %o0
diff --git a/sysdeps/unix/sysv/sysv4/solaris2/sparc/sysdep.h b/sysdeps/unix/sysv/sysv4/solaris2/sparc/sysdep.h
new file mode 100644
index 0000000000..edb98309e6
--- /dev/null
+++ b/sysdeps/unix/sysv/sysv4/solaris2/sparc/sysdep.h
@@ -0,0 +1,51 @@
+/* Copyright (C) 1993, 1994, 1995 Free Software Foundation, Inc.
+ Contributed by Brendan Kehoe (brendan@zen.org).
+
+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. */
+
+/* Solaris 2 does not precede the asm names of C symbols with a `_'. */
+#define NO_UNDERSCORES
+
+#include <sysdeps/unix/sysdep.h>
+
+#ifdef ASSEMBLER
+
+/* As of gcc-2.6.0, it complains about pound signs in front of things
+ that aren't arguments to the macro. So we use this to pull it off
+ instead. */
+#define cat(a,b) a##b
+#define poundfnc cat(#,function)
+
+#define ENTRY(name) \
+ .section ".text"; \
+ .align 4; \
+ .global C_SYMBOL_NAME(name); \
+ .type C_SYMBOL_NAME(name), poundfnc; \
+ C_LABEL(name)
+
+#define PSEUDO(name, syscall_name, args) \
+ ENTRY (name) \
+ mov SYS_ify(syscall_name), %g1; \
+ ta 8; \
+ bcs C_SYMBOL_NAME(syscall_error); \
+ nop
+
+#define ret retl; nop
+#define r0 %o0
+#define r1 %o1
+#define MOVE(x,y) mov x, y
+
+#endif /* ASSEMBLER */
diff --git a/sysdeps/unix/sysv/sysv4/solaris2/statbuf.h b/sysdeps/unix/sysv/sysv4/solaris2/statbuf.h
new file mode 100644
index 0000000000..ac74cdffa7
--- /dev/null
+++ b/sysdeps/unix/sysv/sysv4/solaris2/statbuf.h
@@ -0,0 +1,82 @@
+/* Copyright (C) 1993 Free Software Foundation, Inc.
+ Contributed by Brendan Kehoe (brendan@zen.org).
+
+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
+
+#include <gnu/types.h>
+
+/* Structure describing file characteristics. */
+struct stat
+ {
+ unsigned long int st_dev;
+ long st_filler1[3];
+ __ino_t st_ino; /* File serial number. */
+ unsigned long int st_mode; /* File mode. */
+ /* This is unsigned long instead of __nlink_t, since SVR4 has
+ a long nlink_t, not a short one. */
+ unsigned long int st_nlink; /* Link count. */
+ __uid_t st_uid; /* User ID of the file's owner. */
+ __gid_t st_gid; /* Group ID of the file's group.*/
+ unsigned long int st_rdev; /* Device number, if device. */
+ long st_filler2[2];
+
+ __off_t st_size; /* Size of file, in bytes. */
+ /* SVR4 added this extra long to allow for expansion of off_t. */
+ long st_filler3;
+
+ __time_t st_atime; /* Time of last access. */
+ unsigned long int st_atime_usec;
+ __time_t st_mtime; /* Time of last modification. */
+ unsigned long int st_mtime_usec;
+ __time_t st_ctime; /* Time of last status change. */
+ unsigned long int st_ctime_usec;
+
+ long st_blksize; /* Optimal block size for I/O. */
+#define _STATBUF_ST_BLKSIZE /* Tell code we have this member. */
+
+ long st_blocks; /* Number of 512-byte blocks allocated. */
+ char st_fstype[16];
+ long st_filler4[8];
+ };
+
+/* 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/sysv4/solaris2/utimes.S b/sysdeps/unix/sysv/sysv4/solaris2/utimes.S
new file mode 100644
index 0000000000..54a043c835
--- /dev/null
+++ b/sysdeps/unix/sysv/sysv4/solaris2/utimes.S
@@ -0,0 +1,2 @@
+/* Solaris has the BSD `utimes' function. */
+#include <sysdeps/unix/bsd/utimes.S>
diff --git a/sysdeps/unix/sysv/sysv4/sysconf.c b/sysdeps/unix/sysv/sysv4/sysconf.c
new file mode 100644
index 0000000000..607cd05d14
--- /dev/null
+++ b/sysdeps/unix/sysv/sysv4/sysconf.c
@@ -0,0 +1,181 @@
+/* Copyright (C) 1993, 1995 Free Software Foundation, Inc.
+ Contributed by Brendan Kehoe (brendan@zen.org).
+
+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 <errno.h>
+#include <limits.h>
+#include <unistd.h>
+#include <stdio.h>
+#include <time.h>
+#include <sysconfig.h>
+
+extern int EXFUN(__sysconfig, (int));
+
+/* Get the value of the system variable NAME. */
+long int
+DEFUN(__sysconf, (name), int name)
+{
+ switch (name)
+ {
+ default:
+ errno = EINVAL;
+ return -1;
+
+ case _SC_ARG_MAX:
+#ifdef ARG_MAX
+ return ARG_MAX;
+#else
+ return -1;
+#endif
+
+ case _SC_CHILD_MAX:
+#ifdef CHILD_MAX
+ return CHILD_MAX;
+#else
+ return -1;
+#endif
+
+ case _SC_CLK_TCK:
+ return __sysconfig (_CONFIG_CLK_TCK);
+
+ case _SC_NGROUPS_MAX:
+#ifdef NGROUPS_MAX
+ return NGROUPS_MAX;
+#else
+ return -1;
+#endif
+
+ /* Both of these are looking for _CONFIG_OPEN_FILES. */
+ case _SC_OPEN_MAX:
+ case _SC_STREAM_MAX:
+ return __sysconfig (_CONFIG_OPEN_FILES);
+
+ case _SC_TZNAME_MAX:
+ return __tzname_max ();
+
+ case _SC_JOB_CONTROL:
+#ifdef _POSIX_JOB_CONTROL
+ return 1;
+#else
+ return -1;
+#endif
+ case _SC_SAVED_IDS:
+#ifdef _POSIX_SAVED_IDS
+ return 1;
+#else
+ return -1;
+#endif
+ case _SC_VERSION:
+ return _POSIX_VERSION;
+
+ case _SC_PAGESIZE:
+ return __sysconfig (_CONFIG_PAGESIZE);
+
+ case _SC_BC_BASE_MAX:
+#ifdef BC_BASE_MAX
+ return BC_BASE_MAX;
+#else
+ return -1;
+#endif
+
+ case _SC_BC_DIM_MAX:
+#ifdef BC_DIM_MAX
+ return BC_DIM_MAX;
+#else
+ return -1;
+#endif
+
+ case _SC_BC_SCALE_MAX:
+#ifdef BC_SCALE_MAX
+ return BC_SCALE_MAX;
+#else
+ return -1;
+#endif
+
+ case _SC_BC_STRING_MAX:
+#ifdef BC_STRING_MAX
+ return BC_STRING_MAX;
+#else
+ return -1;
+#endif
+
+ case _SC_EQUIV_CLASS_MAX:
+#ifdef EQUIV_CLASS_MAX
+ return EQUIV_CLASS_MAX;
+#else
+ return -1;
+#endif
+
+ case _SC_EXPR_NEST_MAX:
+#ifdef EXPR_NEST_MAX
+ return EXPR_NEST_MAX;
+#else
+ return -1;
+#endif
+
+ case _SC_LINE_MAX:
+#ifdef LINE_MAX
+ return LINE_MAX;
+#else
+ return -1;
+#endif
+
+ case _SC_RE_DUP_MAX:
+#ifdef RE_DUP_MAX
+ return RE_DUP_MAX;
+#else
+ return -1;
+#endif
+
+
+ case _SC_2_VERSION:
+ /* This is actually supposed to return the version
+ of the 1003.2 utilities on the system {POSIX2_VERSION}. */
+ return _POSIX2_C_VERSION;
+
+ case _SC_2_C_BIND:
+#ifdef _POSIX2_C_BIND
+ return _POSIX2_C_BIND;
+#else
+ return -1;
+#endif
+
+ case _SC_2_C_DEV:
+#ifdef _POSIX2_C_DEV
+ return _POSIX2_C_DEV;
+#else
+ return -1;
+#endif
+
+ case _SC_2_FORT_DEV:
+#ifdef _POSIX2_FORT_DEV
+ return _POSIX2_FORT_DEV;
+#else
+ return -1;
+#endif
+
+ case _SC_2_SW_DEV:
+#ifdef _POSIX2_SW_DEV
+ return _POSIX2_SW_DEV;
+#else
+ return -1;
+#endif
+ }
+}
+
+weak_alias (__sysconf, sysconf)
diff --git a/sysdeps/unix/sysv/sysv4/sysconfig.S b/sysdeps/unix/sysv/sysv4/sysconfig.S
new file mode 100644
index 0000000000..034e012e84
--- /dev/null
+++ b/sysdeps/unix/sysv/sysv4/sysconfig.S
@@ -0,0 +1,22 @@
+/* Copyright (C) 1993 Free Software Foundation, Inc.
+ Contributed by Brendan Kehoe (brendan@zen.org).
+
+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__ (sysconfig, 1)
+ ret
diff --git a/sysdeps/unix/sysv/sysv4/sysconfig.h b/sysdeps/unix/sysv/sysv4/sysconfig.h
new file mode 100644
index 0000000000..77c84c7af6
--- /dev/null
+++ b/sysdeps/unix/sysv/sysv4/sysconfig.h
@@ -0,0 +1,28 @@
+/* `__sysconfig' NAME values.
+ Copyright (C) 1993 Free Software Foundation, Inc.
+ Contributed by Brendan Kehoe (brendan@zen.org).
+
+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 __SYSCONFIG_H
+#define __SYSCONFIG_H
+
+#define _CONFIG_OPEN_FILES 4 /* process limit on open files */
+#define _CONFIG_PAGESIZE 6 /* MMU page size */
+#define _CONFIG_CLK_TCK 7 /* all times are in CLK_TCKths of a second */
+
+#endif
+
diff --git a/sysdeps/unix/sysv/sysv4/sysinfo.S b/sysdeps/unix/sysv/sysv4/sysinfo.S
new file mode 100644
index 0000000000..c279c96e9c
--- /dev/null
+++ b/sysdeps/unix/sysv/sysv4/sysinfo.S
@@ -0,0 +1,22 @@
+/* Copyright (C) 1994 Free Software Foundation, Inc.
+ Contributed by Brendan Kehoe (brendan@zen.org).
+
+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>
+
+PSEUDO (__sysinfo, systeminfo, 3)
+ ret
diff --git a/sysdeps/unix/sysv/sysv4/system.c b/sysdeps/unix/sysv/sysv4/system.c
new file mode 100644
index 0000000000..fbfe43f19a
--- /dev/null
+++ b/sysdeps/unix/sysv/sysv4/system.c
@@ -0,0 +1,2 @@
+/* SVR4 does have `waitpid'. Avoid unix/system.c, which says we don't. */
+#include <sysdeps/posix/system.c>
diff --git a/sysdeps/unix/sysv/sysv4/time.S b/sysdeps/unix/sysv/sysv4/time.S
new file mode 100644
index 0000000000..61f3514fb7
--- /dev/null
+++ b/sysdeps/unix/sysv/sysv4/time.S
@@ -0,0 +1,22 @@
+/* Copyright (C) 1993 Free Software Foundation, Inc.
+ Contributed by Brendan Kehoe (brendan@zen.org).
+
+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 (time, 1)
+ ret
diff --git a/sysdeps/unix/sysv/sysv4/utsnamelen.h b/sysdeps/unix/sysv/sysv4/utsnamelen.h
new file mode 100644
index 0000000000..9dcc618068
--- /dev/null
+++ b/sysdeps/unix/sysv/sysv4/utsnamelen.h
@@ -0,0 +1 @@
+#define _UTSNAME_LENGTH 257
diff --git a/sysdeps/unix/sysv/sysv4/waitflags.h b/sysdeps/unix/sysv/sysv4/waitflags.h
new file mode 100644
index 0000000000..cdb6f29e1d
--- /dev/null
+++ b/sysdeps/unix/sysv/sysv4/waitflags.h
@@ -0,0 +1,34 @@
+/* Definitions of flag bits for `waitpid' et al.
+ Copyright (C) 1993 Free Software Foundation, Inc.
+ Contributed by Brendan Kehoe (brendan@zen.org).
+
+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 _WAITFLAGS_H
+
+#define _WAITFLAGS_H 1
+
+/* Bits in the third argument to `waitpid'. */
+#define WNOHANG 64 /* Don't block waiting. */
+#define WUNTRACED 4 /* Report status of stopped children. */
+
+#ifdef __USE_SVID
+#define WEXITED 1 /* Look for children that have exited. */
+#define WTRAPPED 2 /* Look for processes that stopped
+ while tracing. */
+#endif
+
+#endif /* waitflags.h */
diff --git a/sysdeps/unix/sysv/sysv4/waitpid.c b/sysdeps/unix/sysv/sysv4/waitpid.c
new file mode 100644
index 0000000000..f54df4bf6b
--- /dev/null
+++ b/sysdeps/unix/sysv/sysv4/waitpid.c
@@ -0,0 +1,120 @@
+/* Copyright (C) 1993, 1994, 1995 Free Software Foundation, Inc.
+ Contributed by Brendan Kehoe (brendan@zen.org).
+
+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 <errno.h>
+#include <sys/wait.h>
+#include <sys/types.h>
+#include <stddef.h>
+#include "siginfo.h"
+
+typedef enum __idtype
+ {
+ /* Look for processes based upon a given PID. */
+ P_PID,
+
+ /* Look for processes based upon a given process-group ID. */
+ P_PGID = 2,
+
+ /* Look for any process. */
+ P_ALL = 7,
+ } __idtype_t;
+
+extern __pid_t __getpgid __P ((__pid_t pid));
+extern int __waitid __P ((__idtype_t idtype, __pid_t id,
+ __siginfo_t *infop, int options));
+
+/* Wait for a child matching PID to die.
+ If PID is greater than 0, match any process whose process ID is PID.
+ If PID is (pid_t) -1, match any process.
+ If PID is (pid_t) 0, match any process with the
+ same process group as the current process.
+ If PID is less than -1, match any process whose
+ process group is the absolute value of PID.
+ If the WNOHANG bit is set in OPTIONS, and that child
+ is not already dead, return (pid_t) 0. If successful,
+ return PID and store the dead child's status in STAT_LOC.
+ Return (pid_t) -1 for errors. If the WUNTRACED bit is set in OPTIONS,
+ return status for stopped children; otherwise don't. */
+
+__pid_t
+DEFUN(__waitpid, (pid, stat_loc, options),
+ __pid_t pid AND int *stat_loc AND int options)
+{
+ __idtype_t idtype;
+ __pid_t tmp_pid = pid;
+ __siginfo_t infop;
+
+ if (pid <= WAIT_MYPGRP)
+ {
+ if (pid == WAIT_ANY)
+ {
+ /* Request the status for any child. */
+ idtype = P_ALL;
+ }
+ else if (pid == WAIT_MYPGRP)
+ {
+ /* Request the status for any child process that has
+ a pgid that's equal to that of our parent. */
+ tmp_pid = __getpgid (0);
+ idtype = P_PGID;
+ }
+ else /* PID < -1 */
+ {
+ /* Request the status for any child whose pgid is equal
+ to the absolute value of PID. */
+ tmp_pid = pid & ~0; /* XXX not pseudo-insn */
+ idtype = P_PGID;
+ }
+ }
+ else
+ {
+ /* Request the status for the child whose pid is PID. */
+ idtype = P_PID;
+ }
+
+ if (__waitid (idtype, tmp_pid, &infop, options | WEXITED | WTRAPPED) < 0)
+ return -1;
+
+ switch (infop.__code)
+ {
+ case EXITED:
+ *stat_loc = W_EXITCODE (infop.__status, 0);
+ break;
+ case STOPPED:
+ case TRAPPED:
+ *stat_loc = W_STOPCODE (infop.__status);
+ break;
+ case KILLED:
+ /* Don't know what to do with continue, since it isn't documented.
+ Putting it here seemed the right place though. */
+ case CONTINUED:
+ *stat_loc = infop.__status;
+ /* FALLTHROUGH */
+ case CORED:
+ *stat_loc |= WCOREFLAG;
+ break;
+ }
+
+ /* Return the PID out of the INFOP structure instead of the one we were
+ called with, to account for cases of being called with -1 to signify
+ any PID. */
+ return infop.__pid;
+}
+
+weak_alias (__waitpid, waitpid)
diff --git a/sysdeps/unix/sysv/sysv_termio.h b/sysdeps/unix/sysv/sysv_termio.h
new file mode 100644
index 0000000000..c1c5d72b4f
--- /dev/null
+++ b/sysdeps/unix/sysv/sysv_termio.h
@@ -0,0 +1,155 @@
+/* Copyright (C) 1992 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 various parts of this file we define the System V values for
+ things as _SYSV_<whatever>. Those are the values that System V
+ uses for termio, and also (SVR4) termios. Not necessarily the
+ same as the GNU termios that the library user sees. */
+
+/* Number of elements of c_cc. termio only. */
+#define _SYSV_NCC 8
+
+#define _SYSV_VINTR 0
+#define _SYSV_VQUIT 1
+#define _SYSV_VERASE 2
+#define _SYSV_VKILL 3
+#define _SYSV_VEOF 4
+/* This field means VEOF if ICANON, VMIN if not. */
+#define _SYSV_VMIN 4
+#define _SYSV_VEOL 5
+/* This field means VEOL if ICANON, VTIME if not. */
+#define _SYSV_VTIME 5
+#define _SYSV_VEOL2 6
+
+/* Flags in c_iflag. */
+#define _SYSV_IGNBRK 1
+#define _SYSV_BRKINT 2
+#define _SYSV_IGNPAR 4
+#define _SYSV_PARMRK 8
+#define _SYSV_INPCK 0x10
+#define _SYSV_ISTRIP 0x20
+#define _SYSV_INLCR 0x40
+#define _SYSV_IGNCR 0x80
+#define _SYSV_ICRNL 0x100
+#define _SYSV_IUCLC 0x200
+#define _SYSV_IXON 0x400
+#define _SYSV_IXANY 0x800
+#define _SYSV_IXOFF 0x1000
+#define _SYSV_IMAXBEL 0x2000
+
+/* Flags in c_cflag. */
+#define _SYSV_CBAUD 0xf
+#define _SYSV_CIBAUD 0xf0000 /* termios only. */
+#define _SYSV_IBSHIFT 16
+/* Values for CBAUD and CIBAUD. */
+#define _SYSV_B0 0
+#define _SYSV_B50 1
+#define _SYSV_B75 2
+#define _SYSV_B110 3
+#define _SYSV_B134 4
+#define _SYSV_B150 5
+#define _SYSV_B200 6
+#define _SYSV_B300 7
+#define _SYSV_B600 8
+#define _SYSV_B1200 9
+#define _SYSV_B1800 10
+#define _SYSV_B2400 11
+#define _SYSV_B4800 12
+#define _SYSV_B9600 13
+#define _SYSV_B19200 14
+#define _SYSV_B38400 15
+
+#define _SYSV_CS5 0
+#define _SYSV_CS6 0x10
+#define _SYSV_CS7 0x20
+#define _SYSV_CS8 0x30
+#define _SYSV_CSIZE 0x30
+#define _SYSV_CSTOPB 0x40
+#define _SYSV_CREAD 0x80
+#define _SYSV_PARENB 0x100
+#define _SYSV_PARODD 0x200
+#define _SYSV_HUPCL 0x400
+#define _SYSV_CLOCAL 0x800
+
+/* Flags in c_lflag. */
+#define _SYSV_ISIG 1
+#define _SYSV_ICANON 2
+#define _SYSV_ECHO 8
+#define _SYSV_ECHOE 0x10
+#define _SYSV_ECHOK 0x20
+#define _SYSV_ECHONL 0x40
+#define _SYSV_NOFLSH 0x80
+#define _SYSV_TOSTOP 0x100
+#define _SYSV_ECHOCTL 0x200
+#define _SYSV_ECHOPRT 0x400
+#define _SYSV_ECHOKE 0x800
+#define _SYSV_FLUSHO 0x2000
+#define _SYSV_PENDIN 0x4000
+#define _SYSV_IEXTEN 0x8000
+
+/* Flags in c_oflag. */
+#define _SYSV_OPOST 1
+#define _SYSV_OLCUC 2
+#define _SYSV_ONLCR 4
+#define _SYSV_NLDLY 0x100
+#define _SYSV_NL0 0
+#define _SYSV_NL1 0x100
+#define _SYSV_CRDLY 0x600
+#define _SYSV_CR0 0
+#define _SYSV_CR1 0x200
+#define _SYSV_CR2 0x400
+#define _SYSV_CR3 0x600
+#define _SYSV_TABDLY 0x1800
+#define _SYSV_TAB0 0
+#define _SYSV_TAB1 0x0800
+#define _SYSV_TAB2 0x1000
+/* TAB3 is an obsolete name for XTABS. But we provide it since some
+ programs expect it to exist. */
+#define _SYSV_TAB3 0x1800
+#define _SYSV_XTABS 0x1800
+#define _SYSV_BSDLY 0x2000
+#define _SYSV_BS0 0
+#define _SYSV_BS1 0x2000
+#define _SYSV_VTDLY 0x4000
+#define _SYSV_VT0 0
+#define _SYSV_VT1 0x4000
+#define _SYSV_FFDLY 0x8000
+#define _SYSV_FF0 0
+#define _SYSV_FF1 0x8000
+
+/* ioctl's. */
+
+#define _TCGETA 0x5401
+#define _TCSETA 0x5402
+#define _TCSETAW 0x5403
+#define _TCSETAF 0x5404
+#define _TCSBRK 0x5405
+#define _TCXONC 0x5406
+#define _TCFLSH 0x5407
+#define _TIOCGPGRP 0x7414
+#define _TIOCSPGRP 0x7415
+
+struct __sysv_termio
+ {
+ unsigned short c_iflag;
+ unsigned short c_oflag;
+ unsigned short c_cflag;
+ unsigned short c_lflag;
+ char c_line;
+ unsigned char c_cc[_SYSV_NCC];
+ };
diff --git a/sysdeps/unix/sysv/tcdrain.c b/sysdeps/unix/sysv/tcdrain.c
new file mode 100644
index 0000000000..37144799e4
--- /dev/null
+++ b/sysdeps/unix/sysv/tcdrain.c
@@ -0,0 +1,33 @@
+/* Copyright (C) 1992 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 <errno.h>
+#include <stddef.h>
+#include <termios.h>
+#include <unistd.h>
+#include <sysv_termio.h>
+#include <sys/ioctl.h>
+
+/* Wait for pending output to be written on FD. */
+int
+DEFUN(tcdrain, (fd), int fd)
+{
+ /* With an argument of 1, TCSBRK just waits for output to drain. */
+ return __ioctl (fd, _TCSBRK, 1);
+}
diff --git a/sysdeps/unix/sysv/tcflow.c b/sysdeps/unix/sysv/tcflow.c
new file mode 100644
index 0000000000..fecb40dd82
--- /dev/null
+++ b/sysdeps/unix/sysv/tcflow.c
@@ -0,0 +1,46 @@
+/* Copyright (C) 1992 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 <errno.h>
+#include <stddef.h>
+#include <termios.h>
+#include <unistd.h>
+#include <sys/ioctl.h>
+
+#include "sysv_termio.h"
+
+/* Suspend or restart transmission on FD. */
+int
+DEFUN(tcflow, (fd, action), int fd AND int action)
+{
+ switch (action)
+ {
+ case TCOOFF:
+ return __ioctl (fd, _TCXONC, 0);
+ case TCOON:
+ return __ioctl (fd, _TCXONC, 1);
+ case TCIOFF:
+ return __ioctl (fd, _TCXONC, 2);
+ case TCION:
+ return __ioctl (fd, _TCXONC, 3);
+ default:
+ errno = EINVAL;
+ return -1;
+ }
+}
diff --git a/sysdeps/unix/sysv/tcflush.c b/sysdeps/unix/sysv/tcflush.c
new file mode 100644
index 0000000000..88574a5c4b
--- /dev/null
+++ b/sysdeps/unix/sysv/tcflush.c
@@ -0,0 +1,44 @@
+/* Copyright (C) 1992 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 <errno.h>
+#include <stddef.h>
+#include <termios.h>
+#include <unistd.h>
+#include <sys/ioctl.h>
+
+#include <sysv_termio.h>
+
+/* Flush pending data on FD. */
+int
+DEFUN(tcflush, (fd, queue_selector), int fd AND int queue_selector)
+{
+ switch (queue_selector)
+ {
+ case TCIFLUSH:
+ return __ioctl (fd, _TCFLSH, 0);
+ case TCOFLUSH:
+ return __ioctl (fd, _TCFLSH, 1);
+ case TCIOFLUSH:
+ return __ioctl (fd, _TCFLSH, 2);
+ default:
+ errno = EINVAL;
+ return -1;
+ }
+}
diff --git a/sysdeps/unix/sysv/tcgetattr.c b/sysdeps/unix/sysv/tcgetattr.c
new file mode 100644
index 0000000000..dd914a2955
--- /dev/null
+++ b/sysdeps/unix/sysv/tcgetattr.c
@@ -0,0 +1,171 @@
+/* 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 <ansidecl.h>
+#include <errno.h>
+#include <stddef.h>
+#include <sysv_termio.h>
+#include <termios.h>
+#include <sys/ioctl.h>
+
+/* Put the state of FD into *TERMIOS_P. */
+int
+DEFUN(__tcgetattr, (fd, termios_p),
+ int fd AND struct termios *termios_p)
+{
+ struct __sysv_termio buf;
+ int termio_speed;
+
+ if (termios_p == NULL)
+ {
+ errno = EINVAL;
+ return -1;
+ }
+
+ if (__ioctl (fd, _TCGETA, &buf) < 0)
+ return -1;
+
+ termio_speed = buf.c_cflag & _SYSV_CBAUD;
+ termios_p->__ospeed =
+ (termio_speed == _SYSV_B0 ? 0 :
+ termio_speed == _SYSV_B50 ? 50 :
+ termio_speed == _SYSV_B75 ? 75 :
+ termio_speed == _SYSV_B110 ? 110 :
+ termio_speed == _SYSV_B134 ? 134 :
+ termio_speed == _SYSV_B150 ? 150 :
+ termio_speed == _SYSV_B200 ? 200 :
+ termio_speed == _SYSV_B300 ? 300 :
+ termio_speed == _SYSV_B600 ? 600 :
+ termio_speed == _SYSV_B1200 ? 1200 :
+ termio_speed == _SYSV_B1800 ? 1800 :
+ termio_speed == _SYSV_B2400 ? 2400 :
+ termio_speed == _SYSV_B4800 ? 4800 :
+ termio_speed == _SYSV_B9600 ? 9600 :
+ termio_speed == _SYSV_B19200 ? 19200 :
+ termio_speed == _SYSV_B38400 ? 38400 :
+ -1);
+ termios_p->__ispeed = termios_p->__ospeed;
+
+ termios_p->c_iflag = 0;
+ if (buf.c_iflag & _SYSV_IGNBRK)
+ termios_p->c_iflag |= IGNBRK;
+ if (buf.c_iflag & _SYSV_BRKINT)
+ termios_p->c_iflag |= BRKINT;
+ if (buf.c_iflag & _SYSV_IGNPAR)
+ termios_p->c_iflag |= IGNPAR;
+ if (buf.c_iflag & _SYSV_PARMRK)
+ termios_p->c_iflag |= PARMRK;
+ if (buf.c_iflag & _SYSV_INPCK)
+ termios_p->c_iflag |= INPCK;
+ if (buf.c_iflag & _SYSV_ISTRIP)
+ termios_p->c_iflag |= ISTRIP;
+ if (buf.c_iflag & _SYSV_INLCR)
+ termios_p->c_iflag |= INLCR;
+ if (buf.c_iflag & _SYSV_IGNCR)
+ termios_p->c_iflag |= IGNCR;
+ if (buf.c_iflag & _SYSV_ICRNL)
+ termios_p->c_iflag |= ICRNL;
+ if (buf.c_iflag & _SYSV_IXON)
+ termios_p->c_iflag |= IXON;
+ if (buf.c_iflag & _SYSV_IXOFF)
+ termios_p->c_iflag |= IXOFF;
+ if (buf.c_iflag & _SYSV_IXANY)
+ termios_p->c_iflag |= IXANY;
+ if (buf.c_iflag & _SYSV_IMAXBEL)
+ termios_p->c_iflag |= IMAXBEL;
+
+ termios_p->c_oflag = 0;
+ if (buf.c_oflag & OPOST)
+ termios_p->c_oflag |= OPOST;
+ if (buf.c_oflag & ONLCR)
+ termios_p->c_oflag |= ONLCR;
+ termios_p->c_cflag = 0;
+ switch (buf.c_cflag & _SYSV_CSIZE)
+ {
+ case _SYSV_CS5:
+ termios_p->c_cflag |= CS5;
+ break;
+ case _SYSV_CS6:
+ termios_p->c_cflag |= CS6;
+ break;
+ case _SYSV_CS7:
+ termios_p->c_cflag |= CS7;
+ break;
+ case _SYSV_CS8:
+ termios_p->c_cflag |= CS8;
+ break;
+ }
+ if (buf.c_cflag & _SYSV_CSTOPB)
+ termios_p->c_cflag |= CSTOPB;
+ if (buf.c_cflag & _SYSV_CREAD)
+ termios_p->c_cflag |= CREAD;
+ if (buf.c_cflag & _SYSV_PARENB)
+ termios_p->c_cflag |= PARENB;
+ if (buf.c_cflag & _SYSV_PARODD)
+ termios_p->c_cflag |= PARODD;
+ if (buf.c_cflag & _SYSV_HUPCL)
+ termios_p->c_cflag |= HUPCL;
+ if (buf.c_cflag & _SYSV_CLOCAL)
+ termios_p->c_cflag |= CLOCAL;
+ termios_p->c_lflag = 0;
+ if (buf.c_lflag & _SYSV_ISIG)
+ termios_p->c_lflag |= _ISIG;
+ if (buf.c_lflag & _SYSV_ICANON)
+ termios_p->c_lflag |= _ICANON;
+ if (buf.c_lflag & _SYSV_ECHO)
+ termios_p->c_lflag |= _ECHO;
+ if (buf.c_lflag & _SYSV_ECHOE)
+ termios_p->c_lflag |= _ECHOE;
+ if (buf.c_lflag & _SYSV_ECHOK)
+ termios_p->c_lflag |= _ECHOK;
+ if (buf.c_lflag & _SYSV_ECHONL)
+ termios_p->c_lflag |= _ECHONL;
+ if (buf.c_lflag & _SYSV_NOFLSH)
+ termios_p->c_lflag |= _NOFLSH;
+ if (buf.c_lflag & _SYSV_TOSTOP)
+ termios_p->c_lflag |= _TOSTOP;
+ if (buf.c_lflag & _SYSV_ECHOKE)
+ termios_p->c_lflag |= ECHOKE;
+ if (buf.c_lflag & _SYSV_ECHOPRT)
+ termios_p->c_lflag |= ECHOPRT;
+ if (buf.c_lflag & _SYSV_ECHOCTL)
+ termios_p->c_lflag |= ECHOCTL;
+ if (buf.c_lflag & _SYSV_FLUSHO)
+ termios_p->c_lflag |= FLUSHO;
+ if (buf.c_lflag & _SYSV_PENDIN)
+ termios_p->c_lflag |= PENDIN;
+ if (buf.c_lflag & _SYSV_IEXTEN)
+ termios_p->c_lflag |= IEXTEN;
+
+ termios_p->c_cc[VEOF] = buf.c_cc[_SYSV_VEOF];
+ termios_p->c_cc[VEOL] = buf.c_cc[_SYSV_VEOL];
+ termios_p->c_cc[VEOL2] = buf.c_cc[_SYSV_VEOL2];
+ termios_p->c_cc[VERASE] = buf.c_cc[_SYSV_VERASE];
+ termios_p->c_cc[VKILL] = buf.c_cc[_SYSV_VKILL];
+ termios_p->c_cc[VINTR] = buf.c_cc[_SYSV_VINTR];
+ termios_p->c_cc[VQUIT] = buf.c_cc[_SYSV_VQUIT];
+ termios_p->c_cc[VSTART] = '\021'; /* XON (^Q). */
+ termios_p->c_cc[VSTOP] = '\023'; /* XOFF (^S). */
+ termios_p->c_cc[VSUSP] = '\0'; /* System V release 3 lacks job control. */
+ termios_p->c_cc[VMIN] = buf.c_cc[_SYSV_VMIN];
+ termios_p->c_cc[VTIME] = buf.c_cc[_SYSV_VTIME];
+
+ return 0;
+}
+
+weak_alias (__tcgetattr, tcgetattr)
diff --git a/sysdeps/unix/sysv/tcgetpgrp.c b/sysdeps/unix/sysv/tcgetpgrp.c
new file mode 100644
index 0000000000..d4c47227d0
--- /dev/null
+++ b/sysdeps/unix/sysv/tcgetpgrp.c
@@ -0,0 +1,35 @@
+/* Copyright (C) 1992 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 <termios.h>
+#include <sysv_termio.h>
+#include <errno.h>
+#include <unistd.h>
+#include <sys/types.h>
+#include <sys/ioctl.h>
+
+/* Return the foreground process group ID of FD. */
+pid_t
+DEFUN(tcgetpgrp, (fd), int fd)
+{
+ int pgrp;
+ if (__ioctl(fd, _TIOCGPGRP, &pgrp) < 0)
+ return (pid_t) -1;
+ return (pid_t) pgrp;
+}
diff --git a/sysdeps/unix/sysv/tcsendbrk.c b/sysdeps/unix/sysv/tcsendbrk.c
new file mode 100644
index 0000000000..78fe2c542a
--- /dev/null
+++ b/sysdeps/unix/sysv/tcsendbrk.c
@@ -0,0 +1,43 @@
+/* Copyright (C) 1992 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 <errno.h>
+#include <stddef.h>
+#include <signal.h>
+#include <termios.h>
+#include <unistd.h>
+#include <sysv_termio.h>
+#include <sys/ioctl.h>
+
+/* Send zero bits on FD. */
+int
+DEFUN(tcsendbreak, (fd, duration), int fd AND int duration)
+{
+ /* The break lasts 0.25 to 0.5 seconds if DURATION is zero,
+ and an implementation-defined period if DURATION is nonzero.
+ We define a positive DURATION to be number of milliseconds to break. */
+ if (duration <= 0)
+ return __ioctl (fd, _TCSBRK, 0);
+
+ /* ioctl can't send a break of any other duration for us.
+ This could be changed to use trickery (e.g. lower speed and
+ send a '\0') to send the break, but for now just return an error. */
+ errno = EINVAL;
+ return -1;
+}
diff --git a/sysdeps/unix/sysv/tcsetattr.c b/sysdeps/unix/sysv/tcsetattr.c
new file mode 100644
index 0000000000..30e1b0b48d
--- /dev/null
+++ b/sysdeps/unix/sysv/tcsetattr.c
@@ -0,0 +1,208 @@
+/* Copyright (C) 1992 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 <errno.h>
+#include <stddef.h>
+#include <termios.h>
+#include <sys/ioctl.h>
+
+#include <sysv_termio.h>
+
+
+CONST speed_t __unix_speeds[] =
+ {
+ 0,
+ 50,
+ 75,
+ 110,
+ 134,
+ 150,
+ 200,
+ 300,
+ 600,
+ 1200,
+ 1800,
+ 2400,
+ 4800,
+ 9600,
+ 19200,
+ 38400,
+ };
+
+
+/* Set the state of FD to *TERMIOS_P. */
+int
+DEFUN(tcsetattr, (fd, optional_actions, termios_p),
+ int fd AND int optional_actions AND CONST struct termios *termios_p)
+{
+ struct __sysv_termio buf;
+ int ioctl_function;
+ size_t i;
+
+ if (termios_p == NULL)
+ {
+ errno = EINVAL;
+ return -1;
+ }
+ switch (optional_actions)
+ {
+ case TCSANOW:
+ ioctl_function = _TCSETA;
+ break;
+ case TCSADRAIN:
+ ioctl_function = _TCSETAW;
+ break;
+ case TCSAFLUSH:
+ ioctl_function = _TCSETAF;
+ break;
+ default:
+ errno = EINVAL;
+ return -1;
+ }
+
+ if (termios_p->__ispeed != termios_p->__ospeed)
+ {
+ errno = EINVAL;
+ return -1;
+ }
+ buf.c_cflag = -1;
+ for (i = 0; i <= sizeof (__unix_speeds) / sizeof (__unix_speeds[0]); ++i)
+ {
+ if (__unix_speeds[i] == termios_p->__ispeed)
+ buf.c_cflag = i;
+ }
+ if (buf.c_cflag == -1)
+ {
+ errno = EINVAL;
+ return -1;
+ }
+
+ buf.c_iflag = 0;
+ if (termios_p->c_iflag & IGNBRK)
+ buf.c_iflag |= _SYSV_IGNBRK;
+ if (termios_p->c_iflag & BRKINT)
+ buf.c_iflag |= _SYSV_BRKINT;
+ if (termios_p->c_iflag & IGNPAR)
+ buf.c_iflag |= _SYSV_IGNPAR;
+ if (termios_p->c_iflag & PARMRK)
+ buf.c_iflag |= _SYSV_PARMRK;
+ if (termios_p->c_iflag & INPCK)
+ buf.c_iflag |= _SYSV_INPCK;
+ if (termios_p->c_iflag & ISTRIP)
+ buf.c_iflag |= _SYSV_ISTRIP;
+ if (termios_p->c_iflag & INLCR)
+ buf.c_iflag |= _SYSV_INLCR;
+ if (termios_p->c_iflag & IGNCR)
+ buf.c_iflag |= _SYSV_IGNCR;
+ if (termios_p->c_iflag & ICRNL)
+ buf.c_iflag |= _SYSV_ICRNL;
+ if (termios_p->c_iflag & IXON)
+ buf.c_iflag |= _SYSV_IXON;
+ if (termios_p->c_iflag & IXOFF)
+ buf.c_iflag |= _SYSV_IXOFF;
+ if (termios_p->c_iflag & IXANY)
+ buf.c_iflag |= _SYSV_IXANY;
+ if (termios_p->c_iflag & IMAXBEL)
+ buf.c_iflag |= _SYSV_IMAXBEL;
+
+ buf.c_oflag = 0;
+ if (termios_p->c_oflag & OPOST)
+ buf.c_oflag = _SYSV_OPOST;
+ if (termios_p->c_oflag & ONLCR)
+ buf.c_oflag = _SYSV_ONLCR;
+
+ /* So far, buf.c_cflag contains the speed in CBAUD. */
+ if (termios_p->c_cflag & CSTOPB)
+ buf.c_cflag |= _SYSV_CSTOPB;
+ if (termios_p->c_cflag & CREAD)
+ buf.c_cflag |= _SYSV_CREAD;
+ if (termios_p->c_cflag & PARENB)
+ buf.c_cflag |= _SYSV_PARENB;
+ if (termios_p->c_cflag & PARODD)
+ buf.c_cflag |= _SYSV_PARODD;
+ if (termios_p->c_cflag & HUPCL)
+ buf.c_cflag |= _SYSV_HUPCL;
+ if (termios_p->c_cflag & CLOCAL)
+ buf.c_cflag |= _SYSV_CLOCAL;
+ switch (termios_p->c_cflag & CSIZE)
+ {
+ case CS5:
+ buf.c_cflag |= _SYSV_CS5;
+ break;
+ case CS6:
+ buf.c_cflag |= _SYSV_CS6;
+ break;
+ case CS7:
+ buf.c_cflag |= _SYSV_CS7;
+ break;
+ case CS8:
+ buf.c_cflag |= _SYSV_CS8;
+ break;
+ }
+
+ buf.c_lflag = 0;
+ if (termios_p->c_lflag & ISIG)
+ buf.c_lflag |= _SYSV_ISIG;
+ if (termios_p->c_lflag & ICANON)
+ buf.c_lflag |= _SYSV_ICANON;
+ if (termios_p->c_lflag & ECHO)
+ buf.c_lflag |= _SYSV_ECHO;
+ if (termios_p->c_lflag & ECHOE)
+ buf.c_lflag |= _SYSV_ECHOE;
+ if (termios_p->c_lflag & ECHOK)
+ buf.c_lflag |= _SYSV_ECHOK;
+ if (termios_p->c_lflag & ECHONL)
+ buf.c_lflag |= _SYSV_ECHONL;
+ if (termios_p->c_lflag & NOFLSH)
+ buf.c_lflag |= _SYSV_NOFLSH;
+ if (termios_p->c_lflag & TOSTOP)
+ buf.c_lflag |= _SYSV_TOSTOP;
+ if (termios_p->c_lflag & ECHOCTL)
+ buf.c_lflag |= _SYSV_ECHOCTL;
+ if (termios_p->c_lflag & ECHOPRT)
+ buf.c_lflag |= _SYSV_ECHOPRT;
+ if (termios_p->c_lflag & ECHOKE)
+ buf.c_lflag |= _SYSV_ECHOKE;
+ if (termios_p->c_lflag & FLUSHO)
+ buf.c_lflag |= _SYSV_FLUSHO;
+ if (termios_p->c_lflag & PENDIN)
+ buf.c_lflag |= _SYSV_PENDIN;
+ if (termios_p->c_lflag & IEXTEN)
+ buf.c_lflag |= _SYSV_IEXTEN;
+
+ buf.c_cc[_SYSV_VINTR] = termios_p->c_cc[VINTR];
+ buf.c_cc[_SYSV_VQUIT] = termios_p->c_cc[VQUIT];
+ buf.c_cc[_SYSV_VERASE] = termios_p->c_cc[VERASE];
+ buf.c_cc[_SYSV_VKILL] = termios_p->c_cc[VKILL];
+ if (buf.c_lflag & _SYSV_ICANON)
+ {
+ buf.c_cc[_SYSV_VEOF] = termios_p->c_cc[VEOF];
+ buf.c_cc[_SYSV_VEOL] = termios_p->c_cc[VEOL];
+ }
+ else
+ {
+ buf.c_cc[_SYSV_VMIN] = termios_p->c_cc[VMIN];
+ buf.c_cc[_SYSV_VTIME] = termios_p->c_cc[VTIME];
+ }
+ buf.c_cc[_SYSV_VEOL2] = termios_p->c_cc[VEOL2];
+
+ if (__ioctl (fd, ioctl_function, &buf) < 0)
+ return -1;
+ return 0;
+}
diff --git a/sysdeps/unix/sysv/tcsetpgrp.c b/sysdeps/unix/sysv/tcsetpgrp.c
new file mode 100644
index 0000000000..da83f3bd6c
--- /dev/null
+++ b/sysdeps/unix/sysv/tcsetpgrp.c
@@ -0,0 +1,31 @@
+/* Copyright (C) 1992 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 <sys/types.h>
+#include <sysv_termio.h>
+#include <errno.h>
+#include <unistd.h>
+#include <sys/ioctl.h>
+
+/* Set the foreground process group ID of FD set PGRP_ID. */
+int
+DEFUN(tcsetpgrp, (fd, pgrp_id), int fd AND pid_t pgrp_id)
+{
+ return __ioctl (fd, _TIOCSPGRP, &pgrp_id);
+}
diff --git a/sysdeps/unix/sysv/times.S b/sysdeps/unix/sysv/times.S
new file mode 100644
index 0000000000..c2bb1685f5
--- /dev/null
+++ b/sysdeps/unix/sysv/times.S
@@ -0,0 +1,24 @@
+/* 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>
+
+SYSCALL__ (times, 1)
+ ret
+
+weak_alias (__times, times)
diff --git a/sysdeps/unix/sysv/ulimit.S b/sysdeps/unix/sysv/ulimit.S
new file mode 100644
index 0000000000..1bc6dc910a
--- /dev/null
+++ b/sysdeps/unix/sysv/ulimit.S
@@ -0,0 +1,22 @@
+/* Copyright (C) 1991, 1992 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 (ulimit, 2)
+ ret
diff --git a/sysdeps/unix/sysv/uname.S b/sysdeps/unix/sysv/uname.S
new file mode 100644
index 0000000000..ab4879fa40
--- /dev/null
+++ b/sysdeps/unix/sysv/uname.S
@@ -0,0 +1,22 @@
+/* Copyright (C) 1992 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 (uname, 1)
+ ret
diff --git a/sysdeps/unix/sysv/utime.S b/sysdeps/unix/sysv/utime.S
new file mode 100644
index 0000000000..e24db03b5e
--- /dev/null
+++ b/sysdeps/unix/sysv/utime.S
@@ -0,0 +1,22 @@
+/* Copyright (C) 1992 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 (utime, 2)
+ ret
diff --git a/sysdeps/unix/sysv/utmp.h b/sysdeps/unix/sysv/utmp.h
new file mode 100644
index 0000000000..4c3d33e987
--- /dev/null
+++ b/sysdeps/unix/sysv/utmp.h
@@ -0,0 +1,23 @@
+#ifndef _UTMP_H
+
+#define _UTMP_H 1
+
+#include <time.h>
+
+struct utmp
+ {
+#define ut_name ut_user
+ char ut_user[8];
+ char ut_id[4];
+ char ut_line[12];
+ short ut_pid;
+ short ut_type;
+ struct exit_status
+ {
+ short e_termination;
+ short e_exit;
+ } ut_exit;
+ time_t ut_time;
+ };
+
+#endif /* utmp.h. */
diff --git a/sysdeps/unix/sysv/utsnamelen.h b/sysdeps/unix/sysv/utsnamelen.h
new file mode 100644
index 0000000000..31473cf4ea
--- /dev/null
+++ b/sysdeps/unix/sysv/utsnamelen.h
@@ -0,0 +1 @@
+#define _UTSNAME_LENGTH 9