Browse Source

initial commit, after a0 completion

tsdedhar 6 years ago
commit
731461ebee
100 changed files with 4296 additions and 0 deletions
  1. 35 0
      .gitignore
  2. 42 0
      LICENSE
  3. 71 0
      Makefile
  4. 3 0
      README.md
  5. BIN
      build/install/bin/cat
  6. BIN
      build/install/bin/cp
  7. BIN
      build/install/bin/false
  8. BIN
      build/install/bin/ln
  9. BIN
      build/install/bin/ls
  10. BIN
      build/install/bin/mkdir
  11. BIN
      build/install/bin/mv
  12. BIN
      build/install/bin/pwd
  13. BIN
      build/install/bin/rm
  14. BIN
      build/install/bin/rmdir
  15. BIN
      build/install/bin/sh
  16. BIN
      build/install/bin/sync
  17. BIN
      build/install/bin/true
  18. BIN
      build/install/hostbin/host-dumpsfs
  19. BIN
      build/install/hostbin/host-hash
  20. BIN
      build/install/hostbin/host-mksfs
  21. BIN
      build/install/hostbin/host-sfsck
  22. 35 0
      build/install/hostinclude/hostcompat.h
  23. 1 0
      build/install/hostinclude/kern
  24. 60 0
      build/install/include/assert.h
  25. 57 0
      build/install/include/err.h
  26. 39 0
      build/install/include/errno.h
  27. 31 0
      build/install/include/fcntl.h
  28. 50 0
      build/install/include/kern/endian.h
  29. 114 0
      build/install/include/kern/errmsg.h
  30. 111 0
      build/install/include/kern/errno.h
  31. 100 0
      build/install/include/kern/fcntl.h
  32. 39 0
      build/install/include/kern/ioctl.h
  33. 68 0
      build/install/include/kern/iovec.h
  34. 1 0
      build/install/include/kern/kern
  35. 100 0
      build/install/include/kern/limits.h
  36. 1 0
      build/install/include/kern/machine
  37. 44 0
      build/install/include/kern/mips/endian.h
  38. 1 0
      build/install/include/kern/mips/machine
  39. 1 0
      build/install/include/kern/mips/mips
  40. 74 0
      build/install/include/kern/mips/regdefs.h
  41. 47 0
      build/install/include/kern/mips/setjmp.h
  42. 45 0
      build/install/include/kern/mips/signal.h
  43. 78 0
      build/install/include/kern/mips/types.h
  44. 45 0
      build/install/include/kern/reboot.h
  45. 92 0
      build/install/include/kern/resource.h
  46. 47 0
      build/install/include/kern/seek.h
  47. 98 0
      build/install/include/kern/sfs.h
  48. 131 0
      build/install/include/kern/signal.h
  49. 116 0
      build/install/include/kern/socket.h
  50. 71 0
      build/install/include/kern/stat.h
  51. 55 0
      build/install/include/kern/stattypes.h
  52. 203 0
      build/install/include/kern/syscall.h
  53. 70 0
      build/install/include/kern/time.h
  54. 92 0
      build/install/include/kern/types.h
  55. 39 0
      build/install/include/kern/unistd.h
  56. 79 0
      build/install/include/kern/wait.h
  57. 53 0
      build/install/include/limits.h
  58. 1 0
      build/install/include/machine
  59. 52 0
      build/install/include/setjmp.h
  60. 30 0
      build/install/include/signal.h
  61. 48 0
      build/install/include/stdarg.h
  62. 51 0
      build/install/include/stdint.h
  63. 72 0
      build/install/include/stdio.h
  64. 73 0
      build/install/include/stdlib.h
  65. 65 0
      build/install/include/string.h
  66. 35 0
      build/install/include/sys/endian.h
  67. 31 0
      build/install/include/sys/ioctl.h
  68. 39 0
      build/install/include/sys/null.h
  69. 31 0
      build/install/include/sys/reboot.h
  70. 83 0
      build/install/include/sys/stat.h
  71. 87 0
      build/install/include/sys/types.h
  72. 31 0
      build/install/include/sys/wait.h
  73. 31 0
      build/install/include/time.h
  74. 36 0
      build/install/include/types/size_t.h
  75. 167 0
      build/install/include/unistd.h
  76. 42 0
      build/install/man/bin/cat.html
  77. 42 0
      build/install/man/bin/cp.html
  78. 31 0
      build/install/man/bin/false.html
  79. 37 0
      build/install/man/bin/index.html
  80. 52 0
      build/install/man/bin/ln.html
  81. 60 0
      build/install/man/bin/ls.html
  82. 36 0
      build/install/man/bin/mkdir.html
  83. 42 0
      build/install/man/bin/mv.html
  84. 36 0
      build/install/man/bin/pwd.html
  85. 47 0
      build/install/man/bin/rm.html
  86. 45 0
      build/install/man/bin/rmdir.html
  87. 40 0
      build/install/man/bin/sh.html
  88. 25 0
      build/install/man/bin/sync.html
  89. 31 0
      build/install/man/bin/true.html
  90. 27 0
      build/install/man/dev/beep.html
  91. 35 0
      build/install/man/dev/con.html
  92. 32 0
      build/install/man/dev/emu.html
  93. 37 0
      build/install/man/dev/index.html
  94. 30 0
      build/install/man/dev/lamebus.html
  95. 27 0
      build/install/man/dev/lhd.html
  96. 25 0
      build/install/man/dev/lnet.html
  97. 26 0
      build/install/man/dev/lrandom.html
  98. 33 0
      build/install/man/dev/lscreen.html
  99. 29 0
      build/install/man/dev/lser.html
  100. 27 0
      build/install/man/dev/ltimer.html

+ 35 - 0
.gitignore

@@ -0,0 +1,35 @@
+# ---> C
+# Object files
+*.o
+*.ko
+*.obj
+*.elf
+
+# Precompiled Headers
+*.gch
+*.pch
+
+# Libraries
+*.lib
+*.a
+*.la
+*.lo
+
+# Shared objects (inc. Windows DLLs)
+*.dll
+*.so
+*.so.*
+*.dylib
+
+# Executables
+*.exe
+*.out
+*.app
+*.i*86
+*.x86_64
+*.hex
+
+# Debug files
+*.dSYM/
+
+

+ 42 - 0
LICENSE

@@ -0,0 +1,42 @@
+Academic Free License (“AFL”) v. 3.0
+This Academic Free License (the "License") applies to any original work of authorship (the "Original Work") whose owner (the "Licensor") has placed the following licensing notice adjacent to the copyright notice for the Original Work:
+
+Licensed under the Academic Free License version 3.0
+
+1) Grant of Copyright License. Licensor grants You a worldwide, royalty-free, non-exclusive, sublicensable license, for the duration of the copyright, to do the following:
+
+a) to reproduce the Original Work in copies, either alone or as part of a collective work; 
+b) to translate, adapt, alter, transform, modify, or arrange the Original Work, thereby creating derivative works ("Derivative Works") based upon the Original Work; 
+c) to distribute or communicate copies of the Original Work and Derivative Works to the public, under any license of your choice that does not contradict the terms and conditions, including Licensor’s reserved rights and remedies, in this Academic Free License; 
+d) to perform the Original Work publicly; and 
+e) to display the Original Work publicly.
+
+2) Grant of Patent License. Licensor grants You a worldwide, royalty-free, non-exclusive, sublicensable license, under patent claims owned or controlled by the Licensor that are embodied in the Original Work as furnished by the Licensor, for the duration of the patents, to make, use, sell, offer for sale, have made, and import the Original Work and Derivative Works.
+
+3) Grant of Source Code License. The term "Source Code" means the preferred form of the Original Work for making modifications to it and all available documentation describing how to modify the Original Work. Licensor agrees to provide a machine-readable copy of the Source Code of the Original Work along with each copy of the Original Work that Licensor distributes. Licensor reserves the right to satisfy this obligation by placing a machine-readable copy of the Source Code in an information repository reasonably calculated to permit inexpensive and convenient access by You for as long as Licensor continues to distribute the Original Work.
+
+4) Exclusions From License Grant. Neither the names of Licensor, nor the names of any contributors to the Original Work, nor any of their trademarks or service marks, may be used to endorse or promote products derived from this Original Work without express prior permission of the Licensor. Except as expressly stated herein, nothing in this License grants any license to Licensor’s trademarks, copyrights, patents, trade secrets or any other intellectual property. No patent license is granted to make, use, sell, offer for sale, have made, or import embodiments of any patent claims other than the licensed claims defined in Section 2. No license is granted to the trademarks of Licensor even if such marks are included in the Original Work. Nothing in this License shall be interpreted to prohibit Licensor from licensing under terms different from this License any Original Work that Licensor otherwise would have a right to license.
+
+5) External Deployment. The term "External Deployment" means the use, distribution, or communication of the Original Work or Derivative Works in any way such that the Original Work or Derivative Works may be used by anyone other than You, whether those works are distributed or communicated to those persons or made available as an application intended for use over a network. As an express condition for the grants of license hereunder, You must treat any External Deployment by You of the Original Work or a Derivative Work as a distribution under section 1(c).
+
+6) Attribution Rights. You must retain, in the Source Code of any Derivative Works that You create, all copyright, patent, or trademark notices from the Source Code of the Original Work, as well as any notices of licensing and any descriptive text identified therein as an "Attribution Notice." You must cause the Source Code for any Derivative Works that You create to carry a prominent Attribution Notice reasonably calculated to inform recipients that You have modified the Original Work.
+
+7) Warranty of Provenance and Disclaimer of Warranty. Licensor warrants that the copyright in and to the Original Work and the patent rights granted herein by Licensor are owned by the Licensor or are sublicensed to You under the terms of this License with the permission of the contributor(s) of those copyrights and patent rights. Except as expressly stated in the immediately preceding sentence, the Original Work is provided under this License on an "AS IS" BASIS and WITHOUT WARRANTY, either express or implied, including, without limitation, the warranties of non-infringement, merchantability or fitness for a particular purpose. THE ENTIRE RISK AS TO THE QUALITY OF THE ORIGINAL WORK IS WITH YOU. This DISCLAIMER OF WARRANTY constitutes an essential part of this License. No license to the Original Work is granted by this License except under this disclaimer.
+
+8) Limitation of Liability. Under no circumstances and under no legal theory, whether in tort (including negligence), contract, or otherwise, shall the Licensor be liable to anyone for any indirect, special, incidental, or consequential damages of any character arising as a result of this License or the use of the Original Work including, without limitation, damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses. This limitation of liability shall not apply to the extent applicable law prohibits such limitation.
+
+9) Acceptance and Termination. If, at any time, You expressly assented to this License, that assent indicates your clear and irrevocable acceptance of this License and all of its terms and conditions. If You distribute or communicate copies of the Original Work or a Derivative Work, You must make a reasonable effort under the circumstances to obtain the express assent of recipients to the terms of this License. This License conditions your rights to undertake the activities listed in Section 1, including your right to create Derivative Works based upon the Original Work, and doing so without honoring these terms and conditions is prohibited by copyright law and international treaty. Nothing in this License is intended to affect copyright exceptions and limitations (including “fair use” or “fair dealing”). This License shall terminate immediately and You may no longer exercise any of the rights granted to You by this License upon your failure to honor the conditions in Section 1(c).
+
+10) Termination for Patent Action. This License shall terminate automatically and You may no longer exercise any of the rights granted to You by this License as of the date You commence an action, including a cross-claim or counterclaim, against Licensor or any licensee alleging that the Original Work infringes a patent. This termination provision shall not apply for an action alleging patent infringement by combinations of the Original Work with other software or hardware.
+
+11) Jurisdiction, Venue and Governing Law. Any action or suit relating to this License may be brought only in the courts of a jurisdiction wherein the Licensor resides or in which Licensor conducts its primary business, and under the laws of that jurisdiction excluding its conflict-of-law provisions. The application of the United Nations Convention on Contracts for the International Sale of Goods is expressly excluded. Any use of the Original Work outside the scope of this License or after its termination shall be subject to the requirements and penalties of copyright or patent law in the appropriate jurisdiction. This section shall survive the termination of this License.
+
+12) Attorneys’ Fees. In any action to enforce the terms of this License or seeking damages relating thereto, the prevailing party shall be entitled to recover its costs and expenses, including, without limitation, reasonable attorneys' fees and costs incurred in connection with such action, including any appeal of such action. This section shall survive the termination of this License.
+
+13) Miscellaneous. If any provision of this License is held to be unenforceable, such provision shall be reformed only to the extent necessary to make it enforceable.
+
+14) Definition of "You" in This License. "You" throughout this License, whether in upper or lower case, means an individual or a legal entity exercising rights under, and complying with all of the terms of, this License. For legal entities, "You" includes any entity that controls, is controlled by, or is under common control with you. For purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity.
+
+15) Right to Use. You may use the Original Work in all ways not otherwise restricted or conditioned by this License or by law, and Licensor promises not to interfere with or be responsible for such uses by You.
+
+16) Modification of This License. This License is Copyright © 2005 Lawrence Rosen. Permission is granted to copy, distribute, or communicate this License without modification. Nothing in this License permits You to modify this License as applied to the Original Work or to Derivative Works. However, You may modify the text of this License and copy, distribute or communicate your modified version (the "Modified License") and apply it to other original works of authorship subject to the following conditions: (i) You may not indicate in any way that your Modified License is the "Academic Free License" or "AFL" and you may not use those names in the name of your Modified License; (ii) You must replace the notice specified in the first paragraph above with the notice "Licensed under <insert your license name here>" or with a notice of your own that is not confusingly similar to the notice in this License; and (iii) You may not claim that your original works are open source software unless your Modified License has been approved by Open Source Initiative (OSI) and You comply with its license review and certification process.

+ 71 - 0
Makefile

@@ -0,0 +1,71 @@
+#
+# Toplevel makefile for OS/161.
+#
+#
+# Main rules:
+#    all (default):  depend and compile system; install into staging area
+#    rebuild:        likewise, but start with a clean slate.
+#    fullrebuild:    likewise, but start with a very clean slate.
+#
+# What all does, in order:
+#    tools:          depend and compile the tools used in build.
+#    includes:       install header files.
+#    build:          depend and compile the system.
+#
+# Other targets:
+#    depend:         just update make dependency information.
+#    tags:           generate/regenerate "tags" files.
+#    install:        install into $(OSTREE).
+#    clean:          remove generated files.
+#    distclean:      remove all generated files.
+#
+
+TOP=.
+.include "$(TOP)/mk/os161.config.mk"
+
+all:;  # make this first
+
+MKDIRS=$(OSTREE)
+
+.include "$(TOP)/mk/os161.mkdirs.mk"
+
+all: tools .WAIT includes .WAIT build
+
+rebuild:
+	$(MAKE) clean
+	$(MAKE) all
+
+fullrebuild:
+	$(MAKE) distclean
+	$(MAKE) all
+
+# currently no tools required, hence no tools/ dir or work to do
+tools:
+	@true
+
+build:
+	(cd user && $(MAKE) build)
+	(cd man && $(MAKE) install-staging)
+
+includes tags depend:
+	(cd kern && $(MAKE) $@)
+	(cd user && $(MAKE) $@)
+
+clean:
+	(cd kern && $(MAKE) $@)
+	(cd user && $(MAKE) $@)
+	rm -rf $(INSTALLTOP)
+
+distclean: clean
+	rm -rf $(WORKDIR)
+
+install: $(OSTREE)
+	(cd $(INSTALLTOP) && tar -cf - .) | (cd $(OSTREE) && tar -xvf -)
+
+
+.PHONY: all rebuild fullrebuild tools build includes tags depend
+.PHONY: clean distclean
+
+# old BSD name, same as distclean
+cleandir: distclean
+.PHONY: cleandir

+ 3 - 0
README.md

@@ -0,0 +1,3 @@
+# cs350
+
+repo for my os161 kernel

BIN
build/install/bin/cat


BIN
build/install/bin/cp


BIN
build/install/bin/false


BIN
build/install/bin/ln


BIN
build/install/bin/ls


BIN
build/install/bin/mkdir


BIN
build/install/bin/mv


BIN
build/install/bin/pwd


