summaryrefslogtreecommitdiff
path: root/ports/sysdeps/unix/bsd
diff options
context:
space:
mode:
Diffstat (limited to 'ports/sysdeps/unix/bsd')
-rw-r--r--ports/sysdeps/unix/bsd/hp/Dist1
-rw-r--r--ports/sysdeps/unix/bsd/hp/m68k/brk.S46
-rw-r--r--ports/sysdeps/unix/bsd/hp/m68k/dl-brk.S1
-rw-r--r--ports/sysdeps/unix/bsd/hp/m68k/start.c10
-rw-r--r--ports/sysdeps/unix/bsd/hp/m68k/sysdep.h56
-rw-r--r--ports/sysdeps/unix/bsd/hp/m68k/vfork.S56
-rw-r--r--ports/sysdeps/unix/bsd/hp/m68k/wait3.S39
-rw-r--r--ports/sysdeps/unix/bsd/osf/Dist1
-rw-r--r--ports/sysdeps/unix/bsd/osf/Implies2
-rw-r--r--ports/sysdeps/unix/bsd/osf/Makefile3
-rw-r--r--ports/sysdeps/unix/bsd/osf/alpha/bits/stat.h79
-rw-r--r--ports/sysdeps/unix/bsd/osf/alpha/brk.S54
-rw-r--r--ports/sysdeps/unix/bsd/osf/alpha/dl-brk.S1
-rw-r--r--ports/sysdeps/unix/bsd/osf/alpha/fork.S28
-rw-r--r--ports/sysdeps/unix/bsd/osf/alpha/killpg.S27
-rw-r--r--ports/sysdeps/unix/bsd/osf/alpha/recv.S26
-rw-r--r--ports/sysdeps/unix/bsd/osf/alpha/send.S26
-rw-r--r--ports/sysdeps/unix/bsd/osf/alpha/sigblock.S29
-rw-r--r--ports/sysdeps/unix/bsd/osf/alpha/sigpause.S30
-rw-r--r--ports/sysdeps/unix/bsd/osf/alpha/sigsetmask.S29
-rw-r--r--ports/sysdeps/unix/bsd/osf/alpha/sigvec.S29
-rw-r--r--ports/sysdeps/unix/bsd/osf/alpha/start.S83
-rw-r--r--ports/sysdeps/unix/bsd/osf/alpha/syscalls.list3
-rw-r--r--ports/sysdeps/unix/bsd/osf/alpha/sysdep.h30
-rw-r--r--ports/sysdeps/unix/bsd/osf/alpha/vhangup.S26
-rw-r--r--ports/sysdeps/unix/bsd/osf/alpha/waitpid.c1
-rw-r--r--ports/sysdeps/unix/bsd/osf/bits/mman.h71
-rw-r--r--ports/sysdeps/unix/bsd/osf/bits/sigaction.h50
-rw-r--r--ports/sysdeps/unix/bsd/osf/syscalls.list3
-rw-r--r--ports/sysdeps/unix/bsd/osf/system.c2
-rw-r--r--ports/sysdeps/unix/bsd/sequent/i386/getgroups.S44
-rw-r--r--ports/sysdeps/unix/bsd/sequent/i386/sigvec.S45
-rw-r--r--ports/sysdeps/unix/bsd/sequent/i386/syscall.S31
-rw-r--r--ports/sysdeps/unix/bsd/sequent/i386/sysdep.h82
-rw-r--r--ports/sysdeps/unix/bsd/sony/newsos/m68k/Implies2
-rw-r--r--ports/sysdeps/unix/bsd/sony/newsos/m68k/sysdep.h56
-rw-r--r--ports/sysdeps/unix/bsd/sony/newsos4/Makefile3
-rw-r--r--ports/sysdeps/unix/bsd/sony/newsos4/syscalls.list3
-rw-r--r--ports/sysdeps/unix/bsd/sony/newsos4/wait.c1
-rw-r--r--ports/sysdeps/unix/bsd/sony/newsos4/wait3.c1
-rw-r--r--ports/sysdeps/unix/bsd/sony/newsos4/wait4.c1
-rw-r--r--ports/sysdeps/unix/bsd/tahoe/Implies1
-rw-r--r--ports/sysdeps/unix/bsd/tahoe/sysdep.h5
-rw-r--r--ports/sysdeps/unix/bsd/ultrix4/Implies2
-rw-r--r--ports/sysdeps/unix/bsd/ultrix4/Makefile3
-rw-r--r--ports/sysdeps/unix/bsd/ultrix4/bits/fcntl.h122
-rw-r--r--ports/sysdeps/unix/bsd/ultrix4/bits/mman.h51
-rw-r--r--ports/sysdeps/unix/bsd/ultrix4/bits/posix_opt.h24
-rw-r--r--ports/sysdeps/unix/bsd/ultrix4/bits/utsname.h23
-rw-r--r--ports/sysdeps/unix/bsd/ultrix4/mips/Dist1
-rw-r--r--ports/sysdeps/unix/bsd/ultrix4/mips/Makefile3
-rw-r--r--ports/sysdeps/unix/bsd/ultrix4/mips/__handler.S115
-rw-r--r--ports/sysdeps/unix/bsd/ultrix4/mips/bits/sigcontext.h63
-rw-r--r--ports/sysdeps/unix/bsd/ultrix4/mips/sigvec.c55
-rw-r--r--ports/sysdeps/unix/bsd/ultrix4/mips/start.S87
-rw-r--r--ports/sysdeps/unix/bsd/ultrix4/mips/syscalls.list3
-rw-r--r--ports/sysdeps/unix/bsd/ultrix4/mips/sysdep.h3
-rw-r--r--ports/sysdeps/unix/bsd/ultrix4/mips/vfork.S36
-rw-r--r--ports/sysdeps/unix/bsd/ultrix4/syscalls.list3
-rw-r--r--ports/sysdeps/unix/bsd/ultrix4/sysconf.c61
-rw-r--r--ports/sysdeps/unix/bsd/ultrix4/system.c2
-rw-r--r--ports/sysdeps/unix/bsd/ultrix4/wait3.S26
-rw-r--r--ports/sysdeps/unix/bsd/vax/brk.S47
-rw-r--r--ports/sysdeps/unix/bsd/vax/dl-brk.S1
-rw-r--r--ports/sysdeps/unix/bsd/vax/pipe.S29
-rw-r--r--ports/sysdeps/unix/bsd/vax/sysdep.S35
-rw-r--r--ports/sysdeps/unix/bsd/vax/sysdep.h55
-rw-r--r--ports/sysdeps/unix/bsd/vax/vfork.S57
-rw-r--r--ports/sysdeps/unix/bsd/vax/wait.S27
-rw-r--r--ports/sysdeps/unix/bsd/vax/wait3.S37
70 files changed, 2088 insertions, 0 deletions
diff --git a/ports/sysdeps/unix/bsd/hp/Dist b/ports/sysdeps/unix/bsd/hp/Dist
new file mode 100644
index 000000000..ccd3a610e
--- /dev/null
+++ b/ports/sysdeps/unix/bsd/hp/Dist
@@ -0,0 +1 @@
+m68k/dl-brk.S
diff --git a/ports/sysdeps/unix/bsd/hp/m68k/brk.S b/ports/sysdeps/unix/bsd/hp/m68k/brk.S
new file mode 100644
index 000000000..037d4d0d0
--- /dev/null
+++ b/ports/sysdeps/unix/bsd/hp/m68k/brk.S
@@ -0,0 +1,46 @@
+/* Copyright (C) 1991, 1993, 1994, 1995, 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <sysdep.h>
+
+#ifndef SYS_brk
+#define SYS_brk 17
+#endif
+
+#ifndef HAVE_GNU_LD
+#define __end _end
+#endif
+
+.data
+.globl ___curbrk
+___curbrk:
+ .long __end
+
+.text
+ENTRY (__brk)
+ movel #__end, d0
+ cmpl sp@(4), d0
+ ble 0f
+ movel d0, sp@(4)
+0: DO_CALL (#SYS_brk, 1)
+ movel sp@(4), ___curbrk
+ clrl d0
+ rts
+error: jmp syscall_error
+
+weak_alias (__brk, brk)
diff --git a/ports/sysdeps/unix/bsd/hp/m68k/dl-brk.S b/ports/sysdeps/unix/bsd/hp/m68k/dl-brk.S
new file mode 100644
index 000000000..eeb96544e
--- /dev/null
+++ b/ports/sysdeps/unix/bsd/hp/m68k/dl-brk.S
@@ -0,0 +1 @@
+#include <brk.S>
diff --git a/ports/sysdeps/unix/bsd/hp/m68k/start.c b/ports/sysdeps/unix/bsd/hp/m68k/start.c
new file mode 100644
index 000000000..e04ca0632
--- /dev/null
+++ b/ports/sysdeps/unix/bsd/hp/m68k/start.c
@@ -0,0 +1,10 @@
+/* hp300 4.3 BSD starts at 4, rather than 0, when the start address is 0.
+ Go figure. */
+asm(".globl __start");
+asm("__start: .long 0");
+
+#define _start __start0
+
+#define DUMMIES dummy0
+
+#include <sysdeps/unix/start.c>
diff --git a/ports/sysdeps/unix/bsd/hp/m68k/sysdep.h b/ports/sysdeps/unix/bsd/hp/m68k/sysdep.h
new file mode 100644
index 000000000..75aee674f
--- /dev/null
+++ b/ports/sysdeps/unix/bsd/hp/m68k/sysdep.h
@@ -0,0 +1,56 @@
+/* Copyright (C) 1991, 92, 93, 94, 95, 97 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+/* This code wants to be run through m4. */
+
+#include <sysdeps/unix/sysdep.h>
+
+#ifdef __ASSEMBLER__
+
+#define POUND #
+
+#ifdef __STDC__
+#define ENTRY(name) \
+ .globl _##name; \
+ .even; \
+ _##name##:
+#else
+#define ENTRY(name) \
+ .globl _/**/name; \
+ .even; \
+ _/**/name/**/:
+#endif
+
+#define PSEUDO(name, syscall_name, args) \
+ .even; \
+ .globl syscall_error; \
+ error: jmp syscall_error; \
+ ENTRY (name) \
+ DO_CALL (POUND SYS_ify (syscall_name), args)
+
+#define DO_CALL(syscall, args) \
+ movel syscall, d0; \
+ trap POUND 0; \
+ bcs error
+
+#define ret rts
+#define r0 d0
+#define r1 d1
+#define MOVE(x,y) movel x , y
+
+#endif /* __ASSEMBLER__ */
diff --git a/ports/sysdeps/unix/bsd/hp/m68k/vfork.S b/ports/sysdeps/unix/bsd/hp/m68k/vfork.S
new file mode 100644
index 000000000..abcc1c338
--- /dev/null
+++ b/ports/sysdeps/unix/bsd/hp/m68k/vfork.S
@@ -0,0 +1,56 @@
+/* Copyright (C) 1991, 1994, 1995, 1997, 2002 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <sysdep.h>
+
+#ifndef SYS_vfork
+#define SYS_vfork 66
+#endif
+
+/* Clone the calling process, but without copying the whole address space.
+ The calling process is suspended until the new process exits or is
+ replaced by a call to `execve'. Return -1 for errors, 0 to the new process,
+ and the process ID of the new process to the old process. */
+.globl ___vfork
+___vfork:
+ /* Pop the return PC value into A0. */
+ moveal sp@+, a0
+
+ /* Stuff the syscall number in D0 and trap into the kernel. */
+ movel #SYS_vfork, d0
+ trap #0
+ bcs error /* Branch forward if it failed. */
+
+ /* It succeeded. See which fork we're in. D1 is now 0 for the
+ parent and 1 for the child. Decrement it to make it -1 (all
+ bits set) for the parent, and 0 (no bits set) for the child.
+ Then AND it with D0, so the parent gets D0&-1==R0, and the child
+ gets D0&0==0. */
+ subl #1, d1
+ andl d1, d0
+
+ /* Jump to the return PC. */
+ jmp a0@
+
+error:
+ movel d0, _errno
+ moveq #-1, d0
+ jmp a0@
+libc_hidden_def (__vfork)
+
+weak_alias (__vfork, vfork)
diff --git a/ports/sysdeps/unix/bsd/hp/m68k/wait3.S b/ports/sysdeps/unix/bsd/hp/m68k/wait3.S
new file mode 100644
index 000000000..5b6319182
--- /dev/null
+++ b/ports/sysdeps/unix/bsd/hp/m68k/wait3.S
@@ -0,0 +1,39 @@
+/* Copyright (C) 1991, 1992, 1995, 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <sysdep.h>
+
+ENTRY(__wait3)
+ movel sp@(8), d1
+ moveal sp@(12), a0
+ movel #SYS_wait, d0
+ /* Set all condition codes to tell the kernel this is wait3. */
+ movew #31, ccr
+ trap #0
+ bcs error
+
+ tstl sp@(4)
+ beq 1f
+ moveal sp@(4), a0
+ movel d1, a0@
+1: rts
+
+.globl syscall_error
+error: jmp syscall_error
+
+weak_alias (__wait3, wait3)
diff --git a/ports/sysdeps/unix/bsd/osf/Dist b/ports/sysdeps/unix/bsd/osf/Dist
new file mode 100644
index 000000000..e792f44bd
--- /dev/null
+++ b/ports/sysdeps/unix/bsd/osf/Dist
@@ -0,0 +1 @@
+alpha/dl-brk.S
diff --git a/ports/sysdeps/unix/bsd/osf/Implies b/ports/sysdeps/unix/bsd/osf/Implies
new file mode 100644
index 000000000..82719f5a5
--- /dev/null
+++ b/ports/sysdeps/unix/bsd/osf/Implies
@@ -0,0 +1,2 @@
+# OSF/1 has the canonical set of <sys/mman.h> system calls.
+unix/mman
diff --git a/ports/sysdeps/unix/bsd/osf/Makefile b/ports/sysdeps/unix/bsd/osf/Makefile
new file mode 100644
index 000000000..743788a41
--- /dev/null
+++ b/ports/sysdeps/unix/bsd/osf/Makefile
@@ -0,0 +1,3 @@
+# Without -non_shared (via the compiler's -static flag), we'll end up
+# with some unresolved symbols wrt exceptions.
+LDFLAGS := $(LDFLAGS) -static
diff --git a/ports/sysdeps/unix/bsd/osf/alpha/bits/stat.h b/ports/sysdeps/unix/bsd/osf/alpha/bits/stat.h
new file mode 100644
index 000000000..20f358f70
--- /dev/null
+++ b/ports/sysdeps/unix/bsd/osf/alpha/bits/stat.h
@@ -0,0 +1,79 @@
+/* Copyright (C) 1993, 1996, 1997, 1999, 2000 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#ifndef _SYS_STAT_H
+# error "Never include <bits/stat.h> directly; use <sys/stat.h> instead."
+#endif
+
+#include <bits/types.h>
+
+/* Structure describing file characteristics. */
+struct stat
+ {
+ int st_dev; /* Device. */
+ unsigned int st_ino; /* File serial number. */
+ unsigned int st_mode; /* File mode. */
+ unsigned short st_nlink; /* Link count. */
+ unsigned int st_uid; /* User ID of the file's owner. */
+ unsigned int st_gid; /* Group ID of the file's group.*/
+ int st_rdev; /* Device number, if device. */
+
+ long st_size; /* Size of file, in bytes. */
+
+ int st_atime; /* Time of last access. */
+ int st_atime_usec;
+ int st_mtime; /* Time of last modification. */
+ int st_mtime_usec;
+ int st_ctime; /* Time of last status change. */
+ int st_ctime_usec;
+
+ __blksize_t st_blksize; /* Optimal block size for I/O. */
+#define _STATBUF_ST_BLKSIZE /* Tell code we have this member. */
+
+ __blkcnt_t st_blocks; /* Number of 512-byte blocks allocated. */
+ unsigned int st_flags;
+ unsigned int st_gen;
+ };
+
+/* Encoding of the file mode. */
+
+#define __S_IFMT 0170000 /* These bits determine file type. */
+
+/* File types. */
+#define __S_IFDIR 0040000 /* Directory. */
+#define __S_IFCHR 0020000 /* Character device. */
+#define __S_IFBLK 0060000 /* Block device. */
+#define __S_IFREG 0100000 /* Regular file. */
+#define __S_IFIFO 0010000 /* FIFO. */
+
+#define __S_IFLNK 0120000 /* Symbolic link. */
+#define __S_IFSOCK 0140000 /* Socket. */
+
+/* POSIX.1b objects. */
+#define __S_TYPEISMQ(buf) (0)
+#define __S_TYPEISSEM(buf) (0)
+#define __S_TYPEISSHM(buf) (0)
+
+/* Protection bits. */
+
+#define __S_ISUID 04000 /* Set user ID on execution. */
+#define __S_ISGID 02000 /* Set group ID on execution. */
+#define __S_ISVTX 01000 /* Save swapped text after use (sticky). */
+#define __S_IREAD 0400 /* Read by owner. */
+#define __S_IWRITE 0200 /* Write by owner. */
+#define __S_IEXEC 0100 /* Execute by owner. */
diff --git a/ports/sysdeps/unix/bsd/osf/alpha/brk.S b/ports/sysdeps/unix/bsd/osf/alpha/brk.S
new file mode 100644
index 000000000..51abaa6c1
--- /dev/null
+++ b/ports/sysdeps/unix/bsd/osf/alpha/brk.S
@@ -0,0 +1,54 @@
+/* Copyright (C) 1993, 1995, 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ 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 Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <sysdep.h>
+
+#ifndef SYS_brk
+#define SYS_brk 17
+#endif
+
+#ifndef HAVE_GNU_LD
+#define __end end
+#endif
+
+.data
+ .extern __end,8
+ .globl __curbrk
+__curbrk:
+ .quad __end
+
+.text
+ENTRY(__brk)
+ /* FIXME We do not check for asking for less than a page yet. */
+ ldiq v0, SYS_brk
+ call_pal PAL_callsys
+ bne a3, error
+
+ /* Update __curbrk and exit cleanly. */
+/* ldgp gp, 0(t12) */
+ stq a0, __curbrk
+
+ mov zero, v0
+ ret
+ /* What a horrible way to die. */
+error: ldgp gp,0(gp)
+ jmp zero,syscall_error
+ .end __brk
+
+weak_alias (__brk, brk)
diff --git a/ports/sysdeps/unix/bsd/osf/alpha/dl-brk.S b/ports/sysdeps/unix/bsd/osf/alpha/dl-brk.S
new file mode 100644
index 000000000..eeb96544e
--- /dev/null
+++ b/ports/sysdeps/unix/bsd/osf/alpha/dl-brk.S
@@ -0,0 +1 @@
+#include <brk.S>
diff --git a/ports/sysdeps/unix/bsd/osf/alpha/fork.S b/ports/sysdeps/unix/bsd/osf/alpha/fork.S
new file mode 100644
index 000000000..a4ec14b56
--- /dev/null
+++ b/ports/sysdeps/unix/bsd/osf/alpha/fork.S
@@ -0,0 +1,28 @@
+/* Copyright (C) 1993, 1995, 1997, 2002 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ 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 Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <sysdep.h>
+
+SYSCALL__ (fork, 0)
+ cmovne a4, 0, v0
+ ret
+ .end __fork
+libc_hidden_def (__fork)
+
+weak_alias (__fork, fork)
diff --git a/ports/sysdeps/unix/bsd/osf/alpha/killpg.S b/ports/sysdeps/unix/bsd/osf/alpha/killpg.S
new file mode 100644
index 000000000..741616bc7
--- /dev/null
+++ b/ports/sysdeps/unix/bsd/osf/alpha/killpg.S
@@ -0,0 +1,27 @@
+/* Copyright (C) 1993, 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ 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 Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <sysdep.h>
+
+#include <sys/ult_syscall.h>
+#define SYS_killpg SYS_ult_killpg
+
+SYSCALL (killpg, 2)
+ ret
+ .end killpg
diff --git a/ports/sysdeps/unix/bsd/osf/alpha/recv.S b/ports/sysdeps/unix/bsd/osf/alpha/recv.S
new file mode 100644
index 000000000..92a273d15
--- /dev/null
+++ b/ports/sysdeps/unix/bsd/osf/alpha/recv.S
@@ -0,0 +1,26 @@
+/* Copyright (C) 1991, 1992, 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <sysdep.h>
+
+#include <sys/ult_syscall.h>
+#define SYS_recv SYS_ult_recv
+
+SYSCALL (recv, 4)
+ ret
+ .end recv
diff --git a/ports/sysdeps/unix/bsd/osf/alpha/send.S b/ports/sysdeps/unix/bsd/osf/alpha/send.S
new file mode 100644
index 000000000..7d61d46a1
--- /dev/null
+++ b/ports/sysdeps/unix/bsd/osf/alpha/send.S
@@ -0,0 +1,26 @@
+/* Copyright (C) 1991, 1992, 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <sysdep.h>
+
+#include <sys/ult_syscall.h>
+#define SYS_send SYS_ult_send
+
+SYSCALL (send, 4)
+ ret
+ .end send
diff --git a/ports/sysdeps/unix/bsd/osf/alpha/sigblock.S b/ports/sysdeps/unix/bsd/osf/alpha/sigblock.S
new file mode 100644
index 000000000..5db55f447
--- /dev/null
+++ b/ports/sysdeps/unix/bsd/osf/alpha/sigblock.S
@@ -0,0 +1,29 @@
+/* Copyright (C) 1994, 1995, 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ 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 Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <sysdep.h>
+
+#include <sys/ult_syscall.h>
+#define SYS_sigblock SYS_ult_sigblock
+
+SYSCALL__ (sigblock, 1)
+ ret
+ .end __sigblock
+
+weak_alias (__sigblock, sigblock)
diff --git a/ports/sysdeps/unix/bsd/osf/alpha/sigpause.S b/ports/sysdeps/unix/bsd/osf/alpha/sigpause.S
new file mode 100644
index 000000000..764636647
--- /dev/null
+++ b/ports/sysdeps/unix/bsd/osf/alpha/sigpause.S
@@ -0,0 +1,30 @@
+/* Copyright (C) 1993,95,97,2002 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ 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 Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <sysdep.h>
+
+#include <sys/ult_syscall.h>
+#define SYS_sigpause SYS_ult_sigpause
+
+SYSCALL__ (sigpause, 1)
+ ret
+ .end __sigpause
+libc_hidden_def (__sigpause)
+
+weak_alias (__sigpause, sigpause)
diff --git a/ports/sysdeps/unix/bsd/osf/alpha/sigsetmask.S b/ports/sysdeps/unix/bsd/osf/alpha/sigsetmask.S
new file mode 100644
index 000000000..93333aa0b
--- /dev/null
+++ b/ports/sysdeps/unix/bsd/osf/alpha/sigsetmask.S
@@ -0,0 +1,29 @@
+/* Copyright (C) 1993, 1995, 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ 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 Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <sysdep.h>
+
+#include <sys/ult_syscall.h>
+#define SYS_sigsetmask SYS_ult_sigsetmask
+
+SYSCALL__ (sigsetmask, 1)
+ ret
+ .end __sigsetmask
+
+weak_alias (__sigsetmask, sigsetmask)
diff --git a/ports/sysdeps/unix/bsd/osf/alpha/sigvec.S b/ports/sysdeps/unix/bsd/osf/alpha/sigvec.S
new file mode 100644
index 000000000..45fcc58a0
--- /dev/null
+++ b/ports/sysdeps/unix/bsd/osf/alpha/sigvec.S
@@ -0,0 +1,29 @@
+/* Copyright (C) 1993, 1995, 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ 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 Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <sysdep.h>
+
+#include <sys/ult_syscall.h>
+#define SYS_sigvec SYS_ult_sigvec
+
+SYSCALL__ (sigvec, 3)
+ ret
+ .end __sigvec
+
+weak_alias (__sigvec, sigvec)
diff --git a/ports/sysdeps/unix/bsd/osf/alpha/start.S b/ports/sysdeps/unix/bsd/osf/alpha/start.S
new file mode 100644
index 000000000..1fa52a643
--- /dev/null
+++ b/ports/sysdeps/unix/bsd/osf/alpha/start.S
@@ -0,0 +1,83 @@
+/* Copyright (C) 1993, 1995, 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ 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 Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ In addition to the permissions in the GNU Lesser General Public
+ License, the Free Software Foundation gives you unlimited
+ permission to link the compiled version of this file with other
+ programs, and to distribute those programs without any restriction
+ coming from the use of this file. (The GNU Lesser General Public
+ License restrictions do apply in other respects; for example, they
+ cover modification of the file, and distribution when not linked
+ into another program.)
+
+ Note that people who make modified versions of this file are not
+ obligated to grant this special exception for their modified
+ versions; it is their choice whether to do so. The GNU Lesser
+ General Public License gives permission to release a modified
+ version without this exception; this exception also makes it
+ possible to release a modified version which carries forward this
+ exception.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <sysdep.h>
+
+#if 0
+.sdata
+.globl STARTFRM
+STARTFRM = 0
+#endif
+
+.text
+ENTRY(__start)
+ lda sp, -16(sp)
+ stq zero, 8(sp)
+
+ /* This branch puts the address of the current insn in t0. */
+ br t0, 10f
+10:
+ /* We set the GP register by using the address of the ldgp */
+ /* (what we just put into t0). */
+ ldgp gp, 0(t0)
+
+ /* get argc */
+ ldl a0, 16(sp)
+
+ /* get argv */
+ lda a1, 24(sp)
+
+ /* move ahead to envp */
+ s8addq a0, a1, a2
+ addq a2, 0x8, a2
+
+ /* Store in environ. */
+ stq a2, environ
+
+ /* Clear out errno. */
+/* ldgp gp, 0(t12) */
+ stl zero, errno
+
+ /* Call main. */
+ jsr ra, main
+ ldgp gp, 0(ra)
+
+ mov v0, a0
+
+ jsr ra, exit
+ ldgp gp, 0(ra)
+
+ .end __start
diff --git a/ports/sysdeps/unix/bsd/osf/alpha/syscalls.list b/ports/sysdeps/unix/bsd/osf/alpha/syscalls.list
new file mode 100644
index 000000000..ac883925e
--- /dev/null
+++ b/ports/sysdeps/unix/bsd/osf/alpha/syscalls.list
@@ -0,0 +1,3 @@
+# File name Caller Syscall name # args Strong name Weak names
+
+wait4 - wait4 4 __wait4 wait4
diff --git a/ports/sysdeps/unix/bsd/osf/alpha/sysdep.h b/ports/sysdeps/unix/bsd/osf/alpha/sysdep.h
new file mode 100644
index 000000000..84ac541aa
--- /dev/null
+++ b/ports/sysdeps/unix/bsd/osf/alpha/sysdep.h
@@ -0,0 +1,30 @@
+/* Copyright (C) 1993, 1995, 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ 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 Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+/* OSF/1 does not precede the asm names of C symbols with a `_'. */
+#define NO_UNDERSCORES
+
+#include <sysdeps/unix/alpha/sysdep.h>
+
+#ifdef __ASSEMBLER__
+
+#include <machine/pal.h> /* get PAL_callsys */
+#include <regdef.h>
+
+#endif
diff --git a/ports/sysdeps/unix/bsd/osf/alpha/vhangup.S b/ports/sysdeps/unix/bsd/osf/alpha/vhangup.S
new file mode 100644
index 000000000..3c2b04af7
--- /dev/null
+++ b/ports/sysdeps/unix/bsd/osf/alpha/vhangup.S
@@ -0,0 +1,26 @@
+/* Copyright (C) 1991, 1992, 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <sysdep.h>
+
+#include <sys/ult_syscall.h>
+#define SYS_vhangup SYS_ult_vhangup
+
+SYSCALL (vhangup, 1)
+ ret
+ .end vhangup
diff --git a/ports/sysdeps/unix/bsd/osf/alpha/waitpid.c b/ports/sysdeps/unix/bsd/osf/alpha/waitpid.c
new file mode 100644
index 000000000..8378982ac
--- /dev/null
+++ b/ports/sysdeps/unix/bsd/osf/alpha/waitpid.c
@@ -0,0 +1 @@
+#include <sysdeps/unix/bsd/bsd4.4/waitpid.c>
diff --git a/ports/sysdeps/unix/bsd/osf/bits/mman.h b/ports/sysdeps/unix/bsd/osf/bits/mman.h
new file mode 100644
index 000000000..d4672ccca
--- /dev/null
+++ b/ports/sysdeps/unix/bsd/osf/bits/mman.h
@@ -0,0 +1,71 @@
+/* Flags for BSD-style memory management. OSF/1 version.
+ Copyright (C) 1994, 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#ifndef _BITS_MMAN_H
+#define _BITS_MMAN_H 1
+
+/* Protections are chosen from these bits, OR'd together. The
+ implementation does not necessarily support PROT_EXEC or PROT_WRITE
+ without PROT_READ. The only guarantees are that no writing will be
+ allowed without PROT_WRITE and no access will be allowed for PROT_NONE. */
+
+#define PROT_NONE 0x00 /* No access. */
+#define PROT_READ 0x01 /* Pages can be read. */
+#define PROT_WRITE 0x02 /* Pages can be written. */
+#define PROT_EXEC 0x04 /* Pages can be executed. */
+
+/* Flags contain mapping type, sharing type and options. */
+
+/* Mapping type (must choose one and only one of these). */
+#ifdef __USE_BSD
+# define MAP_FILE 0x00 /* Mapped from a file or device. */
+# define MAP_ANON 0x10 /* Allocated from anonymous virtual memory. */
+# define MAP_ANONYMOUS MAP_ANON
+# define MAP_TYPE 0xf0 /* Mask for type field. */
+#endif
+
+/* 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. */
+
+/* Other flags. */
+#define MAP_FIXED 0x0100 /* Map address must be exactly as requested. */
+#ifdef __USE_BSD
+# define MAP_VARIABLE 0 /* Absence of MAP_FIXED. */
+# define MAP_HASSEMPHORE 0x0200 /* Region may contain semaphores. */
+# define MAP_INHERIT 0x0400 /* Region is retained after exec. */
+# define MAP_UNALIGNED 0x0800 /* File offset need not be page-aligned. */
+#endif
+
+/* Advice to `madvise'. */
+#ifdef __USE_BSD
+# define MADV_NORMAL 0 /* No further special treatment. */
+# define MADV_RANDOM 1 /* Expect random page references. */
+# define MADV_SEQUENTIAL 2 /* Expect sequential page references. */
+# define MADV_WILLNEED 3 /* Will need these pages. */
+# define MADV_DONTNEED 4 /* Don't need these pages. */
+# define MADV_SPACEAVAIL 5 /* Ensure that resources are available. */
+#endif
+
+/* Flags to `msync'. */
+#define MS_ASYNC 1 /* Asynchronous cache flush. */
+#define MS_SYNC 3 /* Synchronous cache flush. */
+#define MS_INVALIDATE 4 /* Invalidate cached pages. */
+
+#endif /* bits/mman.h */
diff --git a/ports/sysdeps/unix/bsd/osf/bits/sigaction.h b/ports/sysdeps/unix/bsd/osf/bits/sigaction.h
new file mode 100644
index 000000000..13f9144fa
--- /dev/null
+++ b/ports/sysdeps/unix/bsd/osf/bits/sigaction.h
@@ -0,0 +1,50 @@
+/* Structure and constant definitions for sigaction et al. OSF/1 version.
+ Copyright (C) 1993, 1996, 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ 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 Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#ifndef _SIGNAL_H
+# error "Never include <bits/sigaction.h> directly; use <signal.h> instead."
+#endif
+
+/* 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_BSD
+# define SA_ONSTACK 0x1 /* Take signal on signal stack. */
+# define SA_RESTART 0x2 /* Restart syscall on signal return. */
+# define SA_DISABLE 0x4 /* Disable alternate signal stack. */
+#endif
+#define SA_NOCLDSTOP 0x4 /* 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/ports/sysdeps/unix/bsd/osf/syscalls.list b/ports/sysdeps/unix/bsd/osf/syscalls.list
new file mode 100644
index 000000000..731763b3e
--- /dev/null
+++ b/ports/sysdeps/unix/bsd/osf/syscalls.list
@@ -0,0 +1,3 @@
+# File name Caller Syscall name # args Strong name Weak names
+
+msync - msync 3 msync
diff --git a/ports/sysdeps/unix/bsd/osf/system.c b/ports/sysdeps/unix/bsd/osf/system.c
new file mode 100644
index 000000000..ef42ea215
--- /dev/null
+++ b/ports/sysdeps/unix/bsd/osf/system.c
@@ -0,0 +1,2 @@
+/* OSF/1 does have `waitpid'. Avoid unix/system.c, which says we don't. */
+#include <sysdeps/posix/system.c>
diff --git a/ports/sysdeps/unix/bsd/sequent/i386/getgroups.S b/ports/sysdeps/unix/bsd/sequent/i386/getgroups.S
new file mode 100644
index 000000000..55fa7288d
--- /dev/null
+++ b/ports/sysdeps/unix/bsd/sequent/i386/getgroups.S
@@ -0,0 +1,44 @@
+/* Copyright (C) 1994, 1995, 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <sysdep.h>
+#include <limits.h>
+
+/* Dynix erroneously reports `getgroups (0, 0)' as an error.
+ We fix up for that case. */
+
+#define syscall_error myerror
+SYSCALL__ (getgroups, 2)
+#undef syscall_error
+ ret
+myerror:
+ tstl 4(%esp) /* Was the first arg 0? */
+ jnz syscall_error /* If not, go to the normal error case. */
+ /* When called with (0, 0), we want to return the number of groups
+ without storing anything. The Dynix system call gives an error
+ for this case, so we fix up by calling it with a local array we
+ never use, and just use the return value. */
+ subl %esp, $(NGROUPS_MAX * 4) /* Allocate a local array. */
+ movl $NGROUPS_MAX, %ecx /* Pass NGROUPS_MAX for first arg. */
+ movl %esp, %edx /* Pass local array for second arg. */
+ DO_CALL (getgroups, 2) /* Do the system call. */
+ addl %esp, $(NGROUPS_MAX * 4) /* Pop the local array. */
+ jb syscall_error /* Check for error from the system call. */
+ ret /* Return its value. */
+
+weak_alias (__getgroups, getgroups)
diff --git a/ports/sysdeps/unix/bsd/sequent/i386/sigvec.S b/ports/sysdeps/unix/bsd/sequent/i386/sigvec.S
new file mode 100644
index 000000000..62373e131
--- /dev/null
+++ b/ports/sysdeps/unix/bsd/sequent/i386/sigvec.S
@@ -0,0 +1,45 @@
+/* Copyright (C) 1993, 1995, 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <sysdep.h>
+
+/* The Dynix `sigvec' system call takes an extra argument,
+ which is the address of the trampoline function. */
+
+.text
+.align 4
+trampoline:
+ cld /* Clear direction flag. */
+ call %eax /* Call the handler, address in %eax. */
+ addl $8, %esp /* Pop signum & code off the stack. */
+ /* __sigreturn will restore the context, and never return here. */
+ call C_SYMBOL_NAME (__sigreturn)
+
+.globl syscall_error
+ENTRY (__sigvec)
+ pushl $trampoline /* Push fourth arg: trampoline address. */
+ pushl 16(%esp) /* Push third arg: our third arg. */
+ pushl 16(%esp) /* Push second arg: our second arg. */
+ pushl 16(%esp) /* Push first arg: our first arg. */
+ mov %esp, %ecx /* Point the syscall at the arguments. */
+ addl $16, %esp /* Pop those four args. */
+ DO_CALL (sigvec, 4) /* Do the system call. */
+ jb syscall_error /* Check for error. */
+ ret
+
+weak_alias (__sigvec, sigvec)
diff --git a/ports/sysdeps/unix/bsd/sequent/i386/syscall.S b/ports/sysdeps/unix/bsd/sequent/i386/syscall.S
new file mode 100644
index 000000000..9ff189885
--- /dev/null
+++ b/ports/sysdeps/unix/bsd/sequent/i386/syscall.S
@@ -0,0 +1,31 @@
+/* `syscall' function for Sequent Symmetry running Dynix version 3.
+ Copyright (C) 1994, 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <sysdep.h>
+
+.text
+.globl syscall_error
+.align 4
+ENTRY (syscall)
+ leal 8(%esp), %ecx /* Load address of second argument. */
+ movl $SYS_HANDLER, %eax /* Use BSD system calls. */
+ movw 4(%esp), %ax /* Load system call number into low word. */
+ int $T_SVC6 /* Pretend it takes six args. */
+ jb syscall_error
+ ret
diff --git a/ports/sysdeps/unix/bsd/sequent/i386/sysdep.h b/ports/sysdeps/unix/bsd/sequent/i386/sysdep.h
new file mode 100644
index 000000000..c3d9d919b
--- /dev/null
+++ b/ports/sysdeps/unix/bsd/sequent/i386/sysdep.h
@@ -0,0 +1,82 @@
+/* System call interface code for Sequent Symmetry running Dynix version 3.
+ Copyright (C) 1993, 1995, 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <sysdeps/unix/i386/sysdep.h>
+
+#ifdef __ASSEMBLER__
+
+/* Get the symbols for system call interrupts. */
+#include <machine/trap.h>
+
+/* Use the BSD versions of system calls, by setting the high 16 bits
+ of the syscall number (see /usr/include/syscall.h). */
+#define SYS_HANDLER (SYS_bsd << 16)
+
+/* Dynix uses an interrupt interface to system calls.
+ "int $T_SVCn" are syscall interfaces for 0-6 arg functions.
+ (see /usr/include/machine/trap.h). */
+
+#undef DO_CALL
+
+#ifdef __STDC__
+#define DO_CALL(syscall_name, args) \
+ movl $(SYS_HANDLER | SYS_##syscall_name), %eax; \
+ int $T_SVC##args;
+#else
+#define DO_CALL(syscall_name, args) \
+ movl $(SYS_HANDLER | SYS_/**/syscall_name), %eax; \
+ int $T_SVC/**/args;
+#endif
+
+#undef PSEUDO
+#define PSEUDO(name, syscall_name, args) \
+ .text; \
+ .globl syscall_error; \
+ .align 4; \
+ ENTRY (name) \
+ ARGS (args) \
+ DO_CALL (syscall_name, args) \
+ jb syscall_error
+
+/* For one and two-argument calls, Dynix takes the arguments in %ecx and
+ %edx. For 3-6 argument calls, Dynix takes the address of the first
+ argument in %ecx. */
+
+#ifdef __STDC__
+#define ARGS(n) ARGS_##n
+#else
+#define ARGS(n) ARGS_/**/n
+#endif
+
+#define ARGS_0
+#define ARGS_1 movl 4(%esp), %ecx;
+#define ARGS_2 movl 4(%esp), %ecx; movl 8(%esp), %edx;
+#define ARGS_3 leal 4(%esp), %ecx;
+#define ARGS_4 ARGS_3
+#define ARGS_5 ARGS_3
+#define ARGS_6 ARGS_3
+
+/* Dynix reverses %ecx and %edx relative to most i386 Unices. */
+
+#undef r1
+#define r1 %ecx /* Secondary return-value register. */
+#undef scratch
+#define scratch %edx /* Call-clobbered register for random use. */
+
+#endif /* __ASSEMBLER__ */
diff --git a/ports/sysdeps/unix/bsd/sony/newsos/m68k/Implies b/ports/sysdeps/unix/bsd/sony/newsos/m68k/Implies
new file mode 100644
index 000000000..7b5f3cfc9
--- /dev/null
+++ b/ports/sysdeps/unix/bsd/sony/newsos/m68k/Implies
@@ -0,0 +1,2 @@
+# A news800 is almost exactly like an hp300
+unix/bsd/hp/m68k
diff --git a/ports/sysdeps/unix/bsd/sony/newsos/m68k/sysdep.h b/ports/sysdeps/unix/bsd/sony/newsos/m68k/sysdep.h
new file mode 100644
index 000000000..db124fa15
--- /dev/null
+++ b/ports/sysdeps/unix/bsd/sony/newsos/m68k/sysdep.h
@@ -0,0 +1,56 @@
+/* Copyright (C) 1993, 1994, 1995, 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <sysdeps/unix/sysdep.h>
+
+#ifdef __ASSEMBLER__
+
+#define POUND #
+
+#ifdef __STDC__
+#define ENTRY(name) \
+ .globl _##name; \
+ .even; \
+ _##name##:
+#else
+#define ENTRY(name) \
+ .globl _/**/name; \
+ .even; \
+ _/**/name/**/:
+#endif
+
+#define PSEUDO(name, syscall_name, args) \
+ .even; \
+ .globl syscall_error; \
+ error: jmp syscall_error; \
+ ENTRY (name) \
+ DO_CALL (POUND SYS_ify (syscall_name), args)
+
+#define DO_CALL(syscall, args) \
+ movel syscall, d0; \
+ linkw a6, POUND(0); \
+ trap POUND(0); \
+ unlk a6; \
+ bcs error
+
+#define ret rts
+#define r0 d0
+#define r1 d1
+#define MOVE(x,y) movel x , y
+
+#endif
diff --git a/ports/sysdeps/unix/bsd/sony/newsos4/Makefile b/ports/sysdeps/unix/bsd/sony/newsos4/Makefile
new file mode 100644
index 000000000..053da568d
--- /dev/null
+++ b/ports/sysdeps/unix/bsd/sony/newsos4/Makefile
@@ -0,0 +1,3 @@
+ifeq ($(subdir),posix)
+sysdep_routines := $(sysdep_routines) sys_wait4
+endif
diff --git a/ports/sysdeps/unix/bsd/sony/newsos4/syscalls.list b/ports/sysdeps/unix/bsd/sony/newsos4/syscalls.list
new file mode 100644
index 000000000..b90087f42
--- /dev/null
+++ b/ports/sysdeps/unix/bsd/sony/newsos4/syscalls.list
@@ -0,0 +1,3 @@
+# File name Caller Syscall name # args Strong name Weak names
+
+sys_wait4 wait4 wait4 4 __wait4_syscall
diff --git a/ports/sysdeps/unix/bsd/sony/newsos4/wait.c b/ports/sysdeps/unix/bsd/sony/newsos4/wait.c
new file mode 100644
index 000000000..79d54580f
--- /dev/null
+++ b/ports/sysdeps/unix/bsd/sony/newsos4/wait.c
@@ -0,0 +1 @@
+#include <sysdeps/unix/bsd/bsd4.4/wait.c>
diff --git a/ports/sysdeps/unix/bsd/sony/newsos4/wait3.c b/ports/sysdeps/unix/bsd/sony/newsos4/wait3.c
new file mode 100644
index 000000000..0b3bdee77
--- /dev/null
+++ b/ports/sysdeps/unix/bsd/sony/newsos4/wait3.c
@@ -0,0 +1 @@
+#include <sysdeps/unix/bsd/bsd4.4/wait3.c>
diff --git a/ports/sysdeps/unix/bsd/sony/newsos4/wait4.c b/ports/sysdeps/unix/bsd/sony/newsos4/wait4.c
new file mode 100644
index 000000000..856c99fd6
--- /dev/null
+++ b/ports/sysdeps/unix/bsd/sony/newsos4/wait4.c
@@ -0,0 +1 @@
+#include <sysdeps/unix/bsd/sun/sunos4/wait4.c>
diff --git a/ports/sysdeps/unix/bsd/tahoe/Implies b/ports/sysdeps/unix/bsd/tahoe/Implies
new file mode 100644
index 000000000..a7ecf5827
--- /dev/null
+++ b/ports/sysdeps/unix/bsd/tahoe/Implies
@@ -0,0 +1 @@
+unix/bsd/vax
diff --git a/ports/sysdeps/unix/bsd/tahoe/sysdep.h b/ports/sysdeps/unix/bsd/tahoe/sysdep.h
new file mode 100644
index 000000000..b87590632
--- /dev/null
+++ b/ports/sysdeps/unix/bsd/tahoe/sysdep.h
@@ -0,0 +1,5 @@
+/* The Tahoe is just like the Vax, except the
+ `chmk' instruction is called `kcall'. */
+
+#define chmk kcall
+#include <sysdeps/unix/bsd/vax/sysdep.h>
diff --git a/ports/sysdeps/unix/bsd/ultrix4/Implies b/ports/sysdeps/unix/bsd/ultrix4/Implies
new file mode 100644
index 000000000..b0e08ef1d
--- /dev/null
+++ b/ports/sysdeps/unix/bsd/ultrix4/Implies
@@ -0,0 +1,2 @@
+# Ultrix 4 has the canonical set of <sys/mman.h> system calls.
+unix/mman
diff --git a/ports/sysdeps/unix/bsd/ultrix4/Makefile b/ports/sysdeps/unix/bsd/ultrix4/Makefile
new file mode 100644
index 000000000..26b90346e
--- /dev/null
+++ b/ports/sysdeps/unix/bsd/ultrix4/Makefile
@@ -0,0 +1,3 @@
+ifeq ($(subdir),posix)
+sysdep_routines := $(sysdep_routines) getsysinfo
+endif
diff --git a/ports/sysdeps/unix/bsd/ultrix4/bits/fcntl.h b/ports/sysdeps/unix/bsd/ultrix4/bits/fcntl.h
new file mode 100644
index 000000000..6392bc341
--- /dev/null
+++ b/ports/sysdeps/unix/bsd/ultrix4/bits/fcntl.h
@@ -0,0 +1,122 @@
+/* O_*, F_*, FD_* bit values for Ultrix 4.
+ Copyright (C) 1991, 1992, 1997, 2004 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#ifndef _FCNTL_H
+#error "Never use <bits/fcntl.h> directly; include <fcntl.h> instead."
+#endif
+
+
+/* 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 0x0200 /* Create file if it doesn't exist. */
+#define O_EXCL 0x0800 /* Fail if file already exists. */
+#define O_TRUNC 0x0400 /* Truncate file to zero length. */
+#ifdef __USE_MISC
+#define O_ASYNC 0x0040 /* Send SIGIO to owner when data is ready. */
+#define O_FSYNC 0x8000 /* Synchronous writes. */
+#define O_SYNC O_FSYNC
+#define O_BLKINUSE 0x1000 /* Block if "in use". */
+#define O_BLKANDSET 0x3000 /* Block, test and set "in use" flag. */
+#define O_TERMIO 0x40000 /* "termio style program". */
+#endif
+#define O_NOCTTY 0x80000 /* Don't assign a controlling terminal. */
+
+/* File status flags for `open' and `fcntl'. */
+#define O_APPEND 0x0008 /* Writes append to the file. */
+#define O_NONBLOCK 0x20000 /* Non-blocking I/O. */
+
+#ifdef __USE_BSD
+#define O_NDELAY 0x0004
+#endif
+
+#ifdef __USE_BSD
+/* Bits in the file status flags returned by F_GETFL.
+ These are all the O_* flags, plus FREAD and FWRITE, which are
+ independent bits set by which of O_RDONLY, O_WRONLY, and O_RDWR, was
+ given to `open'. */
+#define FREAD 1
+#define FWRITE 2
+
+/* Traditional BSD names the O_* bits. */
+#define FASYNC O_ASYNC
+#define FCREAT O_CREAT
+#define FEXCL O_EXCL
+#define FTRUNC O_TRUNC
+#define FNOCTTY O_NOCTTY
+#define FFSYNC O_FSYNC
+#define FSYNC O_SYNC
+#define FAPPEND O_APPEND
+#define FNONBLOCK O_NONBLOCK
+#define FNDELAY O_NDELAY
+#define FNBLOCK O_NONBLOCK
+#define FTERMIO O_TERMIO
+#define FNOCTTY O_NOCTTY
+#define FSYNCRON O_FSYNC
+#define FBLKINUSE O_BLKINUSE
+#define FBLKANDSET O_BLKANDSET
+#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. */
+#if defined __USE_BSD || defined __USE_UNIX98
+#define F_GETOWN 5 /* Get owner (receiver of SIGIO). */
+#define F_SETOWN 6 /* Set owner (receiver of SIGIO). */
+#endif
+#define F_GETLK 7 /* Get record locking info. */
+#define F_SETLK 8 /* Set record locking info (non-blocking). */
+#define F_SETLKW 9 /* Set record locking info (blocking). */
+#ifdef __USE_MISC
+#define F_SETSYN 10 /* Set synchronous writing. */
+#define F_CLRSYN 10 /* Clear synchronous writing. */
+#endif
+
+/* File descriptor flags used with F_GETFD and F_SETFD. */
+#define FD_CLOEXEC 1 /* Close on exec. */
+
+
+#include <bits/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. */
+ __pid_t 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. */
diff --git a/ports/sysdeps/unix/bsd/ultrix4/bits/mman.h b/ports/sysdeps/unix/bsd/ultrix4/bits/mman.h
new file mode 100644
index 000000000..918b53563
--- /dev/null
+++ b/ports/sysdeps/unix/bsd/ultrix4/bits/mman.h
@@ -0,0 +1,51 @@
+/* Definitions for BSD-style memory management. Ultrix 4 version.
+ Copyright (C) 1994, 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#ifndef _BITS_MMAN_H
+#define _BITS_MMAN_H 1
+
+/* Protections are chosen from these bits, OR'd together. The
+ implementation does not necessarily support PROT_EXEC or PROT_WRITE
+ without PROT_READ. The only guarantees are that no writing will be
+ allowed without PROT_WRITE and no access will be allowed for PROT_NONE. */
+
+#define PROT_NONE 0x00 /* No access. */
+#define PROT_READ 0x01 /* Pages can be read. */
+#define PROT_WRITE 0x02 /* Pages can be written. */
+#define PROT_EXEC 0x04 /* Pages can be executed. */
+/* 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. */
+#ifdef __USE_BSD
+# define MAP_TYPE 0x0f /* Mask for sharing type. */
+#endif
+
+/* Other flags. */
+#define MAP_FIXED 0x10 /* Map address must be exactly as requested. */
+
+/* Advice to `madvise'. */
+#ifdef __USE_BSD
+# define MADV_NORMAL 0 /* No further special treatment. */
+# define MADV_RANDOM 1 /* Expect random page references. */
+# define MADV_SEQUENTIAL 2 /* Expect sequential page references. */
+# define MADV_WILLNEED 3 /* Will need these pages. */
+# define MADV_DONTNEED 4 /* Don't need these pages. */
+#endif
+
+#endif /* bits/mman.h */
diff --git a/ports/sysdeps/unix/bsd/ultrix4/bits/posix_opt.h b/ports/sysdeps/unix/bsd/ultrix4/bits/posix_opt.h
new file mode 100644
index 000000000..aba6852e1
--- /dev/null
+++ b/ports/sysdeps/unix/bsd/ultrix4/bits/posix_opt.h
@@ -0,0 +1,24 @@
+/* Copyright (C) 1992, 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed 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 Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#define _POSIX_JOB_CONTROL 1
+#define _POSIX_SAVED_IDS 1
+#define _POSIX_CHOWN_RESTRICTED 1
+#define _POSIX_NO_TRUNC 1
+#define _POSIX_VDISABLE ((unsigned char) -1)
diff --git a/ports/sysdeps/unix/bsd/ultrix4/bits/utsname.h b/ports/sysdeps/unix/bsd/ultrix4/bits/utsname.h
new file mode 100644
index 000000000..57820471a
--- /dev/null
+++ b/ports/sysdeps/unix/bsd/ultrix4/bits/utsname.h
@@ -0,0 +1,23 @@
+/* Copyright (C) 1997, 2002 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#ifndef _SYS_UTSNAME_H
+# error "Never include <bits/utsname.h> directly; use <sys/utsname.h> instead."
+#endif
+
+#define _UTSNAME_LENGTH 32
diff --git a/ports/sysdeps/unix/bsd/ultrix4/mips/Dist b/ports/sysdeps/unix/bsd/ultrix4/mips/Dist
new file mode 100644
index 000000000..06cf9cc2d
--- /dev/null
+++ b/ports/sysdeps/unix/bsd/ultrix4/mips/Dist
@@ -0,0 +1 @@
+__handler.S
diff --git a/ports/sysdeps/unix/bsd/ultrix4/mips/Makefile b/ports/sysdeps/unix/bsd/ultrix4/mips/Makefile
new file mode 100644
index 000000000..74e3b04f6
--- /dev/null
+++ b/ports/sysdeps/unix/bsd/ultrix4/mips/Makefile
@@ -0,0 +1,3 @@
+ifeq ($(subdir),signal)
+sysdep_routines := $(sysdep_routines) __handler
+endif
diff --git a/ports/sysdeps/unix/bsd/ultrix4/mips/__handler.S b/ports/sysdeps/unix/bsd/ultrix4/mips/__handler.S
new file mode 100644
index 000000000..2b815c46d
--- /dev/null
+++ b/ports/sysdeps/unix/bsd/ultrix4/mips/__handler.S
@@ -0,0 +1,115 @@
+/* Copyright (C) 1992, 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Brendan Kehoe (brendan@zen.org).
+ 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 Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#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)
+ /* 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)
+
+ /* Move the stack up four. This will save the context. */
+ addu sp, sp, -32
+ 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. */
+ la v0, __sigreturn
+ jal ra, v0
+ .end __handler
diff --git a/ports/sysdeps/unix/bsd/ultrix4/mips/bits/sigcontext.h b/ports/sysdeps/unix/bsd/ultrix4/mips/bits/sigcontext.h
new file mode 100644
index 000000000..367465137
--- /dev/null
+++ b/ports/sysdeps/unix/bsd/ultrix4/mips/bits/sigcontext.h
@@ -0,0 +1,63 @@
+/* Copyright (C) 1992, 1994, 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#ifndef _SIGNAL_H
+# error "Never use <bits/sigcontext.h> directly; include <signal.h> instead."
+#endif
+
+/* Note that ANY change to this instantly implies a change to __handler.S. */
+
+struct sigcontext
+ {
+ /* Nonzero if running on signal stack. */
+ int sc_onstack;
+
+ /* Signal mask to restore. */
+ __sigset_t sc_mask;
+
+ /* Program counter when the signal hit. */
+ __ptr_t sc_pc;
+
+ /* Registers 0 through 31. */
+ int sc_regs[32];
+
+ /* mul/div low and hi; these aren't part of a jmp_buf, but are part of the
+ sigcontext and are referenced from the signal trampoline code. */
+ int sc_mdlo;
+ int sc_mdhi;
+
+ /* Flag to see if the FP's been used. */
+ int sc_ownedfp;
+
+ /* Floating point registers 0 to 31. */
+ int sc_fpregs[32];
+ /* Control & status register for FP. */
+ int sc_fpc_csr;
+
+ /* Exception instruction register for FP. */
+ int sc_fpc_eir;
+
+ /* The coprocessor's cause register. */
+ int sc_cause;
+
+ /* CPU bad virtual address. */
+ __ptr_t sc_badvaddr;
+
+ /* CPU board bad physical address. */
+ __ptr_t sc_badpaddr;
+ };
diff --git a/ports/sysdeps/unix/bsd/ultrix4/mips/sigvec.c b/ports/sysdeps/unix/bsd/ultrix4/mips/sigvec.c
new file mode 100644
index 000000000..5775c9adb
--- /dev/null
+++ b/ports/sysdeps/unix/bsd/ultrix4/mips/sigvec.c
@@ -0,0 +1,55 @@
+/* Copyright (C) 1992, 1996, 1997, 2004 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+/* 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 <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 *);
+
+extern int __raw_sigvec (int sig, CONST struct sigvec *vec,
+ struct sigvec *ovec,
+ void (*)(int sig, int code,
+ struct sigcontext *,
+ handler_type));
+
+extern void __handler (int sig, int code,
+ struct sigcontext *,
+ handler_type);
+
+int
+__sigvec (sig, vec, ovec)
+ int sig;
+ const struct sigvec *vec;
+ struct sigvec *ovec;
+{
+ return __raw_sigvec (sig, vec, ovec, __handler);
+}
diff --git a/ports/sysdeps/unix/bsd/ultrix4/mips/start.S b/ports/sysdeps/unix/bsd/ultrix4/mips/start.S
new file mode 100644
index 000000000..a88268af4
--- /dev/null
+++ b/ports/sysdeps/unix/bsd/ultrix4/mips/start.S
@@ -0,0 +1,87 @@
+/* Copyright (C) 1993, 1995, 1996, 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ 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 Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ In addition to the permissions in the GNU Lesser General Public
+ License, the Free Software Foundation gives you unlimited
+ permission to link the compiled version of this file with other
+ programs, and to distribute those programs without any restriction
+ coming from the use of this file. (The GNU Lesser General Public
+ License restrictions do apply in other respects; for example, they
+ cover modification of the file, and distribution when not linked
+ into another program.)
+
+ Note that people who make modified versions of this file are not
+ obligated to grant this special exception for their modified
+ versions; it is their choice whether to do so. The GNU Lesser
+ General Public License gives permission to release a modified
+ version without this exception; this exception also makes it
+ possible to release a modified version which carries forward this
+ exception.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <sysdep.h>
+
+ENTRY(__start)
+ .set noreorder
+
+ /* The first thing on the stack is argc. */
+ lw s0, 0(sp)
+ nop
+
+ /* Set up the global pointer. */
+ la gp, _gp
+
+ /* Then set up argv. */
+ addiu s1, sp, 4
+
+ /* To compute where envp is, first we have to jump ahead four
+ bytes from what argv was. This will bring us ahead, so we don't
+ need to compute the NULL at the end of argv later. */
+ addiu v1, s1, 4
+
+ /* Now, compute the space to skip given the number of arguments
+ we've got. We do this by multiplying argc by 4. */
+ sll v0, s0, 2
+
+ /* Now, add (argv+4) with the space to skip...that's envp. */
+ addu s2, v1, v0
+
+ /* __environ = envp; */
+ sw s2, __environ
+
+ addiu sp, sp, -24
+
+ /* __libc_init (argc, argv, envp); */
+ move a0, s0
+ move a1, s1
+ jal __libc_init
+ move a2, s2
+
+ /* errno = 0; */
+ sw zero, errno
+
+ /* exit (main (argc, argv, envp)); */
+ move a0, s0
+ move a1, s1
+ jal main
+ move a2, s2
+
+ /* Make the value returned by main be the argument to exit. */
+ jal exit
+ move a0, v0
+ .end __start
diff --git a/ports/sysdeps/unix/bsd/ultrix4/mips/syscalls.list b/ports/sysdeps/unix/bsd/ultrix4/mips/syscalls.list
new file mode 100644
index 000000000..f7d0bba6a
--- /dev/null
+++ b/ports/sysdeps/unix/bsd/ultrix4/mips/syscalls.list
@@ -0,0 +1,3 @@
+# File name Caller Syscall name # args Strong name Weak names
+
+raw-sigvec sigvec sigvec 4 __raw_sigvec
diff --git a/ports/sysdeps/unix/bsd/ultrix4/mips/sysdep.h b/ports/sysdeps/unix/bsd/ultrix4/mips/sysdep.h
new file mode 100644
index 000000000..09b69ff85
--- /dev/null
+++ b/ports/sysdeps/unix/bsd/ultrix4/mips/sysdep.h
@@ -0,0 +1,3 @@
+#define NO_UNDERSCORES
+
+#include <sysdeps/unix/mips/sysdep.h>
diff --git a/ports/sysdeps/unix/bsd/ultrix4/mips/vfork.S b/ports/sysdeps/unix/bsd/ultrix4/mips/vfork.S
new file mode 100644
index 000000000..d413e45dc
--- /dev/null
+++ b/ports/sysdeps/unix/bsd/ultrix4/mips/vfork.S
@@ -0,0 +1,36 @@
+/* Copyright (C) 1992, 1995, 1997, 2002 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ 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 Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <sysdep.h>
+
+#ifndef SYS_vfork
+#define SYS_vfork 66
+#endif
+
+SYSCALL__ (vfork, 0)
+ beq v1, zero, parent /* Branch if parent. */
+ nop
+ move v0, zero
+parent:
+ ret
+ nop
+ .end __vfork
+libc_hidden_def (__vfork)
+
+weak_alias (__vfork, vfork)
diff --git a/ports/sysdeps/unix/bsd/ultrix4/syscalls.list b/ports/sysdeps/unix/bsd/ultrix4/syscalls.list
new file mode 100644
index 000000000..68df0a766
--- /dev/null
+++ b/ports/sysdeps/unix/bsd/ultrix4/syscalls.list
@@ -0,0 +1,3 @@
+# File name Caller Syscall name # args Strong name Weak names
+
+getsysinfo sysconf getsysinfo 5 __getsysinfo
diff --git a/ports/sysdeps/unix/bsd/ultrix4/sysconf.c b/ports/sysdeps/unix/bsd/ultrix4/sysconf.c
new file mode 100644
index 000000000..0982fc832
--- /dev/null
+++ b/ports/sysdeps/unix/bsd/ultrix4/sysconf.c
@@ -0,0 +1,61 @@
+/* Copyright (C) 1992, 1995, 1996, 1997, 2004 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed 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 Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+/* On Ultrix we can use the getsysinfo call to get the right return
+ value for _SC_CHILD_MAX. Everything else is from <sys/param.h>,
+ which the default sysconf already knows how to handle. */
+
+#include <unistd.h>
+#include <errno.h>
+
+/* This is an Ultrix header file. */
+#include <sys/sysinfo.h>
+
+extern int __getsysinfo (unsigned int op, void *buffer,
+ size_t nbytes, int *start, void *arg);
+extern long int __default_sysconf (int name);
+
+long int
+__sysconf (name)
+ int name;
+{
+ if (name == _SC_CHILD_MAX)
+ {
+ int save = errno;
+ int start = 0;
+ int ret;
+
+ /* getsysinfo returns the number of values it put into the
+ buffer, or 0 if not available, or -1 on error. */
+ if (__getsysinfo (GSI_MAX_UPROCS, &ret, sizeof (ret), &start,
+ (void *) 0) > 0)
+ {
+ __set_errno (save);
+ return ret;
+ }
+
+ __set_errno (save);
+ }
+
+ return __default_sysconf (name);
+}
+
+#define __sysconf __default_sysconf
+
+#include <sysdeps/posix/sysconf.c>
diff --git a/ports/sysdeps/unix/bsd/ultrix4/system.c b/ports/sysdeps/unix/bsd/ultrix4/system.c
new file mode 100644
index 000000000..b133fe77c
--- /dev/null
+++ b/ports/sysdeps/unix/bsd/ultrix4/system.c
@@ -0,0 +1,2 @@
+/* Ultrix 4 does have `waitpid'. Avoid unix/system.c, which says we don't. */
+#include <sysdeps/posix/system.c>
diff --git a/ports/sysdeps/unix/bsd/ultrix4/wait3.S b/ports/sysdeps/unix/bsd/ultrix4/wait3.S
new file mode 100644
index 000000000..b20ecfa24
--- /dev/null
+++ b/ports/sysdeps/unix/bsd/ultrix4/wait3.S
@@ -0,0 +1,26 @@
+/* Copyright (C) 1992, 1995, 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ 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 Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <sysdep.h>
+
+SYSCALL__ (wait3, 3)
+ ret
+ .end __wait3
+
+weak_alias (__wait3, wait3)
diff --git a/ports/sysdeps/unix/bsd/vax/brk.S b/ports/sysdeps/unix/bsd/vax/brk.S
new file mode 100644
index 000000000..52377bc43
--- /dev/null
+++ b/ports/sysdeps/unix/bsd/vax/brk.S
@@ -0,0 +1,47 @@
+/* Copyright (C) 1991, 1995, 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <sysdep.h>
+
+#ifndef SYS_brk
+#define SYS_brk 17
+#endif
+
+#ifndef HAVE_GNU_LD
+#define __end _end
+#endif
+
+.data
+.globl ___curbrk
+___curbrk:
+ .long __end
+
+.text
+ENTRY (__brk)
+ cmpl 4(ap), __end
+ bgeq 0f
+ movl __env, 4(ap)
+0: chmk $SYS_brk
+ bcs 1f
+ movl 4(ap), ___curbrk
+ clrl r0
+ ret
+1:
+ jmp syscall_error
+
+weak_alias (__brk, brk)
diff --git a/ports/sysdeps/unix/bsd/vax/dl-brk.S b/ports/sysdeps/unix/bsd/vax/dl-brk.S
new file mode 100644
index 000000000..eeb96544e
--- /dev/null
+++ b/ports/sysdeps/unix/bsd/vax/dl-brk.S
@@ -0,0 +1 @@
+#include <brk.S>
diff --git a/ports/sysdeps/unix/bsd/vax/pipe.S b/ports/sysdeps/unix/bsd/vax/pipe.S
new file mode 100644
index 000000000..3ed784264
--- /dev/null
+++ b/ports/sysdeps/unix/bsd/vax/pipe.S
@@ -0,0 +1,29 @@
+/* Copyright (C) 1991, 1992, 1995, 1997, 2002 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <sysdep.h>
+
+SYSCALL__ (pipe, 1)
+ movl 4(ap), r2
+ movl r0, (r2)+
+ movl r1, (r2)
+ clrl r0
+ ret
+
+libc_hidden_def (__pipe)
+weak_alias (__pipe, pipe)
diff --git a/ports/sysdeps/unix/bsd/vax/sysdep.S b/ports/sysdeps/unix/bsd/vax/sysdep.S
new file mode 100644
index 000000000..786aed2d1
--- /dev/null
+++ b/ports/sysdeps/unix/bsd/vax/sysdep.S
@@ -0,0 +1,35 @@
+/* Copyright (C) 1991, 1992, 1993, 1994, 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#define _ERRNO_H
+#include <bits/errno.h>
+
+.globl _errno
+.globl syscall_error
+syscall_error:
+#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 r0, $EWOULDBLOCK_sys
+ bne 0f
+ movl $EAGAIN, r0
+#endif
+0: movl r0, _errno
+ mnegl $1, r0
+ ret
diff --git a/ports/sysdeps/unix/bsd/vax/sysdep.h b/ports/sysdeps/unix/bsd/vax/sysdep.h
new file mode 100644
index 000000000..563ad26c1
--- /dev/null
+++ b/ports/sysdeps/unix/bsd/vax/sysdep.h
@@ -0,0 +1,55 @@
+/* Copyright (C) 1991, 1992, 1995, 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <sysdeps/unix/sysdep.h>
+
+#ifdef __ASSEMBLER__
+
+#ifdef __STDC__
+#define ENTRY(name) \
+ .globl _##name; \
+ .even; \
+ _##name##:
+#else
+#define ENTRY(name) \
+ .globl _/**/name; \
+ .even; \
+ _/**/name/**/:
+#endif
+
+#ifdef __STDC__
+#define PSEUDO(name, syscall_name, args) \
+ .even; \
+ .globl syscall_error \
+ error: jmp syscall_error; \
+ ENTRY (name) \
+ chmk $SYS_##syscall_name \
+ bcs error
+#else
+#define PSEUDO(name, syscall_name, args) \
+ .even; \
+ .globl syscall_error \
+ error: jmp syscall_error; \
+ ENTRY (name) \
+ chmk $SYS_/**/syscall_name \
+ bcs error
+#endif
+
+#define MOVE(x,y) movl x , y
+
+#endif /* __ASSEMBLER__ */
diff --git a/ports/sysdeps/unix/bsd/vax/vfork.S b/ports/sysdeps/unix/bsd/vax/vfork.S
new file mode 100644
index 000000000..6c7e754ac
--- /dev/null
+++ b/ports/sysdeps/unix/bsd/vax/vfork.S
@@ -0,0 +1,57 @@
+/* Copyright (C) 1991, 1992, 1995, 1997, 2002 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <sysdep.h>
+
+#ifndef SYS_vfork
+#define SYS_vfork 66
+#endif
+
+/* Clone the calling process, but without copying the whole address space.
+ The calling process is suspended until the new process exits or is
+ replaced by a call to `execve'. Return -1 for errors, 0 to the new process,
+ and the process ID of the new process to the old process. */
+.globl ___vfork
+___vfork:
+ .word 0
+ /* Save our return address in R2, and return to code below. */
+ movl 16(fp), r2
+ movab unwind, 16(fp)
+ ret
+unwind:
+ /* Do the system call. */
+ chmk $SYS_vfork
+ bcs error
+
+ tstl r1
+ beq parent
+
+ /* We are the child. Return zero. */
+ clrl r0
+
+ /* Return to the saved address. */
+parent: jmp (r2)
+
+.globl _errno
+error:
+ movl r0, _errno
+ mnegl $1, r0
+ jmp (r2)
+libc_hidden_def (__vfork)
+
+weak_alias (__vfork, vfork)
diff --git a/ports/sysdeps/unix/bsd/vax/wait.S b/ports/sysdeps/unix/bsd/vax/wait.S
new file mode 100644
index 000000000..19396f06e
--- /dev/null
+++ b/ports/sysdeps/unix/bsd/vax/wait.S
@@ -0,0 +1,27 @@
+/* Copyright (C) 1991, 1992, 1995, 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <sysdep.h>
+
+SYSCALL__ (wait, 1)
+ movl 4(ap), r2
+ beq 1f
+ movl r1, (r2)
+1: ret
+
+weak_alias (__wait, wait)
diff --git a/ports/sysdeps/unix/bsd/vax/wait3.S b/ports/sysdeps/unix/bsd/vax/wait3.S
new file mode 100644
index 000000000..e0ceec1de
--- /dev/null
+++ b/ports/sysdeps/unix/bsd/vax/wait3.S
@@ -0,0 +1,37 @@
+/* Copyright (C) 1991, 1992, 1995, 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <sysdep.h>
+
+ENTRY(___wait3)
+ movel 8(ap), r1
+ movel 12(ap), r0
+ /* Set all condition codes to tell the kernel this is wait3. */
+ bispsw $15
+ chmk $SYS_wait
+ bcs error
+
+ movl 4(ap), r2
+ beq 1f
+ movl r1, (r2)
+1: ret
+
+.globl syscall_error
+error: jmp syscall_error
+
+weak_alias (__wait3, wait3)