about summary refs log tree commit diff
path: root/sysdeps/unix/sysv/irix4
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/irix4
downloadglibc-28f540f45bbacd939bfd07f213bcad2bf730b1bf.tar.gz
glibc-28f540f45bbacd939bfd07f213bcad2bf730b1bf.tar.xz
glibc-28f540f45bbacd939bfd07f213bcad2bf730b1bf.zip
initial import
Diffstat (limited to 'sysdeps/unix/sysv/irix4')
-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
38 files changed, 1200 insertions, 0 deletions
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>