BIN
build/install/bin/rm


BIN
build/install/bin/rmdir


BIN
build/install/bin/sh


BIN
build/install/bin/sync


BIN
build/install/bin/true


BIN
build/install/hostbin/host-dumpsfs


BIN
build/install/hostbin/host-hash


BIN
build/install/hostbin/host-mksfs


BIN
build/install/hostbin/host-sfsck


+ 35 - 0
build/install/hostinclude/hostcompat.h

@@ -0,0 +1,35 @@
+/*
+ * Copyright (c) 2000, 2001, 2002, 2003, 2004, 2005, 2008, 2009
+ *	The President and Fellows of Harvard College.
+ *
+ * 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. 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 UNIVERSITY 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 UNIVERSITY 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.
+ */
+
+
+#include <sys/types.h>
+
+void hostcompat_init(int argc, char **argv);
+
+time_t __time(time_t *secs, unsigned long *nsecs);

+ 1 - 0
build/install/hostinclude/kern

@@ -0,0 +1 @@
+../include/kern

+ 60 - 0
build/install/include/assert.h

@@ -0,0 +1,60 @@
+/*
+ * Copyright (c) 2000, 2001, 2002, 2003, 2004, 2005, 2008, 2009
+ *	The President and Fellows of Harvard College.
+ *
+ * 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. 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 UNIVERSITY 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 UNIVERSITY 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.
+ */
+
+#ifndef _ASSERT_H_
+#define _ASSERT_H_
+
+/*
+ * Required by the C standard
+ */
+#undef assert
+
+/*
+ * Function to call when an assert fails.
+ */
+void __bad_assert(const char *file, int line, const char *msg);
+
+/*
+ * Asserts are only "on" if NDEBUG isn't set. (This is standard C.)
+ */
+
+#ifdef NDEBUG
+
+#if 0 /* not allowed by the C standard */
+#define assert(x) ((void)(x))	/* retain any side effects of X */
+#else
+#define assert(x) ((void)0)	/* mysteriously hide any side effects of X */
+#endif
+
+#else
+#define assert(x) ((x) ? (void)0 : __bad_assert(__FILE__, __LINE__, #x))
+#endif
+
+
+#endif /* _ASSERT_H_ */

+ 57 - 0
build/install/include/err.h

@@ -0,0 +1,57 @@
+/*
+ * Copyright (c) 2000, 2001, 2002, 2003, 2004, 2005, 2008, 2009
+ *	The President and Fellows of Harvard College.
+ *
+ * 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. 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 UNIVERSITY 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 UNIVERSITY 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.
+ */
+
+#ifndef _ERR_H_
+#define _ERR_H_
+
+#include <kern/types.h>  /* for __va_list */
+
+/*
+ * 4.4BSD error-printing functions.
+ *
+ * These print the program name and the supplied message, and
+ * (non-*x versions only) the string for the error currently
+ * stored in "errno", and a newline. The err* versions then
+ * exit with the supplied exitcode.
+ *
+ * The v* versions are to the non-v* versions like vprintf is to
+ * printf.
+ */
+
+void warn(const char *fmt, ...);
+void warnx(const char *fmt, ...);
+void err(int exitcode, const char *fmt, ...);
+void errx(int exitcode, const char *fmt, ...);
+
+void vwarn(const char *fmt, __va_list);
+void vwarnx(const char *fmt, __va_list);
+void verr(int exitcode, const char *fmt, __va_list);
+void verrx(int exitcode, const char *fmt, __va_list);
+
+#endif /* _ERR_H_ */

+ 39 - 0
build/install/include/errno.h

@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2000, 2001, 2002, 2003, 2004, 2005, 2008, 2009
+ *	The President and Fellows of Harvard College.
+ *
+ * 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. 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 UNIVERSITY 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 UNIVERSITY 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.
+ */
+
+#ifndef _ERRNO_H_
+#define _ERRNO_H_
+
+/* Get the error codes from the kernel. */
+#include <kern/errno.h>
+
+/* Declare the standard global variable errno. */
+extern int errno;
+
+#endif /* _ERRNO_H_ */

+ 31 - 0
build/install/include/fcntl.h

@@ -0,0 +1,31 @@
+/*
+ * Copyright (c) 2000, 2001, 2002, 2003, 2004, 2005, 2008, 2009
+ *	The President and Fellows of Harvard College.
+ *
+ * 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. 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 UNIVERSITY 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 UNIVERSITY 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.
+ */
+
+/* This file is for UNIX compat. In OS/161, everything's in <unistd.h> */
+#include <unistd.h>

+ 50 - 0
build/install/include/kern/endian.h

@@ -0,0 +1,50 @@
+/*
+ * Copyright (c) 2009
+ *	The President and Fellows of Harvard College.
+ *
+ * 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. 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 UNIVERSITY 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 UNIVERSITY 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.
+ */
+
+#ifndef _KERN_ENDIAN_H_
+#define _KERN_ENDIAN_H_
+
+/*
+ * Machine-independent and exported endianness definitions.
+ *
+ * Note: get these via <endian.h> in the kernel and <arpa/inet.h> in
+ * userland.
+ *
+ * This is the historic BSD way of defining endianness.
+ */
+
+#define _LITTLE_ENDIAN 1234
+#define _BIG_ENDIAN    4321
+#define _PDP_ENDIAN    3412
+
+/* This defines _BYTE_ORDER to one of the above. */
+#include <kern/machine/endian.h>
+
+
+#endif /* _KERN_ENDIAN_H_ */

+ 114 - 0
build/install/include/kern/errmsg.h

@@ -0,0 +1,114 @@
+/*
+ * Copyright (c) 2000, 2001, 2002, 2003, 2004, 2005, 2008
+ *	The President and Fellows of Harvard College.
+ *
+ * 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. 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 UNIVERSITY 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 UNIVERSITY 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.
+ */
+
+#ifndef _KERN_ERRMSG_H_
+#define _KERN_ERRMSG_H_
+
+/*
+ * Error strings.
+ * This table must agree with kern/errno.h.
+ *
+ * Note that since this actually defines sys_errlist and sys_nerrlist, it
+ * should only be included in one file. For the kernel, that file is 
+ * lib/misc.c; for userland it's lib/libc/strerror.c.
+ */
+const char *const sys_errlist[] = {
+	"Operation succeeded",        /* 0 */
+	"No such system call",        /* ENOSYS */
+	"Unimplemented feature",      /* EUNIMP */
+	"Out of memory",              /* ENOMEM */
+	"Operation would block",      /* EAGAIN (also EWOULDBLOCK) */
+	"Interrupted system call",    /* EINTR */
+	"Bad memory reference",       /* EFAULT */
+	"String too long",            /* ENAMETOOLONG */
+	"Invalid argument",           /* EINVAL */
+	"Operation not permitted",    /* EPERM */
+	"Permission denied",          /* EACCES */
+	"Too many processes",         /* EMPROC (EPROCLIM in Unix) */
+	"Too many processes in system",/* ENPROC */
+	"File is not executable",     /* ENOEXEC */
+	"Argument list too long",     /* E2BIG */
+	"No such process",            /* ESRCH */
+	"No child processes",         /* ECHILD */
+	"Not a directory",            /* ENOTDIR */
+	"Is a directory",             /* EISDIR */
+	"No such file or directory",  /* ENOENT */
+	"Too many levels of symbolic links",/* ELOOP */
+	"Directory not empty",        /* ENOTEMPTY */
+	"File or object exists",      /* EEXIST */
+	"Too many hard links",        /* EMLINK */
+	"Cross-device link",          /* EXDEV */
+	"No such device",             /* ENODEV */
+	"Device not available",       /* ENXIO */
+	"Device or resource busy",    /* EBUSY */
+	"Too many open files",        /* EMFILE */
+	"Too many open files in system",/* ENFILE */
+	"Bad file number",            /* EBADF */
+	"Invalid or inappropriate ioctl",/* EIOCTL (ENOTTY in Unix) */
+	"Input/output error",         /* EIO */
+	"Illegal seek",               /* ESPIPE */
+	"Broken pipe",                /* EPIPE */
+	"Read-only file system",      /* EROFS */
+	"No space left on device",    /* ENOSPC */
+	"Disc quota exceeded",        /* EDQUOT */
+	"File too large",             /* EFBIG */
+	"Invalid file type or format",/* EFTYPE */
+	"Argument out of range",      /* EDOM */
+	"Result out of range",        /* ERANGE */
+	"Invalid multibyte character sequence",/* EILSEQ */
+	"Not a socket",               /* ENOTSOCK */
+	"Is a socket",                /* EISSOCK (EOPNOTSUPP in Unix) */
+	"Socket is already connected",/* EISCONN */
+	"Socket is not connected",    /* ENOTCONN */
+	"Socket has been shut down",  /* ESHUTDOWN */
+	"Protocol family not supported",/* EPFNOSUPPORT */
+	"Socket type not supported",  /* ESOCKTNOSUPPORT */
+	"Protocol not supported",     /* EPROTONOSUPPORT */
+	"Protocol wrong type for socket",/* EPROTOTYPE */
+	"Address family not supported by protocol family",/* EAFNOSUPPORT */
+	"Protocol option not available",/* ENOPROTOOPT */
+	"Address already in use",     /* EADDRINUSE */
+	"Cannot assign requested address",/* EADDRNOTAVAIL */
+	"Network is down",            /* ENETDOWN */
+	"Network is unreachable",     /* ENETUNREACH */
+	"Host is down",               /* EHOSTDOWN */
+	"Host is unreachable",        /* EHOSTUNREACH */
+	"Connection refused",         /* ECONNREFUSED */
+	"Connection timed out",       /* ETIMEDOUT */
+	"Connection reset by peer",   /* ECONNRESET */
+	"Message too large",          /* EMSGSIZE */
+	"Threads operation not supported",/* ENOTSUP */
+};
+
+/*
+ * Number of entries in sys_errlist.
+ */
+const int sys_nerr = sizeof(sys_errlist)/sizeof(const char *);
+
+#endif /* _KERN_ERRMSG_H_ */

+ 111 - 0
build/install/include/kern/errno.h

@@ -0,0 +1,111 @@
+/*
+ * Copyright (c) 2000, 2001, 2002, 2003, 2004, 2005, 2008
+ *	The President and Fellows of Harvard College.
+ *
+ * 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. 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 UNIVERSITY 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 UNIVERSITY 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.
+ */
+
+#ifndef _KERN_ERRNO_H_
+#define _KERN_ERRNO_H_
+
+/*
+ * If you change this, be sure to make appropriate corresponding changes
+ * to kern/errmsg.h as well. You might also want to change the man page
+ * for errno to document the new error.
+ *
+ * This has been changed relative to OS/161 1.x to make the grouping
+ * more logical.
+ *
+ * Also note that this file has to work from assembler, so it should
+ * contain only symbolic constants.
+ */
+
+#define ENOSYS          1      /* No such system call */
+#define EUNIMP          2      /* Unimplemented feature */
+#define ENOMEM          3      /* Out of memory */
+#define EAGAIN          4      /* Operation would block */
+#define EINTR           5      /* Interrupted system call */
+#define EFAULT          6      /* Bad memory reference */
+#define ENAMETOOLONG    7      /* String too long */
+#define EINVAL          8      /* Invalid argument */
+#define EPERM           9      /* Operation not permitted */
+#define EACCES          10     /* Permission denied */
+#define EMPROC          11     /* Too many processes */
+#define ENPROC          12     /* Too many processes in system */
+#define ENOEXEC         13     /* File is not executable */
+#define E2BIG           14     /* Argument list too long */
+#define ESRCH           15     /* No such process */
+#define ECHILD          16     /* No child processes */
+#define ENOTDIR         17     /* Not a directory */
+#define EISDIR          18     /* Is a directory */
+#define ENOENT          19     /* No such file or directory */
+#define ELOOP           20     /* Too many levels of symbolic links */
+#define ENOTEMPTY       21     /* Directory not empty */
+#define EEXIST          22     /* File or object exists */
+#define EMLINK          23     /* Too many hard links */
+#define EXDEV           24     /* Cross-device link */
+#define ENODEV          25     /* No such device */
+#define ENXIO           26     /* Device not available */
+#define EBUSY           27     /* Device or resource busy */
+#define EMFILE          28     /* Too many open files */
+#define ENFILE          29     /* Too many open files in system */
+#define EBADF           30     /* Bad file number */
+#define EIOCTL          31     /* Invalid or inappropriate ioctl */
+#define EIO             32     /* Input/output error */
+#define ESPIPE          33     /* Illegal seek */
+#define EPIPE           34     /* Broken pipe */
+#define EROFS           35     /* Read-only file system */
+#define ENOSPC          36     /* No space left on device */
+#define EDQUOT          37     /* Disc quota exceeded */
+#define EFBIG           38     /* File too large */
+#define EFTYPE          39     /* Invalid file type or format */
+#define EDOM            40     /* Argument out of range */
+#define ERANGE          41     /* Result out of range */
+#define EILSEQ          42     /* Invalid multibyte character sequence */
+#define ENOTSOCK        43     /* Not a socket */
+#define EISSOCK         44     /* Is a socket */
+#define EISCONN         45     /* Socket is already connected */
+#define ENOTCONN        46     /* Socket is not connected */
+#define ESHUTDOWN       47     /* Socket has been shut down */
+#define EPFNOSUPPORT    48     /* Protocol family not supported */
+#define ESOCKTNOSUPPORT 49     /* Socket type not supported */
+#define EPROTONOSUPPORT 50     /* Protocol not supported */
+#define EPROTOTYPE      51     /* Protocol wrong type for socket */
+#define EAFNOSUPPORT   52 /* Address family not supported by protocol family */
+#define ENOPROTOOPT     53     /* Protocol option not available */
+#define EADDRINUSE      54     /* Address already in use */
+#define EADDRNOTAVAIL   55     /* Cannot assign requested address */
+#define ENETDOWN        56     /* Network is down */
+#define ENETUNREACH     57     /* Network is unreachable */
+#define EHOSTDOWN       58     /* Host is down */
+#define EHOSTUNREACH    59     /* Host is unreachable */
+#define ECONNREFUSED    60     /* Connection refused */
+#define ETIMEDOUT       61     /* Connection timed out */
+#define ECONNRESET      62     /* Connection reset by peer */
+#define EMSGSIZE        63     /* Message too large */
+#define ENOTSUP         64     /* Threads operation not supported */
+
+
+#endif /* _KERN_ERRNO_H_ */

+ 100 - 0
build/install/include/kern/fcntl.h

@@ -0,0 +1,100 @@
+/*
+ * Copyright (c) 2000, 2001, 2002, 2003, 2004, 2005, 2008
+ *	The President and Fellows of Harvard College.
+ *
+ * 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. 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 UNIVERSITY 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 UNIVERSITY 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.
+ */
+
+#ifndef _KERN_FCNTL_H_
+#define _KERN_FCNTL_H_
+
+/*
+ * Constants for libc's <fcntl.h>.
+ */
+
+
+/*
+ * Important
+ */
+
+/* Flags for open: choose one of these: */
+#define O_RDONLY      0      /* Open for read */
+#define O_WRONLY      1      /* Open for write */
+#define O_RDWR        2      /* Open for read and write */
+/* then or in any of these: */
+#define O_CREAT       4      /* Create file if it doesn't exist */
+#define O_EXCL        8      /* With O_CREAT, fail if file already exists */
+#define O_TRUNC      16      /* Truncate file upon open */
+#define O_APPEND     32      /* All writes happen at EOF (optional feature) */
+#define O_NOCTTY     64      /* Required by POSIX, != 0, but does nothing */
+
+/* Additional related definition */
+#define O_ACCMODE     3      /* mask for O_RDONLY/O_WRONLY/O_RDWR */
+
+/*
+ * Not so important
+ */
+
+/* operation codes for flock() */
+#define LOCK_SH         1       /* shared lock */
+#define LOCK_EX         2       /* exclusive lock */
+#define LOCK_UN         3       /* release the lock */
+#define LOCK_NB         4       /* flag: don't block */
+
+/*
+ * Mostly pretty useless
+ */
+
+/* fcntl() operations */
+#define F_DUPFD         0       /* like dup() but not quite */  
+#define F_GETFD         1       /* get per-handle flags */
+#define F_SETFD         2       /* set per-handle flags */
+#define F_GETFL         3       /* get per-file flags (O_* open flags) */
+#define F_SETFL         4       /* set per-file flags (O_* open flags) */
+#define F_GETOWN        5       /* get process/pgroup for SIGURG and SIGIO */
+#define F_SETOWN        6       /* set process/pgroup for SIGURG and SIGIO */
+#define F_GETLK         7       /* inspect record locks */
+#define F_SETLK         8       /* acquire record locks nonblocking */
+#define F_SETLKW        9       /* acquire record locks and wait */
+
+/* flag for F_GETFD and F_SETFD */
+#define FD_CLOEXEC      1       /* close-on-exec */
+
+/* modes for fcntl (F_GETLK/SETLK) locking */
+#define F_RDLCK         0       /* shared lock */
+#define F_WRLCK         1       /* exclusive lock */
+#define F_UNLCK         2       /* unlock */
+
+/* struct for fcntl (F_GETLK/SETLK) locking */
+struct flock {
+	off_t l_start;          /* place in file */
+	int l_whence;           /* SEEK_SET, SEEK_CUR, or SEEK_END */
+	int l_type;             /* F_RDLCK or F_WRLCK */
+	off_t l_len;            /* length of locked region */
+	pid_t l_pid;            /* process that holds the lock */
+};
+
+
+#endif /* _KERN_FCNTL_H_ */

