summaryrefslogtreecommitdiff
path: root/include/mach/sa
diff options
context:
space:
mode:
authorThomas Bushnell <thomas@gnu.org>1997-02-25 21:28:37 +0000
committerThomas Bushnell <thomas@gnu.org>1997-02-25 21:28:37 +0000
commitf07a4c844da9f0ecae5bbee1ab94be56505f26f7 (patch)
tree12b07c7e578fc1a5f53dbfde2632408491ff2a70 /include/mach/sa
Initial source
Diffstat (limited to 'include/mach/sa')
-rw-r--r--include/mach/sa/a.out.h28
-rw-r--r--include/mach/sa/alloca.h25
-rw-r--r--include/mach/sa/assert.h44
-rw-r--r--include/mach/sa/ctype.h59
-rw-r--r--include/mach/sa/errno.h98
-rw-r--r--include/mach/sa/fcntl.h22
-rw-r--r--include/mach/sa/limits.h32
-rw-r--r--include/mach/sa/malloc.h51
-rw-r--r--include/mach/sa/memory.h25
-rw-r--r--include/mach/sa/stddef.h24
-rw-r--r--include/mach/sa/stdio.h72
-rw-r--r--include/mach/sa/stdlib.h56
-rw-r--r--include/mach/sa/string.h56
-rw-r--r--include/mach/sa/strings.h28
-rw-r--r--include/mach/sa/sys/cdefs.h48
-rw-r--r--include/mach/sa/sys/ioctl.h52
-rw-r--r--include/mach/sa/sys/mman.h41
-rw-r--r--include/mach/sa/sys/reboot.h123
-rw-r--r--include/mach/sa/sys/signal.h206
-rw-r--r--include/mach/sa/sys/stat.h126
-rw-r--r--include/mach/sa/sys/termios.h207
-rw-r--r--include/mach/sa/sys/time.h53
-rw-r--r--include/mach/sa/sys/types.h91
-rw-r--r--include/mach/sa/time.h26
-rw-r--r--include/mach/sa/unistd.h18
25 files changed, 1611 insertions, 0 deletions
diff --git a/include/mach/sa/a.out.h b/include/mach/sa/a.out.h
new file mode 100644
index 0000000..8ab8ba8
--- /dev/null
+++ b/include/mach/sa/a.out.h
@@ -0,0 +1,28 @@
+/*
+ * Copyright (c) 1994 The University of Utah and
+ * the Computer Systems Laboratory at the University of Utah (CSL).
+ * All rights reserved.
+ *
+ * Permission to use, copy, modify and distribute this software is hereby
+ * granted provided that (1) source code retains these copyright, permission,
+ * and disclaimer notices, and (2) redistributions including binaries
+ * reproduce the notices in supporting documentation, and (3) all advertising
+ * materials mentioning features or use of this software display the following
+ * acknowledgement: ``This product includes software developed by the
+ * Computer Systems Laboratory at the University of Utah.''
+ *
+ * THE UNIVERSITY OF UTAH AND CSL ALLOW FREE USE OF THIS SOFTWARE IN ITS "AS
+ * IS" CONDITION. THE UNIVERSITY OF UTAH AND CSL DISCLAIM ANY LIABILITY OF
+ * ANY KIND FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
+ *
+ * CSL requests users of this software to return to csl-dist@cs.utah.edu any
+ * improvements that they make and grant CSL redistribution rights.
+ *
+ * Author: Bryan Ford, University of Utah CSL
+ */
+#ifndef _MACH_SA_A_OUT_H_
+#define _MACH_SA_A_OUT_H_
+
+#include <mach/exec/a.out.h>
+
+#endif _MACH_SA_A_OUT_H_
diff --git a/include/mach/sa/alloca.h b/include/mach/sa/alloca.h
new file mode 100644
index 0000000..0a476b4
--- /dev/null
+++ b/include/mach/sa/alloca.h
@@ -0,0 +1,25 @@
+/*
+ * Copyright (c) 1994 The University of Utah and
+ * the Computer Systems Laboratory (CSL). All rights reserved.
+ *
+ * Permission to use, copy, modify and distribute this software and its
+ * documentation is hereby granted, provided that both the copyright
+ * notice and this permission notice appear in all copies of the
+ * software, derivative works or modified versions, and any portions
+ * thereof, and that both notices appear in supporting documentation.
+ *
+ * THE UNIVERSITY OF UTAH AND CSL ALLOW FREE USE OF THIS SOFTWARE IN ITS "AS
+ * IS" CONDITION. THE UNIVERSITY OF UTAH AND CSL DISCLAIM ANY LIABILITY OF
+ * ANY KIND FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
+ *
+ * CSL requests users of this software to return to csl-dist@cs.utah.edu any
+ * improvements that they make and grant CSL redistribution rights.
+ *
+ * Author: Bryan Ford, University of Utah CSL
+ */
+#ifndef _MACH_ALLOCA_H_
+#define _MACH_ALLOCA_H_
+
+#define alloca(size) __builtin_alloca(size)
+
+#endif _MACH_ALLOCA_H_
diff --git a/include/mach/sa/assert.h b/include/mach/sa/assert.h
new file mode 100644
index 0000000..8c12f1c
--- /dev/null
+++ b/include/mach/sa/assert.h
@@ -0,0 +1,44 @@
+/*
+ * Copyright (c) 1995 The University of Utah and
+ * the Computer Systems Laboratory at the University of Utah (CSL).
+ * All rights reserved.
+ *
+ * Permission to use, copy, modify and distribute this software is hereby
+ * granted provided that (1) source code retains these copyright, permission,
+ * and disclaimer notices, and (2) redistributions including binaries
+ * reproduce the notices in supporting documentation, and (3) all advertising
+ * materials mentioning features or use of this software display the following
+ * acknowledgement: ``This product includes software developed by the
+ * Computer Systems Laboratory at the University of Utah.''
+ *
+ * THE UNIVERSITY OF UTAH AND CSL ALLOW FREE USE OF THIS SOFTWARE IN ITS "AS
+ * IS" CONDITION. THE UNIVERSITY OF UTAH AND CSL DISCLAIM ANY LIABILITY OF
+ * ANY KIND FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
+ *
+ * CSL requests users of this software to return to csl-dist@cs.utah.edu any
+ * improvements that they make and grant CSL redistribution rights.
+ *
+ * Author: Bryan Ford, University of Utah CSL
+ */
+#ifndef _ASSERT_H_
+#define _ASSERT_H_
+
+#ifdef NDEBUG
+
+#define assert(ignore) ((void)0)
+
+#else
+
+#include <sys/cdefs.h>
+
+__BEGIN_DECLS
+extern void panic(const char *format, ...);
+__END_DECLS
+
+#define assert(expression) \
+ ((void)((expression) ? 0 : (panic("%s:%u: failed assertion `%s'", \
+ __FILE__, __LINE__, #expression), 0)))
+
+#endif
+
+#endif /* _ASSERT_H_ */
diff --git a/include/mach/sa/ctype.h b/include/mach/sa/ctype.h
new file mode 100644
index 0000000..40b5366
--- /dev/null
+++ b/include/mach/sa/ctype.h
@@ -0,0 +1,59 @@
+/*
+ * Copyright (c) 1994 The University of Utah and
+ * the Computer Systems Laboratory (CSL). All rights reserved.
+ *
+ * Permission to use, copy, modify and distribute this software and its
+ * documentation is hereby granted, provided that both the copyright
+ * notice and this permission notice appear in all copies of the
+ * software, derivative works or modified versions, and any portions
+ * thereof, and that both notices appear in supporting documentation.
+ *
+ * THE UNIVERSITY OF UTAH AND CSL ALLOW FREE USE OF THIS SOFTWARE IN ITS "AS
+ * IS" CONDITION. THE UNIVERSITY OF UTAH AND CSL DISCLAIM ANY LIABILITY OF
+ * ANY KIND FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
+ *
+ * CSL requests users of this software to return to csl-dist@cs.utah.edu any
+ * improvements that they make and grant CSL redistribution rights.
+ *
+ * Author: Bryan Ford, University of Utah CSL
+ */
+#ifndef _MACH_CTYPE_H_
+#define _MACH_CTYPE_H_
+
+#include <sys/cdefs.h>
+
+__INLINE_FUNC int isdigit(char c)
+{
+ return ((c) >= '0') && ((c) <= '9');
+}
+
+__INLINE_FUNC int isspace(char c)
+{
+ return ((c) == ' ') || ((c) == '\f')
+ || ((c) == '\n') || ((c) == '\r')
+ || ((c) == '\t') || ((c) == '\v');
+}
+
+__INLINE_FUNC int isalpha(char c)
+{
+ return (((c) >= 'a') && ((c) <= 'z'))
+ || (((c) >= 'A') && ((c) <= 'Z'));
+}
+
+__INLINE_FUNC int isalnum(char c)
+{
+ return isalpha(c) || isdigit(c);
+}
+
+__INLINE_FUNC int toupper(char c)
+{
+ return ((c >= 'a') && (c <= 'z')) ? (c - 'a' + 'A') : c;
+}
+
+__INLINE_FUNC int tolower(char c)
+{
+ return ((c >= 'A') && (c <= 'Z')) ? (c - 'A' + 'a') : c;
+}
+
+
+#endif _MACH_CTYPE_H_
diff --git a/include/mach/sa/errno.h b/include/mach/sa/errno.h
new file mode 100644
index 0000000..1e8be23
--- /dev/null
+++ b/include/mach/sa/errno.h
@@ -0,0 +1,98 @@
+/*
+ * Copyright (c) 1995 The University of Utah and
+ * the Computer Systems Laboratory at the University of Utah (CSL).
+ * All rights reserved.
+ *
+ * Permission to use, copy, modify and distribute this software is hereby
+ * granted provided that (1) source code retains these copyright, permission,
+ * and disclaimer notices, and (2) redistributions including binaries
+ * reproduce the notices in supporting documentation, and (3) all advertising
+ * materials mentioning features or use of this software display the following
+ * acknowledgement: ``This product includes software developed by the
+ * Computer Systems Laboratory at the University of Utah.''
+ *
+ * THE UNIVERSITY OF UTAH AND CSL ALLOW FREE USE OF THIS SOFTWARE IN ITS "AS
+ * IS" CONDITION. THE UNIVERSITY OF UTAH AND CSL DISCLAIM ANY LIABILITY OF
+ * ANY KIND FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
+ *
+ * CSL requests users of this software to return to csl-dist@cs.utah.edu any
+ * improvements that they make and grant CSL redistribution rights.
+ *
+ * Author: Bryan Ford, University of Utah CSL
+ */
+/*
+ * This header file defines a set of POSIX errno values
+ * that fits consistently into the Mach error code "space" -
+ * i.e. these error code values can be mixed with kern_return_t's
+ * and mach_msg_return_t's and such without conflict.
+ * Higher-level services are not required to use these values
+ * (or, for that matter, any of the mach/sa header files),
+ * but if they use other values of their own choosing,
+ * those values may conflict with values in the Mach error code space,
+ * making it necessary to keep the different types of error codes separate.
+ *
+ * (For example, Lites uses BSD's errno values,
+ * which conflict with Mach's kern_return_t values,
+ * and therefore must carefully distinguish between BSD and Mach error codes
+ * and never return one type when the other is expected, etc. -
+ * we've found this to be a frequent source of bugs.)
+ *
+ * One (probably the main) disadvantage of using these error codes
+ * is that, since they don't start from around 0 like typical Unix errno values,
+ * it's impossible to provide a conventional Unix-style sys_errlist table for them.
+ * However, they are compatible with the POSIX-blessed strerror and perror routines.
+ */
+#ifndef _MACH_SA_ERRNO_H_
+#define _MACH_SA_ERRNO_H_
+
+extern int errno; /* global error number */
+
+/* ISO/ANSI C-1990 errors */
+#define EDOM 0xc001 /* Numerical argument out of domain */
+#define ERANGE 0xc002 /* Result too large */
+
+/* POSIX-1990 errors */
+#define E2BIG 0xc003 /* Argument list too long */
+#define EACCES 0xc004 /* Permission denied */
+#define EAGAIN 0xc005 /* Resource temporarily unavailable */
+#define EBADF 0xc006 /* Bad file descriptor */
+#define EBUSY 0xc007 /* Device busy */
+#define ECHILD 0xc008 /* No child processes */
+#define EDEADLK 0xc009 /* Resource deadlock avoided */
+#define EEXIST 0xc00a /* File exists */
+#define EFAULT 0xc00b /* Bad address */
+#define EFBIG 0xc00c /* File too large */
+#define EINTR 0xc00d /* Interrupted system call */
+#define EINVAL 0xc00e /* Invalid argument */
+#define EIO 0xc00f /* Input/output error */
+#define EISDIR 0xc010 /* Is a directory */
+#define EMFILE 0xc011 /* Too many open files */
+#define EMLINK 0xc012 /* Too many links */
+#define ENAMETOOLONG 0xc013 /* File name too long */
+#define ENFILE 0xc014 /* Too many open files in system */
+#define ENODEV 0xc015 /* Operation not supported by device */
+#define ENOENT 0xc016 /* No such file or directory */
+#define ENOEXEC 0xc017 /* Exec format error */
+#define ENOLCK 0xc018 /* No locks available */
+#define ENOMEM 0xc019 /* Cannot allocate memory */
+#define ENOSPC 0xc01a /* No space left on device */
+#define ENOSYS 0xc01b /* Function not implemented */
+#define ENOTDIR 0xc01c /* Not a directory */
+#define ENOTEMPTY 0xc01d /* Directory not empty */
+#define ENOTTY 0xc01e /* Inappropriate ioctl for device */
+#define ENXIO 0xc01f /* Device not configured */
+#define EPERM 0xc020 /* Operation not permitted */
+#define EPIPE 0xc021 /* Broken pipe */
+#define EROFS 0xc022 /* Read-only file system */
+#define ESPIPE 0xc023 /* Illegal seek */
+#define ESRCH 0xc024 /* No such process */
+#define EXDEV 0xc025 /* Cross-device link */
+
+/* POSIX-1993 errors */
+#define EBADMSG 0xc026
+#define ECANCELED 0xc027
+#define EINPROGRESS 0xc028
+#define EMSGSIZE 0xc029
+#define ENOTSUP 0xc02a
+
+#endif _MACH_SA_ERRNO_H_
diff --git a/include/mach/sa/fcntl.h b/include/mach/sa/fcntl.h
new file mode 100644
index 0000000..ac86fe3
--- /dev/null
+++ b/include/mach/sa/fcntl.h
@@ -0,0 +1,22 @@
+#ifndef _MACH_SA_FCNTL_H_
+#define _MACH_SA_FCNTL_H_
+
+#include <sys/cdefs.h>
+
+#define O_ACCMODE 0x0003
+#define O_RDONLY 0x0000
+#define O_WRONLY 0x0001
+#define O_RDWR 0x0002
+
+#define O_CREAT 0x0010
+#define O_TRUNC 0x0020
+#define O_APPEND 0x0040
+#define O_EXCL 0x0080
+
+__BEGIN_DECLS
+
+int open(const char *__name, int __mode, ...);
+
+__END_DECLS
+
+#endif /* _MACH_SA_FCNTL_H_ */
diff --git a/include/mach/sa/limits.h b/include/mach/sa/limits.h
new file mode 100644
index 0000000..f8dd03a
--- /dev/null
+++ b/include/mach/sa/limits.h
@@ -0,0 +1,32 @@
+/*
+ * Copyright (c) 1994 The University of Utah and
+ * the Computer Systems Laboratory (CSL). All rights reserved.
+ *
+ * Permission to use, copy, modify and distribute this software and its
+ * documentation is hereby granted, provided that both the copyright
+ * notice and this permission notice appear in all copies of the
+ * software, derivative works or modified versions, and any portions
+ * thereof, and that both notices appear in supporting documentation.
+ *
+ * THE UNIVERSITY OF UTAH AND CSL ALLOW FREE USE OF THIS SOFTWARE IN ITS "AS
+ * IS" CONDITION. THE UNIVERSITY OF UTAH AND CSL DISCLAIM ANY LIABILITY OF
+ * ANY KIND FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
+ *
+ * CSL requests users of this software to return to csl-dist@cs.utah.edu any
+ * improvements that they make and grant CSL redistribution rights.
+ *
+ * Author: Bryan Ford, University of Utah CSL
+ */
+#ifndef _MACH_LIMITS_H_
+#define _MACH_LIMITS_H_
+
+/* This file is valid for typical 32-bit machines;
+ it should be overridden on 64-bit machines. */
+
+#define INT_MIN ((signed int)0x80000000)
+#define INT_MAX ((signed int)0x7fffffff)
+
+#define UINT_MIN ((unsigned int)0x00000000)
+#define UINT_MAX ((unsigned int)0xffffffff)
+
+#endif _MACH_LIMITS_H_
diff --git a/include/mach/sa/malloc.h b/include/mach/sa/malloc.h
new file mode 100644
index 0000000..3669046
--- /dev/null
+++ b/include/mach/sa/malloc.h
@@ -0,0 +1,51 @@
+/*
+ * Copyright (c) 1994 The University of Utah and
+ * the Computer Systems Laboratory (CSL). All rights reserved.
+ *
+ * Permission to use, copy, modify and distribute this software and its
+ * documentation is hereby granted, provided that both the copyright
+ * notice and this permission notice appear in all copies of the
+ * software, derivative works or modified versions, and any portions
+ * thereof, and that both notices appear in supporting documentation.
+ *
+ * THE UNIVERSITY OF UTAH AND CSL ALLOW FREE USE OF THIS SOFTWARE IN ITS "AS
+ * IS" CONDITION. THE UNIVERSITY OF UTAH AND CSL DISCLAIM ANY LIABILITY OF
+ * ANY KIND FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
+ *
+ * CSL requests users of this software to return to csl-dist@cs.utah.edu any
+ * improvements that they make and grant CSL redistribution rights.
+ *
+ * Author: Bryan Ford, University of Utah CSL
+ */
+#ifndef _MACH_SA_MALLOC_H_
+#define _MACH_SA_MALLOC_H_
+
+#include <mach/machine/vm_types.h>
+#include <sys/cdefs.h>
+
+#ifndef _SIZE_T
+#define _SIZE_T
+typedef natural_t size_t;
+#endif
+
+/* The malloc package in the base C library
+ is implemented on top of the List Memory Manager,
+ and the underlying memory pool can be manipulated
+ directly with the LMM primitives using this lmm structure. */
+extern struct lmm malloc_lmm;
+
+__BEGIN_DECLS
+
+void *malloc(size_t size);
+void *calloc(size_t nelt, size_t eltsize);
+void *realloc(void *buf, size_t new_size);
+void free(void *buf);
+
+/* malloc() and realloc() call this routine when they're about to fail;
+ it should try to scare up more memory and add it to the malloc_lmm.
+ Returns nonzero if it succeeds in finding more memory. */
+int morecore(size_t size);
+
+__END_DECLS
+
+#endif _MACH_SA_MALLOC_H_
diff --git a/include/mach/sa/memory.h b/include/mach/sa/memory.h
new file mode 100644
index 0000000..e2060ea
--- /dev/null
+++ b/include/mach/sa/memory.h
@@ -0,0 +1,25 @@
+/*
+ * Copyright (c) 1994 The University of Utah and
+ * the Computer Systems Laboratory (CSL). All rights reserved.
+ *
+ * Permission to use, copy, modify and distribute this software and its
+ * documentation is hereby granted, provided that both the copyright
+ * notice and this permission notice appear in all copies of the
+ * software, derivative works or modified versions, and any portions
+ * thereof, and that both notices appear in supporting documentation.
+ *
+ * THE UNIVERSITY OF UTAH AND CSL ALLOW FREE USE OF THIS SOFTWARE IN ITS "AS
+ * IS" CONDITION. THE UNIVERSITY OF UTAH AND CSL DISCLAIM ANY LIABILITY OF
+ * ANY KIND FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
+ *
+ * CSL requests users of this software to return to csl-dist@cs.utah.edu any
+ * improvements that they make and grant CSL redistribution rights.
+ *
+ * Author: Bryan Ford, University of Utah CSL
+ */
+#ifndef _MACH_MEMORY_H_
+#define _MACH_MEMORY_H_
+
+#include <string.h>
+
+#endif _MACH_MEMORY_H_
diff --git a/include/mach/sa/stddef.h b/include/mach/sa/stddef.h
new file mode 100644
index 0000000..9da5de0
--- /dev/null
+++ b/include/mach/sa/stddef.h
@@ -0,0 +1,24 @@
+/*
+ * Copyright (c) 1994 The University of Utah and
+ * the Computer Systems Laboratory (CSL). All rights reserved.
+ *
+ * Permission to use, copy, modify and distribute this software and its
+ * documentation is hereby granted, provided that both the copyright
+ * notice and this permission notice appear in all copies of the
+ * software, derivative works or modified versions, and any portions
+ * thereof, and that both notices appear in supporting documentation.
+ *
+ * THE UNIVERSITY OF UTAH AND CSL ALLOW FREE USE OF THIS SOFTWARE IN ITS "AS
+ * IS" CONDITION. THE UNIVERSITY OF UTAH AND CSL DISCLAIM ANY LIABILITY OF
+ * ANY KIND FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
+ *
+ * CSL requests users of this software to return to csl-dist@cs.utah.edu any
+ * improvements that they make and grant CSL redistribution rights.
+ *
+ * Author: Bryan Ford, University of Utah CSL
+ */
+#ifndef _MACH_STDDEF_H_
+#define _MACH_STDDEF_H_
+
+
+#endif _MACH_STDDEF_H_
diff --git a/include/mach/sa/stdio.h b/include/mach/sa/stdio.h
new file mode 100644
index 0000000..d8f7201
--- /dev/null
+++ b/include/mach/sa/stdio.h
@@ -0,0 +1,72 @@
+/*
+ * Copyright (c) 1994 The University of Utah and
+ * the Computer Systems Laboratory at the University of Utah (CSL).
+ * All rights reserved.
+ *
+ * Permission to use, copy, modify and distribute this software is hereby
+ * granted provided that (1) source code retains these copyright, permission,
+ * and disclaimer notices, and (2) redistributions including binaries
+ * reproduce the notices in supporting documentation, and (3) all advertising
+ * materials mentioning features or use of this software display the following
+ * acknowledgement: ``This product includes software developed by the
+ * Computer Systems Laboratory at the University of Utah.''
+ *
+ * THE UNIVERSITY OF UTAH AND CSL ALLOW FREE USE OF THIS SOFTWARE IN ITS "AS
+ * IS" CONDITION. THE UNIVERSITY OF UTAH AND CSL DISCLAIM ANY LIABILITY OF
+ * ANY KIND FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
+ *
+ * CSL requests users of this software to return to csl-dist@cs.utah.edu any
+ * improvements that they make and grant CSL redistribution rights.
+ *
+ * Author: Bryan Ford, University of Utah CSL
+ */
+#ifndef _MACH_SA_STDIO_H
+#define _MACH_SA_STDIO_H
+
+#include <sys/cdefs.h>
+
+/* This is a very naive standard I/O implementation
+ which simply chains to the low-level I/O routines
+ without doing any buffering or anything. */
+
+#ifndef NULL
+#define NULL 0
+#endif
+
+typedef struct
+{
+ int fd;
+} FILE;
+
+#define SEEK_SET 0
+#define SEEK_CUR 1
+#define SEEK_END 2
+
+#ifndef EOF
+#define EOF -1
+#endif
+
+__BEGIN_DECLS
+
+int putchar(int c);
+int puts(const char *str);
+int printf(const char *format, ...);
+int sprintf(char *dest, const char *format, ...);
+FILE *fopen(const char *path, const char *mode);
+int fclose(FILE *stream);
+int fread(void *buf, int size, int count, FILE *stream);
+int fwrite(void *buf, int size, int count, FILE *stream);
+int fputc(int c, FILE *stream);
+int fgetc(FILE *stream);
+int fprintf(FILE *stream, const char *format, ...);
+int fscanf(FILE *stream, const char *format, ...);
+int feof(FILE *stream);
+long ftell(FILE *stream);
+void rewind(FILE *stream);
+int rename(const char *from, const char *to);
+
+#define putc(c, stream) fputc(c, stream)
+
+__END_DECLS
+
+#endif _MACH_SA_STDIO_H
diff --git a/include/mach/sa/stdlib.h b/include/mach/sa/stdlib.h
new file mode 100644
index 0000000..29d3eaf
--- /dev/null
+++ b/include/mach/sa/stdlib.h
@@ -0,0 +1,56 @@
+/*
+ * Copyright (c) 1994 The University of Utah and
+ * the Computer Systems Laboratory (CSL). All rights reserved.
+ *
+ * Permission to use, copy, modify and distribute this software and its
+ * documentation is hereby granted, provided that both the copyright
+ * notice and this permission notice appear in all copies of the
+ * software, derivative works or modified versions, and any portions
+ * thereof, and that both notices appear in supporting documentation.
+ *
+ * THE UNIVERSITY OF UTAH AND CSL ALLOW FREE USE OF THIS SOFTWARE IN ITS "AS
+ * IS" CONDITION. THE UNIVERSITY OF UTAH AND CSL DISCLAIM ANY LIABILITY OF
+ * ANY KIND FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
+ *
+ * CSL requests users of this software to return to csl-dist@cs.utah.edu any
+ * improvements that they make and grant CSL redistribution rights.
+ *
+ * Author: Bryan Ford, University of Utah CSL
+ */
+#ifndef _MACH_SA_STDLIB_H_
+#define _MACH_SA_STDLIB_H_
+
+#include <mach/machine/vm_types.h>
+#include <sys/cdefs.h>
+
+#ifndef _SIZE_T
+#define _SIZE_T
+typedef natural_t size_t;
+#endif
+
+#ifndef NULL
+#define NULL 0
+#endif
+
+__BEGIN_DECLS
+
+int rand(void);
+
+long atol(const char *str);
+#define atoi(str) ((int)atol(str))
+
+#define abs(n) __builtin_abs(n)
+
+void exit(int status);
+
+void srand(unsigned seed);
+int rand(void);
+
+void *malloc(size_t size);
+void *calloc(size_t nelt, size_t eltsize);
+void *realloc(void *buf, size_t new_size);
+void free(void *buf);
+
+__END_DECLS
+
+#endif _MACH_SA_STDLIB_H_
diff --git a/include/mach/sa/string.h b/include/mach/sa/string.h
new file mode 100644
index 0000000..45fc137
--- /dev/null
+++ b/include/mach/sa/string.h
@@ -0,0 +1,56 @@
+/*
+ * Copyright (c) 1994 The University of Utah and
+ * the Computer Systems Laboratory at the University of Utah (CSL).
+ * All rights reserved.
+ *
+ * Permission to use, copy, modify and distribute this software is hereby
+ * granted provided that (1) source code retains these copyright, permission,
+ * and disclaimer notices, and (2) redistributions including binaries
+ * reproduce the notices in supporting documentation, and (3) all advertising
+ * materials mentioning features or use of this software display the following
+ * acknowledgement: ``This product includes software developed by the
+ * Computer Systems Laboratory at the University of Utah.''
+ *
+ * THE UNIVERSITY OF UTAH AND CSL ALLOW FREE USE OF THIS SOFTWARE IN ITS "AS
+ * IS" CONDITION. THE UNIVERSITY OF UTAH AND CSL DISCLAIM ANY LIABILITY OF
+ * ANY KIND FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
+ *
+ * CSL requests users of this software to return to csl-dist@cs.utah.edu any
+ * improvements that they make and grant CSL redistribution rights.
+ *
+ * Author: Bryan Ford, University of Utah CSL
+ */
+#ifndef _MACH_STRING_H_
+#define _MACH_STRING_H_
+
+#include <sys/cdefs.h>
+
+#ifndef NULL
+#define NULL 0
+#endif
+
+__BEGIN_DECLS
+
+__DECL(char *,strdup(const char *s));
+__DECL(char *,strcat(char *dest, const char *src));
+__DECL(int,strcmp(const char *a, const char *b));
+__DECL(int,strncpy(char *dest, const char *src, int n));
+__DECL(int,strncmp(const char *a, const char *b, int n));
+
+__DECL(char *,strchr(const char *s, int c));
+__DECL(char *,strrchr(const char *s, int c));
+__DECL(char *,index(const char *s, int c));
+__DECL(char *,rindex(const char *s, int c));
+__DECL(void *,strstr(const char *haystack, const char *needle));
+
+#ifndef __GNUC__
+__DECL(void *,memcpy(void *to, const void *from, unsigned int n));
+#endif
+__DECL(void *,memset(void *to, int ch, unsigned int n));
+
+__DECL(void,bcopy(const void *from, void *to, unsigned int n));
+__DECL(void,bzero(void *to, unsigned int n));
+
+__END_DECLS
+
+#endif _MACH_STRING_H_
diff --git a/include/mach/sa/strings.h b/include/mach/sa/strings.h
new file mode 100644
index 0000000..67b502e
--- /dev/null
+++ b/include/mach/sa/strings.h
@@ -0,0 +1,28 @@
+/*
+ * Copyright (c) 1994 The University of Utah and
+ * the Computer Systems Laboratory at the University of Utah (CSL).
+ * All rights reserved.
+ *
+ * Permission to use, copy, modify and distribute this software is hereby
+ * granted provided that (1) source code retains these copyright, permission,
+ * and disclaimer notices, and (2) redistributions including binaries
+ * reproduce the notices in supporting documentation, and (3) all advertising
+ * materials mentioning features or use of this software display the following
+ * acknowledgement: ``This product includes software developed by the
+ * Computer Systems Laboratory at the University of Utah.''
+ *
+ * THE UNIVERSITY OF UTAH AND CSL ALLOW FREE USE OF THIS SOFTWARE IN ITS "AS
+ * IS" CONDITION. THE UNIVERSITY OF UTAH AND CSL DISCLAIM ANY LIABILITY OF
+ * ANY KIND FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
+ *
+ * CSL requests users of this software to return to csl-dist@cs.utah.edu any
+ * improvements that they make and grant CSL redistribution rights.
+ *
+ * Author: Bryan Ford, University of Utah CSL
+ */
+#ifndef _MACH_STRINGS_H_
+#define _MACH_STRINGS_H_
+
+#include <string.h>
+
+#endif _MACH_STRINGS_H_
diff --git a/include/mach/sa/sys/cdefs.h b/include/mach/sa/sys/cdefs.h
new file mode 100644
index 0000000..1e804ad
--- /dev/null
+++ b/include/mach/sa/sys/cdefs.h
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 1994 The University of Utah and
+ * the Computer Systems Laboratory at the University of Utah (CSL).
+ * All rights reserved.
+ *
+ * Permission to use, copy, modify and distribute this software is hereby
+ * granted provided that (1) source code retains these copyright, permission,
+ * and disclaimer notices, and (2) redistributions including binaries
+ * reproduce the notices in supporting documentation, and (3) all advertising
+ * materials mentioning features or use of this software display the following
+ * acknowledgement: ``This product includes software developed by the
+ * Computer Systems Laboratory at the University of Utah.''
+ *
+ * THE UNIVERSITY OF UTAH AND CSL ALLOW FREE USE OF THIS SOFTWARE IN ITS "AS
+ * IS" CONDITION. THE UNIVERSITY OF UTAH AND CSL DISCLAIM ANY LIABILITY OF
+ * ANY KIND FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
+ *
+ * CSL requests users of this software to return to csl-dist@cs.utah.edu any
+ * improvements that they make and grant CSL redistribution rights.
+ *
+ * Author: Bryan Ford, University of Utah CSL
+ */
+/*
+ * Common private header file used by the mach/sa headers.
+ * This header file does not cause any non-POSIX-reserved symbols to be defined.
+ */
+#ifndef _MACH_SA_SYS_CDEFS_H_
+#define _MACH_SA_SYS_CDEFS_H_
+
+#ifdef __cplusplus
+#define __BEGIN_DECLS extern "C" {
+#define __END_DECLS }
+#else
+#define __BEGIN_DECLS
+#define __END_DECLS
+#endif
+
+#ifndef __DECL
+#define __DECL(rettype, decl) \
+ extern rettype __##decl; \
+ extern rettype decl;
+#endif
+
+#ifndef __INLINE_FUNC
+#define __INLINE_FUNC static __inline
+#endif
+
+#endif /* _MACH_SA_SYS_CDEFS_H_ */
diff --git a/include/mach/sa/sys/ioctl.h b/include/mach/sa/sys/ioctl.h
new file mode 100644
index 0000000..732494d
--- /dev/null
+++ b/include/mach/sa/sys/ioctl.h
@@ -0,0 +1,52 @@
+/*
+ * Mach Operating System
+ * Copyright (c) 1991 Carnegie Mellon University
+ * All Rights Reserved.
+ *
+ * Permission to use, copy, modify and distribute this software and its
+ * documentation is hereby granted, provided that both the copyright
+ * notice and this permission notice appear in all copies of the
+ * software, derivative works or modified versions, and any portions
+ * thereof, and that both notices appear in supporting documentation.
+ *
+ * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
+ * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
+ * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
+ *
+ * Carnegie Mellon requests users of this software to return to
+ *
+ * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
+ * School of Computer Science
+ * Carnegie Mellon University
+ * Pittsburgh PA 15213-3890
+ *
+ * any improvements or extensions that they make and grant Carnegie Mellon rights
+ * to redistribute these changes.
+ */
+/*
+ * Format definitions for 'ioctl' commands in device definitions.
+ *
+ * From BSD4.4.
+ */
+
+#ifndef _MACH_SYS_IOCTL_H_
+#define _MACH_SYS_IOCTL_H_
+/*
+ * Ioctl's have the command encoded in the lower word, and the size of
+ * any in or out parameters in the upper word. The high 3 bits of the
+ * upper word are used to encode the in/out status of the parameter.
+ */
+#define IOCPARM_MASK 0x1fff /* parameter length, at most 13 bits */
+#define IOC_VOID 0x20000000 /* no parameters */
+#define IOC_OUT 0x40000000 /* copy out parameters */
+#define IOC_IN 0x80000000U /* copy in parameters */
+#define IOC_INOUT (IOC_IN|IOC_OUT)
+
+#define _IOC(inout,group,num,len) \
+ (inout | ((len & IOCPARM_MASK) << 16) | ((group) << 8) | (num))
+#define _IO(g,n) _IOC(IOC_VOID, (g), (n), 0)
+#define _IOR(g,n,t) _IOC(IOC_OUT, (g), (n), sizeof(t))
+#define _IOW(g,n,t) _IOC(IOC_IN, (g), (n), sizeof(t))
+#define _IOWR(g,n,t) _IOC(IOC_INOUT, (g), (n), sizeof(t))
+
+#endif _MACH_SYS_IOCTL_H_
diff --git a/include/mach/sa/sys/mman.h b/include/mach/sa/sys/mman.h
new file mode 100644
index 0000000..3400d30
--- /dev/null
+++ b/include/mach/sa/sys/mman.h
@@ -0,0 +1,41 @@
+/*
+ * Copyright (c) 1994 The University of Utah and
+ * the Computer Systems Laboratory at the University of Utah (CSL).
+ * All rights reserved.
+ *
+ * Permission to use, copy, modify and distribute this software is hereby
+ * granted provided that (1) source code retains these copyright, permission,
+ * and disclaimer notices, and (2) redistributions including binaries
+ * reproduce the notices in supporting documentation, and (3) all advertising
+ * materials mentioning features or use of this software display the following
+ * acknowledgement: ``This product includes software developed by the
+ * Computer Systems Laboratory at the University of Utah.''
+ *
+ * THE UNIVERSITY OF UTAH AND CSL ALLOW FREE USE OF THIS SOFTWARE IN ITS "AS
+ * IS" CONDITION. THE UNIVERSITY OF UTAH AND CSL DISCLAIM ANY LIABILITY OF
+ * ANY KIND FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
+ *
+ * CSL requests users of this software to return to csl-dist@cs.utah.edu any
+ * improvements that they make and grant CSL redistribution rights.
+ *
+ * Author: Bryan Ford, University of Utah CSL
+ */
+#ifndef _MACH_SA_SYS_MMAN_H_
+#define _MACH_SA_SYS_MMAN_H_
+
+/*
+ * Protections are chosen from these bits, or-ed together.
+ * NB: These are the same values as the VM_PROT_xxx definitions,
+ * and they can be used interchangeably.
+ */
+#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 for the mlockall() call.
+ */
+#define MCL_CURRENT 0x0001 /* lock all currently mapped memory */
+#define MCL_FUTURE 0x0002 /* lock all memory mapped in the future */
+
+#endif _MACH_SA_SYS_MMAN_H_
diff --git a/include/mach/sa/sys/reboot.h b/include/mach/sa/sys/reboot.h
new file mode 100644
index 0000000..d74ed98
--- /dev/null
+++ b/include/mach/sa/sys/reboot.h
@@ -0,0 +1,123 @@
+/*
+ * Mach Operating System
+ * Copyright (c) 1993,1991,1990 Carnegie Mellon University
+ * All Rights Reserved.
+ *
+ * Permission to use, copy, modify and distribute this software and its
+ * documentation is hereby granted, provided that both the copyright
+ * notice and this permission notice appear in all copies of the
+ * software, derivative works or modified versions, and any portions
+ * thereof, and that both notices appear in supporting documentation.
+ *
+ * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
+ * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
+ * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
+ *
+ * Carnegie Mellon requests users of this software to return to
+ *
+ * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
+ * School of Computer Science
+ * Carnegie Mellon University
+ * Pittsburgh PA 15213-3890
+ *
+ * any improvements or extensions that they make and grant Carnegie Mellon
+ * the rights to redistribute these changes.
+ */
+/*
+ * Copyright (c) 1982, 1986, 1988 Regents of the University of California.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms are permitted
+ * provided that the above copyright notice and this paragraph are
+ * duplicated in all such forms and that any documentation,
+ * advertising materials, and other materials related to such
+ * distribution and use acknowledge that the software was developed
+ * by the University of California, Berkeley. The name of the
+ * University may not be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
+ * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * @(#)reboot.h 7.5 (Berkeley) 6/27/88
+ */
+/*
+ * Warning: The contents of this file are deprecated;
+ * it should only ever be used for BSD and Mach 3 compatibility.
+ * As the above copyright notice suggests, this file originated in BSD;
+ * it is mostly the same, except the flags after RB_DFLTROOT
+ * have diverged from BSD.
+ */
+#ifndef _MACH_SYS_REBOOT_H_
+#define _MACH_SYS_REBOOT_H_
+
+/*
+ * Arguments to reboot system call.
+ * These are converted to switches, and passed to startup program,
+ * and on to init.
+ */
+#define RB_AUTOBOOT 0 /* flags for system auto-booting itself */
+
+#define RB_ASKNAME 0x01 /* -a: ask for file name to reboot from */
+#define RB_SINGLE 0x02 /* -s: reboot to single user only */
+#define RB_KDB 0x04 /* -d: kernel debugger symbols loaded */
+#define RB_HALT 0x08 /* -h: enter KDB at bootup */
+ /* for host_reboot(): don't reboot,
+ just halt */
+#define RB_INITNAME 0x10 /* -i: name given for /etc/init (unused) */
+#define RB_DFLTROOT 0x20 /* use compiled-in rootdev */
+#define RB_NOBOOTRC 0x20 /* -b: don't run /etc/rc.boot */
+#define RB_ALTBOOT 0x40 /* use /boot.old vs /boot */
+#define RB_UNIPROC 0x80 /* -u: start only one processor */
+
+#define RB_SHIFT 8 /* second byte is for ux */
+
+#define RB_DEBUGGER 0x1000 /* for host_reboot(): enter kernel
+ debugger from user level */
+
+/* Corresponding BSD definitions, where they disagree with the Mach flags. */
+#define BSD_RB_NOSYNC 0x04 /* dont sync before reboot */
+#define BSD_RB_KDB 0x40 /* give control to kernel debugger */
+#define BSD_RB_RDONLY 0x80 /* mount root fs read-only */
+#define BSD_RB_DUMP 0x100 /* dump kernel memory before reboot */
+#define BSD_RB_MINIROOT 0x200 /* mini-root present in memory at boot time */
+#define BSD_RB_CONFIG 0x400 /* invoke user configuration routing */
+
+
+/*
+ * Constants for converting boot-style device number to type,
+ * adaptor (uba, mba, etc), unit number and partition number.
+ * Type (== major device number) is in the low byte
+ * for backward compatibility. Except for that of the "magic
+ * number", each mask applies to the shifted value.
+ * Format:
+ * (4) (4) (4) (4) (8) (8)
+ * --------------------------------
+ * |MA | AD| CT| UN| PART | TYPE |
+ * --------------------------------
+ */
+#define B_ADAPTORSHIFT 24
+#define B_ADAPTORMASK 0x0f
+#define B_ADAPTOR(val) (((val) >> B_ADAPTORSHIFT) & B_ADAPTORMASK)
+#define B_CONTROLLERSHIFT 20
+#define B_CONTROLLERMASK 0xf
+#define B_CONTROLLER(val) (((val)>>B_CONTROLLERSHIFT) & B_CONTROLLERMASK)
+#define B_UNITSHIFT 16
+#define B_UNITMASK 0xf
+#define B_UNIT(val) (((val) >> B_UNITSHIFT) & B_UNITMASK)
+#define B_PARTITIONSHIFT 8
+#define B_PARTITIONMASK 0xff
+#define B_PARTITION(val) (((val) >> B_PARTITIONSHIFT) & B_PARTITIONMASK)
+#define B_TYPESHIFT 0
+#define B_TYPEMASK 0xff
+#define B_TYPE(val) (((val) >> B_TYPESHIFT) & B_TYPEMASK)
+
+#define B_MAGICMASK ((u_int)0xf0000000U)
+#define B_DEVMAGIC ((u_int)0xa0000000U)
+
+#define MAKEBOOTDEV(type, adaptor, controller, unit, partition) \
+ (((type) << B_TYPESHIFT) | ((adaptor) << B_ADAPTORSHIFT) | \
+ ((controller) << B_CONTROLLERSHIFT) | ((unit) << B_UNITSHIFT) | \
+ ((partition) << B_PARTITIONSHIFT) | B_DEVMAGIC)
+
+#endif /* _MACH_SYS_REBOOT_H_ */
diff --git a/include/mach/sa/sys/signal.h b/include/mach/sa/sys/signal.h
new file mode 100644
index 0000000..c3c1206
--- /dev/null
+++ b/include/mach/sa/sys/signal.h
@@ -0,0 +1,206 @@
+/*
+ * Copyright (c) 1982, 1986, 1989, 1991, 1993
+ * The Regents of the University of California. All rights reserved.
+ * (c) UNIX System Laboratories, Inc.
+ * All or some portions of this file are derived from material licensed
+ * to the University of California by American Telephone and Telegraph
+ * Co. or Unix System Laboratories, Inc. and are reproduced herein with
+ * the permission of UNIX System Laboratories, Inc.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by the University of
+ * California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * @(#)signal.h 8.2 (Berkeley) 1/21/94
+ * signal.h,v 1.2 1994/08/02 07:53:32 davidg Exp
+ */
+
+#ifndef _MACH_SA_SYS_SIGNAL_H_
+#define _MACH_SA_SYS_SIGNAL_H_
+
+#define NSIG 32 /* counting 0; could be 33 (mask is 1-32) */
+
+#define SIGHUP 1 /* hangup */
+#define SIGINT 2 /* interrupt */
+#define SIGQUIT 3 /* quit */
+#define SIGILL 4 /* illegal instruction (not reset when caught) */
+#ifndef _POSIX_SOURCE
+#define SIGTRAP 5 /* trace trap (not reset when caught) */
+#endif
+#define SIGABRT 6 /* abort() */
+#ifndef _POSIX_SOURCE
+#define SIGIOT SIGABRT /* compatibility */
+#define SIGEMT 7 /* EMT instruction */
+#endif
+#define SIGFPE 8 /* floating point exception */
+#define SIGKILL 9 /* kill (cannot be caught or ignored) */
+#ifndef _POSIX_SOURCE
+#define SIGBUS 10 /* bus error */
+#endif
+#define SIGSEGV 11 /* segmentation violation */
+#ifndef _POSIX_SOURCE
+#define SIGSYS 12 /* bad argument to system call */
+#endif
+#define SIGPIPE 13 /* write on a pipe with no one to read it */
+#define SIGALRM 14 /* alarm clock */
+#define SIGTERM 15 /* software termination signal from kill */
+#ifndef _POSIX_SOURCE
+#define SIGURG 16 /* urgent condition on IO channel */
+#endif
+#define SIGSTOP 17 /* sendable stop signal not from tty */
+#define SIGTSTP 18 /* stop signal from tty */
+#define SIGCONT 19 /* continue a stopped process */
+#define SIGCHLD 20 /* to parent on child stop or exit */
+#define SIGTTIN 21 /* to readers pgrp upon background tty read */
+#define SIGTTOU 22 /* like TTIN for output if (tp->t_local&LTOSTOP) */
+#ifndef _POSIX_SOURCE
+#define SIGIO 23 /* input/output possible signal */
+#define SIGXCPU 24 /* exceeded CPU time limit */
+#define SIGXFSZ 25 /* exceeded file size limit */
+#define SIGVTALRM 26 /* virtual time alarm */
+#define SIGPROF 27 /* profiling time alarm */
+#define SIGWINCH 28 /* window size changes */
+#define SIGINFO 29 /* information request */
+#endif
+#define SIGUSR1 30 /* user defined signal 1 */
+#define SIGUSR2 31 /* user defined signal 2 */
+
+#if defined(_ANSI_SOURCE) || defined(__cplusplus)
+/*
+ * Language spec sez we must list exactly one parameter, even though we
+ * actually supply three. Ugh!
+ */
+#define SIG_DFL (void (*)(int))0
+#define SIG_IGN (void (*)(int))1
+#define SIG_ERR (void (*)(int))-1
+#else
+#define SIG_DFL (void (*)())0
+#define SIG_IGN (void (*)())1
+#define SIG_ERR (void (*)())-1
+#endif
+
+#ifndef _ANSI_SOURCE
+
+typedef unsigned int sigset_t;
+
+/*
+ * POSIX 1003.1b: Generic value to pass back to an application.
+ */
+union sigval
+{
+ int sival_int;
+ void *sival_ptr;
+};
+
+/*
+ * This structure is passed to signal handlers
+ * that use the new SA_SIGINFO calling convention (see below).
+ */
+typedef struct
+{
+ int si_signo;
+ int si_code;
+ union sigval si_value;
+} siginfo_t;
+
+/* Values for si_code, indicating the source of the signal */
+#define SI_USER 0 /* sent by kill(), raise(), or abort() */
+#define SI_QUEUE 1 /* sent by sigqueue() */
+#define SI_TIMER 2 /* generated by an expired timer */
+#define SI_ASYNCIO 3 /* generated by completion of an async i/o */
+#define SI_MESGQ 4 /* generated by the arrival of a message */
+#define SI_IRQ 5 /* hardware int dispatched to application */
+
+/*
+ * Signal vector "template" used in sigaction call.
+ */
+struct sigaction {
+ union { /* signal handler */
+ void (*sa_u_handler)();
+ void (*sa_u_sigaction)(int, siginfo_t *, void *);
+ } sa_u;
+ sigset_t sa_mask; /* signal mask to apply */
+ int sa_flags; /* see signal options below */
+};
+#define sa_handler sa_u.sa_u_handler
+#define sa_sigaction sa_u.sa_u_sigaction
+
+#ifndef _POSIX_SOURCE
+#define SA_ONSTACK 0x0001 /* take signal on signal stack */
+#define SA_RESTART 0x0002 /* restart system on signal return */
+#define SA_DISABLE 0x0004 /* disable taking signals on alternate stack */
+#ifdef COMPAT_SUNOS
+#define SA_USERTRAMP 0x0100 /* do not bounce off kernel's sigtramp */
+#endif
+#endif
+#define SA_NOCLDSTOP 0x0008 /* do not generate SIGCHLD on child stop */
+#define SA_SIGINFO 0x0010 /* use sa_sigaction calling convention */
+
+/*
+ * Flags for sigprocmask:
+ */
+#define SIG_BLOCK 1 /* block specified signal set */
+#define SIG_UNBLOCK 2 /* unblock specified signal set */
+#define SIG_SETMASK 3 /* set specified signal set */
+
+/*
+ * POSIX 1003.1b:
+ * Used when requesting queued notification of an event,
+ * such as a timer expiration or a message arrival.
+ */
+struct sigevent
+{
+ int sigev_notify;
+ union
+ {
+ struct
+ {
+ int __signo;
+ union sigval __value;
+ } __sig;
+ struct
+ {
+ void (*__handler)(void);
+ void *__stack;
+ } __fastint;
+ } __u;
+};
+
+#define sigev_signo __u.__sig.__signo
+#define sigev_value __u.__sig.__value
+
+#define sigev_handler __u.__fastint.__handler
+#define sigev_stack __u.__fastint.__stack
+
+/* Values for sigev_notify */
+#define SIGEV_NONE 0
+#define SIGEV_SIGNAL 1
+#define SIGEV_FASTINT 2
+
+#endif /* !_ANSI_SOURCE */
+
+#endif /* !_MACH_SA_SYS_SIGNAL_H_ */
diff --git a/include/mach/sa/sys/stat.h b/include/mach/sa/sys/stat.h
new file mode 100644
index 0000000..81ca25d
--- /dev/null
+++ b/include/mach/sa/sys/stat.h
@@ -0,0 +1,126 @@
+/*-
+ * Copyright (c) 1982, 1986, 1989, 1993
+ * The Regents of the University of California. All rights reserved.
+ * (c) UNIX System Laboratories, Inc.
+ * All or some portions of this file are derived from material licensed
+ * to the University of California by American Telephone and Telegraph
+ * Co. or Unix System Laboratories, Inc. and are reproduced herein with
+ * the permission of UNIX System Laboratories, Inc.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by the University of
+ * California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * @(#)stat.h 8.6 (Berkeley) 3/8/94
+ * stat.h,v 1.5 1994/10/02 17:24:57 phk Exp
+ */
+
+#ifndef _MACH_SA_SYS_STAT_H_
+#define _MACH_SA_SYS_STAT_H_
+
+#include <sys/types.h>
+
+/*
+ * XXX we need this for struct timespec. We get miscellaneous namespace
+ * pollution with it. struct timespace itself is namespace pollution if
+ * _POSIX_SOURCE is defined.
+ */
+#include <sys/time.h>
+
+struct stat {
+ dev_t st_dev; /* inode's device */
+ ino_t st_ino; /* inode's number */
+ mode_t st_mode; /* inode protection mode */
+ nlink_t st_nlink; /* number of hard links */
+ uid_t st_uid; /* user ID of the file's owner */
+ gid_t st_gid; /* group ID of the file's group */
+ dev_t st_rdev; /* device type */
+ time_t st_atime; /* time of last access */
+ time_t st_mtime; /* time of last data modification */
+ time_t st_ctime; /* time of last file status change */
+ off_t st_size; /* file size, in bytes */
+ unsigned long st_blocks; /* blocks allocated for file */
+ unsigned long st_blksize; /* optimal blocksize for I/O */
+};
+
+#define S_ISUID 0004000 /* set user id on execution */
+#define S_ISGID 0002000 /* set group id on execution */
+#ifndef _POSIX_SOURCE
+#define S_ISTXT 0001000 /* sticky bit */
+#endif
+
+#define S_IRWXU 0000700 /* RWX mask for owner */
+#define S_IRUSR 0000400 /* R for owner */
+#define S_IWUSR 0000200 /* W for owner */
+#define S_IXUSR 0000100 /* X for owner */
+
+#define S_IRWXG 0000070 /* RWX mask for group */
+#define S_IRGRP 0000040 /* R for group */
+#define S_IWGRP 0000020 /* W for group */
+#define S_IXGRP 0000010 /* X for group */
+
+#define S_IRWXO 0000007 /* RWX mask for other */
+#define S_IROTH 0000004 /* R for other */
+#define S_IWOTH 0000002 /* W for other */
+#define S_IXOTH 0000001 /* X for other */
+
+#ifndef _POSIX_SOURCE
+#define S_IFMT 0170000 /* type of file mask */
+#define S_IFIFO 0010000 /* named pipe (fifo) */
+#define S_IFCHR 0020000 /* character special */
+#define S_IFDIR 0040000 /* directory */
+#define S_IFBLK 0060000 /* block special */
+#define S_IFREG 0100000 /* regular */
+#define S_IFLNK 0120000 /* symbolic link */
+#define S_IFSOCK 0140000 /* socket */
+#define S_ISVTX 0001000 /* save swapped text even after use */
+#endif
+
+#define S_ISDIR(m) (((m) & 0170000) == 0040000) /* directory */
+#define S_ISCHR(m) (((m) & 0170000) == 0020000) /* char special */
+#define S_ISBLK(m) (((m) & 0170000) == 0060000) /* block special */
+#define S_ISREG(m) (((m) & 0170000) == 0100000) /* regular file */
+#define S_ISFIFO(m) (((m) & 0170000) == 0010000 || \
+ ((m) & 0170000) == 0140000) /* fifo or socket */
+#ifndef _POSIX_SOURCE
+#define S_ISLNK(m) (((m) & 0170000) == 0120000) /* symbolic link */
+#define S_ISSOCK(m) (((m) & 0170000) == 0010000 || \
+ ((m) & 0170000) == 0140000) /* fifo or socket */
+#endif
+
+#include <sys/cdefs.h>
+
+__BEGIN_DECLS
+int chmod(const char *, mode_t);
+int fstat(int, struct stat *);
+int mkdir(const char *, mode_t);
+int mkfifo(const char *, mode_t);
+int stat(const char *, struct stat *);
+mode_t umask(mode_t);
+__END_DECLS
+
+#endif /* !_MACH_SA_SYS_STAT_H_ */
diff --git a/include/mach/sa/sys/termios.h b/include/mach/sa/sys/termios.h
new file mode 100644
index 0000000..2d2e4bd
--- /dev/null
+++ b/include/mach/sa/sys/termios.h
@@ -0,0 +1,207 @@
+/*
+ * Copyright (c) 1988, 1989, 1993, 1994
+ * The Regents of the University of California. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by the University of
+ * California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * @(#)termios.h 8.3 (Berkeley) 3/28/94
+ * termios.h,v 1.3 1994/08/02 07:53:46 davidg Exp
+ */
+
+#ifndef _MACH_SA_SYS_TERMIOS_H_
+#define _MACH_SA_SYS_TERMIOS_H_
+
+/*
+ * Special Control Characters
+ *
+ * Index into c_cc[] character array.
+ *
+ * Name Subscript Enabled by
+ */
+#define VEOF 0 /* ICANON */
+#define VEOL 1 /* ICANON */
+#define VERASE 3 /* ICANON */
+#define VKILL 5 /* ICANON */
+#define VINTR 8 /* ISIG */
+#define VQUIT 9 /* ISIG */
+#define VSUSP 10 /* ISIG */
+#define VSTART 12 /* IXON, IXOFF */
+#define VSTOP 13 /* IXON, IXOFF */
+#define VMIN 16 /* !ICANON */
+#define VTIME 17 /* !ICANON */
+#define NCCS 20
+
+#define _POSIX_VDISABLE ((unsigned char)'\377')
+
+/*
+ * Input flags - software input processing
+ */
+#define IGNBRK 0x00000001 /* ignore BREAK condition */
+#define BRKINT 0x00000002 /* map BREAK to SIGINTR */
+#define IGNPAR 0x00000004 /* ignore (discard) parity errors */
+#define PARMRK 0x00000008 /* mark parity and framing errors */
+#define INPCK 0x00000010 /* enable checking of parity errors */
+#define ISTRIP 0x00000020 /* strip 8th bit off chars */
+#define INLCR 0x00000040 /* map NL into CR */
+#define IGNCR 0x00000080 /* ignore CR */
+#define ICRNL 0x00000100 /* map CR to NL (ala CRMOD) */
+#define IXON 0x00000200 /* enable output flow control */
+#define IXOFF 0x00000400 /* enable input flow control */
+#ifndef _POSIX_SOURCE
+#define IXANY 0x00000800 /* any char will restart after stop */
+#define IMAXBEL 0x00002000 /* ring bell on input queue full */
+#endif /*_POSIX_SOURCE */
+
+/*
+ * Output flags - software output processing
+ */
+#define OPOST 0x00000001 /* enable following output processing */
+
+/*
+ * Control flags - hardware control of terminal
+ */
+#ifndef _POSIX_SOURCE
+#define CIGNORE 0x00000001 /* ignore control flags */
+#endif
+#define CSIZE 0x00000300 /* character size mask */
+#define CS5 0x00000000 /* 5 bits (pseudo) */
+#define CS6 0x00000100 /* 6 bits */
+#define CS7 0x00000200 /* 7 bits */
+#define CS8 0x00000300 /* 8 bits */
+#define CSTOPB 0x00000400 /* send 2 stop bits */
+#define CREAD 0x00000800 /* enable receiver */
+#define PARENB 0x00001000 /* parity enable */
+#define PARODD 0x00002000 /* odd parity, else even */
+#define HUPCL 0x00004000 /* hang up on last close */
+#define CLOCAL 0x00008000 /* ignore modem status lines */
+
+
+/*
+ * "Local" flags - dumping ground for other state
+ *
+ * Warning: some flags in this structure begin with
+ * the letter "I" and look like they belong in the
+ * input flag.
+ */
+
+#define ECHOE 0x00000002 /* visually erase chars */
+#define ECHOK 0x00000004 /* echo NL after line kill */
+#define ECHO 0x00000008 /* enable echoing */
+#define ECHONL 0x00000010 /* echo NL even if ECHO is off */
+#define ISIG 0x00000080 /* enable signals INTR, QUIT, [D]SUSP */
+#define ICANON 0x00000100 /* canonicalize input lines */
+#define IEXTEN 0x00000400 /* enable DISCARD and LNEXT */
+#define EXTPROC 0x00000800 /* external processing */
+#define TOSTOP 0x00400000 /* stop background jobs from output */
+#ifndef _POSIX_SOURCE
+#define FLUSHO 0x00800000 /* output being flushed (state) */
+#define NOKERNINFO 0x02000000 /* no kernel output from VSTATUS */
+#define PENDIN 0x20000000 /* XXX retype pending input (state) */
+#endif /*_POSIX_SOURCE */
+#define NOFLSH 0x80000000 /* don't flush after interrupt */
+
+typedef unsigned long tcflag_t;
+typedef unsigned char cc_t;
+typedef long speed_t;
+
+struct termios {
+ tcflag_t c_iflag; /* input flags */
+ tcflag_t c_oflag; /* output flags */
+ tcflag_t c_cflag; /* control flags */
+ tcflag_t c_lflag; /* local flags */
+ cc_t c_cc[NCCS]; /* control chars */
+ long c_ispeed; /* input speed */
+ long c_ospeed; /* output speed */
+};
+
+/*
+ * Commands passed to tcsetattr() for setting the termios structure.
+ */
+#define TCSANOW 0 /* make change immediate */
+#define TCSADRAIN 1 /* drain output, then change */
+#define TCSAFLUSH 2 /* drain output, flush input */
+#ifndef _POSIX_SOURCE
+#define TCSASOFT 0x10 /* flag - don't alter h.w. state */
+#endif
+
+/*
+ * Standard speeds
+ */
+#define B0 0
+#define B50 50
+#define B75 75
+#define B110 110
+#define B134 134
+#define B150 150
+#define B200 200
+#define B300 300
+#define B600 600
+#define B1200 1200
+#define B1800 1800
+#define B2400 2400
+#define B4800 4800
+#define B9600 9600
+#define B19200 19200
+#define B38400 38400
+#ifndef _POSIX_SOURCE
+#define B7200 7200
+#define B14400 14400
+#define B28800 28800
+#define B57600 57600
+#define B76800 76800
+#define B115200 115200
+#define B230400 230400
+#define EXTA 19200
+#define EXTB 38400
+#endif /* !_POSIX_SOURCE */
+
+#define TCIFLUSH 1
+#define TCOFLUSH 2
+#define TCIOFLUSH 3
+#define TCOOFF 1
+#define TCOON 2
+#define TCIOFF 3
+#define TCION 4
+
+#include <sys/cdefs.h>
+
+__BEGIN_DECLS
+speed_t cfgetispeed(const struct termios *);
+speed_t cfgetospeed(const struct termios *);
+int cfsetispeed(struct termios *, speed_t);
+int cfsetospeed(struct termios *, speed_t);
+int tcgetattr(int, struct termios *);
+int tcsetattr(int, int, const struct termios *);
+int tcdrain(int);
+int tcflow(int, int);
+int tcflush(int, int);
+int tcsendbreak(int, int);
+__END_DECLS
+
+#endif /* !_MACH_SA_SYS_TERMIOS_H_ */
diff --git a/include/mach/sa/sys/time.h b/include/mach/sa/sys/time.h
new file mode 100644
index 0000000..ab96678
--- /dev/null
+++ b/include/mach/sa/sys/time.h
@@ -0,0 +1,53 @@
+/*
+ * Mach Operating System
+ * Copyright (c) 1991 Carnegie Mellon University
+ * All Rights Reserved.
+ *
+ * Permission to use, copy, modify and distribute this software and its
+ * documentation is hereby granted, provided that both the copyright
+ * notice and this permission notice appear in all copies of the
+ * software, derivative works or modified versions, and any portions
+ * thereof, and that both notices appear in supporting documentation.
+ *
+ * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
+ * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
+ * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
+ *
+ * Carnegie Mellon requests users of this software to return to
+ *
+ * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
+ * School of Computer Science
+ * Carnegie Mellon University
+ * Pittsburgh PA 15213-3890
+ *
+ * any improvements or extensions that they make and grant Carnegie Mellon rights
+ * to redistribute these changes.
+ */
+/*
+ * Time-keeper for kernel IO devices.
+ *
+ * May or may not have any relation to wall-clock time.
+ */
+
+#ifndef _MACH_SA_SYS_TIME_H_
+#define _MACH_SA_SYS_TIME_H_
+
+#include <mach/time_value.h>
+
+extern time_value_t time;
+
+/*
+ * Definitions to keep old code happy.
+ */
+#define timeval_t time_value_t
+#define timeval time_value
+#define tv_sec seconds
+#define tv_usec microseconds
+
+#define timerisset(tvp) ((tvp)->tv_sec || (tvp)->tv_usec)
+#define timercmp(tvp, uvp, cmp) \
+ ((tvp)->tv_sec cmp (uvp)->tv_sec || \
+ (tvp)->tv_sec == (uvp)->tv_sec && (tvp)->tv_usec cmp (uvp)->tv_usec)
+#define timerclear(tvp) (tvp)->tv_sec = (tvp)->tv_usec = 0
+
+#endif _MACH_SA_SYS_TIME_H_
diff --git a/include/mach/sa/sys/types.h b/include/mach/sa/sys/types.h
new file mode 100644
index 0000000..6973f89
--- /dev/null
+++ b/include/mach/sa/sys/types.h
@@ -0,0 +1,91 @@
+/*
+ * Mach Operating System
+ * Copyright (c) 1993 Carnegie Mellon University
+ * All Rights Reserved.
+ *
+ * Permission to use, copy, modify and distribute this software and its
+ * documentation is hereby granted, provided that both the copyright
+ * notice and this permission notice appear in all copies of the
+ * software, derivative works or modified versions, and any portions
+ * thereof, and that both notices appear in supporting documentation.
+ *
+ * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
+ * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
+ * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
+ *
+ * Carnegie Mellon requests users of this software to return to
+ *
+ * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
+ * School of Computer Science
+ * Carnegie Mellon University
+ * Pittsburgh PA 15213-3890
+ *
+ * any improvements or extensions that they make and grant Carnegie Mellon
+ * the rights to redistribute these changes.
+ */
+#ifndef _MACH_SA_SYS_TYPES_H_
+#define _MACH_SA_SYS_TYPES_H_
+
+#include <mach/machine/vm_types.h>
+
+#ifndef _SIZE_T
+#define _SIZE_T
+typedef natural_t size_t;
+#endif
+
+#ifndef _SSIZE_T
+#define _SSIZE_T
+typedef integer_t ssize_t;
+#endif
+
+typedef unsigned short dev_t; /* device id */
+typedef unsigned long gid_t; /* group id */
+typedef unsigned long ino_t; /* inode number */
+typedef unsigned short mode_t; /* permissions */
+typedef unsigned short nlink_t; /* link count */
+typedef natural_t off_t; /* file offset */
+typedef unsigned long uid_t; /* user id */
+
+
+/* Symbols allowed but not required by POSIX */
+
+typedef char * caddr_t; /* address of a (signed) char */
+
+#ifndef _TIME_T
+#define _TIME_T
+typedef unsigned int time_t;
+#endif
+
+#define RAND_MAX 0x7fffffff
+
+/* Symbols not allowed by POSIX */
+#ifndef _POSIX_SOURCE
+
+/*
+ * Common type definitions that lots of old files seem to want.
+ */
+
+typedef unsigned char u_char; /* unsigned char */
+typedef unsigned short u_short; /* unsigned short */
+typedef unsigned int u_int; /* unsigned int */
+typedef unsigned long u_long; /* unsigned long */
+
+typedef struct _quad_ {
+ unsigned int val[2]; /* 2 32-bit values make... */
+} quad; /* an 8-byte item */
+
+typedef unsigned int daddr_t; /* disk address */
+
+#define major(i) (((i) >> 8) & 0xFF)
+#define minor(i) ((i) & 0xFF)
+#define makedev(i,j) ((((i) & 0xFF) << 8) | ((j) & 0xFF))
+
+#define NBBY 8
+
+#ifndef NULL
+#define NULL ((void *) 0) /* the null pointer */
+#endif
+
+#endif /* _POSIX_SOURCE */
+
+#endif /* _MACH_SA_SYS_TYPES_H_ */
diff --git a/include/mach/sa/time.h b/include/mach/sa/time.h
new file mode 100644
index 0000000..2f02622
--- /dev/null
+++ b/include/mach/sa/time.h
@@ -0,0 +1,26 @@
+/*
+ * Copyright (c) 1995 The University of Utah and
+ * the Computer Systems Laboratory at the University of Utah (CSL).
+ * All rights reserved.
+ *
+ * Permission to use, copy, modify and distribute this software is hereby
+ * granted provided that (1) source code retains these copyright, permission,
+ * and disclaimer notices, and (2) redistributions including binaries
+ * reproduce the notices in supporting documentation, and (3) all advertising
+ * materials mentioning features or use of this software display the following
+ * acknowledgement: ``This product includes software developed by the
+ * Computer Systems Laboratory at the University of Utah.''
+ *
+ * THE UNIVERSITY OF UTAH AND CSL ALLOW FREE USE OF THIS SOFTWARE IN ITS "AS
+ * IS" CONDITION. THE UNIVERSITY OF UTAH AND CSL DISCLAIM ANY LIABILITY OF
+ * ANY KIND FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
+ *
+ * CSL requests users of this software to return to csl-dist@cs.utah.edu any
+ * improvements that they make and grant CSL redistribution rights.
+ *
+ * Author: Bryan Ford, University of Utah CSL
+ */
+#ifndef _MACH_SA_TIME_H
+#define _MACH_SA_TIME_H
+
+#endif /* _MACH_SA_TIME_H */
diff --git a/include/mach/sa/unistd.h b/include/mach/sa/unistd.h
new file mode 100644
index 0000000..d3c313d
--- /dev/null
+++ b/include/mach/sa/unistd.h
@@ -0,0 +1,18 @@
+#ifndef _UNISTD_H_
+#define _UNISTD_H_
+
+#include <sys/cdefs.h>
+#include <sys/types.h>
+
+__BEGIN_DECLS
+
+__DECL(int,close(int fd));
+__DECL(int,read(int fd, void *buf, unsigned int n));
+__DECL(int,write(int fd, const void *buf, unsigned int n));
+__DECL(off_t,lseek(int fd, off_t offset, int whence));
+__DECL(int,rename(const char *oldpath, const char *newpath));
+__DECL(void *,sbrk(int size));
+
+__END_DECLS
+
+#endif /* _UNISTD_H_ */