+ 39 - 0
build/install/include/kern/ioctl.h

@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2000, 2001, 2002, 2003, 2004, 2005, 2008, 2009
+ *	The President and Fellows of Harvard College.
+ *
+ * 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. 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 UNIVERSITY 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 UNIVERSITY 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.
+ */
+
+#ifndef _KERN_IOCTL_H_
+#define _KERN_IOCTL_H_
+
+/*
+ * ioctl operation codes
+ */
+
+/* (none yet) */
+
+#endif /* _KERN_IOCTL_H_*/

+ 68 - 0
build/install/include/kern/iovec.h

@@ -0,0 +1,68 @@
+/*
+ * Copyright (c) 2000, 2001, 2002, 2003, 2004, 2005, 2008, 2009
+ *	The President and Fellows of Harvard College.
+ *
+ * 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. 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 UNIVERSITY 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 UNIVERSITY 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.
+ */
+
+#ifndef _KERN_IOVEC_H_
+#define _KERN_IOVEC_H_
+
+/*
+ * iovec structure, used in the readv/writev scatter/gather I/O calls,
+ * and within the kernel for keeping track of blocks of data for I/O.
+ */
+
+struct iovec {
+	/*
+	 * For maximum type safety, when in the kernel, distinguish
+	 * user pointers from kernel pointers.
+	 *
+	 * (A pointer is a user pointer if it *came* from userspace,
+	 * not necessarily if it *points* to userspace. If a system
+	 * call passes 0xdeadbeef, it points to the kernel, but it's
+	 * still a user pointer.)
+	 *
+	 * In userspace, there are only user pointers; also, the name
+	 * iov_base is defined by POSIX.
+	 *
+	 * Note that to work properly (without extra unwanted fiddling
+	 * around) this scheme requires that void* and userptr_t have
+	 * the same machine representation. This is theoretically
+	 * possible under the C standard, but such machines do not
+	 * exist in practice.
+	 */
+#ifdef _KERNEL
+        union {
+                userptr_t  iov_ubase;	/* user-supplied pointer */
+                void      *iov_kbase;	/* kernel-supplied pointer */
+        };
+#else
+	void *iov_base;			/* user-supplied pointer */
+#endif
+        size_t iov_len;			/* Length of data */
+};
+
+#endif /* _KERN_IOVEC_H_ */

+ 1 - 0
build/install/include/kern/kern

@@ -0,0 +1 @@
+../include/kern

+ 100 - 0
build/install/include/kern/limits.h

@@ -0,0 +1,100 @@
+/*
+ * Copyright (c) 2000, 2001, 2002, 2003, 2004, 2005, 2008
+ *	The President and Fellows of Harvard College.
+ *
+ * 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. 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 UNIVERSITY 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 UNIVERSITY 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.
+ */
+
+#ifndef _KERN_LIMITS_H_
+#define _KERN_LIMITS_H_
+
+/*
+ * Constants for libc's <limits.h> - system limits.
+ *
+ * The symbols are prefixed with __ here to avoid namespace pollution
+ * in libc. Use <limits.h> (in either userspace or the kernel) to get
+ * the proper names.
+ *
+ * These are Unix-style limits that Unix; you can change them around
+ * or add others as needed or as are appropriate to your system design.
+ * Likewise, the default values provided here are fairly reasonable,
+ * but you can change them around pretty freely.
+ */
+
+
+/*
+ * Important, both as part of the system call API and for system behavior.
+ */
+
+/* Longest filename (without directory) not including null terminator */
+#define __NAME_MAX      255
+
+/* Longest full path name */
+#define __PATH_MAX      1024
+
+/* Max bytes for an exec function */
+#define __ARG_MAX       (64 * 1024)
+
+
+/*
+ * Important for system behavior, but not a big part of the API.
+ */
+
+/* Min value for a process ID (that can be assigned to a user process) */
+#define __PID_MIN       2
+
+/* Max value for a process ID */
+#define __PID_MAX       32767
+
+/* Max bytes for atomic pipe I/O -- see description in the pipe() man page */
+#define __PIPE_BUF      512
+
+
+/*
+ * Not so important parts of the API.
+ */
+
+/* Max number of supplemental group IDs in process credentials */
+#define __NGROUPS_MAX   32
+
+/* Max login name size (for setlogin/getlogin), incl. null */
+#define __LOGIN_NAME_MAX 17
+
+
+/*
+ * Not very important at all.
+ *
+ * Most modern systems don't have OPEN_MAX at all, and instead go by
+ * whatever limit is set with setrlimit().
+ */
+
+/* Max open files per process */
+#define __OPEN_MAX      128
+
+/* Max number of iovec structures at once for readv/writev/preadv/pwritev */
+#define __IOV_MAX       1024
+
+
+#endif /* _KERN_LIMITS_H_ */

+ 1 - 0
build/install/include/kern/machine

@@ -0,0 +1 @@
+mips

+ 44 - 0
build/install/include/kern/mips/endian.h

@@ -0,0 +1,44 @@
+/*
+ * Copyright (c) 2000, 2001, 2002, 2003, 2004, 2005, 2008, 2009
+ *	The President and Fellows of Harvard College.
+ *
+ * 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. 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 UNIVERSITY 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 UNIVERSITY 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.
+ */
+
+#ifndef _KERN_MIPS_ENDIAN_H_
+#define _KERN_MIPS_ENDIAN_H_
+
+/*
+ * Endianness. While the MIPS can be either big-endian (mipseb) or
+ * little-endian (mipsel), at least for now we only do mipseb.
+ *
+ * This file should only be included via <kern/endian.h> which in turn
+ * should be gotten via <endian.h> in the kernel or <arpa/inet.h> in
+ * userland.
+ */
+
+#define _BYTE_ORDER _BIG_ENDIAN
+
+#endif /* _KERN_MIPS_ENDIAN_H_ */

+ 1 - 0
build/install/include/kern/mips/machine

@@ -0,0 +1 @@
+kern/machine

+ 1 - 0
build/install/include/kern/mips/mips

@@ -0,0 +1 @@
+mips

+ 74 - 0
build/install/include/kern/mips/regdefs.h

@@ -0,0 +1,74 @@
+/*
+ * Copyright (c) 2000, 2001, 2002, 2003, 2004, 2005, 2008, 2009
+ *	The President and Fellows of Harvard College.
+ *
+ * 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. 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 UNIVERSITY 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 UNIVERSITY 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.
+ */
+
+/*
+ * Macros for general-purpose register numbers for MIPS.
+ *
+ * Exported to userlevel because it's ~standard for that architecture.
+ */
+
+#ifndef _KERN_MIPS_REGDEFS_H_
+#define _KERN_MIPS_REGDEFS_H_
+
+
+#define z0  $0     /* always zero register */
+#define AT  $1     /* assembler temp register */
+#define v0  $2     /* value 0 */
+#define v1  $3     /* value 1 */
+#define a0  $4     /* argument 0 */
+#define a1  $5     /* argument 1 */
+#define a2  $6     /* argument 2 */
+#define a3  $7     /* argument 3 */
+#define t0  $8     /* temporary (caller-save) 0 */
+#define t1  $9     /* temporary (caller-save) 1 */
+#define t2  $10    /* temporary (caller-save) 2 */
+#define t3  $11    /* temporary (caller-save) 3 */
+#define t4  $12    /* temporary (caller-save) 4 */
+#define t5  $13    /* temporary (caller-save) 5 */
+#define t6  $14    /* temporary (caller-save) 6 */
+#define t7  $15    /* temporary (caller-save) 7 */
+#define s0  $16    /* saved (callee-save) 0 */
+#define s1  $17    /* saved (callee-save) 1 */
+#define s2  $18    /* saved (callee-save) 2 */
+#define s3  $19    /* saved (callee-save) 3 */
+#define s4  $20    /* saved (callee-save) 4 */
+#define s5  $21    /* saved (callee-save) 5 */
+#define s6  $22    /* saved (callee-save) 6 */
+#define s7  $23    /* saved (callee-save) 7 */
+#define t8  $24    /* temporary (caller-save) 8 */
+#define t9  $25    /* temporary (caller-save) 9 */
+#define k0  $26    /* kernel temporary 0 */
+#define k1  $27    /* kernel temporary 1 */
+#define gp  $28    /* global pointer */
+#define sp  $29    /* stack pointer */
+#define s8  $30    /* saved (callee-save) 8 = frame pointer */
+#define ra  $31    /* return address */
+
+
+#endif /* _KERN_MIPS_REGDEFS_H_ */

+ 47 - 0
build/install/include/kern/mips/setjmp.h

@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2000, 2001, 2002, 2003, 2004, 2005, 2008, 2009
+ *	The President and Fellows of Harvard College.
+ *
+ * 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. 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 UNIVERSITY 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 UNIVERSITY 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.
+ */
+
+#ifndef _MIPS_SETJMP_H_
+#define _MIPS_SETJMP_H_
+
+/*
+ * MIPS jmp_buf definition.
+ */
+
+/*
+ * Must save: s0-s8, sp, ra (11 registers)
+ * Don't change __JB_REGS without adjusting mips_setjmp.S accordingly.
+ */
+#define __JB_REGS  11
+
+/* A jmp_buf is an array of __JB_REGS registers */
+typedef uint32_t jmp_buf[__JB_REGS];
+
+
+#endif /* _MIPS_SETJMP_H_ */

+ 45 - 0
build/install/include/kern/mips/signal.h

@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 2009
+ *	The President and Fellows of Harvard College.
+ *
+ * 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. 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 UNIVERSITY 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 UNIVERSITY 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.
+ */
+
+
+#ifndef _KERN_MIPS_SIGNAL_H_
+#define _KERN_MIPS_SIGNAL_H_
+
+/*
+ * Structure used to hold the register values for returning from a
+ * userland signal handler - basically the saved register values from
+ * whatever userlevel execution context the signal interrupted. Fill
+ * this in as needed, if you ever implement signal handlers. (Which you
+ * probably won't.)
+ */
+struct sigcontext {
+	/* Dummy. */
+};
+
+#endif /* _KERN_MIPS_SIGNAL_H_ */

+ 78 - 0
build/install/include/kern/mips/types.h

@@ -0,0 +1,78 @@
+/*
+ * Copyright (c) 2000, 2001, 2002, 2003, 2004, 2005, 2008, 2009
+ *	The President and Fellows of Harvard College.
+ *
+ * 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. 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 UNIVERSITY 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 UNIVERSITY 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.
+ */
+
+#ifndef _KERN_MIPS_TYPES_H_
+#define _KERN_MIPS_TYPES_H_
+
+/*
+ * Machine-dependent types visible to userland.
+ * (Kernel-only types should go in mips/types.h.)
+ * 32-bit MIPS version.
+ *
+ * See kern/types.h for an explanation of the underscores.
+ */
+
+
+/* Sized integer types, with convenient short names */
+typedef char      __i8;                 /* 8-bit signed integer */
+typedef short     __i16;                /* 16-bit signed integer */
+typedef int       __i32;                /* 32-bit signed integer */
+typedef long long __i64;                /* 64-bit signed integer */
+
+typedef unsigned char      __u8;        /* 8-bit unsigned integer */
+typedef unsigned short     __u16;       /* 16-bit unsigned integer */
+typedef unsigned int       __u32;       /* 32-bit unsigned integer */
+typedef unsigned long long __u64;       /* 64-bit unsigned integer */
+
+/* Further standard C types */
+typedef long __intptr_t;                /* Signed pointer-sized integer */
+typedef unsigned long __uintptr_t;      /* Unsigned pointer-sized integer */
+
+/*
+ * Since we're a 32-bit platform, size_t, ssize_t, and ptrdiff_t can
+ * correctly be either (unsigned) int or (unsigned) long. However, if we
+ * don't define it to the same one gcc is using, gcc will get
+ * upset. If you switch compilers and see otherwise unexplicable type
+ * errors involving size_t, try changing this.
+ */
+#if 1
+typedef unsigned __size_t;              /* Size of a memory region */
+typedef int __ssize_t;                  /* Signed type of same size */
+typedef int __ptrdiff_t;                /* Difference of two pointers */
+#else
+typedef unsigned long __size_t;         /* Size of a memory region */
+typedef long __ssize_t;                 /* Signed type of same size */
+typedef long __ptrdiff_t;               /* Difference of two pointers */
+#endif
+
+/* Number of bits per byte. */
+#define __CHAR_BIT  8
+
+
+#endif /* _KERN_MIPS_TYPES_H_ */

+ 45 - 0
build/install/include/kern/reboot.h

@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 2000, 2001, 2002, 2003, 2004, 2005, 2008
+ *	The President and Fellows of Harvard College.
+ *
+ * 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. 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 UNIVERSITY 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 UNIVERSITY 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.
+ */
+
+#ifndef _KERN_REBOOT_H_
+#define _KERN_REBOOT_H_
+
+/*
+ * Constants for libc's <sys/reboot.h> and the reboot() system call.
+ * (Not all that important.)
+ */
+
+
+/* Codes for reboot */
+#define RB_REBOOT     0      /* Reboot system */
+#define RB_HALT       1      /* Halt system and do not reboot */
+#define RB_POWEROFF   2      /* Halt system and power off */
+
+
+#endif /* _KERN_REBOOT_H_ */

+ 92 - 0
build/install/include/kern/resource.h

@@ -0,0 +1,92 @@
+/*
+ * Copyright (c) 2004, 2008
+ *	The President and Fellows of Harvard College.
+ *
+ * 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. 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 UNIVERSITY 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 UNIVERSITY 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.
+ */
+
+#ifndef _KERN_RESOURCE_H_
+#define _KERN_RESOURCE_H_
+
+/*
+ * Definitions for resource usage and limits.
+ *
+ * Not very important.
+ */
+
+
+/* priorities for setpriority() */
+#define PRIO_MIN	(-20)
+#define PRIO_MAX	20
+
+/* "which" codes for setpriority() */
+#define PRIO_PROCESS	0
+#define PRIO_PGRP	1
+#define PRIO_USER	2
+
+/* flags for getrusage() */
+#define RUSAGE_SELF	0
+#define RUSAGE_CHILDREN	(-1)
+
+struct rusage {
+	struct timeval ru_utime;
+	struct timeval ru_stime;
+	__size_t ru_maxrss;		/* maximum RSS during lifespan (kb) */
+	__counter_t ru_ixrss;		/* text memory usage (kb-ticks) */
+	__counter_t ru_idrss;		/* data memory usage (kb-ticks) */
+	__counter_t ru_isrss;		/* stack memory usage (kb-ticks) */
+	__counter_t ru_minflt;		/* minor VM faults (count) */
+	__counter_t ru_majflt;		/* major VM faults (count) */
+	__counter_t ru_nswap;		/* whole-process swaps (count) */
+	__counter_t ru_inblock;		/* file blocks read (count) */
+	__counter_t ru_oublock;		/* file blocks written (count) */
+	__counter_t ru_msgrcv;		/* socket/pipe packets rcv'd (count) */
+	__counter_t ru_msgsnd;		/* socket/pipe packets sent (count) */
+	__counter_t ru_nsignals;	/* signals delivered (count) */
+	__counter_t ru_nvcsw;		/* voluntary context switches (count)*/
+	__counter_t ru_nivcsw;		/* involuntary ditto (count) */
+};
+
+/* limit codes for getrusage/setrusage */
+
+#define RLIMIT_NPROC		0	/* max procs per user (count) */
+#define RLIMIT_NOFILE		1	/* max open files per proc (count) */
+#define RLIMIT_CPU		2	/* cpu usage (seconds) */
+#define RLIMIT_DATA		3	/* max .data/sbrk size (bytes) */
+#define RLIMIT_STACK		4	/* max stack size (bytes) */
+#define RLIMIT_MEMLOCK		5	/* max locked memory region (bytes) */
+#define RLIMIT_RSS		6	/* max RSS (bytes) */
+#define RLIMIT_CORE		7	/* core file size (bytes) */
+#define RLIMIT_FSIZE		8	/* max file size (bytes) */
+#define __RLIMIT_NUM		9	/* number of limits */
+
+struct rlimit {
+	__rlim_t rlim_cur;	/* soft limit */
+	__rlim_t rlim_max;	/* hard limit */
+};
+
+#define RLIM_INFINITY	(~(__rlim_t)0)
+
+#endif /* _KERN_RESOURCE_H_ */

+ 47 - 0
build/install/include/kern/seek.h

@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2000, 2001, 2002, 2003, 2004, 2005, 2008
+ *	The President and Fellows of Harvard College.
+ *
+ * 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. 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 UNIVERSITY 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 UNIVERSITY 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.
+ */
+
+#ifndef _KERN_SEEK_H_
+#define _KERN_SEEK_H_
+
+/*
+ * Codes for lseek(), which are shared in libc between <fcntl.h> and
+ * <unistd.h> and thus get their own file.
+ *
+ * These are pretty important. Back in the day (like 20+ years ago)
+ * people would often just write the values 0, 1, and 2, but that's
+ * really not recommended.
+ */
+
+#define SEEK_SET      0      /* Seek relative to beginning of file */
+#define SEEK_CUR      1      /* Seek relative to current position in file */
+#define SEEK_END      2      /* Seek relative to end of file */
+
+
+#endif /* _KERN_SEEK_H_ */

+ 98 - 0
build/install/include/kern/sfs.h

@@ -0,0 +1,98 @@
+/*
+ * Copyright (c) 2000, 2001, 2002, 2003, 2004, 2005, 2008, 2009
+ *	The President and Fellows of Harvard College.
+ *
+ * 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. 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 UNIVERSITY 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 UNIVERSITY 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.
+ */
+
+#ifndef _KERN_SFS_H_
+#define _KERN_SFS_H_
+
+
+/*
+ * SFS definitions visible to userspace. This covers the on-disk format
+ * and is used by tools that work on SFS volumes, such as mksfs.
+ */
+
+#define SFS_MAGIC         0xabadf001    /* magic number identifying us */
+#define SFS_BLOCKSIZE     512           /* size of our blocks */
+#define SFS_VOLNAME_SIZE  32            /* max length of volume name */
+#define SFS_NDIRECT       15            /* # of direct blocks in inode */
+#define SFS_DBPERIDB      128           /* # direct blks per indirect blk */
+#define SFS_NAMELEN       60            /* max length of filename */
+#define SFS_SB_LOCATION    0            /* block the superblock lives in */
+#define SFS_ROOT_LOCATION  1            /* loc'n of the root dir inode */
+#define SFS_MAP_LOCATION   2            /* 1st block of the freemap */
+#define SFS_NOINO          0            /* inode # for free dir entry */
+
+/* Number of bits in a block */
+#define SFS_BLOCKBITS (SFS_BLOCKSIZE * CHAR_BIT)
+
+/* Utility macro */
+#define SFS_ROUNDUP(a,b)       ((((a)+(b)-1)/(b))*b)
+
+/* Size of bitmap (in bits) */
+#define SFS_BITMAPSIZE(nblocks) SFS_ROUNDUP(nblocks, SFS_BLOCKBITS)
+
+/* Size of bitmap (in blocks) */
+#define SFS_BITBLOCKS(nblocks)  (SFS_BITMAPSIZE(nblocks)/SFS_BLOCKBITS)
+
+/* File types for sfi_type */
+#define SFS_TYPE_INVAL    0       /* Should not appear on disk */
+#define SFS_TYPE_FILE     1
+#define SFS_TYPE_DIR      2
+
+/*
+ * On-disk superblock
+ */
+struct sfs_super {
+	uint32_t sp_magic;		/* Magic number, should be SFS_MAGIC */
+	uint32_t sp_nblocks;			/* Number of blocks in fs */
+	char sp_volname[SFS_VOLNAME_SIZE];	/* Name of this volume */
+	uint32_t reserved[118];
+};
+
+/*
+ * On-disk inode
+ */
+struct sfs_inode {
+	uint32_t sfi_size;			/* Size of this file (bytes) */
+	uint16_t sfi_type;			/* One of SFS_TYPE_* above */
+	uint16_t sfi_linkcount;			/* # hard links to this file */
+	uint32_t sfi_direct[SFS_NDIRECT];	/* Direct blocks */
+	uint32_t sfi_indirect;			/* Indirect block */
+	uint32_t sfi_waste[128-3-SFS_NDIRECT];	/* unused space, set to 0 */
+};
+
+/*
+ * On-disk directory entry
+ */
+struct sfs_dir {
+	uint32_t sfd_ino;			/* Inode number */
+	char sfd_name[SFS_NAMELEN];		/* Filename */
+};
+
+
+#endif /* _KERN_SFS_H_ */

+ 131 - 0
build/install/include/kern/signal.h

@@ -0,0 +1,131 @@
+/*
+ * 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. 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.4 (Berkeley) 5/4/95
+ */
+
+#ifndef _KERN_SIGNAL_H_
+#define _KERN_SIGNAL_H_
+
+/*
+ * Machine-independent definitions for signals.
+ */
+ 
+
+/*
+ * The signals.
+ *
+ * The values of many of these are "well known", particularly 1, 9,
+ * 10, and 11.
+ *
+ * Note that Unix signals are a semantic cesspool; many have special
+ * properties or are supposed to interact with the system in special
+ * ways. It is gross.
+ */
+
+#define SIGHUP		1	/* Hangup */
+#define SIGINT		2	/* Interrupt (^C) */
+#define SIGQUIT		3	/* Quit (typically ^\) */
+#define SIGILL		4	/* Illegal instruction */
+#define SIGTRAP		5	/* Breakpoint trap */
+#define SIGABRT		6	/* abort() call */
+#define SIGEMT		7	/* Emulator trap */
+#define SIGFPE		8	/* Floating point exception */
+#define SIGKILL		9	/* Hard kill (unblockable) */
+#define SIGBUS		10	/* Bus error, typically bad pointer alignment*/
+#define SIGSEGV		11	/* Segmentation fault */
+#define SIGSYS		12	/* Bad system call */
+#define SIGPIPE		13	/* Broken pipe */
+#define SIGALRM		14	/* alarm() expired */
+#define SIGTERM		15	/* Termination requested (default kill) */
+#define SIGURG		16	/* Urgent data on socket */
+#define SIGSTOP		17	/* Hard process stop (unblockable) */
+#define SIGTSTP		18	/* Terminal stop (^Z) */
+#define SIGCONT		19	/* Time to continue after stop */
+#define SIGCHLD		20	/* Child process exited */
+#define SIGTTIN		21	/* Stop on tty read while in background */
+#define SIGTTOU		22	/* Stop on tty write while in background */
+#define SIGIO		23	/* Nonblocking or async I/O is now ready */
+#define SIGXCPU		24	/* CPU time resource limit exceeded */
+#define SIGXFSZ		25	/* File size resource limit exceeded */
+#define SIGVTALRM	26	/* Like SIGALRM but in virtual time */
+#define SIGPROF		27	/* Profiling timer */
+#define SIGWINCH	28	/* Window size change on tty */
+#define SIGINFO		29	/* Information request (typically ^T) */
+#define SIGUSR1		20	/* Application-defined */
+#define SIGUSR2		31	/* Application-defined */
+#define SIGPWR		32	/* Power failure */
+#define _NSIG		32
+
+
+/* Type for a set of signals; used by e.g. sigprocmask(). */
+typedef __u32 sigset_t;
+
+/* flags for sigaction.sa_flags */
+#define SA_ONSTACK	1	/* Use sigaltstack() stack. */
+#define SA_RESTART	2	/* Restart syscall instead of interrupting. */
+#define SA_RESETHAND	4	/* Clear handler after one usage. */
+
+/* codes for sigprocmask() */
+#define SIG_BLOCK	1	/* Block selected signals. */
+#define SIG_UNBLOCK	2	/* Unblock selected signals. */
+#define SIG_SETMASK	3	/* Set mask to the selected signals. */
+
+/* Type for a signal handler function. */
+typedef void (*__sigfunc)(int);
+
+/* Magic values for signal handlers. */
+#define SIG_DFL		((__sigfunc) 0)		/* Default behavior. */
+#define SIG_IGN		((__sigfunc) 1)		/* Ignore the signal. */
+
+/*
+ * Struct for sigaction().
+ */
+struct sigaction {
+	__sigfunc sa_handler;
+	sigset_t sa_mask;
+	unsigned sa_flags;
+};
+
+/*
+ * Struct for sigaltstack().
+ * (not very important)
+ */
+struct sigaltstack {
+	void *ss_sp;
+	size_t ss_size;
+	unsigned ss_flags;
+};
+
+
+#endif /* _KERN_SIGNAL_H_ */

+ 116 - 0
build/install/include/kern/socket.h

@@ -0,0 +1,116 @@
+/*
+ * Copyright (c) 2004, 2008
+ *	The President and Fellows of Harvard College.
+ *
+ * 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. 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 UNIVERSITY 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 UNIVERSITY 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.
+ */
+
+#ifndef _KERN_SOCKET_H_
+#define _KERN_SOCKET_H_
+
+/*
+ * Socket-related definitions, for <sys/socket.h>.
+ */
+
+
+/*
+ * Important
+ */
+
+/* Socket types that we (might) support. */
+#define SOCK_STREAM	1	/* stream */
+#define SOCK_DGRAM	2	/* packet */
+#define SOCK_RAW	3	/* raw packet */
+
+/* Address families that we (might) support. */
+#define AF_UNSPEC	0
+#define AF_UNIX		1
+#define AF_INET		2
+#define AF_INET6	3
+
+/* Protocol families. Pointless layer of indirection in the standard API. */
+#define PF_UNSPEC	AF_UNSPEC
+#define PF_UNIX		AF_UNIX
+#define PF_INET		AF_INET
+#define PF_INET6	AF_INET6
+
+/*
+ * Socket address structures. Socket addresses are polymorphic, and
+ * the polymorphism is handled by casting pointers. It's fairly gross,
+ * but way too deeply standardized to ever change.
+ *
+ * Each address family defines a sockaddr type (sockaddr_un,
+ * sockaddr_in, etc.) struct sockaddr is the common prefix of all
+ * these, and struct sockaddr_storage is defined to be large enough to
+ * hold any of them.
+ *
+ * The complex padding in sockaddr_storage forces it to be aligned,
+ * which wouldn't happen if it were just a char array.
+ */
+
+struct sockaddr {
+   __u8	sa_len;
+   __u8 sa_family;
+};
+
+#define _SS_SIZE	128
+struct sockaddr_storage {
+   __u8 ss_len;
+   __u8 ss_family;
+   __u8 __ss_pad1;
+   __u8 __ss_pad2;
+   __u32 __ss_pad3;
+   __u64 __ss_pad4;
+   char __ss_pad5[_SS_SIZE - sizeof(__u64) - sizeof(__u32) - 4*sizeof(__u8)];
+};
+
+
+/*
+ * Not very important.
+ */
+
+/*
+ * msghdr structures for sendmsg() and recvmsg().
+ */
+
+struct msghdr {
+	void *msg_name;		/* really sockaddr; address, or null */
+	socklen_t msg_namelen;	/* size of msg_name object, or 0 */
+	struct iovec *msg_iov;	/* I/O buffers */
+	int msg_iovlen;		/* number of iovecs */
+	void *msg_control;	/* auxiliary data area, or null */
+	socklen_t msg_controllen; /* size of msg_control area */
+	int msg_flags;		/* flags */
+};
+
+struct cmsghdr {
+	socklen_t cmsg_len;	/* length of control data, including header */
+	int cmsg_level;		/* protocol layer item originates from */
+	int cmsg_type;		/* protocol-specific message type */
+	/* char cmsg_data[];*/	/* data follows the header */
+};
+
+
+#endif /* _KERN_SOCKET_H_ */

+ 71 - 0
build/install/include/kern/stat.h

@@ -0,0 +1,71 @@
+/*
+ * Copyright (c) 2000, 2001, 2002, 2003, 2004, 2005, 2008
+ *	The President and Fellows of Harvard College.
+ *
+ * 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. 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 UNIVERSITY 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 UNIVERSITY 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.
+ */
+
+#ifndef _KERN_STAT_H_
+#define _KERN_STAT_H_
+
+/*
+ * The stat structure, for returning file information via stat(),
+ * fstat(), and lstat().
+ *
+ * Fields corresponding to things you aren't implementing should be
+ * set to zero.
+ *
+ * The file types are in kern/stattypes.h.
+ */
+struct stat {
+	/* Essential fields */
+	off_t st_size;		/* file size in bytes */
+	mode_t st_mode;		/* file type and protection mode */
+	nlink_t st_nlink;	/* number of hard links */
+	blkcnt_t st_blocks;	/* number of blocks file is using */
+
+ 	/* Identity */
+	dev_t st_dev;           /* device object lives on */
+	ino_t st_ino;           /* inode number (serial number) of object */
+	dev_t st_rdev;          /* device object is (if a device) */
+
+	/* Timestamps */
+	time_t st_atime;        /* last access time: seconds */
+	time_t st_ctime;        /* inode change time: seconds */
+	time_t st_mtime;        /* modification time: seconds */
+	__u32 st_atimensec;     /* last access time: nanoseconds */
+	__u32 st_ctimensec;     /* inode change time: nanoseconds */
+	__u32 st_mtimensec;     /* modification time: nanoseconds */
+
+	/* Permissions (also st_mode) */
+	uid_t st_uid;           /* owner */
+	gid_t st_gid;           /* group */
+
+	/* Other */
+	__u32 st_gen;           /* file generation number (root only) */
+	blksize_t st_blksize;   /* recommended I/O block size */
+};
+
+#endif /* _KERN_STAT_H_ */

+ 55 - 0
build/install/include/kern/stattypes.h

@@ -0,0 +1,55 @@
+/*
+ * Copyright (c) 2000, 2001, 2002, 2003, 2004, 2005, 2008
+ *	The President and Fellows of Harvard College.
+ *
+ * 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. 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 UNIVERSITY 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 UNIVERSITY 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.
+ */
+
+#ifndef _KERN_STATTYPES_H_
+#define _KERN_STATTYPES_H_
+
+/*
+ * Further supporting material for stat(), fstat(), and lstat().
+ *
+ * File types for st_mode. (The permissions are the low 12 bits.)
+ * 
+ * These are also used, shifted right by those 12 bits, in struct
+ * dirent in libc, which is why they get their own file.
+ *
+ * Non-underscore versions of the names can be gotten from <stat.h>
+ * (kernel) or <sys/stat.h> (userland).
+ */
+
+#define _S_IFMT   070000	/* mask for type of file */
+#define _S_IFREG  010000	/* ordinary regular file */
+#define _S_IFDIR  020000	/* directory */
+#define _S_IFLNK  030000	/* symbolic link */
+#define _S_IFIFO  040000	/* pipe or named pipe */
+#define _S_IFSOCK 050000	/* socket */
+#define _S_IFCHR  060000	/* character device */
+#define _S_IFBLK  070000	/* block device */
+
+
+#endif /* _KERN_STATTYPES_H_ */

+ 203 - 0
build/install/include/kern/syscall.h

@@ -0,0 +1,203 @@
+/*
+ * Copyright (c) 2000, 2001, 2002, 2003, 2004, 2005, 2008
+ *	The President and Fellows of Harvard College.
+ *
+ * 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. 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 UNIVERSITY 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 UNIVERSITY 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.
+ */
+
+#ifndef _KERN_SYSCALL_H_
+#define _KERN_SYSCALL_H_
+
+/*
+ * System call numbers.
+ *
+ * To foster compatibility, this file contains a number for every
+ * more-or-less standard Unix system call that someone might
+ * conceivably implement on OS/161. The commented-out ones are ones
+ * we're pretty sure you won't be implementing. The others, you might
+ * or might not. Check your own course materials to find out what's
+ * specifically required of you.
+ *
+ * Caution: this file is parsed by a shell script to generate the assembly
+ * language system call stubs. Don't add weird stuff between the markers.
+ */
+
+/*CALLBEGIN*/
+
+//                              -- Process-related --
+#define SYS_fork         0
+#define SYS_vfork        1
+#define SYS_execv        2
+#define SYS__exit        3
+#define SYS_waitpid      4
+#define SYS_getpid       5
+#define SYS_getppid      6
+//                              (virtual memory)
+#define SYS_sbrk         7
+#define SYS_mmap         8
+#define SYS_munmap       9
+#define SYS_mprotect     10
+//#define SYS_madvise    11
+//#define SYS_mincore    12
+//#define SYS_mlock      13
+//#define SYS_munlock    14
+//#define SYS_munlockall 15
+//#define SYS_minherit   16
+//                              (security/credentials)
+#define SYS_umask        17
+#define SYS_issetugid    18
+#define SYS_getresuid    19
+#define SYS_setresuid    20
+#define SYS_getresgid    21
+#define SYS_setresgid    22
+#define SYS_getgroups    23
+#define SYS_setgroups    24
+#define SYS___getlogin   25
+#define SYS___setlogin   26
+//                              (signals)
+#define SYS_kill         27
+#define SYS_sigaction    28
+#define SYS_sigpending   29
+#define SYS_sigprocmask  30
+#define SYS_sigsuspend   31
+#define SYS_sigreturn    32
+//#define SYS_sigaltstack 33
+//                              (resource tracking and usage)
+//#define SYS_wait4      34
+//#define SYS_getrusage  35
+//                              (resource limits)
+//#define SYS_getrlimit  36
+//#define SYS_setrlimit  37
+//                              (process priority control)
+//#define SYS_getpriority 38
+//#define SYS_setpriority 39
+//                              (process groups, sessions, and job control)
+//#define SYS_getpgid    40
+//#define SYS_setpgid    41
+//#define SYS_getsid     42
+//#define SYS_setsid     43
+//                              (userlevel debugging)
+//#define SYS_ptrace     44
+
+//                              -- File-handle-related --
+#define SYS_open         45
+#define SYS_pipe         46
+#define SYS_dup          47
+#define SYS_dup2         48
+#define SYS_close        49
+#define SYS_read         50
+#define SYS_pread        51
+//#define SYS_readv      52
+//#define SYS_preadv     53
+#define SYS_getdirentry  54
+#define SYS_write        55
+#define SYS_pwrite       56
+//#define SYS_writev     57
+//#define SYS_pwritev    58
+#define SYS_lseek        59
+#define SYS_flock        60
+#define SYS_ftruncate    61
+#define SYS_fsync        62
+#define SYS_fcntl        63
+#define SYS_ioctl        64
+#define SYS_select       65
+#define SYS_poll         66
+
+//                              -- Pathname-related --
+#define SYS_link         67
+#define SYS_remove       68
+#define SYS_mkdir        69
+#define SYS_rmdir        70
+#define SYS_mkfifo       71
+#define SYS_rename       72
+#define SYS_access       73
+//                              (current directory)
+#define SYS_chdir        74
+#define SYS_fchdir       75
+#define SYS___getcwd     76
+//                              (symbolic links)
+#define SYS_symlink      77
+#define SYS_readlink     78
+//                              (mount)
+#define SYS_mount        79
+#define SYS_unmount      80
+
+
+//                              -- Any-file-related --
+#define SYS_stat         81
+#define SYS_fstat        82
+#define SYS_lstat        83
+//                              (timestamps)
+#define SYS_utimes       84
+#define SYS_futimes      85
+#define SYS_lutimes      86
+//                              (security/permissions)
+#define SYS_chmod        87
+#define SYS_chown        88
+#define SYS_fchmod       89
+#define SYS_fchown       90
+#define SYS_lchmod       91
+#define SYS_lchown       92
+//                              (file system info)
+//#define SYS_statfs     93
+//#define SYS_fstatfs    94
+//#define SYS_getfsstat  95
+//                              (POSIX dynamic system limits stuff)
+//#define SYS_pathconf   96
+//#define SYS_fpathconf  97
+
+//                              -- Sockets and networking --
+#define SYS_socket       98
+#define SYS_bind         99
+#define SYS_connect      100
+#define SYS_listen       101
+#define SYS_accept       102
+//#define SYS_socketpair 103
+#define SYS_shutdown     104
+#define SYS_getsockname  105
+#define SYS_getpeername  106
+#define SYS_getsockopt   107
+#define SYS_setsockopt   108
+//#define SYS_recvfrom   109
+//#define SYS_sendto     110
+//#define SYS_recvmsg    111
+//#define SYS_sendmsg    112
+
+//                              -- Time-related --
+#define SYS___time       113
+#define SYS___settime    114
+#define SYS_nanosleep    115
+//#define SYS_getitimer  116
+//#define SYS_setitimer  117
+
+//                              -- Other --
+#define SYS_sync         118
+#define SYS_reboot       119
+//#define SYS___sysctl   120
+
+/*CALLEND*/
+
+
+#endif /* _KERN_SYSCALL_H_ */

+ 70 - 0
build/install/include/kern/time.h

@@ -0,0 +1,70 @@
+/*
+ * Copyright (c) 2004, 2008
+ *	The President and Fellows of Harvard College.
+ *
+ * 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. 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 UNIVERSITY 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 UNIVERSITY 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.
+ */
+
+#ifndef _KERN_TIME_H_
+#define _KERN_TIME_H_
+
+/*
+ * Time-related definitions, for <sys/time.h> and others.
+ */
+
+
+/*
+ * Time with fractional seconds. Important. Unfortunately, to be
+ * compatible, we need both timeval and timespec.
+ */
+
+struct timeval {
+        __time_t tv_sec;        /* seconds */
+        __i32 tv_usec;          /* microseconds */
+};
+
+struct timespec {
+        __time_t tv_sec;        /* seconds */
+        __i32 tv_nsec;          /* nanoseconds */
+};
+
+
+/*
+ * Bits for interval timers. Obscure and not really that important.
+ */
+
+/* codes for the various timers */
+#define ITIMER_REAL	0	/* Real (wall-clock) time. */
+#define ITIMER_VIRTUAL	1	/* Virtual (when process is executing) time. */
+#define ITIMER_PROF	2	/* For execution profiling. */
+
+/* structure for setitimer/getitimer */
+struct itimerval {
+        struct timeval it_interval;	/* Time to reload after expiry. */
+	struct timeval it_value;	/* Time to count. */
+};
+
+
+#endif /* _KERN_TIME_H_ */

+ 92 - 0
build/install/include/kern/types.h

@@ -0,0 +1,92 @@
+/*
+ * Copyright (c) 2000, 2001, 2002, 2003, 2004, 2005, 2008
+ *	The President and Fellows of Harvard College.
+ *
+ * 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. 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 UNIVERSITY 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 UNIVERSITY 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.
+ */
+
+#ifndef _KERN_TYPES_H_
+#define _KERN_TYPES_H_
+
+/* Get machine-dependent types. */
+#include <kern/machine/types.h>
+
+/*
+ * Machine-independent types visible to user level.
+ *
+ * Define everything with leading underscores to avoid polluting the C
+ * namespace for applications.
+ *
+ * The C standard (and additionally the POSIX standard) define rules
+ * for what families of symbol names are allowed to be used by
+ * application programmers, and what families of symbol names can be
+ * defined by various standard header files. The C library needs to
+ * conform to those rules, to the extent reasonably practical, to make
+ * sure that application code compiles and behaves as intended.
+ *
+ * Many of the C library's headers need to use one or more of these
+ * types in places where the "real" name of the type cannot be
+ * exposed, or expose the names of some of these types and not others.
+ * (For example, <string.h> is supposed to define size_t, but is not
+ * supposed to also define e.g. pid_t.)
+ *
+ * For this reason we define everything with two underscores in front
+ * of it; in C such symbol names are reserved for the implementation,
+ * which we are, so this file can be included anywhere in any libc
+ * header without causing namespace problems. The "real" type names
+ * are defined with an additional layer of typedefs; this happens for
+ * the kernel in <types.h> and for userland in (mostly) <sys/types.h>
+ * and also various other places as per relevant standards.
+ */
+
+typedef __u32 __blkcnt_t;  /* Count of blocks */
+typedef __u32 __blksize_t; /* Size of an I/O block */
+typedef __u64 __counter_t; /* Event counter */
+typedef __u32 __daddr_t;   /* Disk block number */
+typedef __u32 __dev_t;     /* Hardware device ID */
+typedef __u32 __fsid_t;    /* Filesystem ID */
+typedef __i32 __gid_t;     /* Group ID */
+typedef __u32 __in_addr_t; /* Internet address */
+typedef __u32 __in_port_t; /* Internet port number */
+typedef __u32 __ino_t;     /* Inode number */
+typedef __u32 __mode_t;    /* File access mode */
+typedef __u16 __nlink_t;   /* Number of links (intentionally only 16 bits) */
+typedef __i64 __off_t;     /* Offset within file */
+typedef __i32 __pid_t;     /* Process ID */
+typedef __u64 __rlim_t;    /* Resource limit quantity */
+typedef __u8 __sa_family_t;/* Socket address family */
+typedef __i64 __time_t;    /* Time in seconds */
+typedef __i32 __uid_t;     /* User ID */
+
+typedef int __nfds_t;    /* Number of file handles */
+typedef int __socklen_t;   /* Socket-related length */
+
+/* See note in <stdarg.h> */
+#ifdef __GNUC__
+typedef __builtin_va_list __va_list;
+#endif
+
+
+#endif /* _KERN_TYPES_H_ */

+ 39 - 0
build/install/include/kern/unistd.h

@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2000, 2001, 2002, 2003, 2004, 2005, 2008
+ *	The President and Fellows of Harvard College.
+ *
+ * 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. 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 UNIVERSITY 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 UNIVERSITY 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.
+ */
+
+#ifndef _KERN_UNISTD_H_
+#define _KERN_UNISTD_H_
+
+/* Constants for read/write/etc: special file handles */
+#define STDIN_FILENO  0      /* Standard input */
+#define STDOUT_FILENO 1      /* Standard output */
+#define STDERR_FILENO 2      /* Standard error */
+
+
+#endif /* _KERN_UNISTD_H_ */

+ 79 - 0
build/install/include/kern/wait.h

@@ -0,0 +1,79 @@
+/*
+ * Copyright (c) 2003, 2008
+ *	The President and Fellows of Harvard College.
+ *
+ * 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. 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 UNIVERSITY 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 UNIVERSITY 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.
+ */
+
+#ifndef _KERN_WAIT_H_
+#define _KERN_WAIT_H_
+
+/*
+ * Definitions for wait().
+ */
+
+
+/* Flags for waitpid() and equivalent. */
+#define WNOHANG      1	/* Nonblocking. */
+#define WUNTRACED    2	/* Report stopping as well as exiting processes. */
+
+/* Special "pids" to wait for. */
+#define WAIT_ANY     (-1)	/* Any child process. */
+#define WAIT_MYPGRP  0		/* Any process in the same process group. */
+
+/*
+ * Result encoding.
+ *
+ * The lowest two bits say what happened; the rest encodes up to 30
+ * bits of exit code. Note that the traditional Unix encoding, which
+ * is different, wastes most of the bits and can only transmit 8 bits
+ * of exit code...
+ */
+#define _WWHAT(x)  ((x)&3)	/* lower two bits say what happened */
+#define _WVAL(x)   ((x)>>2)	/* the rest is the value */
+#define _MKWVAL(x) ((x)<<2)	/* encode a value */
+
+/* Four things can happen... */
+#define __WEXITED    0		/* Process exited by calling _exit(). */
+#define __WSIGNALED  1		/* Process received a fatal signal. */
+#define __WCORED     2		/* Process dumped core on a fatal signal. */
+#define __WSTOPPED   3		/* Process stopped (and didn't exit). */
+
+/* Test macros, used by applications. */
+#define WIFEXITED(x)   (_WWHAT(x)==__WEXITED)
+#define WIFSIGNALED(x) (_WWHAT(x)==__WSIGNALED || _WWHAT(x)==__WCORED)
+#define WIFSTOPPED(x)  (_WWHAT(x)==__WSTOPPED)
+#define WEXITSTATUS(x) (_WVAL(x))
+#define WTERMSIG(x)    (_WVAL(x))
+#define WSTOPSIG(x)    (_WVAL(x))
+#define WCOREDUMP(x)   (_WWHAT(x)==__WCORED)
+
+/* Encoding macros, used by the kernel to generate the wait result. */
+#define _MKWAIT_EXIT(x) (_MKWVAL(x)|__WEXITED)
+#define _MKWAIT_SIG(x)  (_MKWVAL(x)|__WSIGNALED)
+#define _MKWAIT_CORE(x) (_MKWVAL(x)|__WCORED)
+#define _MKWAIT_STOP(x) (_MKWVAL(x)|__WSTOPPED)
+
+#endif /* _KERN_WAIT_H_ */

+ 53 - 0
build/install/include/limits.h

@@ -0,0 +1,53 @@
+/*
+ * Copyright (c) 2000, 2001, 2002, 2003, 2004, 2005, 2008, 2009
+ *	The President and Fellows of Harvard College.
+ *
+ * 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. 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 UNIVERSITY 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 UNIVERSITY 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.
+ */
+
+#ifndef _LIMITS_H_
+#define _LIMITS_H_
+
+/*
+ * System limits.
+ */
+
+/* Get the limits the kernel exports. libc doesn't have any limits :-) */ 
+#include <kern/limits.h>
+
+/* Provide the real names */
+#define NAME_MAX        __NAME_MAX
+#define PATH_MAX        __PATH_MAX
+#define ARG_MAX         __ARG_MAX
+#define PID_MIN         __PID_MIN
+#define PID_MAX         __PID_MAX
+#define PIPE_BUF        __PIPE_BUF
+#define NGROUPS_MAX     __NGROUPS_MAX
+#define LOGIN_NAME_MAX  __LOGIN_NAME_MAX
+#define OPEN_MAX        __OPEN_MAX
+#define IOV_MAX         __IOV_MAX
+
+
+#endif /* _LIMITS_H_ */

+ 1 - 0
build/install/include/machine

@@ -0,0 +1 @@
+kern/machine

+ 52 - 0
build/install/include/setjmp.h

@@ -0,0 +1,52 @@
+/*
+ * Copyright (c) 2000, 2001, 2002, 2003, 2004, 2005, 2008, 2009
+ *	The President and Fellows of Harvard College.
+ *
+ * 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. 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 UNIVERSITY 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 UNIVERSITY 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.
+ */
+
+#ifndef _SETJMP_H_
+#define _SETJMP_H_
+
+/* Get the (machine-dependent) definition of jmp_buf. */
+#include <machine/setjmp.h>
+
+/*
+ * Functions.
+ *
+ * setjmp saves the current processor state in the jmp_buf and 
+ * returns 0. A subsequent call to longjmp with the same jmp_buf
+ * causes execution to return to where setjmp was called. setjmp
+ * returns a second time, this time returning CODE. (If CODE is
+ * 0, it is forced to 1.)
+ *
+ * If the stack frame that called setjmp returns before longjmp is
+ * called, the results are undefined. 
+ */
+
+int setjmp(jmp_buf jb);
+void longjmp(jmp_buf jb, int code);
+
+#endif /* _SETJMP_H_ */

+ 30 - 0
build/install/include/signal.h

@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 2009
+ *	The President and Fellows of Harvard College.
+ *
+ * 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. 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 UNIVERSITY 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 UNIVERSITY 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.
+ */
+
+#include <kern/signal.h>

+ 48 - 0
build/install/include/stdarg.h

@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 2000, 2001, 2002, 2003, 2004, 2005, 2008, 2009
+ *	The President and Fellows of Harvard College.
+ *
+ * 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. 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 UNIVERSITY 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 UNIVERSITY 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.
+ */
+
+#ifndef _STDARG_H_
+#define _STDARG_H_
+
+#include <kern/types.h>
+
+/*
+ * As of gcc 3.0, the stdarg declarations can be made
+ * machine-independent because gcc abstracts the implementations away
+ * for us.
+ */
+
+typedef __va_list va_list;
+
+#define va_start(ap,fmt) __builtin_stdarg_start(ap,fmt)
+#define va_arg(ap,t) __builtin_va_arg(ap,t)
+#define va_copy(ap1,ap2) __builtin_va_copy(ap1,ap2)
+#define va_end(ap) __builtin_va_end(ap)
+
+#endif /* _STDARG_H_ */

+ 51 - 0
build/install/include/stdint.h

@@ -0,0 +1,51 @@
+/*
+ * Copyright (c) 2000, 2001, 2002, 2003, 2004, 2005, 2008, 2009
+ *	The President and Fellows of Harvard College.
+ *
+ * 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. 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 UNIVERSITY 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 UNIVERSITY 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.
+ */
+
+#ifndef _STDINT_H_
+#define _STDINT_H_
+
+/*
+ * <stdint.h> - C99 header file with sized integer types.
+ */
+
+#include <kern/types.h>
+
+typedef __i8 int8_t;
+typedef __i16 int16_t;
+typedef __i32 int32_t;
+typedef __i64 int64_t;
+typedef __u8 uint8_t;
+typedef __u16 uint16_t;
+typedef __u32 uint32_t;
+typedef __u64 uint64_t;
+
+typedef __intptr_t intptr_t;
+typedef __uintptr_t uintptr_t;
+
+#endif /* _STDINT_H_ */

+ 72 - 0
build/install/include/stdio.h

@@ -0,0 +1,72 @@
+/*
+ * Copyright (c) 2000, 2001, 2002, 2003, 2004, 2005, 2008, 2009
+ *	The President and Fellows of Harvard College.
+ *
+ * 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. 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 UNIVERSITY 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 UNIVERSITY 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.
+ */
+
+#ifndef _STDIO_H_
+#define _STDIO_H_
+
+/*
+ * Get the __-protected definition of va_list. We aren't supposed to
+ * include stdarg.h here.
+ */
+#include <kern/types.h>
+#include <types/size_t.h>
+#include <sys/null.h>
+
+/* Constant returned by a bunch of stdio functions on error */
+#define EOF (-1)
+
+/*
+ * The actual guts of printf
+ * (for libc internal use only)
+ */
+int __vprintf(void (*sendfunc)(void *clientdata, const char *, size_t len),
+	      void *clientdata,
+	      const char *fmt,
+	      __va_list ap);
+
+/* Printf calls for user programs */
+int printf(const char *fmt, ...);
+int vprintf(const char *fmt, __va_list ap);
+int snprintf(char *buf, size_t len, const char *fmt, ...);
+int vsnprintf(char *buf, size_t len, const char *fmt, __va_list ap);
+
+/* Print the argument string and then a newline. Returns 0 or -1 on error. */
+int puts(const char *);
+
+/* Like puts, but without the newline. Returns #chars written. */
+/* Nonstandard C, hence the __. */
+int __puts(const char *);
+
+/* Writes one character. Returns it. */
+int putchar(int);
+
+/* Reads one character (0-255) or returns EOF on error. */
+int getchar(void);
+
+#endif /* _STDIO_H_ */

+ 73 - 0
build/install/include/stdlib.h

@@ -0,0 +1,73 @@
+/*
+ * Copyright (c) 2000, 2001, 2002, 2003, 2004, 2005, 2008, 2009
+ *	The President and Fellows of Harvard College.
+ *
+ * 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. 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 UNIVERSITY 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 UNIVERSITY 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.
+ */
+
+#ifndef _STDLIB_H_
+#define _STDLIB_H_
+
+#include <kern/types.h>
+#include <types/size_t.h>
+#include <sys/null.h>
+
+/*
+ * Ascii to integer - turn a string holding a number into a number.
+ */
+int atoi(const char *);
+
+/*
+ * Standard routine to bail out of a program in a severe error condition.
+ */
+void abort(void);
+
+/*
+ * Routine to exit cleanly.
+ * (This does libc cleanup before calling the _exit system call.)
+ */
+void exit(int code);
+
+/*
+ * Run a command. Returns its exit status as it comes back from waitpid().
+ */
+int system(const char *command);
+
+/*
+ * Pseudo-random number generator.
+ */
+#define RAND_MAX  0x7fffffff
+long random(void);
+void srandom(unsigned long seed);
+char *initstate(unsigned long, char *, size_t);
+char *setstate(char *);
+
+/*
+ * Memory allocation functions.
+ */
+void *malloc(size_t size);
+void free(void *ptr);
+
+#endif /* _STDLIB_H_ */

+ 65 - 0
build/install/include/string.h

@@ -0,0 +1,65 @@
+/*
+ * Copyright (c) 2000, 2001, 2002, 2003, 2004, 2005, 2008, 2009
+ *	The President and Fellows of Harvard College.
+ *
+ * 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. 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 UNIVERSITY 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 UNIVERSITY 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.
+ */
+
+#ifndef _STRING_H_
+#define _STRING_H_
+
+#include <kern/types.h>
+#include <types/size_t.h>
+#include <sys/null.h>
+
+/*
+ * Standard C string functions.
+ */
+char *strcat(char *, const char *);
+char *strcpy(char *, const char *);
+char *strchr(const char *, int);
+char *strrchr(const char *, int);
+int strcmp(const char *, const char *);
+size_t strlen(const char *);
+char *strtok_r(char *, const char *, char **);
+char *strtok(char *, const char *);
+
+void *memset(void *, int c, size_t);
+void *memcpy(void *, const void *, size_t);
+void *memmove(void *, const void *, size_t);
+int memcmp(const void *, const void *, size_t);
+
+/*
+ * POSIX string functions.
+ */
+const char *strerror(int errcode);
+
+/*
+ * BSD string functions.
+ */
+void bzero(void *, size_t);
+
+
+#endif /* _STRING_H_ */

+ 35 - 0
build/install/include/sys/endian.h

@@ -0,0 +1,35 @@
+/*
+ * Copyright (c) 2009
+ *	The President and Fellows of Harvard College.
+ *
+ * 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. 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 UNIVERSITY 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 UNIVERSITY 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.
+ */
+
+#ifndef _SYS_ENDIAN_H_
+#define _SYS_ENDIAN_H_
+
+#include <kern/endian.h>
+
+#endif /* _SYS_ENDIAN_H_ */

+ 31 - 0
build/install/include/sys/ioctl.h

@@ -0,0 +1,31 @@
+/*
+ * Copyright (c) 2000, 2001, 2002, 2003, 2004, 2005, 2008, 2009
+ *	The President and Fellows of Harvard College.
+ *
+ * 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. 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 UNIVERSITY 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 UNIVERSITY 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.
+ */
+
+/* This file is for UNIX compat. In OS/161, everything's in <unistd.h> */
+#include <unistd.h>

+ 39 - 0
build/install/include/sys/null.h

@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2000, 2001, 2002, 2003, 2004, 2005, 2008, 2009
+ *	The President and Fellows of Harvard College.
+ *
+ * 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. 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 UNIVERSITY 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 UNIVERSITY 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.
+ */
+
+#ifndef _SYS_NULL_H_
+#define _SYS_NULL_H_
+
+/*
+ * Null pointer.
+ */
+
+#define NULL ((void *)0)
+
+#endif /* _SYS_NULL_H_ */

+ 31 - 0
build/install/include/sys/reboot.h

@@ -0,0 +1,31 @@
+/*
+ * Copyright (c) 2000, 2001, 2002, 2003, 2004, 2005, 2008, 2009
+ *	The President and Fellows of Harvard College.
+ *
+ * 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. 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 UNIVERSITY 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 UNIVERSITY 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.
+ */
+
+/* This file is for UNIX compat. In OS/161, everything's in <unistd.h> */
+#include <unistd.h>

+ 83 - 0
build/install/include/sys/stat.h

@@ -0,0 +1,83 @@
+/*
+ * Copyright (c) 2000, 2001, 2002, 2003, 2004, 2005, 2008, 2009
+ *	The President and Fellows of Harvard College.
+ *
+ * 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. 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 UNIVERSITY 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 UNIVERSITY 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.
+ */
+
+#ifndef _SYS_STAT_H_
+#define _SYS_STAT_H_
+
+/*
+ * Get struct stat and all the #defines from the kernel
+ */
+#include <kern/stat.h>
+#include <kern/stattypes.h>
+
+/*
+ * Test macros for object types.
+ */
+#define S_ISDIR(mode) ((mode & _S_IFMT) == _S_IFDIR)
+#define S_ISREG(mode) ((mode & _S_IFMT) == _S_IFREG)
+#define S_ISDIR(mode) ((mode & _S_IFMT) == _S_IFDIR)
+#define S_ISLNK(mode) ((mode & _S_IFMT) == _S_IFLNK)
+#define S_ISIFO(mode) ((mode & _S_IFMT) == _S_IFIFO)
+#define S_ISSOCK(mode) ((mode & _S_IFMT) ==_S_IFSOCK)
+#define S_ISCHR(mode) ((mode & _S_IFMT) == _S_IFCHR)
+#define S_ISBLK(mode) ((mode & _S_IFMT) == _S_IFBLK)
+
+/*
+ * Provide non-underscore names. These are not actually standard; for
+ * some reason only the test macros are.
+ */
+#define S_IFMT   _S_IFMT
+#define S_IFREG  _S_IFREG
+#define S_IFDIR  _S_IFDIR
+#define S_IFLNK  _S_IFLNK
+#define S_IFIFO  _S_IFIFO
+#define S_IFSOCK _S_IFSOCK
+#define S_IFCHR  _S_IFCHR
+#define S_IFBLK  _S_IFBLK
+
+/*
+ * stat is the same as fstat, only on a file that isn't already
+ * open. lstat is the same as stat, only if the name passed names a
+ * symlink, information about the symlink is returned rather than
+ * information about the file it points to. You don't need to
+ * implement lstat unless you're implementing symbolic links.
+ */
+int fstat(int filehandle, struct stat *buf);
+int stat(const char *path, struct stat *buf);
+int lstat(const char *path, struct stat *buf);
+
+/* 
+ * The second argument to mkdir is the mode for the new directory.
+ * Unless you're implementing security and permissions, you can
+ * (and should) ignore it. See notes in unistd.h.
+ */
+int mkdir(const char *dirname, int ignore);
+
+
+#endif /* _SYS_STAT_H_ */

+ 87 - 0
build/install/include/sys/types.h

@@ -0,0 +1,87 @@
+/*
+ * Copyright (c) 2000, 2001, 2002, 2003, 2004, 2005, 2008, 2009
+ *	The President and Fellows of Harvard College.
+ *
+ * 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. 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 UNIVERSITY 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 UNIVERSITY 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.
+ */
+
+#ifndef _SYS_TYPES_H_
+#define _SYS_TYPES_H_
+
+/*
+ * This header file is supposed to define standard system types,
+ * stuff like size_t and pid_t, as well as define a few other
+ * standard symbols like NULL.
+ *
+ * There are no such types that are user-level only.
+ */
+
+/* Get the exported kernel definitions, protected with __ */
+#include <kern/types.h>
+
+/* Pick up stuff that needs to be defined individually due to standards. */
+#include <types/size_t.h>
+#include <sys/null.h>
+
+/*
+ * Define the rest with user-visible names.
+ *
+ * Note that the standards-compliance stuff is not by any means
+ * complete here yet...
+ */
+
+typedef __ssize_t ssize_t;
+typedef __ptrdiff_t ptrdiff_t;
+
+/* ...and machine-independent from <kern/types.h>. */
+typedef __blkcnt_t blkcnt_t;
+typedef __blksize_t blksize_t;
+typedef __daddr_t daddr_t;
+typedef __dev_t dev_t;
+typedef __fsid_t fsid_t;
+typedef __gid_t gid_t;
+typedef __in_addr_t in_addr_t;
+typedef __in_port_t in_port_t;
+typedef __ino_t ino_t;
+typedef __mode_t mode_t;
+typedef __nlink_t nlink_t;
+typedef __off_t off_t;
+typedef __pid_t pid_t;
+typedef __rlim_t rlim_t;
+typedef __sa_family_t sa_family_t;
+typedef __time_t time_t;
+typedef __uid_t uid_t;
+
+typedef __nfds_t nfds_t;
+typedef __socklen_t socklen_t;
+
+/*
+ * Number of bits per byte.
+ */
+
+#define CHAR_BIT __CHAR_BIT
+
+
+#endif /* _SYS_TYPES_H_ */

+ 31 - 0
build/install/include/sys/wait.h

@@ -0,0 +1,31 @@
+/*
+ * Copyright (c) 2000, 2001, 2002, 2003, 2004, 2005, 2008, 2009
+ *	The President and Fellows of Harvard College.
+ *
+ * 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. 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 UNIVERSITY 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 UNIVERSITY 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.
+ */
+
+/* This file is for UNIX compat. In OS/161, everything's in <unistd.h> */
+#include <unistd.h>

+ 31 - 0
build/install/include/time.h

@@ -0,0 +1,31 @@
+/*
+ * Copyright (c) 2000, 2001, 2002, 2003, 2004, 2005, 2008, 2009
+ *	The President and Fellows of Harvard College.
+ *
+ * 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. 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 UNIVERSITY 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 UNIVERSITY 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.
+ */
+
+/* This file is for UNIX compat. In OS/161, everything's in <unistd.h> */
+#include <unistd.h>

+ 36 - 0
build/install/include/types/size_t.h

@@ -0,0 +1,36 @@
+/*
+ * Copyright (c) 2000, 2001, 2002, 2003, 2004, 2005, 2008, 2009
+ *	The President and Fellows of Harvard College.
+ *
+ * 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. 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 UNIVERSITY 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 UNIVERSITY 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.
+ */
+
+#ifndef _TYPES_SIZE_T_H_
+#define _TYPES_SIZE_T_H_
+
+#include <kern/types.h>
+typedef __size_t size_t;
+
+#endif /* _TYPES_SIZE_T_H_ */

+ 167 - 0
build/install/include/unistd.h

@@ -0,0 +1,167 @@
+/*
+ * Copyright (c) 2000, 2001, 2002, 2003, 2004, 2005, 2008, 2009
+ *	The President and Fellows of Harvard College.
+ *
+ * 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. 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 UNIVERSITY 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 UNIVERSITY 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.
+ */
+
+#ifndef _UNISTD_H_
+#define _UNISTD_H_
+
+#include <sys/types.h>
+
+/*
+ * Get the various constants (flags, codes, etc.) for calls from
+ * kernel includes. This way user-level code doesn't need to know
+ * about the kern/ headers.
+ */
+#include <kern/fcntl.h>
+#include <kern/ioctl.h>
+#include <kern/reboot.h>
+#include <kern/seek.h>
+#include <kern/time.h>
+#include <kern/unistd.h>
+#include <kern/wait.h>
+
+
+/*
+ * Prototypes for OS/161 system calls.
+ *
+ * Note that the following system calls are prototyped in other
+ * header files, as follows:
+ *
+ *     stat:     sys/stat.h
+ *     fstat:    sys/stat.h
+ *     lstat:    sys/stat.h
+ *     mkdir:    sys/stat.h
+ *
+ * If this were standard Unix, more prototypes would go in other
+ * header files as well, as follows:
+ * 
+ *     waitpid:  sys/wait.h
+ *     open:     fcntl.h or sys/fcntl.h
+ *     reboot:   sys/reboot.h
+ *     ioctl:    sys/ioctl.h
+ *     remove:   stdio.h
+ *     rename:   stdio.h
+ *     time:     time.h
+ *
+ * Also note that the prototypes for open() and mkdir() contain, for
+ * compatibility with Unix, an extra argument that is not meaningful
+ * in OS/161. This is the "mode" (file permissions) for a newly created
+ * object. (With open, if no file is created, this is ignored, and the
+ * call prototype is gimmicked so it doesn't have to be passed either.)
+ * 
+ * You should ignore these arguments in the OS/161 kernel unless you're
+ * implementing security and file permissions. 
+ *
+ * If you are implementing security and file permissions and using a 
+ * model different from Unix so that you need different arguments to
+ * these calls, you may make appropriate changes, or define new syscalls
+ * with different names and take the old ones out, or whatever. 
+ *
+ * As a general rule of thumb, however, while you can make as many new
+ * syscalls of your own as you like, you shouldn't change the
+ * definitions of the ones that are already here. They've been written
+ * to be pretty much compatible with Unix, and the teaching staff has
+ * test code that expects them to behave in particular ways.
+ *
+ * Of course, if you want to redesign the user/kernel API and make a
+ * lot of work for yourself, feel free, just contact the teaching
+ * staff beforehand. :-)
+ *
+ * The categories (required/recommended/optional) are guesses - check
+ * the text of the various assignments for an authoritative list.
+ */
+
+
+/*
+ * NOTE NOTE NOTE NOTE NOTE
+ *
+ * This file is *not* shared with the kernel, even though in a sense
+ * the kernel needs to know about these prototypes. This is because,
+ * due to error handling concerns, the in-kernel versions of these
+ * functions will usually have slightly different signatures.
+ */
+
+
+#ifdef __GNUC__
+/* GCC gets into a snit if _exit isn't declared to not return */
+#define __DEAD __attribute__((__noreturn__))
+#else
+#define __DEAD
+#endif
+
+/* Required. */
+__DEAD void _exit(int code);
+int execv(const char *prog, char *const *args);
+pid_t fork(void);
+int waitpid(pid_t pid, int *returncode, int flags);
+/* 
+ * Open actually takes either two or three args: the optional third
+ * arg is the file mode used for creation. Unless you're implementing
+ * security and permissions, you can ignore it.
+ */
+int open(const char *filename, int flags, ...);
+int read(int filehandle, void *buf, size_t size);
+int write(int filehandle, const void *buf, size_t size);
+int close(int filehandle);
+int reboot(int code);
+int sync(void);
+/* mkdir - see sys/stat.h */
+int rmdir(const char *dirname);
+
+/* Recommended. */
+int getpid(void);
+int ioctl(int filehandle, int code, void *buf);
+off_t lseek(int filehandle, off_t pos, int code);
+int fsync(int filehandle);
+int ftruncate(int filehandle, off_t size);
+int remove(const char *filename);
+int rename(const char *oldfile, const char *newfile);
+int link(const char *oldfile, const char *newfile);
+/* fstat - see sys/stat.h */
+int chdir(const char *path);
+
+/* Optional. */
+void *sbrk(int change);
+int getdirentry(int filehandle, char *buf, size_t buflen);
+int symlink(const char *target, const char *linkname);
+int readlink(const char *path, char *buf, size_t buflen);
+int dup2(int filehandle, int newhandle);
+int pipe(int filehandles[2]);
+time_t __time(time_t *seconds, unsigned long *nanoseconds);
+int __getcwd(char *buf, size_t buflen);
+/* stat - see sys/stat.h */
+/* lstat - see sys/stat.h */
+
+/*
+ * These are not themselves system calls, but wrapper routines in libc.
+ */
+
+char *getcwd(char *buf, size_t buflen);		/* calls __getcwd */
+time_t time(time_t *seconds);			/* calls __time */
+
+#endif /* _UNISTD_H_ */

+ 42 - 0
build/install/man/bin/cat.html

@@ -0,0 +1,42 @@
+<html>
+<head>
+<title>cat</title>
+<body bgcolor=#ffffff>
+<h2 align=center>cat</h2>
+<h4 align=center>OS/161 Reference Manual</h4>
+
+<h3>Name</h3>
+cat - concatenate and print files
+
+<h3>Synopsis</h3>
+/bin/cat <em>files...</em>
+
+<h3>Description</h3>
+
+cat prints the files listed on its command line in order to its
+standard output. If the magic filename "-" is encountered, cat
+prints its standard input up to the first EOF.
+<p>
+
+With no arguments, cat prints its standard input.
+<p>
+
+cat takes no options.
+<p>
+
+<h3>Requirements</h3>
+
+cat uses the following syscalls:
+<ul>
+<li><A HREF=../syscall/open.html>open</A>
+<li><A HREF=../syscall/read.html>read</A>
+<li><A HREF=../syscall/write.html>write</A>
+<li><A HREF=../syscall/close.html>close</A>
+<li><A HREF=../syscall/_exit.html>_exit</A>
+</ul>
+
+cat should function properly once the basic system calls assignment is
+completed.
+
+</body>
+</html>

+ 42 - 0
build/install/man/bin/cp.html

@@ -0,0 +1,42 @@
+<html>
+<head>
+<title>cp</title>
+<body bgcolor=#ffffff>
+<h2 align=center>cp</h2>
+<h4 align=center>OS/161 Reference Manual</h4>
+
+<h3>Name</h3>
+cp - copy files
+
+<h3>Synopsis</h3>
+/bin/cp <em>oldfile</em> <em>newfile</em>
+
+<h3>Description</h3>
+
+cp copies the file <em>oldfile</em> to the file <em>newfile</em>,
+overwriting <em>newfile</em> if it already exists.
+<p>
+
+cp supports no options.
+<p>
+
+<h3>Requirements</h3>
+
+cp uses the following syscalls:
+<ul>
+<li><A HREF=../syscall/open.html>open</A>
+<li><A HREF=../syscall/read.html>read</A>
+<li><A HREF=../syscall/write.html>write</A>
+<li><A HREF=../syscall/close.html>close</A>
+<li><A HREF=../syscall/_exit.html>_exit</A>
+</ul>
+
+cp should function properly once the basic system calls assignment is
+completed.
+
+<h3>See Also</h3>
+
+<A HREF=ln.html>ln</A>, <A HREF=mv.html>mv<A>
+
+</body>
+</html>

+ 31 - 0
build/install/man/bin/false.html

@@ -0,0 +1,31 @@
+<html>
+<head>
+<title>false</title>
+<body bgcolor=#ffffff>
+<h2 align=center>false</h2>
+<h4 align=center>OS/161 Reference Manual</h4>
+
+<h3>Name</h3>
+false - return false value
+
+<h3>Synopsis</h3>
+/bin/false
+
+<h3>Description</h3>
+
+false exits with exit code 1, signifying failure.
+
+<h3>Requirements</h3>
+
+false uses the <A HREF=../syscall/_exit.html>_exit</A> system call.
+<p>
+
+false should function properly once the basic system calls assignment
+is completed.
+
+<h3>See Also</h3>
+
+<A HREF=true.html>true</A>
+
+</body>
+</html>

+ 37 - 0
build/install/man/bin/index.html

@@ -0,0 +1,37 @@
+<html>
+<head>
+<title>OS/161 Binaries</title>
+</head>
+<body bgcolor=#ffffff>
+
+<h2 align=center>OS/161 Binaries (/bin)</h2>
+
+<p align=center>
+<A HREF=..>Top</A> |
+<A HREF=../sbin>Sysadmin binaries</A> |
+<A HREF=../testbin>Test binaries</A> |
+<A HREF=../syscall>System calls</A> |
+<A HREF=../libc>C standard library</A> |
+<A HREF=../dev>Device drivers</A> |
+<A HREF=../misc>Miscellaneous</A>
+</p>
+<br>
+
+<ul>
+<li> <A HREF=cat.html>cat</A> - concatenate and print files
+<li> <A HREF=cp.html>cp</A> - copy files
+<li> <A HREF=false.html>false</A> - return false value
+<li> <A HREF=ln.html>ln</A> - link files
+<li> <A HREF=ls.html>ls</A> - list files or directory contents
+<li> <A HREF=mkdir.html>mkdir</A> - create directory
+<li> <A HREF=mv.html>mv</A> - rename or move files
+<li> <A HREF=pwd.html>pwd</A> - print working directory
+<li> <A HREF=rm.html>rm</A> - remove (unlink) files
+<li> <A HREF=rmdir.html>rmdir</A> - remove directory
+<li> <A HREF=sh.html>sh</A> - user command shell
+<li> <A HREF=sync.html>sync</A> - synchronize buffers to disk
+<li> <A HREF=true.html>true</A> - return true value
+</ul>
+
+</body>
+</html>

+ 52 - 0
build/install/man/bin/ln.html

@@ -0,0 +1,52 @@
+<html>
+<head>
+<title>ln</title>
+<body bgcolor=#ffffff>
+<h2 align=center>ln</h2>
+<h4 align=center>OS/161 Reference Manual</h4>
+
+<h3>Name</h3>
+ln - link files
+
+<h3>Synopsis</h3>
+/bin/ln <em>oldfile</em> <em>newfile</em>
+<br>
+/bin/ln -s <em>oldfile</em> <em>newfile</em>
+
+<h3>Description</h3>
+
+ln creates links to files. The first usage creates a hard link, that
+is, an additional name for the <strong>same</strong> file. The second
+usage, with the -s option, creates a symbolic link, a special
+filesystem entry that redirects accesses back to the first original
+file.
+<p>
+
+The symlink created is of the form <em>newfile</em> -> <em>oldfile</em>.
+<p>
+
+<h3>Requirements</h3>
+
+ln uses the following syscalls:
+<ul>
+<li><A HREF=../syscall/link.html>link</A>
+<li><A HREF=../syscall/symlink.html>symlink</A>
+<li><A HREF=../syscall/write.html>write</A>
+<li><A HREF=../syscall/_exit.html>_exit</A>
+</ul>
+
+ln without the -s option should work once (or if) you implement hard
+links.  ln with the -s option should work once (or if) you implement
+symbolic links. Check your assignments for when (or if) you need to
+implement these features.
+<p>
+
+ln is able to create symlinks even if hard links are not implemented,
+and vice versa.
+
+<h3>See Also</h3>
+
+<A HREF=cp.html>cp</A>, <A HREF=mv.html>mv<A>
+
+</body>
+</html>

+ 60 - 0
build/install/man/bin/ls.html

@@ -0,0 +1,60 @@
+<html>
+<head>
+<title>ls</title>
+<body bgcolor=#ffffff>
+<h2 align=center>ls</h2>
+<h4 align=center>OS/161 Reference Manual</h4>
+
+<h3>Name</h3>
+ls - list files or directory contents
+
+<h3>Synopsis</h3>
+/bin/ls [-adlRs] [<em>path</em>...]
+
+<h3>Description</h3>
+
+ls lists the filesystem objects specified on the command line. If they
+are directories, the contents of the directories are listed (unless
+the -d option is used).
+<p>
+
+If the -a option is given, filenames beginning with dot (.) will be
+listed. Ordinarily, they are skipped.
+<p>
+
+If the -d option is given, directory contents will not be listed; the
+directories themselves will be.
+<p>
+
+If the -l option is given, a long format listing showing the file
+size, type, and link count will be displayed instead of just the
+filenames.
+<p>
+
+If the -R option is given, subdirectories encountered will be listed
+recursively.
+<p>
+
+If the -s option is given, the number of filesystem blocks used by
+each object will be displayed in addition to other information.
+<p>
+
+If no <em>paths</em> are specified, the current directory is assumed.
+
+<h3>Requirements</h3>
+
+ls uses the following syscalls:
+<ul>
+<li> <A HREF=../syscall/open.html>open</A>
+<li> <A HREF=../syscall/write.html>write</A>
+<li> <A HREF=../syscall/fstat.html>fstat</A>
+<li> <A HREF=../syscall/getdirentry.html>getdirentry</A>
+<li> <A HREF=../syscall/close.html>close</A>
+<li> <A HREF=../syscall/_exit.html>_exit</A>
+</ul>
+
+ls should function properly once the file system assignment is
+completed.
+
+</body>
+</html>

+ 36 - 0
build/install/man/bin/mkdir.html

@@ -0,0 +1,36 @@
+<html>
+<head>
+<title>mkdir</title>
+<body bgcolor=#ffffff>
+<h2 align=center>mkdir</h2>
+<h4 align=center>OS/161 Reference Manual</h4>
+
+<h3>Name</h3>
+mkdir - create directory
+
+<h3>Synopsis</h3>
+/bin/mkdir <em>directory</em>
+
+<h3>Description</h3>
+
+mkdir creates the named directory. All intermediate components must
+already exist. If the named directory already exists, an error occurs.
+
+<h3>Requirements</h3>
+
+mkdir uses the following syscalls:
+<ul>
+<li> <A HREF=../syscall/mkdir.html>mkdir</A>
+<li> <A HREF=../syscall/write.html>write</A>
+<li> <A HREF=../syscall/_exit.html>_exit</A>
+</ul>
+
+mkdir should function properly once the file system assignment is
+completed.
+
+<h3>See Also</h3>
+
+<A HREF=rmdir.html>rmdir</A>
+
+</body>
+</html>

+ 42 - 0
build/install/man/bin/mv.html

@@ -0,0 +1,42 @@
+<html>
+<head>
+<title>mv</title>
+<body bgcolor=#ffffff>
+<h2 align=center>mv</h2>
+<h4 align=center>OS/161 Reference Manual</h4>
+
+<h3>Name</h3>
+mv - rename or move files
+
+<h3>Synopsis</h3>
+/bin/mv <em>oldname</em> <em>newname</em>
+
+<h3>Description</h3>
+
+mv renames the filesystem object specified by <em>oldname</em> so that
+it is subsequently named <em>newname</em>. Both files and directories
+can be renamed or moved into other parts of the filesystem tree.
+However, devices may not be renamed and filesystem objects may not be
+moved across filesystems.
+<p>
+
+mv accepts no options.
+
+<h3>Requirements</h3>
+
+mv uses the following system calls:
+<ul>
+<li> <A HREF=../syscall/rename.html>rename</A>
+<li> <A HREF=../syscall/write.html>write</A>
+<li> <A HREF=../syscall/_exit.html>_exit</A>
+</ul>
+
+mv should function properly once the file system assignment is
+completed.
+
+<h3>See Also</h3>
+
+<A HREF=cp.html>cp</A>, <A HREF=ln.html>ln<A>
+
+</body>
+</html>

+ 36 - 0
build/install/man/bin/pwd.html

@@ -0,0 +1,36 @@
+<html>
+<head>
+<title>pwd</title>
+<body bgcolor=#ffffff>
+<h2 align=center>pwd</h2>
+<h4 align=center>OS/161 Reference Manual</h4>
+
+<h3>Name</h3>
+pwd - print working directory
+
+<h3>Synopsis</h3>
+/bin/pwd
+
+<h3>Description</h3>
+
+pwd prints the current working directory.
+
+<h3>Requirements</h3>
+
+pwd uses the following system calls:
+<ul>
+<li> <A HREF=../syscall/__getcwd.html>__getcwd</A>
+<li> <A HREF=../syscall/write.html>write</A>
+<li> <A HREF=../syscall/_exit.html>_exit</A>
+</ul>
+
+pwd should function properly once the basic system calls assignment is
+completed, except on filesystems or in directories that do not support
+getcwd.
+<p>
+
+pwd should function properly in all directories of your filesystem
+once the file system assignment is completed.
+
+</body>
+</html>

+ 47 - 0
build/install/man/bin/rm.html

@@ -0,0 +1,47 @@
+<html>
+<head>
+<title>rm</title>
+<body bgcolor=#ffffff>
+<h2 align=center>rm</h2>
+<h4 align=center>OS/161 Reference Manual</h4>
+
+<h3>Name</h3>
+rm - remove (unlink) files
+
+<h3>Synopsis</h3>
+/bin/rm <em>file...</em>
+
+<h3>Description</h3>
+
+rm deletes the files specified on its command line. (If one of the
+filenames specified is one of several hard links to the same file, the
+actual file is only erased when all links are removed.)
+<p>
+
+Using rm on directories produces an error. Use 
+<A HREF=rmdir.html>rmdir</A> to remove
+directories. 
+
+<h3>Requirements</h3>
+
+rm uses the following system calls:
+<ul>
+<li> <A HREF=../syscall/remove.html>remove</A>
+<li> <A HREF=../syscall/write.html>write</A>
+<li> <A HREF=../syscall/_exit.html>_exit</A>
+</ul>
+
+rm should function properly once the file system assignment is
+completed.
+
+<h3>Restrictions</h3>
+
+<A HREF=../dev/emu.html>emufs</A> does not support rm. (This is
+intentional.)
+
+<h3>See Also</h3>
+
+<A HREF=rmdir.html>rmdir</A>
+
+</body>
+</html>

+ 45 - 0
build/install/man/bin/rmdir.html

@@ -0,0 +1,45 @@
+<html>
+<head>
+<title>rmdir</title>
+<body bgcolor=#ffffff>
+<h2 align=center>rmdir</h2>
+<h4 align=center>OS/161 Reference Manual</h4>
+
+<h3>Name</h3>
+rmdir - remove directory
+
+<h3>Synopsis</h3>
+/bin/rmdir <em>directory</em>
+
+<h3>Description</h3>
+
+rmdir removes the specified directory. The directory must be empty.
+<p>
+
+It is an error to attempt to remove the . or .. names in a directory,
+or to apply rmdir to a filesystem object that is not a directory.
+<p>
+
+<h3>Requirements</h3>
+
+rmdir uses the following system calls:
+<ul>
+<li> <A HREF=../syscall/rmdir.html>rmdir</A>
+<li> <A HREF=../syscall/write.html>write</A>
+<li> <A HREF=../syscall/_exit.html>_exit</A>
+</ul>
+
+rmdir should function properly once the file system assignment is
+completed.
+
+<h3>Restrictions</h3>
+
+<A HREF=../dev/emu.html>emufs</A> does not support rmdir. (This is
+intentional.)
+
+<h3>See Also</h3>
+
+<A HREF=mkdir.html>mkdir</A>, <A HREF=rm.html>rm</A>
+
+</body>
+</html>

+ 40 - 0
build/install/man/bin/sh.html

@@ -0,0 +1,40 @@
+<html>
+<head>
+<title>sh</title>
+<body bgcolor=#ffffff>
+<h2 align=center>sh</h2>
+<h4 align=center>OS/161 Reference Manual</h4>
+
+<h3>Name</h3>
+sh - user command shell
+
+<h3>Synopsis</h3>
+/bin/sh [-c command]
+
+<h3>Description</h3>
+
+This is a simple command interpreter. The shell provided with OS/161
+(or, perhaps, provided as a solution set, if you had to write a shell)
+is a simple shell accepting some basic Unix-like syntax.
+
+<h3>Requirements</h3>
+
+sh uses these system calls:
+
+<ul>
+<li> <A HREF=../syscall/chdir.html>chdir</A>
+<li> <A HREF=../syscall/fork.html>fork</A>
+<li> <A HREF=../syscall/execv.html>execv</A>
+<li> <A HREF=../syscall/waitpid.html>waitpid</A>
+<li> <A HREF=../syscall/read.html>read</A>
+<li> <A HREF=../syscall/write.html>write</A>
+<li> <A HREF=../syscall/_exit.html>_exit</A>
+<li> <A HREF=../syscall/__time.html>__time</A>
+</ul>
+
+This shell's basic functionality should work properly once the basic
+system calls assignment is complete. Some features may require
+additional support which may be part of subsequent assignments.
+
+</body>
+</html>

+ 25 - 0
build/install/man/bin/sync.html

@@ -0,0 +1,25 @@
+<html>
+<head>
+<title>sync</title>
+<body bgcolor=#ffffff>
+<h2 align=center>sync</h2>
+<h4 align=center>OS/161 Reference Manual</h4>
+
+<h3>Name</h3>
+sync - synchronize buffers to disk
+
+<h3>Synopsis</h3>
+/bin/sync
+
+<h3>Description</h3>
+
+sync causes filesystem I/O buffers that have been modified but not yet
+written to be written to disk.
+
+<h3>Requirements</h3>
+
+sync uses the <A HREF=../syscall/sync.html>sync</A> system call, and
+of course <A HREF=../syscall/_exit.html>_exit</A>.
+
+</body>
+</html>

+ 31 - 0
build/install/man/bin/true.html

@@ -0,0 +1,31 @@
+<html>
+<head>
+<title>true</title>
+<body bgcolor=#ffffff>
+<h2 align=center>true</h2>
+<h4 align=center>OS/161 Reference Manual</h4>
+
+<h3>Name</h3>
+true - return true value
+
+<h3>Synopsis</h3>
+/bin/true
+
+<h3>Description</h3>
+
+true exits with exit code 0, signifying success.
+
+<h3>Requirements</h3>
+
+true uses the <A HREF=../syscall/_exit.html>_exit</A> system call.
+<p>
+
+true should function properly once the basic system calls assignment
+is completed.
+
+<h3>See Also</h3>
+
+<A HREF=false.html>false</A>
+
+</body>
+</html>

+ 27 - 0
build/install/man/dev/beep.html

@@ -0,0 +1,27 @@
+<html>
+<head>
+<title>beep</title>
+<body bgcolor=#ffffff>
+<h2 align=center>beep</h2>
+<h4 align=center>OS/161 Reference Manual</h4>
+
+<h3>Name</h3>
+beep - console beep device
+
+<h3>Synopsis</h3>
+device beep0 at ltimer*
+
+<h3>Description</h3>
+
+The beep device is an abstract entry point for in-kernel beeping. The
+beep() function is provided, and redirected to the first attached
+device. If no beep device is available, beeping will cause a warning
+to be printed to the system console.
+<p>
+
+<h3>See Also</h3>
+
+<A HREF=ltimer.html>ltimer</A>
+
+</body>
+</html>

+ 35 - 0
build/install/man/dev/con.html

@@ -0,0 +1,35 @@
+<html>
+<head>
+<title>console</title>
+<body bgcolor=#ffffff>
+<h2 align=center>con</h2>
+<h4 align=center>OS/161 Reference Manual</h4>
+
+<h3>Name</h3>
+con - system login console
+
+<h3>Synopsis</h3>
+device con0 at lser*<br>
+device con0 at lscreen*<br>
+
+<h3>Description</h3>
+
+The generic console device can be attached to either a serial port or
+a memory-mapped screen. It provides no internal buffering or input
+editing. You may add such features if you desire.
+<p>
+
+The in-kernel kprintf() routine and its relatives send their
+output to the console device.
+
+<h3>Files</h3>
+
+<tt>con:</tt>
+
+<h3>See Also</h3>
+
+<A HREF=lser.html>lser</A>,
+<A HREF=lscreen.html>lscreen</A>
+
+</body>
+</html>

+ 32 - 0
build/install/man/dev/emu.html

@@ -0,0 +1,32 @@
+<html>
+<head>
+<title>emu</title>
+<body bgcolor=#ffffff>
+<h2 align=center>emu</h2>
+<h4 align=center>OS/161 Reference Manual</h4>
+
+<h3>Name</h3>
+emu - emulator pass-through filesystem
+
+<h3>Synopsis</h3>
+device emu* at lamebus*
+
+<h3>Description</h3>
+
+emu, also known as emufs, is a driver for a special-purpose System/161
+device that provides access to the filesystem System/161 is running
+atop. It provides the appearance of a mounted filesystem.
+<p>
+
+It is not recommended to access the same underlying files through
+different instances of emufs.
+
+<h3>Files</h3>
+
+<tt>emu0:</tt>, <tt>emu1:</tt>, etc.
+
+<h3>See Also</h3>
+<A HREF=lamebus.html>lamebus</A>
+
+</body>
+</html>

+ 37 - 0
build/install/man/dev/index.html

@@ -0,0 +1,37 @@
+<html>
+<head>
+<title>OS/161 Devices</title>
+</head>
+<body bgcolor=#ffffff>
+
+<h2 align=center>OS/161 Devices</h2>
+
+<p align=center>
+<A HREF=..>Top</A> |
+<A HREF=../bin>Binaries</A> |
+<A HREF=../sbin>Sysadmin binaries</A> |
+<A HREF=../testbin>Test binaries</A> |
+<A HREF=../syscall>System calls</A> |
+<A HREF=../libc>C standard library</A> |
+<A HREF=../misc>Miscellaneous</A>
+</p>
+<br>
+
+<ul>
+<li> <A HREF=beep.html>beep</A> - console beep device
+<li> <A HREF=con.html>con</A> - system login console
+<li> <A HREF=emu.html>emu</A> - emulator pass-through filesystem
+<li> <A HREF=lamebus.html>lamebus</A> - driver for LAMEbus system bus
+<li> <A HREF=lhd.html>lhd</A> - LAMEbus hard drive
+<li> <A HREF=lnet.html>lnet</A> - LAMEbus network card
+<li> <A HREF=lrandom.html>lrandom</A> - LAMEbus random source
+<li> <A HREF=lscreen.html>lscreen</A> - LAMEbus memory-mapped screen
+<li> <A HREF=lser.html>lser</A> - LAMEbus serial port
+<li> <A HREF=ltimer.html>ltimer</A> - LAMEbus timer device
+<li> <A HREF=null.html>null</A> - null device
+<li> <A HREF=random.html>random</A> - kernel randomness source
+<li> <A HREF=rtclock.html>rtclock</A> - realtime clock
+</ul>
+
+</body>
+</html>

+ 30 - 0
build/install/man/dev/lamebus.html

@@ -0,0 +1,30 @@
+<html>
+<head>
+<title>lamebus</title>
+<body bgcolor=#ffffff>
+<h2 align=center>lamebus</h2>
+<h4 align=center>OS/161 Reference Manual</h4>
+
+<h3>Name</h3>
+lamebus - driver for LAMEbus system bus
+
+<h3>Synopsis</h3>
+device lamebus0
+
+<h3>Description</h3>
+
+LAMEbus is the system bus for System/161. This driver takes care of
+managing the bus controller, distributing interrupts, and similar
+issues. It serves mostly as an attachment point for other drivers.
+
+<h3>See Also</h3>
+<A HREF=emu.html>emu</A>,
+<A HREF=lhd.html>lhd</A>,
+<A HREF=lnet.html>lnet</A>,
+<A HREF=lrandom.html>lrandom</A>,
+<A HREF=lscreen.html>lscreen</A>,
+<A HREF=lser.html>lser</A>,
+<A HREF=ltimer.html>ltimer</A>
+
+</body>
+</html>

+ 27 - 0
build/install/man/dev/lhd.html

@@ -0,0 +1,27 @@
+<html>
+<head>
+<title>lhd</title>
+<body bgcolor=#ffffff>
+<h2 align=center>lhd</h2>
+<h4 align=center>OS/161 Reference Manual</h4>
+
+<h3>Name</h3>
+lhd - LAMEbus hard drive
+
+<h3>Synopsis</h3>
+device lhd* at lamebus*
+
+<h3>Description</h3>
+
+lhd is the driver for the CS161 LAMEbus fixed disk interface. It
+provides mountable block-device and raw-device access to the disk.
+
+<h3>Files</h3>
+
+<tt>lhd0:</tt>, <tt>lhd0raw:</tt>, <tt>lhd1:</tt>, <tt>lhd1raw:</tt>, etc.
+
+<h3>See Also</h3>
+<A HREF=lamebus.html>lamebus</A>
+
+</body>
+</html>

+ 25 - 0
build/install/man/dev/lnet.html

@@ -0,0 +1,25 @@
+<html>
+<head>
+<title>lnet</title>
+<body bgcolor=#ffffff>
+<h2 align=center>lnet</h2>
+<h4 align=center>OS/161 Reference Manual</h4>
+
+<h3>Name</h3>
+lnet - LAMEbus network card
+
+<h3>Synopsis</h3>
+options net<br>
+device lnet* at lamebus*<br>
+
+<h3>Description</h3>
+
+lnet is the driver for the CS161 LAMEbus network interface card.  As
+of this writing the driver is not completed and is thus not available
+for actual use yet.
+
+<h3>See Also</h3>
+<A HREF=lamebus.html>lamebus</A>
+
+</body>
+</html>

+ 26 - 0
build/install/man/dev/lrandom.html

@@ -0,0 +1,26 @@
+<html>
+<head>
+<title>lrandom</title>
+<body bgcolor=#ffffff>
+<h2 align=center>lrandom</h2>
+<h4 align=center>OS/161 Reference Manual</h4>
+
+<h3>Name</h3>
+lrandom - LAMEbus random source
+
+<h3>Synopsis</h3>
+device lrandom* at lamebus*
+
+<h3>Description</h3>
+
+lrandom is the driver for the CS161 LAMEbus random source card.
+<p>
+
+The generic <A HREF=random.html>random</A> device can be attached to
+an lrandom instance.
+
+<h3>See Also</h3>
+<A HREF=lamebus.html>lamebus</A>
+
+</body>
+</html>

+ 33 - 0
build/install/man/dev/lscreen.html

@@ -0,0 +1,33 @@
+<html>
+<head>
+<title>lscreen</title>
+<body bgcolor=#ffffff>
+<h2 align=center>lscreen</h2>
+<h4 align=center>OS/161 Reference Manual</h4>
+
+<h3>Name</h3>
+lscreen - LAMEbus memory-mapped screen
+
+<h3>Synopsis</h3>
+device lscreen* at lamebus*
+
+<h3>Description</h3>
+
+lscreen is the driver for the CS161 LAMEbus memory-mapped screen
+card. It does not provide any internal input buffering; that is
+expected to happen at a higher level.
+<p>
+
+Since the memory-mapped screen card is not actually available yet as
+of this writing, the driver has not been tested and probably does not
+work.
+<p>
+
+The <A HREF=con.html>system console</A> device can be attached to an
+lscreen instance.
+
+<h3>See Also</h3>
+<A HREF=lamebus.html>lamebus</A>
+
+</body>
+</html>

+ 29 - 0
build/install/man/dev/lser.html

@@ -0,0 +1,29 @@
+<html>
+<head>
+<title>lser</title>
+<body bgcolor=#ffffff>
+<h2 align=center>lser</h2>
+<h4 align=center>OS/161 Reference Manual</h4>
+
+<h3>Name</h3>
+lser - LAMEbus serial port
+
+<h3>Synopsis</h3>
+device lser* at lamebus*
+
+<h3>Description</h3>
+
+lser is the driver for the CS161 LAMEbus serial port card. It does not
+provide any internal buffering; that is expected to happen at a higher
+level. It can, however, operate in either polled or interrupt-driven
+output mode.
+<p>
+
+The <A HREF=con.html>system console</A> device can be attached to an
+lser instance.
+
+<h3>See Also</h3>
+<A HREF=lamebus.html>lamebus</A>
+
+</body>
+</html>

+ 27 - 0
build/install/man/dev/ltimer.html

@@ -0,0 +1,27 @@
+<html>
+<head>
+<title>ltimer</title>
+<body bgcolor=#ffffff>
+<h2 align=center>ltimer</h2>
+<h4 align=center>OS/161 Reference Manual</h4>
+
+<h3>Name</h3>
+ltimer - LAMEbus timer device
+
+<h3>Synopsis</h3>
+ltimer* at lamebus*
+
+<h3>Description</h3>
+
+ltimer is a driver for the CS161 LAMEbus clock/timer card. The
+card can also provide beep services to the kernel.
+<p>
+
+The <A HREF=beep.html>beep</A> and <A HREF=rtclock.html>rtclock</A>
+generic devices can be attached to an ltimer instance.
+
+<h3>See Also</h3>
+<A HREF=lamebus.html>lamebus</A>
+
+</body>
+</html>

Some files were not shown because too many files changed in this diff