Initial Spring 2016 commit.

This commit is contained in:
Geoffrey Challen
2015-12-23 00:50:04 +00:00
commit cafa9f5690
732 changed files with 92195 additions and 0 deletions

16
man/Makefile Normal file
View File

@@ -0,0 +1,16 @@
#
# Makefile for src/man (man page tree)
#
TOP=..
.include "$(TOP)/mk/os161.config.mk"
SUBDIRS=bin sbin testbin libc syscall dev misc
# Top level man pages
MANDIR=/man
MANFILES=index.html man.css manindex.css
.include "$(TOP)/mk/os161.subdir.mk"
.include "$(TOP)/mk/os161.man.mk"

13
man/bin/Makefile Normal file
View File

@@ -0,0 +1,13 @@
# Man pages for /bin programs
TOP=../..
.include "$(TOP)/mk/os161.config.mk"
MANDIR=/man/bin
MANFILES=\
cat.html cp.html false.html index.html ln.html ls.html mkdir.html \
mv.html pwd.html rm.html rmdir.html sh.html sync.html tac.html \
true.html
.include "$(TOP)/mk/os161.man.mk"

81
man/bin/cat.html Normal file
View File

@@ -0,0 +1,81 @@
<!--
Copyright (c) 2000, 2001, 2002, 2003, 2004, 2005, 2008, 2009, 2013
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.
-->
<html>
<head>
<title>cat</title>
<link rel="stylesheet" type="text/css" media="all" href="../man.css">
</head>
<body bgcolor=#ffffff>
<h2 align=center>cat</h2>
<h4 align=center>OS/161 Reference Manual</h4>
<h3>Name</h3>
<p>
<tt>cat</tt> - concatenate and print files
</p>
<h3>Synopsis</h3>
<p>
<tt>/bin/cat</tt> <em>files...</em>
</p>
<h3>Description</h3>
<p>
<tt>cat</tt> prints the files listed on its command line in order to its
standard output. If the magic filename "-" is encountered, <tt>cat</tt>
prints its standard input up to the first EOF.
</p>
<p>
With no arguments, <tt>cat</tt> prints its standard input.
</p>
<p>
<tt>cat</tt> takes no options.
</p>
<h3>Requirements</h3>
<p>
<tt>cat</tt> 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>
</p>
<p>
<tt>cat</tt> should function properly once the basic system calls
assignment is completed.
</p>
</body>
</html>

88
man/bin/cp.html Normal file
View File

@@ -0,0 +1,88 @@
<!--
Copyright (c) 2000, 2001, 2002, 2003, 2004, 2005, 2008, 2009, 2013
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.
-->
<html>
<head>
<title>cp</title>
<link rel="stylesheet" type="text/css" media="all" href="../man.css">
</head>
<body bgcolor=#ffffff>
<h2 align=center>cp</h2>
<h4 align=center>OS/161 Reference Manual</h4>
<h3>Name</h3>
<p>
cp - copy files
</p>
<h3>Synopsis</h3>
<p>
<tt>/bin/cp</tt> <em>oldfile</em> <em>newfile</em>
</p>
<h3>Description</h3>
<p>
<tt>cp</tt> copies the file <em>oldfile</em> to the file <em>newfile</em>,
overwriting <em>newfile</em> if it already exists.
</p>
<p>
<tt>cp</tt> supports no options.
</p>
<p>
Note that <tt>cp</tt> does <em>not</em> support the Unix idiom
<tt>cp file1 file2 ... destination-dir</tt> to copy a number of files
at once. In particular, <tt>cp foo bar/</tt> will fail, probably with
"Is a directory".
</p>
<h3>Requirements</h3>
<p>
<tt>cp</tt> 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>
</p>
<p>
<tt>cp</tt> should function properly once the basic system calls
assignment is completed.
</p>
<h3>See Also</h3>
<p>
<A HREF=ln.html>ln</A>, <A HREF=mv.html>mv<A>
</p>
</body>
</html>

69
man/bin/false.html Normal file
View File

@@ -0,0 +1,69 @@
<!--
Copyright (c) 2000, 2001, 2002, 2003, 2004, 2005, 2008, 2009, 2013
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.
-->
<html>
<head>
<title>false</title>
<link rel="stylesheet" type="text/css" media="all" href="../man.css">
</head>
<body bgcolor=#ffffff>
<h2 align=center>false</h2>
<h4 align=center>OS/161 Reference Manual</h4>
<h3>Name</h3>
<p>
false - return false value
</p>
<h3>Synopsis</h3>
<p>
<tt>/bin/false</tt>
</p>
<h3>Description</h3>
<p>
<tt>false</tt> exits with exit code 1, signifying failure.
</p>
<h3>Requirements</h3>
<p>
<tt>false</tt> uses the <A HREF=../syscall/_exit.html>_exit</A> system call.
</p>
<p>
false should function properly once the basic system calls assignment
is completed.
</p>
<h3>See Also</h3>
<p>
<A HREF=true.html>true</A>
</p>
</body>
</html>

67
man/bin/index.html Normal file
View File

@@ -0,0 +1,67 @@
<!--
Copyright (c) 2000, 2001, 2002, 2003, 2004, 2005, 2008, 2009, 2013
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.
-->
<html>
<head>
<title>OS/161 Binaries</title>
<link rel="stylesheet" type="text/css" media="all" href="../manindex.css">
</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=tac.html>tac</A> - print files backwards
<li> <A HREF=true.html>true</A> - return true value
</ul>
</body>
</html>

99
man/bin/ln.html Normal file
View File

@@ -0,0 +1,99 @@
<!--
Copyright (c) 2000, 2001, 2002, 2003, 2004, 2005, 2008, 2009, 2013
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.
-->
<html>
<head>
<title>ln</title>
<link rel="stylesheet" type="text/css" media="all" href="../man.css">
</head>
<body bgcolor=#ffffff>
<h2 align=center>ln</h2>
<h4 align=center>OS/161 Reference Manual</h4>
<h3>Name</h3>
<p>
ln - link files
</p>
<h3>Synopsis</h3>
<p>
<tt>/bin/ln</tt> <em>oldfile</em> <em>newfile</em>
<br>
<tt>/bin/ln -s</tt> <em>oldfile</em> <em>newfile</em>
</p>
<h3>Description</h3>
<p>
ln creates links to files. The first usage creates a hard link, that
is, an additional name for the <em>same</em> 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>
<p>
The symlink created is of the form <em>newfile</em> -> <em>oldfile</em>.
</p>
<p>
Note that <tt>ln</tt> does <em>not</em> support the Unix idiom
<tt>ln file1 file2 ... destination-dir</tt> to link a number of files
at once. In particular, <tt>ln foo bar/</tt> will fail, probably with
"Is a directory".
</p>
<h3>Requirements</h3>
<p>
<tt>ln</tt> 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>
</p>
<p>
<tt>ln</tt> without the -s option should work once (or if) you
implement hard links. <tt>ln</tt> 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>
<p>
<tt>ln</tt> is able to create symlinks even if hard links are not
implemented, and vice versa.
</p>
<h3>See Also</h3>
<p>
<A HREF=cp.html>cp</A>, <A HREF=mv.html>mv<A>
</p>
</body>
</html>

110
man/bin/ls.html Normal file
View File

@@ -0,0 +1,110 @@
<!--
Copyright (c) 2000, 2001, 2002, 2003, 2004, 2005, 2008, 2009, 2013
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.
-->
<html>
<head>
<title>ls</title>
<link rel="stylesheet" type="text/css" media="all" href="../man.css">
</head>
<body bgcolor=#ffffff>
<h2 align=center>ls</h2>
<h4 align=center>OS/161 Reference Manual</h4>
<h3>Name</h3>
<p>
ls - list files or directory contents
</p>
<h3>Synopsis</h3>
<p>
<tt>/bin/ls</tt> [<tt>-adlRs</tt>] [<em>path</em>...]
</p>
<h3>Description</h3>
<p>
<tt>ls</tt> lists the filesystem objects specified on the command
line. If they are directories, the contents of the directories are
listed (unless the <tt>-d</tt> option is used).
</p>
<p>
If the <tt>-a</tt> option is given, filenames beginning with dot (.)
will be listed. Ordinarily, they are skipped.
</p>
<p>
If the <tt>-d</tt> option is given, directory contents will not be
listed; the directories themselves will be.
</p>
<p>
If the <tt>-l</tt> option is given, a long format listing showing the
file size, type, and link count will be displayed instead of just the
filenames.
</p>
<p>
If the <tt>-R</tt> option is given, subdirectories encountered will be
listed recursively.
</p>
<p>
If the <tt>-s</tt> option is given, the number of filesystem blocks
used by each object will be displayed in addition to other
information.
</p>
<p>
If no <em>paths</em> are specified, the current directory is assumed.
</p>
<h3>Requirements</h3>
<p>
<tt>ls</tt> 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>
</p>
<p>
As fstat and getdirentry are generally not part of the basic system
calls assignment, <tt>ls</tt> will usually still not function after
the basic system calls assignment is complete.
These calls are typically part of a later assignment, usually the file
system assignment. You may also need to implement the getdirentry
functionality at the file system level.
Consult your course materials for specific information.
</p>
</body>
</html>

81
man/bin/mkdir.html Normal file
View File

@@ -0,0 +1,81 @@
<!--
Copyright (c) 2000, 2001, 2002, 2003, 2004, 2005, 2008, 2009, 2013
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.
-->
<html>
<head>
<title>mkdir</title>
<link rel="stylesheet" type="text/css" media="all" href="../man.css">
</head>
<body bgcolor=#ffffff>
<h2 align=center>mkdir</h2>
<h4 align=center>OS/161 Reference Manual</h4>
<h3>Name</h3>
<p>
mkdir - create directory
</p>
<h3>Synopsis</h3>
<p>
<tt>/bin/mkdir</tt> <em>directory</em>
</p>
<h3>Description</h3>
<p>
<tt>mkdir</tt> creates the named directory. All intermediate
components must already exist. If the named directory already exists,
an error occurs.
</p>
<h3>Requirements</h3>
<p>
<tt>mkdir</tt> 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>
</p>
<p>
As the mkdir system call is generally not part of the basic system
calls assignment, <tt>mkdir</tt> will usually still not function after
the basic system calls assignment is complete.
This call is typically part of a later assignment, usually the file
system assignment. You may also need to implement subdirectories in
the file system.
Consult your course materials for specific information.
</p>
<h3>See Also</h3>
<p>
<A HREF=rmdir.html>rmdir</A>
</p>
</body>
</html>

98
man/bin/mv.html Normal file
View File

@@ -0,0 +1,98 @@
<!--
Copyright (c) 2000, 2001, 2002, 2003, 2004, 2005, 2008, 2009, 2013
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.
-->
<html>
<head>
<title>mv</title>
<link rel="stylesheet" type="text/css" media="all" href="../man.css">
</head>
<body bgcolor=#ffffff>
<h2 align=center>mv</h2>
<h4 align=center>OS/161 Reference Manual</h4>
<h3>Name</h3>
<p>
mv - rename or move files
</p>
<h3>Synopsis</h3>
<p>
<tt>/bin/mv</tt> <em>oldname</em> <em>newname</em>
</p>
<h3>Description</h3>
<p>
<tt>mv</tt> 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>
<p>
<tt>mv</tt> accepts no options.
</p>
<p>
Note that <tt>mv</tt> does <em>not</em> support the Unix idiom
<tt>mv file1 file2 ... destination-dir</tt> to move a number of files
at once. In particular, <tt>mv foo bar/</tt> will fail, probably with
"Is a directory".
</p>
<h3>Requirements</h3>
<p>
<tt>mv</tt> 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>
</p>
<p>
As the rename system call is generally not part of the basic system
calls assignment, <tt>mv</tt> will usually still not function after
the basic system calls assignment is complete.
This call is typically part of a later assignment, usually the file
system assignment.
Once you implement the system call you should be able to rename
objects within the same directory.
To move things between directories you will need to implement
cross-directory support for rename at the file system layer.
This may or may not be part of your file system assignment;
consult your course materials for specific information.
</p>
<h3>See Also</h3>
<p>
<A HREF=cp.html>cp</A>, <A HREF=ln.html>ln<A>
</p>
</body>
</html>

77
man/bin/pwd.html Normal file
View File

@@ -0,0 +1,77 @@
<!--
Copyright (c) 2000, 2001, 2002, 2003, 2004, 2005, 2008, 2009, 2013
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.
-->
<html>
<head>
<title>pwd</title>
<link rel="stylesheet" type="text/css" media="all" href="../man.css">
</head>
<body bgcolor=#ffffff>
<h2 align=center>pwd</h2>
<h4 align=center>OS/161 Reference Manual</h4>
<h3>Name</h3>
<p>
pwd - print working directory
</p>
<h3>Synopsis</h3>
<p>
<tt>/bin/pwd</tt>
</p>
<h3>Description</h3>
<p>
<tt>pwd</tt> prints the current working directory.
</p>
<h3>Requirements</h3>
<p>
<tt>pwd</tt> 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>
</p>
<p>
pwd should function properly once the basic system calls assignment is
completed, except on filesystems or in directories that do not support
getcwd.
Note that by default <A HREF=../dev/emu.html>emufs</A> does not
support getcwd except in its root directory.
</p>
<p>
<tt>pwd</tt> should function properly in all directories of your
filesystem once the file system assignment is completed.
</p>
</body>
</html>

91
man/bin/rm.html Normal file
View File

@@ -0,0 +1,91 @@
<!--
Copyright (c) 2000, 2001, 2002, 2003, 2004, 2005, 2008, 2009, 2013
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.
-->
<html>
<head>
<title>rm</title>
<link rel="stylesheet" type="text/css" media="all" href="../man.css">
</head>
<body bgcolor=#ffffff>
<h2 align=center>rm</h2>
<h4 align=center>OS/161 Reference Manual</h4>
<h3>Name</h3>
<p>
rm - remove (unlink) files
</p>
<h3>Synopsis</h3>
<p>
<tt>/bin/rm</tt> <em>file...</em>
</p>
<h3>Description</h3>
<p>
<tt>rm</tt> 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 file is only removed erased when all links to it are
deleted.)
</p>
<p>
Using <tt>rm</tt> on directories produces an error. Use
<A HREF=rmdir.html>rmdir</A> to remove directories.
</p>
<h3>Requirements</h3>
<p>
<tt>rm</tt> 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>
<p>
As the remove system call is generally not part of the basic system
calls assignment, <tt>rm</tt> will usually still not function after
the basic system calls assignment is complete.
This call is typically part of a later assignment, usually the file
system assignment.
Consult your course materials for specific information.
</p>
<h3>Restrictions</h3>
<p>
<A HREF=../dev/emu.html>emufs</A> does not support <tt>rm</tt>. (This is
intentional.)
</p>
<h3>See Also</h3>
<p>
<A HREF=rmdir.html>rmdir</A>
</p>
</body>
</html>

90
man/bin/rmdir.html Normal file
View File

@@ -0,0 +1,90 @@
<!--
Copyright (c) 2000, 2001, 2002, 2003, 2004, 2005, 2008, 2009, 2013
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.
-->
<html>
<head>
<title>rmdir</title>
<link rel="stylesheet" type="text/css" media="all" href="../man.css">
</head>
<body bgcolor=#ffffff>
<h2 align=center>rmdir</h2>
<h4 align=center>OS/161 Reference Manual</h4>
<h3>Name</h3>
<p>
rmdir - remove directory
</p>
<h3>Synopsis</h3>
<p>
<tt>/bin/rmdir</tt> <em>directory</em>
</p>
<h3>Description</h3>
<p>
<tt>rmdir</tt> removes the specified directory. The directory must be empty.
</p>
<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>
<p>
<tt>rmdir</tt> 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>
</p>
<p>
As the rmdir system call is generally not part of the basic system
calls assignment, <tt>rmdir</tt> will usually still not function after
the basic system calls assignment is complete.
This call is typically part of a later assignment, usually the file
system assignment. You may also need to implement subdirectories in
the file system.
Consult your course materials for specific information.
</p>
<h3>Restrictions</h3>
<p>
<A HREF=../dev/emu.html>emufs</A> does not support <tt>rmdir</tt>.
(This is intentional.)
</p>
<h3>See Also</h3>
<p>
<A HREF=mkdir.html>mkdir</A>, <A HREF=rm.html>rm</A>
</p>
</body>
</html>

77
man/bin/sh.html Normal file
View File

@@ -0,0 +1,77 @@
<!--
Copyright (c) 2000, 2001, 2002, 2003, 2004, 2005, 2008, 2009, 2013
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.
-->
<html>
<head>
<title>sh</title>
<link rel="stylesheet" type="text/css" media="all" href="../man.css">
</head>
<body bgcolor=#ffffff>
<h2 align=center>sh</h2>
<h4 align=center>OS/161 Reference Manual</h4>
<h3>Name</h3>
<p>
sh - user command shell
</p>
<h3>Synopsis</h3>
<p>
<tt>/bin/sh</tt> [<tt>-c</tt> <i>command</i>]
</p>
<h3>Description</h3>
<p>
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.
</p>
<h3>Requirements</h3>
<p>
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>
</p>
<p>
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.
</p>
</body>
</html>

66
man/bin/sync.html Normal file
View File

@@ -0,0 +1,66 @@
<!--
Copyright (c) 2000, 2001, 2002, 2003, 2004, 2005, 2008, 2009, 2013
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.
-->
<html>
<head>
<title>sync</title>
<link rel="stylesheet" type="text/css" media="all" href="../man.css">
</head>
<body bgcolor=#ffffff>
<h2 align=center>sync</h2>
<h4 align=center>OS/161 Reference Manual</h4>
<h3>Name</h3>
<p>
sync - synchronize buffers to disk
</p>
<h3>Synopsis</h3>
<p>
<tt>/bin/sync</tt>
</p>
<h3>Description</h3>
<p>
<tt>sync</tt> causes filesystem I/O buffers that have been modified
but not yet written to be written to disk.
</p>
<h3>Requirements</h3>
<p>
<tt>sync</tt> uses the <A HREF=../syscall/sync.html>sync</A> system
call, and of course <A HREF=../syscall/_exit.html>_exit</A>.
</p>
<p>
<tt>sync</tt> should function once the sync system call is wired up.
This is likely part of the file system assignment
</p>
</body>
</html>

87
man/bin/tac.html Normal file
View File

@@ -0,0 +1,87 @@
<!--
Copyright (c) 2000, 2001, 2002, 2003, 2004, 2005, 2008, 2009, 2013, 2014
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.
-->
<html>
<head>
<title>tac</title>
<link rel="stylesheet" type="text/css" media="all" href="../man.css">
</head>
<body bgcolor=#ffffff>
<h2 align=center>tac</h2>
<h4 align=center>OS/161 Reference Manual</h4>
<h3>Name</h3>
<p>
<tt>tac</tt> - print in reverse order
</p>
<h3>Synopsis</h3>
<p>
<tt>/bin/tac</tt> <em>files...</em>
</p>
<h3>Description</h3>
<p>
<tt>tac</tt> prints the files listed on its command line in reverse
order to its standard output. If the magic filename "-" is
encountered, <tt>tac</tt> prints its standard input up to the first
EOF. Each file is printed backwards in line-by-line fashion.
</p>
<p>
With no arguments, <tt>tac</tt> prints its standard input.
</p>
<p>
<tt>tac</tt> takes no options.
</p>
<h3>Requirements</h3>
<p>
<tt>tac</tt> uses the following syscalls:
<ul>
<li><A HREF=../syscall/getpid.html>getpid</A>
<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/remove.html>remove</A>
<li><A HREF=../syscall/_exit.html>_exit</A>
</ul>
</p>
<p>
<tt>tac</tt> should function properly once the basic system calls
assignment is completed. However, until the file system assignment is
done and the <A HREF=../syscall/remove.html>remove</A> system call
implemented, it will leave two scratch files behind per invocation.
</p>
</body>
</html>

69
man/bin/true.html Normal file
View File

@@ -0,0 +1,69 @@
<!--
Copyright (c) 2000, 2001, 2002, 2003, 2004, 2005, 2008, 2009, 2013
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.
-->
<html>
<head>
<title>true</title>
<link rel="stylesheet" type="text/css" media="all" href="../man.css">
</head>
<body bgcolor=#ffffff>
<h2 align=center>true</h2>
<h4 align=center>OS/161 Reference Manual</h4>
<h3>Name</h3>
<p>
true - return true value
</p>
<h3>Synopsis</h3>
<p>
<tt>/bin/true</tt>
</p>
<h3>Description</h3>
<p>
<tt>true</tt> exits with exit code 0, signifying success.
<p>
<h3>Requirements</h3>
<p>
<tt>true</tt> uses the <A HREF=../syscall/_exit.html>_exit</A> system call.
</p>
<p>
<tt>true</tt> should function properly once the basic system calls
assignment is completed.
</p>
<h3>See Also</h3>
<p>
<A HREF=false.html>false</A>
</p>
</body>
</html>

13
man/dev/Makefile Normal file
View File

@@ -0,0 +1,13 @@
# Man pages for device drivers
TOP=../..
.include "$(TOP)/mk/os161.config.mk"
MANDIR=/man/dev
MANFILES=\
beep.html con.html emu.html index.html lamebus.html lhd.html \
lnet.html lrandom.html lscreen.html lser.html ltimer.html \
null.html random.html rtclock.html
.include "$(TOP)/mk/os161.man.mk"

62
man/dev/beep.html Normal file
View File

@@ -0,0 +1,62 @@
<!--
Copyright (c) 2000, 2001, 2002, 2003, 2004, 2005, 2008, 2009, 2013
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.
-->
<html>
<head>
<title>beep</title>
<link rel="stylesheet" type="text/css" media="all" href="../man.css">
</head>
<body bgcolor=#ffffff>
<h2 align=center>beep</h2>
<h4 align=center>OS/161 Reference Manual</h4>
<h3>Name</h3>
<p>
beep - console beep device
</p>
<h3>Synopsis</h3>
<p>
device beep0 at ltimer*
</p>
<h3>Description</h3>
<p>
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>
<p>
<A HREF=ltimer.html>ltimer</A>
</p>
</body>
</html>

73
man/dev/con.html Normal file
View File

@@ -0,0 +1,73 @@
<!--
Copyright (c) 2000, 2001, 2002, 2003, 2004, 2005, 2008, 2009, 2013
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.
-->
<html>
<head>
<title>console</title>
<link rel="stylesheet" type="text/css" media="all" href="../man.css">
</head>
<body bgcolor=#ffffff>
<h2 align=center>con</h2>
<h4 align=center>OS/161 Reference Manual</h4>
<h3>Name</h3>
<p>
con - system login console
</p>
<h3>Synopsis</h3>
<p>
device con0 at lser*<br>
device con0 at lscreen*<br>
</p>
<h3>Description</h3>
<p>
The generic console device can be attached to either a serial port or
a memory-mapped screen. It provides a small input buffer but no input
editing. You may add such features if you desire.
</p>
<p>
The in-kernel kprintf() routine and its relatives send their
output to the console device.
</p>
<h3>Files</h3>
<p>
<tt>con:</tt>
</p>
<h3>See Also</h3>
<p>
<A HREF=lser.html>lser</A>,
<A HREF=lscreen.html>lscreen</A>
</p>
</body>
</html>

83
man/dev/emu.html Normal file
View File

@@ -0,0 +1,83 @@
<!--
Copyright (c) 2000, 2001, 2002, 2003, 2004, 2005, 2008, 2009, 2013
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.
-->
<html>
<head>
<title>emu</title>
<link rel="stylesheet" type="text/css" media="all" href="../man.css">
</head>
<body bgcolor=#ffffff>
<h2 align=center>emu</h2>
<h4 align=center>OS/161 Reference Manual</h4>
<h3>Name</h3>
<p>
emu - emulator pass-through filesystem
</p>
<h3>Synopsis</h3>
<p>
device emu* at lamebus*
</p>
<h3>Description</h3>
<p>
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>
<p>
It is not recommended to access the same underlying files through
different instances of emufs.
</p>
<h3>Files</h3>
<p>
<tt>emu0:</tt>, <tt>emu1:</tt>, etc.
</p>
<h3>Restrictions</h3>
<p>
emufs does not restrict access to the host directory tree under and
including its root directory. This is so symbolic links out of this
tree work without requiring special handling.
</p>
<p>
A number of file system operations, most notably remove and rmdir, are
not supported.
</p>
<h3>See Also</h3>
<p>
<A HREF=lamebus.html>lamebus</A>
</p>
</body>
</html>

67
man/dev/index.html Normal file
View File

@@ -0,0 +1,67 @@
<!--
Copyright (c) 2000, 2001, 2002, 2003, 2004, 2005, 2008, 2009, 2013
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.
-->
<html>
<head>
<title>OS/161 Devices</title>
<link rel="stylesheet" type="text/css" media="all" href="../manindex.css">
</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=ltrace.html>ltrace</A> - LAMEbus trace/debug 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>

68
man/dev/lamebus.html Normal file
View File

@@ -0,0 +1,68 @@
<!--
Copyright (c) 2000, 2001, 2002, 2003, 2004, 2005, 2008, 2009, 2013
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.
-->
<html>
<head>
<title>lamebus</title>
<link rel="stylesheet" type="text/css" media="all" href="../man.css">
</head>
<body bgcolor=#ffffff>
<h2 align=center>lamebus</h2>
<h4 align=center>OS/161 Reference Manual</h4>
<h3>Name</h3>
<p>
lamebus - driver for LAMEbus system bus
</p>
<h3>Synopsis</h3>
<p>
device lamebus0
</p>
<h3>Description</h3>
<p>
LAMEbus (Linear Always-Mapped Extents bus) 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.
</p>
<h3>See Also</h3>
<p>
<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>
</p>
</body>
</html>

65
man/dev/lhd.html Normal file
View File

@@ -0,0 +1,65 @@
<!--
Copyright (c) 2000, 2001, 2002, 2003, 2004, 2005, 2008, 2009, 2013
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.
-->
<html>
<head>
<title>lhd</title>
<link rel="stylesheet" type="text/css" media="all" href="../man.css">
</head>
<body bgcolor=#ffffff>
<h2 align=center>lhd</h2>
<h4 align=center>OS/161 Reference Manual</h4>
<h3>Name</h3>
<p>
lhd - LAMEbus hard drive
</p>
<h3>Synopsis</h3>
<p>
device lhd* at lamebus*
</p>
<h3>Description</h3>
<p>
lhd is the driver for the LAMEbus fixed disk interface. It
provides mountable block-device and raw-device access to the disk.
</p>
<h3>Files</h3>
<p>
<tt>lhd0:</tt>, <tt>lhd0raw:</tt>, <tt>lhd1:</tt>, <tt>lhd1raw:</tt>, etc.
</p>
<h3>See Also</h3>
<p>
<A HREF=lamebus.html>lamebus</A>
</p>
</body>
</html>

62
man/dev/lnet.html Normal file
View File

@@ -0,0 +1,62 @@
<!--
Copyright (c) 2000, 2001, 2002, 2003, 2004, 2005, 2008, 2009, 2013
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.
-->
<html>
<head>
<title>lnet</title>
<link rel="stylesheet" type="text/css" media="all" href="../man.css">
</head>
<body bgcolor=#ffffff>
<h2 align=center>lnet</h2>
<h4 align=center>OS/161 Reference Manual</h4>
<h3>Name</h3>
<p>
lnet - LAMEbus network card
</p>
<h3>Synopsis</h3>
<p>
options net<br>
device lnet* at lamebus*<br>
</p>
<h3>Description</h3>
<p>
lnet is the driver for the LAMEbus network interface card. As
of this writing the driver is not completed and is thus not available
for actual use yet.
</p>
<h3>See Also</h3>
<p>
<A HREF=lamebus.html>lamebus</A>
</p>
</body>
</html>

64
man/dev/lrandom.html Normal file
View File

@@ -0,0 +1,64 @@
<!--
Copyright (c) 2000, 2001, 2002, 2003, 2004, 2005, 2008, 2009, 2013
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.
-->
<html>
<head>
<title>lrandom</title>
<link rel="stylesheet" type="text/css" media="all" href="../man.css">
</head>
<body bgcolor=#ffffff>
<h2 align=center>lrandom</h2>
<h4 align=center>OS/161 Reference Manual</h4>
<h3>Name</h3>
<p>
lrandom - LAMEbus random source
</p>
<h3>Synopsis</h3>
<p>
device lrandom* at lamebus*
</p>
<h3>Description</h3>
<p>
lrandom is the driver for the LAMEbus random source card.
</p>
<p>
The generic <A HREF=random.html>random</A> device can be attached to
an lrandom instance.
</p>
<h3>See Also</h3>
<p>
<A HREF=lamebus.html>lamebus</A>
</p>
</body>
</html>

72
man/dev/lscreen.html Normal file
View File

@@ -0,0 +1,72 @@
<!--
Copyright (c) 2000, 2001, 2002, 2003, 2004, 2005, 2008, 2009, 2013
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.
-->
<html>
<head>
<title>lscreen</title>
<link rel="stylesheet" type="text/css" media="all" href="../man.css">
</head>
<body bgcolor=#ffffff>
<h2 align=center>lscreen</h2>
<h4 align=center>OS/161 Reference Manual</h4>
<h3>Name</h3>
<p>
lscreen - LAMEbus memory-mapped screen
</p>
<h3>Synopsis</h3>
<p>
device lscreen* at lamebus*
</p>
<h3>Description</h3>
<p>
lscreen is the driver for the LAMEbus memory-mapped screen
card. It does not provide any internal input buffering; that is
expected to happen at a higher level.
</p>
<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>
<p>
The <A HREF=con.html>system console</A> device can be attached to an
lscreen instance.
</p>
<h3>See Also</h3>
<p>
<A HREF=lamebus.html>lamebus</A>
</p>
</body>
</html>

67
man/dev/lser.html Normal file
View File

@@ -0,0 +1,67 @@
<!--
Copyright (c) 2000, 2001, 2002, 2003, 2004, 2005, 2008, 2009, 2013
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.
-->
<html>
<head>
<title>lser</title>
<link rel="stylesheet" type="text/css" media="all" href="../man.css">
</head>
<body bgcolor=#ffffff>
<h2 align=center>lser</h2>
<h4 align=center>OS/161 Reference Manual</h4>
<h3>Name</h3>
<p>
lser - LAMEbus serial port
</p>
<h3>Synopsis</h3>
<p>
device lser* at lamebus*
</p>
<h3>Description</h3>
<p>
lser is the driver for the 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>
<p>
The <A HREF=con.html>system console</A> device can be attached to an
lser instance.
</p>
<h3>See Also</h3>
<p>
<A HREF=lamebus.html>lamebus</A>
</p>
</body>
</html>

65
man/dev/ltimer.html Normal file
View File

@@ -0,0 +1,65 @@
<!--
Copyright (c) 2000, 2001, 2002, 2003, 2004, 2005, 2008, 2009, 2013
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.
-->
<html>
<head>
<title>ltimer</title>
<link rel="stylesheet" type="text/css" media="all" href="../man.css">
</head>
<body bgcolor=#ffffff>
<h2 align=center>ltimer</h2>
<h4 align=center>OS/161 Reference Manual</h4>
<h3>Name</h3>
<p>
ltimer - LAMEbus timer device
</p>
<h3>Synopsis</h3>
<p>
device ltimer* at lamebus*
</p>
<h3>Description</h3>
<p>
ltimer is a driver for the LAMEbus clock/timer card. The
card can also provide beep services to the kernel.
</p>
<p>
The <A HREF=beep.html>beep</A> and <A HREF=rtclock.html>rtclock</A>
generic devices can be attached to an ltimer instance.
</p>
<h3>See Also</h3>
<p>
<A HREF=lamebus.html>lamebus</A>
</p>
</body>
</html>

74
man/dev/ltrace.html Normal file
View File

@@ -0,0 +1,74 @@
<!--
Copyright (c) 2000, 2001, 2002, 2003, 2004, 2005, 2008, 2009, 2013
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.
-->
<html>
<head>
<title>ltrace</title>
<link rel="stylesheet" type="text/css" media="all" href="../man.css">
</head>
<body bgcolor=#ffffff>
<h2 align=center>ltrace</h2>
<h4 align=center>OS/161 Reference Manual</h4>
<h3>Name</h3>
<p>
ltrace - LAMEbus trace device
</p>
<h3>Synopsis</h3>
<p>
device ltrace* at lamebus*
</p>
<h3>Description</h3>
<p>
ltrace is a driver for the LAMEbus trace and debug card.
This device can be used to turn on and off System/161 tracing (with
<tt>trace161)</tt>; it can also be used to emit debug printouts with
much lower latency than printing to the console.
Finally, it can be used to cause a dump of the entire System/161
system state.
</p>
<p>
The calls for these operations are provided to the kernel via the
header file <tt>&lt;lamebus/ltrace.h&gt;</tt>.
</p>
<p>
Only the first ltrace device found, if any, is actually used. If none
is found, the calls have no effect.
</p>
<h3>See Also</h3>
<p>
<A HREF=lamebus.html>lamebus</A>
</p>
</body>
</html>

55
man/dev/null.html Normal file
View File

@@ -0,0 +1,55 @@
<!--
Copyright (c) 2000, 2001, 2002, 2003, 2004, 2005, 2008, 2009, 2013
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.
-->
<html>
<head>
<title>null</title>
<link rel="stylesheet" type="text/css" media="all" href="../man.css">
</head>
<body bgcolor=#ffffff>
<h2 align=center>null</h2>
<h4 align=center>OS/161 Reference Manual</h4>
<h3>Name</h3>
<p>
null - null device
</p>
<h3>Description</h3>
<p>
The null device does nothing. Reads generate immediate EOF. Any data
written is thrown away.
</p>
<h3>Files</h3>
<p>
<tt>null:</tt>
</p>
</body>
</html>

73
man/dev/random.html Normal file
View File

@@ -0,0 +1,73 @@
<!--
Copyright (c) 2000, 2001, 2002, 2003, 2004, 2005, 2008, 2009, 2013
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.
-->
<html>
<head>
<title>random</title>
<link rel="stylesheet" type="text/css" media="all" href="../man.css">
</head>
<body bgcolor=#ffffff>
<h2 align=center>random</h2>
<h4 align=center>OS/161 Reference Manual</h4>
<h3>Name</h3>
<p>
random - kernel randomness source
</p>
<h3>Synopsis</h3>
<p>
device random0 at lrandom*<br>
device random0 at pseudorand0<br>
</p>
<h3>Description</h3>
<p>
The random device is the generalized interface to randomness sources.
Only one random device is used; if more are attached they are ignored.
If no random device is found, the kernel may not run.
</p>
<p>
The random device provides both the in-kernel random() function and a
VFS-level character device, called <tt>random:</tt>. Bytes read from the
latter have random values; writes are discarded.
</p>
<h3>Files</h3>
<p>
<tt>random:</tt>
</p>
<h3>See Also</h3>
<p>
<A HREF=lrandom.html>lrandom</A>
</p>
</body>
</html>

65
man/dev/rtclock.html Normal file
View File

@@ -0,0 +1,65 @@
<!--
Copyright (c) 2000, 2001, 2002, 2003, 2004, 2005, 2008, 2009, 2013
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.
-->
<html>
<head>
<title>rtclock</title>
<link rel="stylesheet" type="text/css" media="all" href="../man.css">
</head>
<body bgcolor=#ffffff>
<h2 align=center>rtclock</h2>
<h4 align=center>OS/161 Reference Manual</h4>
<h3>Name</h3>
<p>
rtclock - realtime clock
</p>
<h3>Synopsis</h3>
<p>
device rtclock0 at ltimer*
</p>
<h3>Description</h3>
<p>
The rtclock device is the generalized interface to the time of day. It
provides the in-kernel function gettime().
</p>
<p>
Only the first clock attached is used. If no clock at all is found,
the system will panic if gettime() is called.
</p>
<h3>See Also</h3>
<p>
<A HREF=ltimer.html>ltimer</A>
</p>
</body>
</html>

50
man/index.html Normal file
View File

@@ -0,0 +1,50 @@
<!--
Copyright (c) 2000, 2001, 2002, 2003, 2004, 2005, 2008, 2009, 2013
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.
-->
<html>
<head>
<title>OS/161 Manual</title>
<link rel="stylesheet" type="text/css" media="all" href="manindex.css">
</head>
<body bgcolor=#ffffff>
<h1 align=center>OS/161 2.0 Reference Manual</h1>
<h1 align=center>&nbsp;</h1>
<ul>
<li> <A HREF=bin>Binaries (/bin)</A>
<li> <A HREF=sbin>Sysadmin binaries (/sbin)</A>
<li> <A HREF=testbin>Test binaries (/testbin)</A>
<li> <A HREF=syscall>System calls</A>
<li> <A HREF=libc>C standard library (libc)</A>
<li> <A HREF=dev>Device drivers</A>
<li> <A HREF=misc>Miscellaneous</A>
</ul>
</body>
</html>

17
man/libc/Makefile Normal file
View File

@@ -0,0 +1,17 @@
# Man pages for libraries
TOP=../..
.include "$(TOP)/mk/os161.config.mk"
MANDIR=/man/libc
MANFILES=\
__vprintf.html abort.html assert.html atoi.html bzero.html \
calloc.html err.html exit.html free.html getchar.html getcwd.html \
index.html malloc.html memcpy.html memmove.html memset.html \
printf.html putchar.html puts.html random.html realloc.html \
setjmp.html snprintf.html stdarg.html strcat.html strchr.html \
strcmp.html strcpy.html strerror.html strlen.html strrchr.html \
strtok.html strtok_r.html system.html time.html warn.html
.include "$(TOP)/mk/os161.man.mk"

97
man/libc/__vprintf.html Normal file
View File

@@ -0,0 +1,97 @@
<!--
Copyright (c) 2000, 2001, 2002, 2003, 2004, 2005, 2008, 2009, 2013
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.
-->
<html>
<head>
<title>__vprintf</title>
<link rel="stylesheet" type="text/css" media="all" href="../man.css">
</head>
<body bgcolor=#ffffff>
<h2 align=center>__vprintf</h2>
<h4 align=center>OS/161 Reference Manual</h4>
<h3>Name</h3>
<p>
__vprintf - printf backend
</p>
<h3>Library</h3>
<p>
Standard C Library (libc, -lc)
</p>
<h3>Synopsis</h3>
<p>
<tt>#include &lt;unistd.h&gt;</tt><br>
<br>
<tt>int</tt><br>
<tt>__vprintf(void (*</tt><em>func</em><tt>)(void
*</tt><em>clientdata</em><tt>,
const char *</tt><em>str</em><tt>,
size_t </tt><em>len</em><tt>),
void *</tt><em>clientdata</em><tt>,
const char *</tt><em>format</em><tt>,
va_list)</tt>
</p>
<h3>Description</h3>
<p>
In OS/161, __vprintf is the back-end engine for
<A HREF=printf.html>printf</A> and printf-like functions.
Note that it is not portable - application code should use
<A HREF=snprintf.html>snprintf or vsnprintf</A> when implementing
their own printf-like functions. This documentation is provided for
use when extending OS/161 itself.
</p>
<p>
The <em>format</em> and subsequent arguments are treated as described
under <A HREF=printf.html>printf</A>.
</p>
<p>
The <em>func</em> argument is called to print text generated by the
formatting process. The <em>clientdata</em> argument is passed
straight through __vprintf to <em>func</em>. The <em>str</em> argument
to func points to some text that is to be printed; the <em>len</em>
argument is the length of that string, which should not be assumed to
be null-terminated.
</p>
<p>
The strings passed to <em>func</em> may be small; if printing is
expensive buffering is probably wanted.
</p>
<h3>Return Values</h3>
<p>
__vprintf returns the number of characters printed.
</p>
</body>
</html>

68
man/libc/abort.html Normal file
View File

@@ -0,0 +1,68 @@
<!--
Copyright (c) 2000, 2001, 2002, 2003, 2004, 2005, 2008, 2009, 2013
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.
-->
<html>
<head>
<title>abort</title>
<link rel="stylesheet" type="text/css" media="all" href="../man.css">
</head>
<body bgcolor=#ffffff>
<h2 align=center>abort</h2>
<h4 align=center>OS/161 Reference Manual</h4>
<h3>Name</h3>
<p>
abort - abnormal program termination
</p>
<h3>Library</h3>
<p>
Standard C Library (libc, -lc)
</p>
<h3>Synopsis</h3>
<p>
<tt>#include &lt;abort.h&gt;</tt><br>
<br>
<tt>void</tt><br>
<tt>abort(void);</tt>
</p>
<h3>Description</h3>
<p>
The <tt>abort</tt> function causes immediate abnormal program termination.
Cleanup is not performed.
</p>
<h3>Return Values</h3>
<p>
<tt>abort</tt> does not return.
</p>
</body>
</html>

74
man/libc/assert.html Normal file
View File

@@ -0,0 +1,74 @@
<!--
Copyright (c) 2000, 2001, 2002, 2003, 2004, 2005, 2008, 2009, 2013
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.
-->
<html>
<head>
<title>assert</title>
<link rel="stylesheet" type="text/css" media="all" href="../man.css">
</head>
<body bgcolor=#ffffff>
<h2 align=center>assert</h2>
<h4 align=center>OS/161 Reference Manual</h4>
<h3>Name</h3>
<p>
assert - check assumptions at run time
</p>
<h3>Library</h3>
<p>
Standard C Library (libc, -lc)
</p>
<h3>Synopsis</h3>
<p>
<tt>#include &lt;assert.h&gt;</tt><br>
<br>
<tt>assert(expression);</tt>
</p>
<h3>Description</h3>
<p>
<tt>assert</tt> checks that its argument evaluates to true. If this is not the
case, an error message is printed and <A HREF=abort.html>abort</A> is
called.
</p>
<p>
<tt>assert</tt> is a macro. If the macro <tt>NDEBUG</tt> is defined at
compile time, assertion tests are removed.
</p>
<h3>Caution</h3>
<p>
Avoid writing assert expressions with side effects, as compiling with
<tt>NDEBUG</tt> normally causes the side effects to disappear.
</p>
</body>
</html>

73
man/libc/atoi.html Normal file
View File

@@ -0,0 +1,73 @@
<!--
Copyright (c) 2000, 2001, 2002, 2003, 2004, 2005, 2008, 2009, 2013
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.
-->
<html>
<head>
<title>atoi</title>
<link rel="stylesheet" type="text/css" media="all" href="../man.css">
</head>
<body bgcolor=#ffffff>
<h2 align=center>atoi</h2>
<h4 align=center>OS/161 Reference Manual</h4>
<h3>Name</h3>
<p>
atoi - convert ascii to integer
</p>
<h3>Library</h3>
<p>
Standard C Library (libc, -lc)
</p>
<h3>Synopsis</h3>
<p>
<tt>#include &lt;stdlib.h&gt;</tt><br>
<br>
<tt>int</tt><br>
<tt>atoi(const char *</tt><em>string</em><tt>);</tt>
</p>
<h3>Description</h3>
<p>
<em>string</em>, which should be a textual representation of an
integer, is converted to the machine representation of that integer.
Leading whitespace, if any, is skipped. Conversion stops when a
non-numeric character is found.
</p>
<h3>Return Values</h3>
<p>
<tt>atoi</tt> returns the number converted. If no digits at all were
found, it returns 0.
If too many digits are found (resulting in overflow) the behavior is
formally undefined.
</p>
</body>
</html>

71
man/libc/bzero.html Normal file
View File

@@ -0,0 +1,71 @@
<!--
Copyright (c) 2000, 2001, 2002, 2003, 2004, 2005, 2008, 2009, 2013
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.
-->
<html>
<head>
<title>bzero</title>
<link rel="stylesheet" type="text/css" media="all" href="../man.css">
</head>
<body bgcolor=#ffffff>
<h2 align=center>bzero</h2>
<h4 align=center>OS/161 Reference Manual</h4>
<h3>Name</h3>
<p>
bzero - zero out memory
</p>
<h3>Library</h3>
<p>
Standard C Library (libc, -lc)
</p>
<h3>Synopsis</h3>
<p>
<tt>#include &lt;string.h&gt;</tt><br>
<br>
<tt>void</tt><br>
<tt>bzero(void *</tt><em>buf</em><tt>, size_t </tt><em>len</em><tt>);</tt>
</p>
<h3>Description</h3>
<p>
The region of memory pointed to by <em>buf</em>, of length
<em>len</em>, is zeroed out.
</p>
<h3>Restrictions</h3>
<p>
Zeroing the bytes of a floating point number does not necessarily
produce a floating point zero value.
Similarly, zeroing the bytes of a pointer does not necessarily produce
<tt>NULL</tt>.
</p>
</body>
</html>

84
man/libc/calloc.html Normal file
View File

@@ -0,0 +1,84 @@
<!--
Copyright (c) 2000, 2001, 2002, 2003, 2004, 2005, 2008, 2009, 2013
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.
-->
<html>
<head>
<title>calloc</title>
<link rel="stylesheet" type="text/css" media="all" href="../man.css">
</head>
<body bgcolor=#ffffff>
<h2 align=center>calloc</h2>
<h4 align=center>OS/161 Reference Manual</h4>
<h3>Name</h3>
<p>
calloc - allocate and clear memory
</p>
<h3>Library</h3>
<p>
Standard C Library (libc, -lc)
</p>
<h3>Synopsis</h3>
<p>
<tt>#include &lt;stdlib.h&gt;</tt><br>
<br>
<tt>void *</tt><br>
<tt>calloc(size_t </tt><em>number</em><tt>, size_t </tt><em>size</em><tt>);</tt>
</p>
<h3>Description</h3>
<p>
<tt>calloc</tt> allocates <em>number</em>*<em>size</em> bytes of
memory, zeros it, and returns a pointer to it. It is equivalent to
calling
<A HREF=malloc.html><tt>malloc</tt></A><tt>(</tt><em>number</em>*<em>size</em></tt>)</tt>
followed by <A HREF=bzero.html>bzero</A>.
</p>
<p>
If the product <em>number</em>*<em>size</em> overflows the range of
<tt>size_t</tt>, calloc fails.
</p>
<h3>Return Values</h3>
<p>
<tt>calloc</tt> returns a pointer to the memory allocated. If memory
cannot be obtained, NULL is returned.
</p>
<h3>See Also</h3>
<p>
<A HREF=malloc.html>malloc</A>,
<A HREF=realloc.html>realloc</A>,
<A HREF=free.html>free</A>
</p>
</body>
</html>

104
man/libc/err.html Normal file
View File

@@ -0,0 +1,104 @@
<!--
Copyright (c) 2000, 2001, 2002, 2003, 2004, 2005, 2008, 2009, 2013
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.
-->
<html>
<head>
<title>err</title>
<link rel="stylesheet" type="text/css" media="all" href="../man.css">
</head>
<body bgcolor=#ffffff>
<h2 align=center>err</h2>
<h4 align=center>OS/161 Reference Manual</h4>
<h3>Name</h3>
<p>
err, errx, verr, verrx - print error messages
</p>
<h3>Library</h3>
<p>
Standard C Library (libc, -lc)
</p>
<h3>Synopsis</h3>
<p>
<tt>#include &lt;err.h&gt;</tt><br>
<br>
<tt>void</tt><br>
<tt>err(int </tt><em>exitcode</em><tt>,
const char *</tt><em>format</em><tt>, ...);</tt><br>
<br>
<tt>void</tt><br>
<tt>errx(int </tt><em>exitcode</em><tt>,
const char *</tt><em>format</em><tt>, ...);</tt><br>
<br>
<tt>void</tt><br>
<tt>verr(int </tt><em>exitcode</em><tt>,
const char *</tt><em>format</em><tt>, va_list);</tt><br>
<br>
<tt>void</tt><br>
<tt>verrx(int </tt><em>exitcode</em><tt>,
const char *</tt><em>format</em><tt>, va_list);</tt><br>
</p>
<h3>Description</h3>
<p>
The <tt>err</tt>, <tt>errx</tt>, <tt>verr</tt>, and <tt>verrx</tt>
functions print error messages to the standard error stream.
</p>
<p>
<tt>errx</tt> prints the name of the program, a colon, the text
generated by passing <em>format</em> and subsequent args through
<A HREF=printf.html>printf</A>, and a newline. Then,
<A HREF=exit.html>exit</A> is called and passed the supplied
<em>exitcode</em>.
</p>
<p>
<tt>err</tt> does the same thing, except that a colon and the error
string for the current error (obtained by calling
<A HREF=strerror.html>strerror</A> on
<A HREF=../syscall/errno.html>errno</A>) are printed prior to the
newline.
</p>
<p>
<tt>verrx</tt> and <tt>verr</tt> are the same as errx and err
respectively, except that the additional arguments for printf are
taken to have been already packaged up in a <tt>va_list</tt> by use of
the <A HREF=stdarg.html>stdarg</A> facility.
</p>
<h3>See Also</h3>
<p>
<A HREF=warn.html>warn</A>
</p>
</body>
</html>

100
man/libc/execvp.html Normal file
View File

@@ -0,0 +1,100 @@
<!--
Copyright (c) 2000, 2001, 2002, 2003, 2004, 2005, 2008, 2009, 2013
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.
-->
<html>
<head>
<title>execvp</title>
<link rel="stylesheet" type="text/css" media="all" href="../man.css">
</head>
<body bgcolor=#ffffff>
<h2 align=center>execvp</h2>
<h4 align=center>OS/161 Reference Manual</h4>
<h3>Name</h3>
<p>
execvp - execute a program found on the search path
</p>
<h3>Library</h3>
<p>
Standard C Library (libc, -lc)
</p>
<h3>Synopsis</h3>
<p>
<tt>#include &lt;unistd.h&gt;</tt><br>
<br>
<tt>int</tt><br>
<tt>execvp(const char *</tt><em>program</em><tt>,
char **</tt><em>args</em><tt>);</tt>
</p>
<h3>Description</h3>
<p>
<tt>execvp</tt> searches for <em>program</em> on the program search
path and execs it with <A HREF=../syscall/execv.html>execv</A> if
found. If <em>program</em> is not found or a serious error occurs, it
returns.
</p>
<p>
If <em>program</em> contains a slash, no search is done; the specified
string is passed directly to <tt>execv</tt>.
</p>
<p>
The <em>args</em> argument should be prepared exactly as for
<tt>execv</tt>.
</p>
<p>
The search path is a colon-delimited list of directories retrieved by
calling <A HREF=getenv.html>getenv</A> to retrieve the <tt>PATH</tt>
environment variable. Unless you implement <tt>execve</tt> and
environment variable passing, the value used is from a default
environment compiled into libc. This path searches the <tt>/bin</tt>,
<tt>/sbin</tt>, and <tt>/testbin</tt> directories.
</p>
<h3>Return Values</h3>
<p>
On success, <tt>execvp</tt> does not return; instead, the new program
begins executing. On failure, <tt>execvp</tt> returns -1, and sets
<A HREF=errno.html>errno</A> to a suitable error code for the error
condition encountered.
</p>
<h3>Errors</h3>
<p>
<tt>execvp</tt> can fail for any of the reasons <tt>execv</tt> can.
In addition, it produces ENOENT if the requested program is not
found.
</p>
</body>
</html>

69
man/libc/exit.html Normal file
View File

@@ -0,0 +1,69 @@
<!--
Copyright (c) 2000, 2001, 2002, 2003, 2004, 2005, 2008, 2009, 2013
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.
-->
<html>
<head>
<title>exit</title>
<link rel="stylesheet" type="text/css" media="all" href="../man.css">
</head>
<body bgcolor=#ffffff>
<h2 align=center>exit</h2>
<h4 align=center>OS/161 Reference Manual</h4>
<h3>Name</h3>
<p>
exit - terminate program
</p>
<h3>Library</h3>
<p>
Standard C Library (libc, -lc)
</p>
<h3>Synopsis</h3>
<p>
<tt>#include &lt;stdlib.h&gt;</tt><br>
<br>
<tt>int</tt><br>
<tt>exit(int </tt><em>code</em><tt>);</tt>
</p>
<h3>Description</h3>
<p>
<tt>exit</tt> causes the program to exit. It calls internal cleanup
routines, and then performs the actual exit by calling
<A HREF=../syscall/_exit.html>_exit</A>.
</p>
<h3>Return Values</h3>
<p>
exit does not return.
</p>
</body>
</html>

104
man/libc/free.html Normal file
View File

@@ -0,0 +1,104 @@
<!--
Copyright (c) 2000, 2001, 2002, 2003, 2004, 2005, 2008, 2009, 2013
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.
-->
<html>
<head>
<title>free</title>
<link rel="stylesheet" type="text/css" media="all" href="../man.css">
</head>
<body bgcolor=#ffffff>
<h2 align=center>free</h2>
<h4 align=center>OS/161 Reference Manual</h4>
<h3>Name</h3>
<p>
free - release/deallocate memory
</p>
<h3>Library</h3>
<p>
Standard C Library (libc, -lc)
</p>
<h3>Synopsis</h3>
<p>
<tt>#include &lt;stdlib.h&gt;</tt><br>
<br>
<tt>void</tt><br>
<tt>free(void *</tt><em>ptr</em><tt>);</tt>
</p>
<h3>Description</h3>
<p>
<tt>free</tt> releases a block of memory previously allocated with
<A HREF=malloc.html>malloc</A>, <A HREF=calloc.html>calloc</A>,
or <A HREF=realloc.html>realloc</A>.
</p>
<p>
Once free has been called, <em>ptr</em> is no longer valid and
attempts to dereference it result in undefined behavior.
(Pedantically, in fact, even using the <i>value</i> of
<em>ptr</em> may produce undefined behavior.) Passing <em>ptr</em> to
free a second or subsequent time (unless of course the same pointer
value is again returned from malloc) is also undefined and
particularly likely to provoke adverse behavior in most
implementations.
</p>
<p>
<tt>free(NULL)</tt> has no effect.
</p>
<p>
In practice it is desirable for implementations of <tt>free</tt> to
detect, to the extent practically possible, pointers that were not
previously allocated by one of the above functions or that are passed
to <tt>free</tt> multiple times. However, this can be difficult and
there is no useful standard mechanism for error reporting.
</p>
<p>
<tt>free</tt> does not necessarily unmap free memory or return it to
the operating system, but may do so if it chooses.
</p>
<h3>Return Values</h3>
<p>
<tt>free</tt> returns no value.
<p>
<h3>See Also</h3>
<p>
<A HREF=calloc.html>calloc</A>,
<A HREF=malloc.html>malloc</A>,
<A HREF=realloc.html>realloc</A>
</p>
</body>
</html>

76
man/libc/getchar.html Normal file
View File

@@ -0,0 +1,76 @@
<!--
Copyright (c) 2000, 2001, 2002, 2003, 2004, 2005, 2008, 2009, 2013
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.
-->
<html>
<head>
<title>getchar</title>
<link rel="stylesheet" type="text/css" media="all" href="../man.css">
</head>
<body bgcolor=#ffffff>
<h2 align=center>getchar</h2>
<h4 align=center>OS/161 Reference Manual</h4>
<h3>Name</h3>
<p>
getchar - read character from standard input
</p>
<h3>Library</h3>
<p>
Standard C Library (libc, -lc)
</p>
<h3>Synopsis</h3>
<p>
<tt>#include &lt;stdio.h&gt;</tt><br>
<br>
<tt>int</tt><br>
<tt>getchar(void);</tt>
</p>
<h3>Description</h3>
<p>
<tt>getchar</tt> reads a single character from standard input. The
character is converted to unsigned char before being returned.
EOF, which is negative, is thus not a possible successful return value.
</p>
<h3>Return Values</h3>
<p>
On success, getchar returns the character read. On error, or end of
file, EOF is returned.
</p>
<h3>Errors</h3>
<p>
Any of the errors associated with <A HREF=../syscall/read>read</A>
may occur.
</p>
</body>
</html>

100
man/libc/getcwd.html Normal file
View File

@@ -0,0 +1,100 @@
<!--
Copyright (c) 2000, 2001, 2002, 2003, 2004, 2005, 2008, 2009, 2013
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.
-->
<html>
<head>
<title>getcwd</title>
<link rel="stylesheet" type="text/css" media="all" href="../man.css">
</head>
<body bgcolor=#ffffff>
<h2 align=center>getcwd</h2>
<h4 align=center>OS/161 Reference Manual</h4>
<h3>Name</h3>
<p>
getcwd - get name of current working directory
</p>
<h3>Library</h3>
<p>
Standard C Library (libc, -lc)
</p>
<h3>Synopsis</h3>
<p>
<tt>#include &lt;unistd.h&gt;</tt><br>
<br>
<tt>char *</tt><br>
<tt>getcwd(char *</tt><em>buf</em><tt>, size_t </tt><em>buflen</em><tt>);</tt>
</p>
<h3>Description</h3>
<p>
The name of the current directory is computed and stored in
<em>buf</em>, an area of size <em>buflen</em>. The resulting string is
0-terminated.
</p>
<p>
This call is a wrapper (for Unix compatibility) around the system call
<A HREF=../syscall/__getcwd.html>__getcwd</A>.
</p>
<p>
Note, however, that the BSD extension whereby space is allocated with
<A HREF=malloc.html>malloc</A> if <em>buf</em> is <tt>NULL</tt> is not
supported.
</p>
<h3>Return Values</h3>
<p>
On success, <tt>getcwd</tt> returns <em>buf</em>.
On error, <tt>NULL</tt> is returned, and <A HREF=errno.html>errno</A>
is set according to the error encountered.
</p>
<h3>Errors</h3>
<p>
The following error codes should be returned under the conditions
given. Other error codes may be returned for other errors not
mentioned here.
</p>
<table width=90%>
<tr><td width=5% rowspan=3>&nbsp;</td>
<td>ENOENT</td>
<td width=5% rowspan=3>&nbsp;</td>
<td>A component of the pathname no longer exists.</td></tr>
<tr><td>EIO</td>
<td>A hard I/O error occurred.</td></tr>
<tr><td>EFAULT</td>
<td><em>buf</em> points to an invalid address.</td></tr>
</table>
</body>
</html>

82
man/libc/getenv.html Normal file
View File

@@ -0,0 +1,82 @@
<!--
Copyright (c) 2000, 2001, 2002, 2003, 2004, 2005, 2008, 2009, 2013
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.
-->
<html>
<head>
<title>getenv</title>
<link rel="stylesheet" type="text/css" media="all" href="../man.css">
</head>
<body bgcolor=#ffffff>
<h2 align=center>getenv</h2>
<h4 align=center>OS/161 Reference Manual</h4>
<h3>Name</h3>
<p>
getenv - retrieve an environment variable
</p>
<h3>Library</h3>
<p>
Standard C Library (libc, -lc)
</p>
<h3>Synopsis</h3>
<p>
<tt>#include &lt;stdlib.h&gt;</tt><br>
<br>
<tt>char *</tt><br>
<tt>getenv(const char *</tt><em>variable</em><tt>);</tt>
</p>
<h3>Description</h3>
<p>
<tt>getenv</tt> retrieves the value of the environment variable
<em>variable</em> from the current process environment.
Unless you implement <tt>execve</tt> and environment variable passing,
the environment used is a default environment compiled into libc.
</p>
<h3>Return Values</h3>
<p>
On success, <tt>getenv</tt> returns a pointer to the value of the
requested variable.
This pointer points to internal storage and the contents should not be
modified.
The contents will in turn be stable until/unless the process
environment is modified.
If the requested variable is not found, <tt>getenv</tt> returns
<tt>NULL</tt>.
</p>
<h3>See Also</h3>
<p>
<A HREF=execvp.html>execvp</A>
</p>
</body>
</html>

96
man/libc/index.html Normal file
View File

@@ -0,0 +1,96 @@
<!--
Copyright (c) 2000, 2001, 2002, 2003, 2004, 2005, 2008, 2009, 2013
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.
-->
<html>
<head>
<title>OS/161 C Standard Library</title>
<link rel="stylesheet" type="text/css" media="all" href="../manindex.css">
</head>
<body bgcolor=#ffffff>
<h2 align=center>OS/161 C Standard Library (libc)</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=../dev>Device drivers</A> |
<A HREF=../misc>Miscellaneous</A>
</p>
<br>
<ul>
<li> <A HREF=__vprintf.html>__vprintf</A> - printf backend
<li> <A HREF=abort.html>abort</A> - abnormal program termination
<li> <A HREF=assert.html>assert</A> - check assumptions at run time
<li> <A HREF=atoi.html>atoi</A> - convert ascii to integer
<li> <A HREF=bzero.html>bzero</A> - zero out memory
<li> <A HREF=calloc.html>calloc</A> - allocate and clear memory
<li> <A HREF=err.html>err, errx</A> - print error messages
<li> <A HREF=execvp.html>execvp</A> - exec on the search path
<li> <A HREF=exit.html>exit</A> - terminate program
<li> <A HREF=free.html>free</A> - release/deallocate memory
<li> <A HREF=getchar.html>getchar</A> - read character from standard input
<li> <A HREF=getcwd.html>getcwd</A> - get name of current working directory
<li> <A HREF=getenv.html>getenv</A> - get environment variable
<li> <A HREF=setjmp.html>longjmp</A> - non-local jump operations
<li> <A HREF=malloc.html>malloc</A> - allocate memory
<li> <A HREF=memcmp.html>memcmp</A> - compare regions of memory
<li> <A HREF=memcpy.html>memcpy</A> - copy region of memory
<li> <A HREF=memmove.html>memmove</A> - copy region of memory
<li> <A HREF=memset.html>memset</A> - initialize region of memory
<li> <A HREF=printf.html>printf</A> - print formatted output
<li> <A HREF=putchar.html>putchar</A> - print character to standard output
<li> <A HREF=puts.html>puts</A> - print string to standard output
<li> <A HREF=random.html>random</A> - pseudorandom number generation
<li> <A HREF=realloc.html>realloc</A> - resize allocated memory
<li> <A HREF=setjmp.html>setjmp</A> - non-local jump operations
<li> <A HREF=snprintf.html>snprintf</A> - print formatted text to string
<li> <A HREF=stdarg.html>stdarg</A> - handle functions with variable arguments
<li> <A HREF=strcat.html>strcat</A> - concatenate strings
<li> <A HREF=strchr.html>strchr</A> - search string for character
<li> <A HREF=strcmp.html>strcmp</A> - compare strings
<li> <A HREF=strcpy.html>strcpy</A> - copy string
<li> <A HREF=strerror.html>strerror</A> - get error message for error code
<li> <A HREF=strlen.html>strlen</A> - determine length of string
<li> <A HREF=strrchr.html>strrchr</A> - search string for character
<li> <A HREF=strtok.html>strtok</A> - tokenize string
<li> <A HREF=strtok_r.html>strtok_r</A> - tokenize string reentrantly
<li> <A HREF=system.html>system</A> - run command as subprocess
<li> <A HREF=time.html>time</A> - get time of day
<li> <A HREF=err.html>verr, verrx</A> - print error messages
<li> <A HREF=printf.html>vprintf</A> - print formatted output
<li> <A HREF=snprintf.html>vsnprintf</A> - print formatted text to string
<li> <A HREF=warn.html>vwarn, vwarnx</A> - print warning messages
<li> <A HREF=warn.html>warn, warnx</A> - print warning messages
</ul>
</body>
</html>

108
man/libc/malloc.html Normal file
View File

@@ -0,0 +1,108 @@
<!--
Copyright (c) 2000, 2001, 2002, 2003, 2004, 2005, 2008, 2009, 2013
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.
-->
<html>
<head>
<title>malloc</title>
<link rel="stylesheet" type="text/css" media="all" href="../man.css">
</head>
<body bgcolor=#ffffff>
<h2 align=center>malloc</h2>
<h4 align=center>OS/161 Reference Manual</h4>
<h3>Name</h3>
<p>
malloc - allocate memory
</p>
<h3>Library</h3>
<p>
Standard C Library (libc, -lc)
</p>
<h3>Synopsis</h3>
<p>
<tt>#include &lt;stdlib.h&gt;</tt><br>
<br>
<tt>void *</tt><br>
<tt>malloc(size_t </tt><em>size</em><tt>);</tt>
</p>
<h3>Description</h3>
<p>
<tt>malloc</tt> allocates <em>size</em> bytes of memory and returns a
pointer to it. The memory is not necessarily zero-filled. (To get
zero-filled memory, call <A HREF=bzero.html>bzero</A> or
<A HREF=memset.html>memset</A>, or use
<A HREF=calloc.html>calloc</A>.)
</p>
<p>
The pointer returned must be suitably aligned for use with any data
type.
</p>
<p>
When asked to allocate zero bytes, <tt>malloc</tt> may either always
return <tt>NULL</tt>, or may return distinct non-null pointers that do
not point to any storage.
</p>
<p>
While <tt>malloc</tt> may at its option allocate more than
<em>size</em> bytes to fill a request, code that calls <tt>malloc</tt>
may not depend on such behavior and must not perform any accesses
outside of the bounds defined by <em>size</em>.
</p>
<p>
It is legitimate for memory returned by malloc to not actually be
physically mapped until it is used.
If at the time it is used, no physical memory is available and there
is no space to swap something out to make room, the process may
potentially receive a fatal signal or be killed.
This behavior is often somewhat contentious; a full discussion of the
possible alternatives and their pros and cons is well beyond the scope
of this man page.
</p>
<h3>Return Values</h3>
<p>
<tt>malloc</tt> returns a pointer to the memory allocated. If memory
cannot be obtained, NULL is returned.
</p>
<h3>See Also</h3>
<p>
<A HREF=calloc.html>calloc</A>,
<A HREF=realloc.html>realloc</A>,
<A HREF=free.html>free</A>
</p>
</body>
</html>

81
man/libc/memcmp.html Normal file
View File

@@ -0,0 +1,81 @@
<!--
Copyright (c) 2000, 2001, 2002, 2003, 2004, 2005, 2008, 2009, 2013
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.
-->
<html>
<head>
<title>strcmp</title>
<link rel="stylesheet" type="text/css" media="all" href="../man.css">
</head>
<body bgcolor=#ffffff>
<h2 align=center>strcmp</h2>
<h4 align=center>OS/161 Reference Manual</h4>
<h3>Name</h3>
<p>
memcmp - compare memory blocks
</p>
<h3>Library</h3>
<p>
Standard C Library (libc, -lc)
</p>
<h3>Synopsis</h3>
<p>
<tt>#include &lt;string.h&gt;</tt><br>
<br>
<tt>int</tt><br>
<tt>memcmp(const void *</tt><em>block1</em><tt>,
const void *</tt><em>block2</em><tt>,
size_t </tt><em>len</em><tt>);</tt>
</p>
<h3>Description</h3>
<p>
The two memory regions <em>block1</em> and <em>block2</em>, both of
length <em>len</em>, are compared lexicographically.
</p>
<h3>Return Values</h3>
<p>
If <em>block1</em> sorts before <em>block2</em>, -1 is returned.
</p>
<p>
If <em>block1</em> sorts after <em>block2</em>, 1 is returned.
</p>
<p>
If <em>block1</em> is the same as <em>block2</em>, 0 is returned.
</p>
<p>
The sort order used is derived from the natural ordering of
the numerical values of (unsigned) characters.
</p>
</body>
</html>

76
man/libc/memcpy.html Normal file
View File

@@ -0,0 +1,76 @@
<!--
Copyright (c) 2000, 2001, 2002, 2003, 2004, 2005, 2008, 2009, 2013
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.
-->
<html>
<head>
<title>memcpy</title>
<link rel="stylesheet" type="text/css" media="all" href="../man.css">
</head>
<body bgcolor=#ffffff>
<h2 align=center>memcpy</h2>
<h4 align=center>OS/161 Reference Manual</h4>
<h3>Name</h3>
<p>
memcpy - copy region of memory
</p>
<h3>Library</h3>
<p>
Standard C Library (libc, -lc)
</p>
<h3>Synopsis</h3>
<p>
<tt>#include &lt;string.h&gt;</tt><br>
<br>
<tt>void *</tt><br>
<tt>memcpy(void *</tt><em>dest</em><tt>,
const void *</tt><em>src</em><tt>, size_t </tt><em>len</em><tt>);</tt>
</p>
<h3>Description</h3>
<p>
The block of memory beginning at <em>src</em>, of length <em>len</em>,
is copied to <em>dest</em>. <em>dest</em> must point to a region large
enough to hold it.
</p>
<p>
<tt>memcpy</tt> is not guaranteed to operate correctly if <em>src</em>
and <em>dest</em> overlap. Use <A HREF=memmove.html>memmove</A> on
overlapping regions.
</p>
<h3>Return Values</h3>
<p>
<tt>memcpy</tt> returns <em>dest</em>.
</p>
</body>
</html>

75
man/libc/memmove.html Normal file
View File

@@ -0,0 +1,75 @@
<!--
Copyright (c) 2000, 2001, 2002, 2003, 2004, 2005, 2008, 2009, 2013
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.
-->
<html>
<head>
<title>memmove</title>
<link rel="stylesheet" type="text/css" media="all" href="../man.css">
</head>
<body bgcolor=#ffffff>
<h2 align=center>memmove</h2>
<h4 align=center>OS/161 Reference Manual</h4>
<h3>Name</h3>
<p>
memmove - copy region of memory
</p>
<h3>Library</h3>
<p>
Standard C Library (libc, -lc)
</p>
<h3>Synopsis</h3>
<p>
<tt>#include &lt;string.h&gt;</tt><br>
<br>
<tt>void *</tt><br>
<tt>memmove(void *</tt><em>dest</em><tt>,
const void *</tt><em>src</em><tt>, size_t </tt><em>len</em><tt>);</tt>
</p>
<h3>Description</h3>
<p>
The block of memory beginning at <em>src</em>, of length <em>len</em>,
is copied to <em>dest</em>. <em>dest</em> must point to a region large
enough to hold it.
</p>
<p>
Unlike <A HREF=memcpy.html>memcpy</A>, <tt>memmove</tt> is guaranteed
to operate correctly if <em>src</em> and <em>dest</em> overlap.
</p>
<h3>Return Values</h3>
<p>
<tt>memmove</tt> returns <em>dest</em>.
</p>
</body>
</html>

82
man/libc/memset.html Normal file
View File

@@ -0,0 +1,82 @@
<!--
Copyright (c) 2000, 2001, 2002, 2003, 2004, 2005, 2008, 2009, 2013
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.
-->
<html>
<head>
<title>memset</title>
<link rel="stylesheet" type="text/css" media="all" href="../man.css">
</head>
<body bgcolor=#ffffff>
<h2 align=center>memset</h2>
<h4 align=center>OS/161 Reference Manual</h4>
<h3>Name</h3>
<p>
memset - initialize region of memory
</p>
<h3>Library</h3>
<p>
Standard C Library (libc, -lc)
</p>
<h3>Synopsis</h3>
<p>
<tt>#include &lt;string.h&gt;</tt><br>
<br>
<tt>void *</tt><br>
<tt>memset(void *</tt><em>buf</em><tt>,
int </tt><em>chr</em><tt>, size_t </tt><em>len</em><tt>);</tt>
</p>
<h3>Description</h3>
<p>
The memory region pointed to by <em>buf</em>, of length <em>len</em>,
is initialized by setting each location of it to <em>chr</em>
(converted to unsigned char).
</p>
<p>
Beware of writing
<pre>
memset(buf, len, 0);
</pre>
(which does nothing at all) when you meant
<pre>
memset(buf, 0, len);
</pre>
instead.
</p>
<h3>Return Values</h3>
<p>
<tt>memset</tt> returns <em>buf</em>.
</p>
</body>
</html>

143
man/libc/printf.html Normal file
View File

@@ -0,0 +1,143 @@
<!--
Copyright (c) 2000, 2001, 2002, 2003, 2004, 2005, 2008, 2009, 2013
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.
-->
<html>
<head>
<title>printf</title>
<link rel="stylesheet" type="text/css" media="all" href="../man.css">
</head>
<body bgcolor=#ffffff>
<h2 align=center>printf</h2>
<h4 align=center>OS/161 Reference Manual</h4>
<h3>Name</h3>
<p>
printf - print formatted output
</p>
<h3>Library</h3>
<p>
Standard C Library (libc, -lc)
</p>
<h3>Synopsis</h3>
<p>
<tt>#include &lt;stdio.h&gt;</tt><br>
<br>
<tt>int</tt><br>
<tt>printf(const char *</tt><em>format</em><tt>, ...);</tt>
</p>
<h3>Description</h3>
<p>
<tt>printf</tt> prints formatted text to standard output. The text is
generated from the <em>format</em> argument and subsequent arguments
according to the following rules.
</p>
<p>
Characters in <em>format</em> that are not the percent sign
(<tt>%</tt>) are printed verbatim. When a percent sign is encountered,
the next argument of the arguments following <em>format</em> is
retrieved and printed. The type of the argument expected, as well as
some simple formatting instructions, are derived from the characters
following the percent sign.
</p>
<p>
The following characters designate types to print. One of these
characters concludes the format sequence begun with a percent sign,
and also determines the type expected as an argument.
</p>
<table width=90%>
<tr><td width=5% rowspan=9>
<td width=5%>%</td> <td>A percent sign is printed; no argument
is consumed.</td></tr>
<tr><td>c</td> <td>Character (char, passed as an integer value)</td></tr>
<tr><td>d</td> <td>Signed integer value printed in decimal</td></tr>
<tr><td>o</td> <td>Unsigned integer value printed in octal</td></tr>
<tr><td>p</td> <td>Pointer (void *)</td></tr>
<tr><td>s</td> <td>String (const char *)</td></tr>
<tr><td>u</td> <td>Unsigned integer value printed in decimal</td></tr>
<tr><td>x</td> <td>Unsigned integer value printed in hexadecimal</td></tr>
<tr><td>X</td> <td>Unsigned integer value printed in uppercase hex</td></tr>
</table>
<p>
The following characters are modifiers; they can be found between the
percent sign and the type designator.
</p>
<table width=90%>
<tr><td width=5% rowspan=6>
<td width=5% valign=top>#</td> <td>Select an "alternate
format". On integer formats this
causes the C base prefix to be printed
along with the integer. On other
formats, this has no effect.</td></tr>
<tr><td valign=top>l</td> <td>Assume an integer argument is
<tt>long</tt> or <tt>unsigned
long</tt> instead of <tt>int</tt> or
<tt>unsigned int</tt>. If repeated,
the argument is taken to be <tt>long
long</tt> or <tt>unsigned long
long</tt>. </td></tr>
<tr><td valign=top>z</td> <td>Assume an integer argument is
<tt>ssize_t</tt> or <tt>size_t</tt>
instead of <tt>int</tt> or
<tt>unsigned int</tt>. </td></tr>
<tr><td valign=top>0-9</td> <td>Digits are treated as a decimal number,
which is considered to be the field
width. The argument is printed
right-aligned in a field that many
characters wide.</td></tr>
<tr><td valign=top>0</td> <td>If the field width has a leading 0, the
padding character for alignment is
made 0 (zero) instead of
space.</td></tr>
<tr><td valign=top>-</td> <td>If a field width is given, use it for
left alignment instead of right
alignment.</td></tr>
</table>
<h3>Restrictions</h3>
<p>
Note that this is a limited printf implementation - it has no support
for precisions (".number" as a modifier), floating-point formats,
field widths passed as arguments, or the rarely-used plus and space
modifiers.
</p>
<h3>Return Values</h3>
<p>
<tt>printf</tt> returns the number of characters printed.
</p>
</body>
</html>

75
man/libc/putchar.html Normal file
View File

@@ -0,0 +1,75 @@
<!--
Copyright (c) 2000, 2001, 2002, 2003, 2004, 2005, 2008, 2009, 2013
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.
-->
<html>
<head>
<title>putchar</title>
<link rel="stylesheet" type="text/css" media="all" href="../man.css">
</head>
<body bgcolor=#ffffff>
<h2 align=center>putchar</h2>
<h4 align=center>OS/161 Reference Manual</h4>
<h3>Name</h3>
<p>
putchar - print character to standard output
</p>
<h3>Library</h3>
<p>
Standard C Library (libc, -lc)
</p>
<h3>Synopsis</h3>
<p>
<tt>#include &lt;stdio.h&gt;</tt><br>
<br>
<tt>int</tt><br>
<tt>putchar(int </tt><em>chr</em><tt>);</tt>
</p>
<h3>Description</h3>
<p>
<tt>putchar</tt> writes its argument character to standard output.
</p>
<h3>Return Values</h3>
<p>
<tt>putchar</tt> returns <em>chr</em>. On error, EOF is returned, and
<A HREF=../syscall/errno.html>errno</A> is set according to the error
encountered.
</p>
<h3>Errors</h3>
<p>
Any of the errors from <A HREF=../syscall/write.html>write</A> may
occur.
</p>
</body>
</html>

76
man/libc/puts.html Normal file
View File

@@ -0,0 +1,76 @@
<!--
Copyright (c) 2000, 2001, 2002, 2003, 2004, 2005, 2008, 2009, 2013
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.
-->
<html>
<head>
<title>puts</title>
<link rel="stylesheet" type="text/css" media="all" href="../man.css">
</head>
<body bgcolor=#ffffff>
<h2 align=center>puts</h2>
<h4 align=center>OS/161 Reference Manual</h4>
<h3>Name</h3>
<p>
puts - print string to standard output
</p>
<h3>Library</h3>
<p>
Standard C Library (libc, -lc)
</p>
<h3>Synopsis</h3>
<p>
<tt>#include &lt;stdio.h&gt;</tt><br>
<br>
<tt>int</tt><br>
<tt>puts(const char *</tt><em>string</em><tt>);</tt>
</p>
<h3>Description</h3>
<p>
The string <em>string</em>, and a following newline character, are
printed on the standard output.
</p>
<h3>Return Values</h3>
<p>
On success, <tt>puts</tt> returns a nonnegative integer. On error, -1 is
returned, and <A HREF=../syscall/errno.html>errno</A> is set
according to the error encountered.
</p>
<h3>Errors</h3>
<p>
Any of the errors from <A HREF=../syscall/write.html>write</A> may
occur.
</p>
</body>
</html>

89
man/libc/random.html Normal file
View File

@@ -0,0 +1,89 @@
<!--
Copyright (c) 2000, 2001, 2002, 2003, 2004, 2005, 2008, 2009, 2013
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.
-->
<html>
<head>
<title>random</title>
<link rel="stylesheet" type="text/css" media="all" href="../man.css">
</head>
<body bgcolor=#ffffff>
<h2 align=center>random</h2>
<h4 align=center>OS/161 Reference Manual</h4>
<h3>Name</h3>
<p>
random - pseudorandom number generation
</p>
<h3>Library</h3>
<p>
Standard C Library (libc, -lc)
</p>
<h3>Synopsis</h3>
<p>
<tt>#include &lt;stdlib.h&gt;</tt><br>
<br>
<tt>long</tt><br>
<tt>random(void);</tt><br>
<br>
<tt>void</tt><br>
<tt>srandom(unsigned long </tt><em>seed</em><tt>);</tt><br>
</p>
<h3>Description</h3>
<p>
<tt>random</tt> returns a number between 0 and 0x7fffffff. This
number is selected using a rather complex generator which is believed
to generate randomness of an acceptable (though not cryptographic)
quality. Unlike with some generators, all bits of the values returned
are random.
</p>
<p>
<tt>srandom</tt> initializes the generator state based on the
passed-in <em>seed</em>. If <tt>srandom</tt> is not called, the
sequence of numbers returned by <tt>random</tt> is the same as if
<tt>srandom</tt> had been called with a <em>seed</em> of 1.
</p>
<p>
The symbolic constant <tt>RAND_MAX</tt> is provided to hold the
maximum value 0x7fffffff.
This is technically incorrect as the name <tt>RAND_MAX</tt> is
properly part of a different random number interface.
</p>
<p>
The implementation of <tt>random</tt> and <tt>srandom</tt> used in
OS/161 is software developed by the University of California, Berkeley
and its contributors.
</p>
</body>
</html>

104
man/libc/realloc.html Normal file
View File

@@ -0,0 +1,104 @@
<!--
Copyright (c) 2000, 2001, 2002, 2003, 2004, 2005, 2008, 2009, 2013
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.
-->
<html>
<head>
<title>realloc</title>
<link rel="stylesheet" type="text/css" media="all" href="../man.css">
</head>
<body bgcolor=#ffffff>
<h2 align=center>realloc</h2>
<h4 align=center>OS/161 Reference Manual</h4>
<h3>Name</h3>
<p>
realloc - resize allocated memory
</p>
<h3>Library</h3>
<p>
Standard C Library (libc, -lc)
</p>
<h3>Synopsis</h3>
<p>
<tt>#include &lt;stdlib.h&gt;</tt><br>
<br>
<tt>void *</tt><br>
<tt>realloc(void *</tt><em>ptr</em><tt>,
size_t </tt><em>newsize</em><tt>);</tt>
</p>
<h3>Description</h3>
<p>
<tt>realloc</tt> attempts to change the size of the memory block
pointed to by <em>ptr</em> to <em>newsize</em>, causing the block to
shrink or grow as necessary. If the size cannot be changed, a new
block is allocated and the contents (up to the lesser of the previous
size and <em>newsize</em>) are copied, then the old block is freed.
</p>
<p>
The size of <tt>NULL</tt> is treated as 0. If the size is increased,
any newly allocated space has undefined contents. If the size is
decreased, the space discarded may no longer be accessed. Otherwise
the contents of the memory block are preserved.
</p>
<p>
<em>ptr</em> must be NULL or have been previously returned by
<A HREF=malloc.html>malloc</A>, <A HREF=calloc.html>calloc</A>, or
realloc.
</p>
The alignment and other restrictions described for
<A HREF=malloc.html>malloc</A> apply equally to realloc.
<p>
<h3>Return Values</h3>
<p>
<tt>realloc</tt> returns a pointer to the resized memory block. This
may not be the same pointer as <em>ptr</em>. If so, the old block is
invalidated and <em>ptr</em> becomes invalid.
</p>
<p>
If the operation cannot be performed at all, NULL is returned and
the original block pointed to by <em>ptr</em> is untouched
and remains valid.
</p>
<h3>See Also</h3>
<p>
<A HREF=calloc.html>calloc</A>,
<A HREF=malloc.html>malloc</A>,
<A HREF=free.html>free</A>
</p>
</body>
</html>

85
man/libc/setjmp.html Normal file
View File

@@ -0,0 +1,85 @@
<!--
Copyright (c) 2000, 2001, 2002, 2003, 2004, 2005, 2008, 2009, 2013
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.
-->
<html>
<head>
<title>setjmp</title>
<link rel="stylesheet" type="text/css" media="all" href="../man.css">
</head>
<body bgcolor=#ffffff>
<h2 align=center>setjmp</h2>
<h4 align=center>OS/161 Reference Manual</h4>
<h3>Name</h3>
<p>
setjmp, longjmp - non-local jump operations
</p>
<h3>Library</h3>
<p>
Standard C Library (libc, -lc)
</p>
<h3>Synopsis</h3>
<p>
<tt>#include &lt;setjmp.h&gt;</tt><br>
<br>
<tt>int</tt><br>
<tt>setjmp(jmp_buf </tt><em>jb</em>)<tt>;</tt><br>
<br>
<tt>void</tt><br>
<tt>longjmp(jmp_buf </tt><em>jb</em><tt>,
int </tt><em>returncode</em>)<tt>;</tt><br>
</p>
<h3>Description</h3>
<p>
<tt>setjmp</tt> saves the current stack frame and processor state in
<em>jb</em>. A subsequent call to <tt>longjmp</tt> with the same
<em>jb</em> causes execution to jump to where <tt>setjmp</tt> was
called from.
</p>
<p>
If the stack frame that called <tt>setjmp</tt> returns before
<tt>longjmp</tt> is called, the results are undefined.
</p>
<h3>Return Values</h3>
<p>
When called, <tt>setjmp</tt> returns 0. When <tt>longjmp</tt> is
called, it does not itself return, but instead causes <tt>setjmp</tt>
to appear to return again, this time returning <em>returncode</em>.
</p>
<p>
If zero is passed as <em>returncode</em>, the value 1 is used instead.
</p>
</body>
</html>

84
man/libc/snprintf.html Normal file
View File

@@ -0,0 +1,84 @@
<!--
Copyright (c) 2000, 2001, 2002, 2003, 2004, 2005, 2008, 2009, 2013
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.
-->
<html>
<head>
<title>snprintf</title>
<link rel="stylesheet" type="text/css" media="all" href="../man.css">
</head>
<body bgcolor=#ffffff>
<h2 align=center>snprintf</h2>
<h4 align=center>OS/161 Reference Manual</h4>
<h3>Name</h3>
<p>
snprintf - print formatted text to string
</p>
<h3>Library</h3>
<p>
Standard C Library (libc, -lc)
</p>
<h3>Synopsis</h3>
<p>
<tt>#include &lt;unistd.h&gt;</tt><br>
<br>
<tt>int</tt><br>
<tt>snprintf(char *</tt><em>buf</em><tt>, size_t </tt><em>buflen</em><tt>,
const char *</tt><em>format</em><tt>, ...);</tt><br>
<br>
<tt>int</tt><br>
<tt>vsnprintf(char *</tt><em>buf</em><tt>, size_t </tt><em>buflen</em><tt>,
const char *</tt><em>format</em><tt>, va_list);</tt><br>
</p>
<h3>Description</h3>
<p>
<tt>snprintf</tt> performs <A HREF=printf.html>printf</A>-style
formatting on the string <em>format</em> and subsequent arguments. The
resulting string is placed in <em>buf</em>, which is a memory area at
least <em>buflen</em> bytes long. A null terminator is always added to
<em>buf</em>; the space for this is presumed to be counted in
<em>buflen</em>.
</p>
<p>
<tt>vsnprintf</tt> is the same as <tt>snprintf</tt>, except that the
subsequent arguments are presumed to have already been collected using
the <A HREF=stdarg.html>stdarg</A> facility.
</p>
<h3>Return Values</h3>
<p>
<tt>snprintf</tt> and <tt>vsnprintf</tt> return the number of
characters printed.
</p>
</body>
</html>

126
man/libc/stdarg.html Normal file
View File

@@ -0,0 +1,126 @@
<!--
Copyright (c) 2000, 2001, 2002, 2003, 2004, 2005, 2008, 2009, 2013
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.
-->
<html>
<head>
<title>stdarg</title>
<link rel="stylesheet" type="text/css" media="all" href="../man.css">
</head>
<body bgcolor=#ffffff>
<h2 align=center>stdarg</h2>
<h4 align=center>OS/161 Reference Manual</h4>
<h3>Name</h3>
<p>
stdarg - handle functions with variable arguments
</p>
<h3>Library</h3>
<p>
Standard C Library (libc, -lc)
</p>
<h3>Synopsis</h3>
<p>
<tt>#include &lt;stdarg.h&gt;</tt><br>
<br>
<tt>va_start(va_list </tt><em>ap</em><tt>,
</tt><em>start-argument</em><tt>);</tt><br>
<br>
<tt>va_end(va_list </tt><em>ap</em><tt>);</tt><br>
<br>
<em>type</em><br>
<tt>va_arg(va_list </tt><em>ap</em><tt>, </tt><em>type</em><tt>);</tt><br>
<br>
<tt>va_copy(va_list </tt><em>dest</em><tt>,
va_list </tt><em>src</em><tt>);</tt><br>
</p>
<h3>Description</h3>
<p>
Functions where the number of arguments is not fixed at compile time
can be written using the stdarg facility. This provides a type,
<tt>va_list</tt>, and the macros listed above. These allow iterating
through the arguments.
</p>
<p>
<tt>va_start</tt> initializes a <tt>va_list</tt> <em>ap</em> to point
to the current function's arguments. The <em>start-argument</em>
argument should be the name of the last fixed parameter in the calling
sequence.
(There must be at least one fixed parameter.)
</p>
<p>
<tt>va_end</tt> cleans up a <tt>va_list</tt> once it is no longer
needed. While failure to use <tt>va_end</tt> may have no effect on
some architectures (in fact, in some cases <tt>va_end</tt> does
nothing at all) on other architectures it may be fatal.
</p>
<p>
<tt>va_arg</tt> retrieves the next argument, which is presumed to be
of type <em>type</em>. The function must have some way to determine
what types to expect, and how many arguments, as this information
cannot be extracted from the argument list itself. To rewind, use
<tt>va_end</tt> and then <tt>va_start</tt> again.
</p>
<p>
Remember that default C argument promotions occur when passing the
variable arguments. There is no run-time checking of any kind, and
little to no compile-time checking: if you use <tt>va_arg</tt> to
retrieve a type different from that which was passed, you will
silently get garbage for that and (usually) all subsequent arguments.
</p>
<p>
<tt>va_copy</tt> assigns a copy of <em>src</em> to
<em>dest</em>. Subsequent operations on either will not affect the
other. Both copies need to be cleaned up with <tt>va_end</tt>.
</p>
<h3>Restrictions</h3>
<p>
Because the <tt>va_list</tt> is not necessarily a simple type, but may
involve pointers to state maintained elsewhere, it is not necessarily
a simple value. Thus, assigning <tt>va_list</tt> objects to each other
with `=', memcpy, or the like, or passing them to functions, may not
give multiple independent objects. When in doubt, use
<tt>va_copy</tt>, or invoke <tt>va_start</tt> multiple times.
</p>
<h3>Return Values</h3>
<p>
<tt>va_start</tt>, <tt>va_end</tt>, and <tt>va_copy</tt> do not return
anything. <tt>va_arg</tt> returns the value of the requested argument.
</p>
</body>
</html>

80
man/libc/strcat.html Normal file
View File

@@ -0,0 +1,80 @@
<!--
Copyright (c) 2000, 2001, 2002, 2003, 2004, 2005, 2008, 2009, 2013
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.
-->
<html>
<head>
<title>strcat</title>
<link rel="stylesheet" type="text/css" media="all" href="../man.css">
</head>
<body bgcolor=#ffffff>
<h2 align=center>strcat</h2>
<h4 align=center>OS/161 Reference Manual</h4>
<h3>Name</h3>
<p>
strcat - concatenate strings
</p>
<h3>Library</h3>
<p>
Standard C Library (libc, -lc)
</p>
<h3>Synopsis</h3>
<p>
<tt>#include &lt;string.h&gt;</tt><br>
<br>
<tt>char *</tt><br>
<tt>strcat(char *</tt><em>dest</em><tt>,
const char *</tt><em>src</em><tt>);</tt>
</p>
<h3>Description</h3>
<p>
<tt>strcat</tt> appends the contents of the string <em>src</em> to the
string <em>dest</em>.
</p>
<h3>Restrictions</h3>
<p>
If <em>dest</em> does not point to enough space to hold both strings,
the resulting behavior is undefined.
</p>
<p>
If the memory areas pointed to by <em>dest</em> and <em>src</em>
overlap, the behavior is undefined.
</p>
<h3>Return Values</h3>
<p>
<tt>strcat</tt> returns <em>dest</em>.
</p>
</body>
</html>

72
man/libc/strchr.html Normal file
View File

@@ -0,0 +1,72 @@
<!--
Copyright (c) 2000, 2001, 2002, 2003, 2004, 2005, 2008, 2009, 2013
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.
-->
<html>
<head>
<title>strchr</title>
<link rel="stylesheet" type="text/css" media="all" href="../man.css">
</head>
<body bgcolor=#ffffff>
<h2 align=center>strchr</h2>
<h4 align=center>OS/161 Reference Manual</h4>
<h3>Name</h3>
<p>
strchr - search string for character
</p>
<h3>Library</h3>
<p>
Standard C Library (libc, -lc)
</p>
<h3>Synopsis</h3>
<p>
<tt>#include &lt;string.h&gt;</tt><br>
<br>
<tt>char *</tt><br>
<tt>strchr(const char *</tt><em>string</em><tt>,
int </tt><em>chr</em><tt>);</tt>
</p>
<h3>Description</h3>
<p>
<tt>strchr</tt> searches <em>string</em> from the left for the first
instance of the character <em>chr</em>.
The characters found and <em>chr</em> are cast to and compared as the
type <tt>unsigned char</tt>.
</p>
<h3>Return Values</h3>
<p>
<tt>strchr</tt> returns a pointer to the character found. If the
character is not found, NULL is returned.
</p>
</body>
</html>

80
man/libc/strcmp.html Normal file
View File

@@ -0,0 +1,80 @@
<!--
Copyright (c) 2000, 2001, 2002, 2003, 2004, 2005, 2008, 2009, 2013
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.
-->
<html>
<head>
<title>strcmp</title>
<link rel="stylesheet" type="text/css" media="all" href="../man.css">
</head>
<body bgcolor=#ffffff>
<h2 align=center>strcmp</h2>
<h4 align=center>OS/161 Reference Manual</h4>
<h3>Name</h3>
<p>
strcmp - compare strings
</p>
<h3>Library</h3>
<p>
Standard C Library (libc, -lc)
</p>
<h3>Synopsis</h3>
<p>
<tt>#include &lt;string.h&gt;</tt><br>
<br>
<tt>int</tt><br>
<tt>strcmp(const char *</tt><em>str1</em><tt>,
const char *</tt><em>str2</em><tt>);</tt>
</p>
<h3>Description</h3>
<p>
The two strings <em>str1</em> and <em>str2</em> are compared
lexicographically.
</p>
<h3>Return Values</h3>
<p>
If <em>str1</em> sorts before <em>str2</em>, -1 is returned.
</p>
<p>
If <em>str1</em> sorts after <em>str2</em>, 1 is returned.
</p>
<p>
If <em>str1</em> is the same as <em>str2</em>, 0 is returned.
</p>
<p>
The sort order used is derived from the natural ordering of
the numerical values of (unsigned) characters.
</p>
</body>
</html>

80
man/libc/strcpy.html Normal file
View File

@@ -0,0 +1,80 @@
<!--
Copyright (c) 2000, 2001, 2002, 2003, 2004, 2005, 2008, 2009, 2013
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.
-->
<html>
<head>
<title>strcpy</title>
<link rel="stylesheet" type="text/css" media="all" href="../man.css">
</head>
<body bgcolor=#ffffff>
<h2 align=center>strcpy</h2>
<h4 align=center>OS/161 Reference Manual</h4>
<h3>Name</h3>
<p>
strcpy - copy string
</p>
<h3>Library</h3>
<p>
Standard C Library (libc, -lc)
</p>
<h3>Synopsis</h3>
<p>
<tt>#include &lt;string.h&gt;</tt><br>
<br>
<tt>char *</tt><br>
<tt>strcpy(char *</tt><em>dest</em><tt>,
const char *</tt><em>src</em><tt>);</tt>
</p>
<h3>Description</h3>
<p>
The contents of the string <em>src</em> are copied into
<em>dest</em>.
</p>
<h3>Restrictions</h3>
<p>
If <em>dest</em> does not point to enough space to hold the string,
the resulting behavior is undefined.
</p>
<p>
If the memory areas pointed to by <em>dest</em> and <em>src</em>
overlap, the behavior is undefined.
</p>
<h3>Return Values</h3>
<p>
<tt>strcpy</tt> returns <em>dest</em>.
</p>
</body>
</html>

75
man/libc/strerror.html Normal file
View File

@@ -0,0 +1,75 @@
<!--
Copyright (c) 2000, 2001, 2002, 2003, 2004, 2005, 2008, 2009, 2013
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.
-->
<html>
<head>
<title>strerror</title>
<link rel="stylesheet" type="text/css" media="all" href="../man.css">
</head>
<body bgcolor=#ffffff>
<h2 align=center>strerror</h2>
<h4 align=center>OS/161 Reference Manual</h4>
<h3>Name</h3>
<p>
strerror - get error message for error code
</p>
<h3>Library</h3>
<p>
Standard C Library (libc, -lc)
</p>
<h3>Synopsis</h3>
<p>
<tt>#include &lt;string.h&gt;</tt><br>
<br>
<tt>const char *</tt><br>
<tt>strerror(int </tt><em>code</em><tt>);</tt>
</p>
<h3>Description</h3>
<p>
The error string for the error specified by <em>code</em> (see
<A HREF=../syscall/errno.html>errno</A> for more information) is
retrieved.
</p>
<p>
It is not itself an error to request error strings for out-of-range
values of <em>code</em>, but the string returned under such
circumstances may not be very enlightening when printed.
</p>
<h3>Return Values</h3>
<p>
The error string is returned.
</p>
</body>
</html>

63
man/libc/strlen.html Normal file
View File

@@ -0,0 +1,63 @@
<!--
Copyright (c) 2000, 2001, 2002, 2003, 2004, 2005, 2008, 2009, 2013
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.
-->
<html>
<head>
<title>strlen</title>
<link rel="stylesheet" type="text/css" media="all" href="../man.css">
</head>
<body bgcolor=#ffffff>
<h2 align=center>strlen</h2>
<h4 align=center>OS/161 Reference Manual</h4>
<h3>Name</h3>
<p>
strlen - determine length of string
</p>
<h3>Library</h3>
<p>
Standard C Library (libc, -lc)
</p>
<h3>Synopsis</h3>
<p>
<tt>#include &lt;string.h&gt;</tt><br>
<br>
<tt>size_t</tt><br>
<tt>strlen(const char *</tt><em>string</em><tt>);</tt>
</p>
<h3>Description</h3>
<p>
<tt>strlen</tt> returns the length of the string <em>string</em>. The
length does not include the null terminator.
</p>
</body>
</html>

72
man/libc/strrchr.html Normal file
View File

@@ -0,0 +1,72 @@
<!--
Copyright (c) 2000, 2001, 2002, 2003, 2004, 2005, 2008, 2009, 2013
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.
-->
<html>
<head>
<title>strrchr</title>
<link rel="stylesheet" type="text/css" media="all" href="../man.css">
</head>
<body bgcolor=#ffffff>
<h2 align=center>strrchr</h2>
<h4 align=center>OS/161 Reference Manual</h4>
<h3>Name</h3>
<p>
strrchr - search string for character
</p>
<h3>Library</h3>
<p>
Standard C Library (libc, -lc)
</p>
<h3>Synopsis</h3>
<p>
<tt>#include &lt;string.h&gt;</tt><br>
<br>
<tt>char *</tt><br>
<tt>strrchr(const char *</tt><em>string</em><tt>,
int </tt><em>chr</em><tt>);</tt>
</p>
<h3>Description</h3>
<p>
<tt>strrchr</tt> searches <em>string</em> from the right for the first
instance of the character <em>chr</em>.
The characters found and <em>chr</em> are cast to and compared as the
type <tt>unsigned char</tt>.
</p>
<h3>Return Values</h3>
<p>
<tt>strrchr</tt> returns a pointer to the character found. If the
character is not found, NULL is returned.
</p>
</body>
</html>

101
man/libc/strtok.html Normal file
View File

@@ -0,0 +1,101 @@
<!--
Copyright (c) 2000, 2001, 2002, 2003, 2004, 2005, 2008, 2009, 2013
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.
-->
<html>
<head>
<title>strtok</title>
<link rel="stylesheet" type="text/css" media="all" href="../man.css">
</head>
<body bgcolor=#ffffff>
<h2 align=center>strtok</h2>
<h4 align=center>OS/161 Reference Manual</h4>
<h3>Name</h3>
<p>
strtok - tokenize string
</p>
<h3>Library</h3>
<p>
Standard C Library (libc, -lc)
</p>
<h3>Synopsis</h3>
<p>
<tt>#include &lt;string.h&gt;</tt><br>
<br>
<tt>char *</tt><br>
<tt>strtok(char *</tt><em>string</em><tt>,
const char *</tt><em>separators</em><tt>);</tt>
</p>
<h3>Description</h3>
<p>
<tt>strtok</tt> splits up the string <em>string</em> into fields using
the characters found in <em>separators</em> as delimiters. The
delimiters found are discarded. Multiple delimiter characters in a row
are treated as a single delimiter.
</p>
<p>
When first called, <tt>strtok</tt> returns the first field of
<em>string</em>. To retrieve successive fields of <em>string</em>,
call <tt>strtok</tt> again repeatedly, passing <tt>NULL</tt> as the
first argument. When no more fields are left, <tt>NULL</tt> is
returned. If the string is empty or contains only delimiters,
<tt>NULL</tt> will be returned on the first call.
</p>
<h3>Cautions</h3>
<p>
Note that the state used to remember <em>string</em> across calls is
global. Thus, <tt>strtok</tt> cannot be used from more than one thread
at a time in a multithreaded program, nor can it be used in a
subroutine called from within a loop that itself uses
<tt>strtok</tt>. If these restrictions are problematic, use <A
HREF=strtok_r.html>strtok_r</A>.
</p>
<p>
The behavior if strtok is called again without passing a new
<em>string</em> after it has returned <tt>NULL</tt> is undefined.
</p>
<p>
The behavior if strtok is called with the first argument <tt>NULL</tt>
without having first passed a valid <em>string</em> is also undefined.
</p>
<h3>Return Values</h3>
<p>
<tt>strtok</tt> returns successive components of the passed-in string,
and <tt>NULL</tt> when no more remain.
</p>
</body>
</html>

81
man/libc/strtok_r.html Normal file
View File

@@ -0,0 +1,81 @@
<!--
Copyright (c) 2000, 2001, 2002, 2003, 2004, 2005, 2008, 2009, 2013
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.
-->
<html>
<head>
<title>strtok_r</title>
<link rel="stylesheet" type="text/css" media="all" href="../man.css">
</head>
<body bgcolor=#ffffff>
<h2 align=center>strtok_r</h2>
<h4 align=center>OS/161 Reference Manual</h4>
<h3>Name</h3>
<p>
strtok_r - tokenize string reentrantly
</p>
<h3>Library</h3>
<p>
Standard C Library (libc, -lc)
</p>
<h3>Synopsis</h3>
<p>
<tt>#include &lt;string.h&gt;</tt><br>
<br>
<tt>char *</tt><br>
<tt>strtok_r(char *</tt><em>string</em><tt>,
const char *</tt><em>separators</em><tt>,
char **</tt><em>context</em><tt>);</tt>
</p>
<h3>Description</h3>
<p>
<tt>strtok_r</tt> is a reentrant version of <A
HREF=strtok.html>strtok</A>. It behaves the same way, except that the
internal state is kept using the <em>context</em> parameter rather
than being global.
</p>
<p>
The value passed to the <em>context</em> parameter should be the
address of a <tt>char *</tt> whose value is preserved between
successive related calls to strtok_r. The <tt>char *</tt> need not be
initialized before the first call, and its value should not be
inspected.
</p>
<h3>Return Values</h3>
<p>
<tt>strtok_r</tt> returns successive components of the passed-in
string, and <tt>NULL</tt> when no more remain.
</p>
</body>
</html>

91
man/libc/system.html Normal file
View File

@@ -0,0 +1,91 @@
<!--
Copyright (c) 2000, 2001, 2002, 2003, 2004, 2005, 2008, 2009, 2013
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.
-->
<html>
<head>
<title>system</title>
<link rel="stylesheet" type="text/css" media="all" href="../man.css">
</head>
<body bgcolor=#ffffff>
<h2 align=center>system</h2>
<h4 align=center>OS/161 Reference Manual</h4>
<h3>Name</h3>
<p>
system - run command as subprocess
</p>
<h3>Library</h3>
<p>
Standard C Library (libc, -lc)
</p>
<h3>Synopsis</h3>
<p>
<tt>#include &lt;stdlib.h&gt;</tt><br>
<br>
<tt>int</tt><br>
<tt>system(const char *</tt><em>command</em><tt>);</tt>
</p>
<h3>Description</h3>
<p>
The <tt>system</tt> routine executes <em>command</em> as if it were
typed into the shell.
</p>
<h3>Return Values</h3>
<p>
On success, system returns the exit status returned from
<A HREF=../syscall/waitpid.html>waitpid</A>.
On error, -1 is returned, and <A HREF=../syscall/errno.html>errno</A>
is set according to the error encountered.
</p>
<h3>Errors</h3>
<p>
Any of the errors from <A HREF=../syscall/fork.html>fork</A> or
<A HREF=../syscall/waitpid.html>waitpid</A>. Errors generated during
<A HREF=../syscall/execv.html>execv</A> cannot readily be reported
back in detail.
</p>
<h3>Restrictions</h3>
<p>
In OS/161 there may be no shell and when there is the shell's behavior
and syntax is not specified. For this reason we make no assumptions
about the shell's operation, and assume <tt>system</tt> cannot
reliably use the shell to parse and execute <em>command</em>.
Instead, <tt>system</tt> does this itself, in a way which may not
necessarily be compatible with the shell as it finally appears. You
may want to change <tt>system</tt> to invoke the shell in a suitable
fashion when/if a shell is available.
</p>
</body>
</html>

88
man/libc/time.html Normal file
View File

@@ -0,0 +1,88 @@
<!--
Copyright (c) 2000, 2001, 2002, 2003, 2004, 2005, 2008, 2009, 2013
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.
-->
<html>
<head>
<title>time</title>
<link rel="stylesheet" type="text/css" media="all" href="../man.css">
</head>
<body bgcolor=#ffffff>
<h2 align=center>time</h2>
<h4 align=center>OS/161 Reference Manual</h4>
<h3>Name</h3>
<p>
time - get time of day
</p>
<h3>Library</h3>
<p>
Standard C Library (libc, -lc)
</p>
<h3>Synopsis</h3>
<p>
<tt>#include &lt;time.h&gt;</tt><br>
<br>
<tt>time_t</tt><br>
<tt>time(time_t *</tt><em>ptr</em><tt>);</tt>
</p>
<h3>Description</h3>
<p>
The current time (in seconds since midnight GMT on January 1, 1970) is
retrieved. If <em>ptr</em> is non-null, the time is stored through
<em>ptr</em>. The time is also returned.
</p>
<p>
time is a wrapper around the system call
<A HREF=../syscall/__time.html>__time</A>, which returns nanoseconds
as well as seconds.
</p>
<h3>Return Values</h3>
<p>
<tt>time</tt> returns the time. On error, -1 is returned, and errno is
set to indicate the error.
</p>
<h3>Errors</h3>
<p>
The following error is the only way <tt>time</tt> should be capable of
failing.
</p>
<table width=90%>
<tr><td width=5%>&nbsp;</td>
<td>EFAULT</td> <td><em>ptr</em> was an invalid non-NULL
address.</td></tr>
</table>
</body>
</html>

99
man/libc/warn.html Normal file
View File

@@ -0,0 +1,99 @@
<!--
Copyright (c) 2000, 2001, 2002, 2003, 2004, 2005, 2008, 2009, 2013
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.
-->
<html>
<head>
<title>warn</title>
<link rel="stylesheet" type="text/css" media="all" href="../man.css">
</head>
<body bgcolor=#ffffff>
<h2 align=center>warn</h2>
<h4 align=center>OS/161 Reference Manual</h4>
<h3>Name</h3>
<p>
warn, warnx, vwarn, vwarnx - print warning messages
</p>
<h3>Library</h3>
<p>
Standard C Library (libc, -lc)
</p>
<h3>Synopsis</h3>
<p>
<tt>#include &lt;err.h&gt;</tt><br>
<br>
<tt>void</tt><br>
<tt>warn(const char *</tt><em>format</em><tt>, ...);</tt><br>
<br>
<tt>void</tt><br>
<tt>warnx(const char *</tt><em>format</em><tt>, ...);</tt><br>
<br>
<tt>void</tt><br>
<tt>vwarn(const char *</tt><em>format</em><tt>, va_list);</tt><br>
<br>
<tt>void</tt><br>
<tt>vwarnx(const char *</tt><em>format</em><tt>, va_list);</tt><br>
</p>
<h3>Description</h3>
<p>
The <tt>warn</tt>, <tt>warnx</tt>, <tt>vwarn</tt>, and <tt>vwarnx</tt>
functions print warning messages to the standard error stream.
</p>
<p>
<tt>warnx</tt> prints the name of the program, a colon, the text
generated by passing <em>format</em> and subsequent args through
<A HREF=printf.html>printf</A>, and a newline.
</p>
<p>
<tt>warn</tt> prints the same thing, except that a colon and the error
string for the current error (obtained by calling
<A HREF=strerror.html>strerror</A> on
<A HREF=../syscall/errno.html>errno</A>) are printed prior to the
newline.
</p>
<p>
<tt>vwarnx</tt> and <tt>vwarn</tt> are the same as <tt>warnx</tt> and
<tt>warn</tt> respectively, except that the additional arguments for
printf are taken to have been already packaged up in a
<tt>va_list</tt> by use of the <A HREF=stdarg.html>stdarg</A> facility.
</p>
<h3>See Also</h3>
<p>
<A HREF=err.html>err</A>
</p>
</body>
</html>

93
man/man.css Normal file
View File

@@ -0,0 +1,93 @@
/*
* Rather than use @import, it's better to put fonts in your html:
* <link href='http://fonts.googleapis.com/css?family=Open+Sans:400,700,400italic'
* rel='stylesheet' type='text/css'/>
* <link href='http://fonts.googleapis.com/css?family=Droid+Sans+Mono'
* rel='stylesheet' type='text/css'/>
*/
@import url(http://fonts.googleapis.com/css?family=Open+Sans:400,700,400italic);
@import url(http://fonts.googleapis.com/css?family=Droid+Sans+Mono);
html {
background-color: #222;
}
body {
font-family: 'Open Sans', sans-serif;
font-size: 11pt;
line-height: 100%;
color: #444;
background-color: #fff;
max-width: 45em;
margin: 0 auto;
padding: 2em 2em 4em 2em;
}
p {
text-align: left;
line-height: 150%;
}
tt, code, pre {
color: #444;
font-family: 'Droid Sans Mono', monospace;
font-size: 10pt;
line-height: 100%;
}
em {
font-weight: regular;
font-style: italic;
}
h4, h3 {
color: #36648b;
}
a, a:link, a:visited, a:active {
color: #36648b;
text-decoration: underline;
font-weight: bold;
}
a:hover {
color: #000;
}
h2, h4 {
line-height: 1em;
margin: 0 0 2em 0;
}
/* title */
h2 {
font-size: 1.5em;
text-align: right;
float: right;
}
/* manual */
h4 {
font-size: inherit;
text-align: left;
float: left;
}
/* section */
h3 {
clear: both;
margin: 2em 0 0 0;
font-weight: bold;
font-size: 1.2em;
}
table {
margin: 1em 0 1em 0;
border: none;
}
td, th {
padding: 0.5ex 1ex;
border: none;
}

78
man/manindex.css Normal file
View File

@@ -0,0 +1,78 @@
/*
* XXX: rather than use @import, better to put fonts in your html, instead:
* <link href='http://fonts.googleapis.com/css?family=Open+Sans:400,700,400italic'
* rel='stylesheet' type='text/css'/>
* <link href='http://fonts.googleapis.com/css?family=Droid+Sans+Mono'
* rel='stylesheet' type='text/css'/>
*/
@import url(http://fonts.googleapis.com/css?family=Open+Sans:400,700,400italic);
@import url(http://fonts.googleapis.com/css?family=Droid+Sans+Mono);
html {
background-color: #222;
}
body {
font-family: 'Open Sans', sans-serif;
font-size: 11pt;
line-height: 100%;
color: #444;
background-color: #fff;
max-width: 45em;
margin: 0 auto;
padding: 2em 2em 4em 2em;
}
p {
line-height: 150%;
}
em {
font-weight: regular;
font-style: italic;
}
h4, h3 {
color: #36648b;
}
a, a:link, a:visited, a:active {
color: #36648b;
text-decoration: underline;
font-weight: bold;
}
a:hover {
color: #000;
}
h2, h4 {
line-height: 1em;
margin: 0 0 2em 0;
}
/* title */
h2 {
font-size: 1.5em;
text-align: center;
}
/* index */
p[align=center] {
width: 80%;
margin: 0 auto;
}
ul {
list-style-type: none;
}
li {
line-height: 150%;
}
li a:first-child {
display: inline-block;
min-width: 8em;
}

10
man/misc/Makefile Normal file
View File

@@ -0,0 +1,10 @@
# Man pages for miscellaneous stuff
TOP=../..
.include "$(TOP)/mk/os161.config.mk"
MANDIR=/man/misc
MANFILES=index.html
.include "$(TOP)/mk/os161.man.mk"

54
man/misc/index.html Normal file
View File

@@ -0,0 +1,54 @@
<!--
Copyright (c) 2000, 2001, 2002, 2003, 2004, 2005, 2008, 2009, 2013
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.
-->
<html>
<head>
<title>OS/161 Miscellaneous Docs</title>
<link rel="stylesheet" type="text/css" media="all" href="../manindex.css">
</head>
<body bgcolor=#ffffff>
<h2 align=center>OS/161 Miscellaneous Docs</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=../dev>Device drivers</A>
</p>
<br>
<ul>
<li> <A HREF=semfs.html>semfs</A> - userland semaphore file system
</ul>
</body>
</html>

87
man/misc/semfs.html Normal file
View File

@@ -0,0 +1,87 @@
<!--
Copyright (c) 2014
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.
-->
<html>
<head>
<title>semfs</title>
<link rel="stylesheet" type="text/css" media="all" href="../man.css">
</head>
<body bgcolor=#ffffff>
<h2 align=center>semfs</h2>
<h4 align=center>OS/161 Reference Manual</h4>
<h3>Name</h3>
<p>
semfs - semaphore filesystem
</p>
<h3>Synopsis</h3>
<p>
options semfs
</p>
<h3>Description</h3>
<p>
semfs is a simple "fake" (memory-only) file system that provides
synchronization facilities to userland in the form of counting
semaphores.
There is one semfs instance, called "sem:", which is created and
mounted during system boot.
</p>
<p>
Semaphores in semfs appear as files in "sem:". To create a semaphore,
open such a file using <tt>O_CREAT</tt>. To destroy it, remove it with
<tt>remove()</tt>.
</p>
<p>
To use the semaphore, write one byte to increase the semaphore count
by one (the "V" operation) and write one byte to decrease the
semaphore count by one (the "P" operation). The count will not
decrease below zero; attempts to do so will block until other
concurrent write operations raise the count again.
You can also set the count explicitly using <tt>ftruncate()</tt>; this
is useful for initializing a semaphore to a nonzero value. Note that
no data is actually transferred by the read and write calls; it is
acceptable to pass NULL as the data pointer.
</p>
<p>
You can create as many semaphores as you want (until memory runs out
or the directory reaches 2^32 entries); however, semfs does not
support subdirectories, hard links of semaphores, or renaming.
</p>
<h3>Files</h3>
<p>
<tt>sem:</tt>
</p>
</body>
</html>

10
man/sbin/Makefile Normal file
View File

@@ -0,0 +1,10 @@
# Man pages for /sbin programs
TOP=../..
.include "$(TOP)/mk/os161.config.mk"
MANDIR=/man/sbin
MANFILES=dumpsfs.html halt.html index.html mksfs.html poweroff.html reboot.html
.include "$(TOP)/mk/os161.man.mk"

102
man/sbin/dumpsfs.html Normal file
View File

@@ -0,0 +1,102 @@
<!--
Copyright (c) 2000, 2001, 2002, 2003, 2004, 2005, 2008, 2009, 2013
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.
-->
<html>
<head>
<title>dumpsfs</title>
<link rel="stylesheet" type="text/css" media="all" href="../man.css">
</head>
<body bgcolor=#ffffff>
<h2 align=center>dumpsfs</h2>
<h4 align=center>OS/161 Reference Manual</h4>
<h3>Name</h3>
<p>
dumpsfs - dump information about an SFS filesystem
</p>
<h3>Synopsis</h3>
<p>
<tt>/sbin/dumpsfs</tt> <em>raw-device</em><br>
<tt>host-dumpsfs</tt> <em>disk-image-file</em>
</p>
<h3>Description</h3>
<p>
<tt>dumpsfs</tt> dumps out selected information regarding the contents
and structure of the SFS filesystem on the device it is passed.
<p>
<p>
Like <A HREF=mksfs.html>mksfs</A>, it is also compiled for the
System/161 host OS, and in that form can access System/161's disk
image files.
</p>
<h3>Requirements</h3>
<p>
<tt>dumpsfs</tt> uses the following system calls:
<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/lseek.html>lseek</A>
<li> <A HREF=../syscall/fstat.html>fstat</A>
<li> <A HREF=../syscall/close.html>close</A>
<li> <A HREF=../syscall/_exit.html>_exit</A>
</ul>
</p>
<p>
Since the fstat system call is not normally part of the basic system
calls assignment, <tt>dumpsfs</tt> will usually still not function
after that assignment is completed.
The fstat call is typically part of a later assignment, usually the
file system assignment.
Consult your course materials for specific information.
</p>
<p>
The host version of <tt>dumpsfs</tt>, since it runs outside of OS/161,
should always work regardless of what you have and have not
implemented.
</p>
<p>
Note that you may wish to extend dumpsfs in the course of doing the
file system assignment.
</p>
<h3>See Also</h3>
<p>
<A HREF=mksfs.html>mksfs</A>,
<A HREF=sfsck.html>sfsck</A>
</p>
</body>
</html>

82
man/sbin/halt.html Normal file
View File

@@ -0,0 +1,82 @@
<!--
Copyright (c) 2000, 2001, 2002, 2003, 2004, 2005, 2008, 2009, 2013
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.
-->
<html>
<head>
<title>halt</title>
<link rel="stylesheet" type="text/css" media="all" href="../man.css">
</head>
<body bgcolor=#ffffff>
<h2 align=center>halt</h2>
<h4 align=center>OS/161 Reference Manual</h4>
<h3>Name</h3>
<p>
halt - halt system
</p>
<h3>Synopsis</h3>
<p>
<tt>/sbin/halt</tt>
</p>
<h3>Description</h3>
<p>
<tt>halt</tt> shuts the system down. A clean shutdown is performed,
flushing buffers to disk, unmounting filesystems, and so forth.
</p>
<p>
Once shutdown is complete, <tt>halt</tt> stops execution of the
operating system. What this entails depends on the platform. On
platforms with a hardware boot monitor, it normally returns to the
boot monitor. On software-based platforms, such as System/161, it
normally terminates the software simulation. On other platforms the
system will generally wait for a keystroke on the console and then
reboot.
</p>
<h3>Requirements</h3>
<p>
<tt>halt</tt> uses the <A HREF=../syscall/reboot.html>reboot</A>
system call.
</p>
<p>
<tt>halt</tt> will function properly even before you do any work on
OS/161.
</p>
<h3>See Also</h3>
<p>
<A HREF=../bin/sync.html>/bin/sync</A><br>
<A HREF=reboot.html>reboot</A>, <A HREF=poweroff.html>poweroff</A>
</p>
</body>
</html>

60
man/sbin/index.html Normal file
View File

@@ -0,0 +1,60 @@
<!--
Copyright (c) 2000, 2001, 2002, 2003, 2004, 2005, 2008, 2009, 2013
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.
-->
<html>
<head>
<title>OS/161 Sysadmin binaries</title>
<link rel="stylesheet" type="text/css" media="all" href="../manindex.css">
</head>
<body bgcolor=#ffffff>
<h2 align=center>OS/161 Sysadmin binaries (/sbin)</h2>
<p align=center>
<A HREF=..>Top</A> |
<A HREF=../bin>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=dumpsfs.html>dumpsfs</A> - dump information about an
SFS filesystem
<li> <A HREF=halt.html>halt</A> - halt system
<li> <A HREF=mksfs.html>mksfs</A> - create an SFS filesystem
<li> <A HREF=poweroff.html>poweroff</A> - halt system and power it off
<li> <A HREF=reboot.html>reboot</A> - reboot system
<li> <A HREF=sfsck.html>sfsck</A> - check/repair an SFS filesystem
</ul>
</body>
</html>

113
man/sbin/mksfs.html Normal file
View File

@@ -0,0 +1,113 @@
<!--
Copyright (c) 2000, 2001, 2002, 2003, 2004, 2005, 2008, 2009, 2013
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.
-->
<html>
<head>
<title>mksfs</title>
<link rel="stylesheet" type="text/css" media="all" href="../man.css">
</head>
<body bgcolor=#ffffff>
<h2 align=center>mksfs</h2>
<h4 align=center>OS/161 Reference Manual</h4>
<h3>Name</h3>
<p>
mksfs - create an SFS filesystem
</p>
<h3>Synopsis</h3>
<p>
<tt>/sbin/mksfs</tt> <em>raw-device</em> <em>volname</em> <br>
<tt>host-mksfs</tt> <em>disk-image-file</em> <em>volname</em>
</p>
<h3>Description</h3>
<p>
<tt>mksfs</tt> creates a new SFS filesystem on the specified device or
disk image. The volume name is set to <em>volname</em>.
</p>
<p>
If <tt>mksfs</tt> is used under OS/161, the first form should be used,
where <em>raw-device</em> is a raw device name (such as "lhd1raw:").
Don't use a device that's already mounted. Don't use a device that's
being used for swap, either.
</p>
<p>
<tt>mksfs</tt> can also be used on the System/161 host OS, in which
case the second form should be used. The host-compiled version of
<tt>mksfs</tt> knows how to deal with the header on System/161 disk
images and does the right thing.
</p>
<p>
Note that as of this writing <tt>host-mksfs</tt> cannot create
System/161 disk image files. This is a bug and will hopefully be
addressed eventually.
</p>
<h3>Requirements</h3>
<p>
<tt>mksfs</tt> uses the following system calls:
<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/lseek.html>lseek</A>
<li> <A HREF=../syscall/fstat.html>fstat</A>
<li> <A HREF=../syscall/close.html>close</A>
<li> <A HREF=../syscall/_exit.html>_exit</A>
</ul>
</p>
<p>
<tt>mksfs</tt> should function properly under OS/161 once the file
system assignment is complete.
</p>
<p>
The host version of <tt>mksfs</tt>, since it runs outside of OS/161,
should always work regardless of what you have and have not
implemented.
</p>
<p>
You will likely need to make some changes to <tt>mksfs</tt> in the
course of doing the file system assignment.
</p>
<h3>See Also</h3>
<p>
<A HREF=dumpsfs.html>dumpsfs</A>,
<A HREF=sfsck.html>sfsck</A>
</p>
</body>
</html>

73
man/sbin/poweroff.html Normal file
View File

@@ -0,0 +1,73 @@
<!--
Copyright (c) 2000, 2001, 2002, 2003, 2004, 2005, 2008, 2009, 2013
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.
-->
<html>
<head>
<title>poweroff</title>
<link rel="stylesheet" type="text/css" media="all" href="../man.css">
</head>
<body bgcolor=#ffffff>
<h2 align=center>poweroff</h2>
<h4 align=center>OS/161 Reference Manual</h4>
<h3>Name</h3>
<p>
poweroff - halt system and power it off
</p>
<h3>Synopsis</h3>
<p>
<tt>/sbin/poweroff</tt>
</p>
<h3>Description</h3>
<p>
<tt>poweroff</tt> shuts down the system and then turns the system
power off. On platforms where soft power-off is not supported,
poweroff functions the same way as <A HREF=halt.html>halt</A>.
</p>
<h3>Requirements</h3>
<p>
<tt>poweroff</tt> uses the <A HREF=../syscall/reboot.html>reboot</A>
system call.
</p>
<p>
<tt>poweroff</tt> will function properly even before you do any work
on OS/161.
</p>
<h3>See Also</h3>
<p>
<A HREF=../bin/sync.html>/bin/sync</A><br>
<A HREF=halt.html>halt</A>, <A HREF=reboot.html>reboot</A>
</p>
</body>
</html>

73
man/sbin/reboot.html Normal file
View File

@@ -0,0 +1,73 @@
<!--
Copyright (c) 2000, 2001, 2002, 2003, 2004, 2005, 2008, 2009, 2013
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.
-->
<html>
<head>
<title>reboot</title>
<link rel="stylesheet" type="text/css" media="all" href="../man.css">
</head>
<body bgcolor=#ffffff>
<h2 align=center>reboot</h2>
<h4 align=center>OS/161 Reference Manual</h4>
<h3>Name</h3>
<p>
reboot - reboot system
</p>
<h3>Synopsis</h3>
<p>
<tt>/sbin/reboot</tt>
</p>
<h3>Description</h3>
<p>
<tt>reboot</tt> shuts the system down and then attempts to restart
it. On platforms where reboot is not possible, it behaves the same way
as <A HREF=halt.html>halt</A>.
</p>
<h3>Requirements</h3>
<p>
<tt>reboot</tt> uses the <A HREF=../syscall/reboot.html>reboot</A>
system call.
</p>
<p>
<tt>reboot</tt> will function properly even before you do any work on
OS/161.
</p>
<h3>See Also</h3>
<p>
<A HREF=../bin/sync.html>/bin/sync</A><br>
<A HREF=halt.html>halt</A>, <A HREF=poweroff.html>poweroff</A>
</p>
</body>
</html>

113
man/sbin/sfsck.html Normal file
View File

@@ -0,0 +1,113 @@
<!--
Copyright (c) 2000, 2001, 2002, 2003, 2004, 2005, 2008, 2009, 2013
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.
-->
<html>
<head>
<title>sfsck</title>
<link rel="stylesheet" type="text/css" media="all" href="../man.css">
</head>
<body bgcolor=#ffffff>
<h2 align=center>sfsck</h2>
<h4 align=center>OS/161 Reference Manual</h4>
<h3>Name</h3>
<p>
sfsck - check/repair an SFS filesystem
</p>
<h3>Synopsis</h3>
<p>
<tt>/sbin/sfsck</tt> <em>raw-device</em><br>
<tt>host-sfsck</tt> <em>disk-image-file</em>
</p>
<h3>Description</h3>
<p>
<tt>sfsck</tt> checks the SFS filesystem on the specified device for
correctness and consistency. Various possible errors and corrupt
states are detected and reported; some (but not all) can be corrected.
</p>
<p>
If <tt>sfsck</tt> is used under OS/161, the first form should be used,
where <em>raw-device</em> is a raw device name (such as "lhd1raw:").
Don't use a device that's currently mounted.
</p>
<p>
<tt>sfsck</tt> can also be used on the System/161 host OS, in which
case the second form should be used. The host-compiled version of
<tt>sfsck</tt> knows how to deal with the header on System/161 disk
images and does the right thing.
</p>
<h3>Requirements</h3>
<p>
<tt>sfsck</tt> uses the following system calls:
<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/lseek.html>lseek</A>
<li> <A HREF=../syscall/fstat.html>fstat</A>
<li> <A HREF=../syscall/close.html>close</A>
<li> <A HREF=../syscall/sbrk.html>sbrk</A>
<li> <A HREF=../syscall/_exit.html>_exit</A>
</ul>
</p>
<p>
<tt>sfsck</tt> should function properly under OS/161 once you have
implemented the basic system calls, <tt>sbrk</tt> in the VM system,
and <tt>fstat</tt>.
</p>
<p>
The host version of <tt>sfsck</tt>, since it runs outside of OS/161,
should always work regardless of what you have and have not
implemented.
</p>
<p>
You will likely need to make some changes to <tt>sfsck</tt> in the
course of doing the file system assignment. If you are implementing
crash recovery for your file system, be sure to update <tt>sfsck</tt>
to know about any extra on-disk structures you add. You will want to
be able to use it to cross-check your recovery code... and so will the
course staff.
</p>
<h3>See Also</h3>
<p>
<A HREF=dumpsfs.html>dumpsfs</A>,
<A HREF=mksfs.html>mksfs</A>
</p>
</body>
</html>

16
man/syscall/Makefile Normal file
View File

@@ -0,0 +1,16 @@
# Man pages for system calls
TOP=../..
.include "$(TOP)/mk/os161.config.mk"
MANDIR=/man/syscall
MANFILES=\
__getcwd.html __time.html _exit.html chdir.html close.html dup2.html \
errno.html execv.html fork.html fstat.html fsync.html ftruncate.html \
getdirentry.html getpid.html index.html ioctl.html link.html \
lseek.html lstat.html mkdir.html open.html pipe.html read.html \
readlink.html reboot.html remove.html rename.html rmdir.html \
sbrk.html stat.html symlink.html sync.html waitpid.html write.html
.include "$(TOP)/mk/os161.man.mk"

109
man/syscall/__getcwd.html Normal file
View File

@@ -0,0 +1,109 @@
<!--
Copyright (c) 2000, 2001, 2002, 2003, 2004, 2005, 2008, 2009, 2013
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.
-->
<html>
<head>
<title>__getcwd</title>
<link rel="stylesheet" type="text/css" media="all" href="../man.css">
</head>
<body bgcolor=#ffffff>
<h2 align=center>__getcwd</h2>
<h4 align=center>OS/161 Reference Manual</h4>
<h3>Name</h3>
<p>
__getcwd - get name of current working directory (backend)
</p>
<h3>Library</h3>
<p>
Standard C Library (libc, -lc)
</p>
<h3>Synopsis</h3>
<p>
<tt>#include &lt;unistd.h&gt;</tt><br>
<br>
<tt>int</tt><br>
<tt>__getcwd(char *</tt><em>buf</em><tt>,
size_t </tt><em>buflen</em><tt>);</tt>
</p>
<h3>Description</h3>
<p>
The name of the current directory is computed and stored in
<em>buf</em>, an area of size <em>buflen</em>. The length of data
actually stored, which must be non-negative, is returned.
</p>
<p>
Note: this call behaves like <A HREF=read.html>read</A> - the name
stored in <em>buf</em> is not 0-terminated.
</p>
<p>
This function is not meant to be called except by the C library;
application programmers should use <A HREF=../libc/getcwd.html>getcwd</A>
instead.
</p>
<p>
<tt>__getcwd</tt> (like all system calls) should be atomic. In
practice, because of complications associated with locking both up and
down trees, it often isn't quite.
Note that the kernel is not obliged to (and generally cannot) make the
<tt>__getcwd</tt> call atomic with respect to other threads in the same
process accessing the transfer buffer during the operation.
</p>
<h3>Return Values</h3>
<p>
On success, <tt>__getcwd</tt> returns the length of the data returned.
On error, -1 is returned, and <A HREF=errno.html>errno</A> is set
according to the error encountered.
</p>
<h3>Errors</h3>
<p>
The following error codes should be returned under the conditions
given. Other error codes may be returned for other cases not
mentioned here.
<table width=90%>
<tr><td width=5% rowspan=3>&nbsp;</td>
<td width=10% valign=top>ENOENT</td>
<td>A component of the pathname no
longer exists.</td></tr>
<tr><td valign=top>EIO</td> <td>A hard I/O error occurred.</td></tr>
<tr><td valign=top>EFAULT</td> <td><em>buf</em> points to an invalid
address.</td></tr>
</table>
</p>
</body>
</html>

89
man/syscall/__time.html Normal file
View File

@@ -0,0 +1,89 @@
<!--
Copyright (c) 2000, 2001, 2002, 2003, 2004, 2005, 2008, 2009, 2013
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.
-->
<html>
<head>
<title>__time</title>
<link rel="stylesheet" type="text/css" media="all" href="../man.css">
</head>
<body bgcolor=#ffffff>
<h2 align=center>__time</h2>
<h4 align=center>OS/161 Reference Manual</h4>
<h3>Name</h3>
<p>
__time - get time of day
</p>
<h3>Library</h3>
<p>
Standard C Library (libc, -lc)
</p>
<h3>Synopsis</h3>
<p>
<tt>#include &lt;time.h&gt;</tt><br>
<br>
<tt>int</tt><br>
<tt>__time(time_t *</tt><em>seconds</em><tt>,
uint32_t *</tt><em>nanoseconds</em><tt>);</tt>
</p>
<h3>Description</h3>
<p>
The current time (in seconds and nanoseconds since midnight GMT on
January 1, 1970) is retrieved. If <em>seconds</em> and/or
<em>nanoseconds</em> are non-null, the corresponding components of the
time are stored through those pointers.
</p>
<h3>Return Values</h3>
<p>
__time returns 0 on success. On error, -1 is returned, and
errno is set to indicate the error.
</p>
<h3>Errors</h3>
<p>
The following error is the only way __time should be capable of failing.
<table width=90%>
<tr><td width=5% rowspan=1>&nbsp;</td>
<td width=10% valign=top>EFAULT</td>
<td><em>seconds</em> or <em>nanoseconds</em>
was an invalid non-NULL address.</td></tr>
</table>
</p>
<h3>See Also</h3>
<p>
<A HREF=../libc/time.html>time</A><br>
</p>
</body>
</html>

78
man/syscall/_exit.html Normal file
View File

@@ -0,0 +1,78 @@
<!--
Copyright (c) 2000, 2001, 2002, 2003, 2004, 2005, 2008, 2009, 2013
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.
-->
<html>
<head>
<title>_exit</title>
<link rel="stylesheet" type="text/css" media="all" href="../man.css">
</head>
<body bgcolor=#ffffff>
<h2 align=center>_exit</h2>
<h4 align=center>OS/161 Reference Manual</h4>
<h3>Name</h3>
<p>
_exit - terminate process
</p>
<h3>Library</h3>
<p>
Standard C Library (libc, -lc)
</p>
<h3>Synopsis</h3>
<p>
<tt>#include &lt;unistd.h&gt;</tt><br>
<br>
<tt>void,</tt><br>
<tt>_exit(int </tt><em>exitcode</em><tt>);</tt>
</p>
<h3>Description</h3>
<p>
Cause the current process to exit. The exit code <em>exitcode</em> is
reported back to other process(es) via the
<A HREF=waitpid.html>waitpid()</A> call. The process id of the exiting
process should not be reused until all processes expected to collect
the exit code with waitpid have done so.
</p>
<p>
Traditionally exit codes are only seven bits wide (values 0-127);
values outside this range were truncated. Portable code should not
rely on being able to use exit codes outside this range. The
definitions in OS/161 support a much wider range.
</p>
<h3>Return Values</h3>
<p>
<tt>_exit</tt> does not return.
</p>
</body>
</html>

97
man/syscall/chdir.html Normal file
View File

@@ -0,0 +1,97 @@
<!--
Copyright (c) 2000, 2001, 2002, 2003, 2004, 2005, 2008, 2009, 2013
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.
-->
<html>
<head>
<title>chdir</title>
<link rel="stylesheet" type="text/css" media="all" href="../man.css">
</head>
<body bgcolor=#ffffff>
<h2 align=center>chdir</h2>
<h4 align=center>OS/161 Reference Manual</h4>
<h3>Name</h3>
<p>
chdir - change current directory
</p>
<h3>Library</h3>
<p>
Standard C Library (libc, -lc)
</p>
<h3>Synopsis</h3>
<p>
<tt>#include &lt;unistd.h&gt;</tt><br>
<br>
<tt>int</tt><br>
<tt>chdir(const char *</tt><em>pathname</em><tt>);</tt>
</p>
<h3>Description</h3>
<p>
The current directory of the current process is set to the directory
named by <em>pathname</em>.
</p>
<p>
<tt>chdir</tt> (like all system calls) should be atomic.
Note that the kernel is not obliged to (and generally cannot) make the
chdir call atomic with respect to other threads in the same
process accessing the pathname string during the operation.
</p>
<h3>Return Values</h3>
<p>
On success, chdir returns 0. On error, -1 is returned, and
<A HREF=errno.html>errno</A> is set according to the error
encountered.
</p>
<h3>Errors</h3>
<p>
The following error codes should be returned under the conditions
given. Other error codes may be returned for other errors not
mentioned here.
<table width=90%>
<tr><td width=5% rowspan=6>&nbsp;</td>
<td width=10%>ENODEV</td>
<td>The device prefix of <em>pathname</em> did
not exist.</td></tr>
<tr><td>ENOTDIR</td> <td>A non-final component of <em>pathname</em>
was not a directory.</td></tr>
<tr><td>ENOTDIR</td> <td><em>pathname</em> did not refer to a
directory.</td>
<tr><td>ENOENT</td> <td><em>pathname</em> did not exist.</td></tr>
<tr><td>EIO</td> <td>A hard I/O error occurred.</td></tr>
<tr><td>EFAULT</td> <td><em>pathname</em> was an invalid pointer.</td></tr>
</table>
</p>
</body>
</html>

96
man/syscall/close.html Normal file
View File

@@ -0,0 +1,96 @@
<!--
Copyright (c) 2000, 2001, 2002, 2003, 2004, 2005, 2008, 2009, 2013
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.
-->
<html>
<head>
<title>close</title>
<link rel="stylesheet" type="text/css" media="all" href="../man.css">
</head>
<body bgcolor=#ffffff>
<h2 align=center>close</h2>
<h4 align=center>OS/161 Reference Manual</h4>
<h3>Name</h3>
<p>
close - close file
</p>
<h3>Library</h3>
<p>
Standard C Library (libc, -lc)
</p>
<h3>Synopsis</h3>
<p>
<tt>#include &lt;unistd.h&gt;</tt><br>
<br>
<tt>int</tt><br>
<tt>close(int </tt><em>fd</em><tt>);</tt>
</p>
<h3>Description</h3>
<p>
The file handle <em>fd</em> is closed. The same file handle may then
be returned again from <A HREF=open.html>open</A>,
<A HREF=dup2.html>dup2</A>, <A HREF=pipe.html>pipe</A>, or similar
calls.
</p>
<p>
Other file handles are not affected in any way, even if they are
attached to the same file.
</p>
<p>
According to POSIX, even if the underlying operation fails, the file
is closed anyway and the file handle becomes invalid.
</p>
<h3>Return Values</h3>
<p>
On success, close returns 0. On error, -1 is returned, and
<A HREF=errno.html>errno</A> is set according to the error
encountered.
</p>
<h3>Errors</h3>
<p>
The following error codes should be returned under the conditions
given. Other error codes may be returned for other cases not
mentioned here.
<table width=90%>
<tr><td width=5% rowspan=10>&nbsp;</td>
<td width=10%>EBADF</td>
<td><em>fd</em> is not a valid file handle.</td></tr>
<tr><td>EIO</td> <td>A hard I/O error occurred.</td></tr>
</table>
</p>
</body>
</html>

134
man/syscall/dup2.html Normal file
View File

@@ -0,0 +1,134 @@
<!--
Copyright (c) 2000, 2001, 2002, 2003, 2004, 2005, 2008, 2009, 2013
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.
-->
<html>
<head>
<title>dup2</title>
<link rel="stylesheet" type="text/css" media="all" href="../man.css">
</head>
<body bgcolor=#ffffff>
<h2 align=center>dup2</h2>
<h4 align=center>OS/161 Reference Manual</h4>
<h3>Name</h3>
<p>
dup2 - clone file handles
</p>
<h3>Library</h3>
<p>
Standard C Library (libc, -lc)
</p>
<h3>Synopsis</h3>
<p>
<tt>#include &lt;unistd.h&gt;</tt><br>
<br>
<tt>int</tt><br>
<tt>dup2(int </tt><em>oldfd</em><tt>, int </tt><em>newfd</em><tt>);</tt>
</p>
<h3>Description</h3>
<p>
<tt>dup2</tt> clones the file handle <em>oldfd</em> onto the file
handle <em>newfd</em>. If <em>newfd</em> names an already-open file,
that file is closed.
</p>
<p>
The two handles refer to the same "open" of the file -- that is,
they are references to the same object and share the same seek
pointer. Note that this is different from opening the same file
twice.
</p>
<p>
dup2 is most commonly used to relocate opened files onto
<tt>STDIN_FILENO</tt>, <tt>STDOUT_FILENO</tt>, and/or
<tt>STDERR_FILENO</tt>.
</p>
<p>
Both filehandles must be non-negative, and, if applicable, smaller
than the maximum allowed file handle number.
</p>
<p>
The call (like all system calls) should be atomic; for single-threaded
processes this is trivial.
Multithreaded processes should never e.g. see an intermediate state
where <em>newfd</em> has been closed but <em>oldfd</em> has not yet
been cloned onto it.
Similarly, if two threads attempt e.g. <tt>dup2(3, 4)</tt> and
<tt>dup2(4, 3)</tt> simultaneously, the results must be equivalent to
one of the calls completing before the other starts.
</p>
<p>
Using dup2 to clone a file handle onto itself has no effect.
</p>
<p>
(The "2" in "dup2" arises from the existence of an older and less
powerful Unix system call "dup".)
</p>
<h3>Return Values</h3>
<p>
<tt>dup2</tt> returns <em>newfd</em>. On error, -1 is returned, and
<A HREF=errno.html>errno</A> is set according to the error
encountered.
</p>
<h3>Errors</h3>
<p>
The following error codes should be returned under the conditions
given. Other error codes may be returned for other cases not mentioned
here.
<table width=90%>
<tr><td width=5% rowspan=3>&nbsp;</td>
<td width=10% valign=top>EBADF</td>
<td><em>oldfd</em> is not a valid file
handle, or <em>newfd</em> is a value
that cannot be a valid file
handle.</td></tr>
<tr><td valign=top>EMFILE</td> <td>The process's file table was full, or a
process-specific limit on open files
was reached.</td></tr>
<tr><td valign=top>ENFILE</td> <td>The system's file table was full,
if such a thing is possible, or a
global limit on open files was
reached.</td></tr>
</table>
</p>
</body>
</html>

435
man/syscall/errno.html Normal file
View File

@@ -0,0 +1,435 @@
<!--
Copyright (c) 2000, 2001, 2002, 2003, 2004, 2005, 2008, 2009, 2013
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.
-->
<html>
<head>
<title>errno</title>
<link rel="stylesheet" type="text/css" media="all" href="../man.css">
</head>
<body bgcolor=#ffffff>
<h2 align=center>errno</h2>
<h4 align=center>OS/161 Reference Manual</h4>
<h3>Name</h3>
<p>
errno - error code reporting
</p>
<h3>Library</h3>
<p>
Standard C Library (libc, -lc)
</p>
<h3>Synopsis</h3>
<p>
<tt>#include &lt;errno.h&gt;</tt><br>
<br>
<tt>extern int errno;</tt>
</p>
<h3>Description</h3>
<p>
When system calls, and sometimes other functions, fail, a code
representing or describing the error condition is placed in the global
variable <tt>errno</tt>.
</p>
<p>
When an operation succeeds, <tt>errno</tt> is not explicitly changed;
however, operations that succeed are also not required to preserve the
pre-existing value of <tt>errno</tt>.
In general one must first check whether the operation failed, and only
then interrogate <tt>errno</tt>.
</p>
<p>
A handful of functions in Standard C and POSIX are explicitly defined
to preserve <tt>errno</tt> on success. These are typically functions
with not-entirely-satisfactory interfaces where the only reliable way
to detect failure is to clear <tt>errno</tt> to zero beforehand and
check it afterwards. The most common/notable example (not currently
available in OS/161's library) is <tt>strtol</tt>.
</p>
<p>
<tt>errno</tt> may be a macro. In a multithreaded process it is almost
invariably a macro. However, it is always an lvalue, that is, it may
be assigned to.
</p>
<p>
Each numeric code has a symbolic name and a textual expansion. The
symbolic names are used in source code; the textual expansions are
printed out when errors are reported to users.
</p>
<p>
The textual expansions can be retrieved with
<A HREF=../libc/strerror.html>strerror</A> or printed with
<A HREF=../libc/err.html>err</A> or <A HREF=../libc/warn.html>warn</A>.
</p>
<h3>Symbolic names</h3>
<p>
The following symbolic errors are defined in the OS/161 base system.
You may add more at your pleasure; but be sure to read the notes in
the file <tt>kern/errno.h</tt> that defines them.
<table width=90%>
<tr><td width=5% rowspan=63>&nbsp;</td>
<td width=10% valign=top>ENOSYS</td>
<td><b>Function not implemented</b>: the action requested required
functionality not yet implemented. This is also the error
produced by attempting to make nonexistent system
calls.</td></tr>
<tr><td valign=top>ENOMEM</td>
<td><b>Out of memory</b>: a memory allocation failed. This normally
means that a process has used up all the memory available to
it. (This may be due to limits or because it has used up all
the memory available to the system.) It may also mean that
memory allocation within the kernel has failed.</td></tr>
<tr><td valign=top>EAGAIN</td>
<td><b>Operation would block</b>: some resource is temporarily
unavailable, or a non-blocking I/O operation (if such things
exist) could not be completed without waiting. Historically,
the message was "Try again later"; in 4.4BSD EAGAIN and the
old EWOULDBLOCK error code were folded together.</td></tr>
<tr><td valign=top>EINTR</td>
<td><b>Interrupted system call</b>: handling of a system call was
interrupted by the delivery of a signal. (If you have
signals.)</td></tr>
<tr><td valign=top>EFAULT</td>
<td><b>Bad memory reference</b>: a pointer passed as an argument was
not valid. Within the kernel, the <tt>copyin</tt> family of
functions produces this error when given an invalid
pointer.</td></tr>
<tr><td valign=top>ENAMETOOLONG</td>
<td><b>String too long</b>: a string passed as an argument was too
long to process.</td></tr>
<tr><td valign=top>EINVAL</td>
<td><b>Invalid argument</b>: an argument passed to a command or system
call was badly formed, invalid, or nonsensical, in a way for
which no more specific error code is defined.</td></tr>
<tr><td valign=top>EPERM</td>
<td><b>Operation not permitted</b>: the requested operation is
restricted to privileged users, or, in some cases, prohibited
entirely. Note that "permission denied" is not EPERM.</td></tr>
<tr><td valign=top>EACCES</td>
<td><b>Permission denied</b>: the current process's credentials do not
allow the desired form of access to the target object
according to its permission settings. Note that "permission
denied" is not EPERM.</td></tr>
<tr><td valign=top>EMPROC</td>
<td><b>Too many processes</b>: the current user ID has reached its
limit of simultaneous running processes. In Unix, this is
spelled EPROCLIM.</td></tr>
<tr><td valign=top>ENPROC</td>
<td><b>Too many processes on system</b>: the system process table is
full. (Void where impossible or prohibited by law.)</td></tr>
<tr><td valign=top>ENOEXEC</td>
<td><b>File is not executable</b>: an
<A HREF=../syscall/execv.html>execv</A> operation was
attempted but the kernel was unable to run the requested
program.</td></tr>
<tr><td valign=top>E2BIG</td>
<td><b>Argument list too long</b>: the space taken up by the
<tt>argv[]</tt> strings (and environment strings, where
applicable) passed to a newly started program is larger than
the system allows. The limit on this space is given by the
symbol <tt>ARG_MAX</tt>.</td></tr>
<tr><td valign=top>ESRCH</td>
<td><b>No such process</b>: the supplied process ID does not name any
of the currently running processes.</td></tr>
<tr><td valign=top>ECHILD</td>
<td><b>No child processes</b>: the current process has no exited child
processes whose exit status has not yet been collected with <A
HREF=../syscall/waitpid.html>waitpid</A>.</td></tr>
<tr><td valign=top>ENOTDIR</td>
<td><b>Not a directory</b>: a directory was expected and a
non-directory filesystem object was found.</td></tr>
<tr><td valign=top>EISDIR</td>
<td><b>Is a directory</b>: a non-directory was expected and a
directory was found.</td></tr>
<tr><td valign=top>ENOENT</td>
<td><b>No such file or directory</b>: the requested filesystem object
does/did not exist.</td></tr>
<tr><td valign=top>ELOOP</td>
<td><b>Too many levels of symbolic links</b>: pathname lookup crossed
more than the maximum allowed number of symbolic links.
Usually means a link points to itself, or a family of links
has been arranged into a loop. (If you have symbolic
links.)</td></tr>
<tr><td valign=top>ENOTEMPTY</td>
<td><b>Directory not empty</b>: a directory must be empty of
everything (except <tt>.</tt> and <tt>..</tt>) before it may
be removed.</td></tr>
<tr><td valign=top>EEXIST</td>
<td><b>File exists</b>: a filesystem object that was expected not to
exist did in fact already exist.</td></tr>
<tr><td valign=top>EMLINK</td>
<td><b>Too many hard links</b>: the maximum number of hard links to
the target file already exist.</td></tr>
<tr><td valign=top>EXDEV</td>
<td><b>Cross-device link</b>: an attempt was made to instruct one
filesystem to handle files on another filesystem.</td></tr>
<tr><td valign=top>ENODEV</td>
<td><b>No such device</b>: the requested device or device driver does
not exist.</td></tr>
<tr><td valign=top>ENXIO</td>
<td><b>Device not available</b>: the requested device exists but is
not available (is not mounted, is powered off, etc.)</td></tr>
<tr><td valign=top>EBUSY</td>
<td><b>Device busy</b>: the requested object cannot be used (or,
perhaps, released) because something else is using
it.</td></tr>
<tr><td valign=top>EMFILE</td>
<td><b>Too many open files</b>: the process file table is full, so the
process cannot open more files.</td></tr>
<tr><td valign=top>ENFILE</td>
<td><b>Too many open files in system</b>: a system-wide limit of some
sort, if any exists, on the number of open files has been
reached. Void where not possible.</td></tr>
<tr><td valign=top>EBADF</td>
<td><b>Bad file number</b>: a file operation was requested on an
illegal file handle, or a file handle that was not open. Or, a
write operation was attempted on a file handle that was open
only for read or vice-versa.</td></tr>
<tr><td valign=top>EIOCTL</td>
<td><b>Invalid or inappropriate ioctl</b>: an operation requested via
the <A HREF=../syscall/ioctl.html>ioctl</A> system call was
not defined or could not be performed on the indicated
object. In Unix, for historical reasons, this is spelled
ENOTTY, with the historic message "Not a
typewriter".</td></tr>
<tr><td valign=top>EIO</td>
<td><b>Input/output error</b>: a hardware-level error occured on a
device. Media errors on disks fall into this
category.</td></tr>
<tr><td valign=top>ESPIPE</td>
<td><b>Illegal seek</b>: a seek operation was attempted on a
sequential object where seeking makes no sense, like a
pipe or terminal.</td></tr>
<tr><td valign=top>EPIPE</td>
<td><b>Broken pipe</b>: a write was made to a pipe or socket object
with nobody to read it.</td></tr>
<tr><td valign=top>EROFS</td>
<td><b>Read-only file system</b>: an attempt was made to modify a
filesystem that was mounted read-only. (If you have read-only
mounts.)</td></tr>
<tr><td valign=top>ENOSPC</td>
<td><b>No space left on device</b>: the target filesystem is
full.</td></tr>
<tr><td valign=top>EDQUOT</td>
<td><b>Disc</b><font size=-2><i>(sic)</i></font><b> quota
exceeded</b>: the current user ID's quota (of space or
number of files) on the target filesystem has been used up.
(If you have disk quotas.)</td></tr>
<tr><td valign=top>EFBIG</td>
<td><b>File too large</b>: an attempt was made to exceed the target
filesystem's maximum file size, or a per-user limit on maximum
file size was reached, if such a thing exists.</td></tr>
<tr><td valign=top>EFTYPE</td>
<td><b>Invalid file type or format</b>: the file provided was the
wrong kind of file or contained invalid syntax.</td></tr>
<tr><td valign=top>EDOM</td>
<td><b>Argument out of range</b>: the (numeric) argument provided was
outside the values upon which the operation is defined. For
example, attempting to evaluate the logarithm of
zero produces this error. It is sometimes also used for
non-numeric arguments where the idea of being "out of range"
still makes sense.</td></tr>
<tr><td valign=top>ERANGE</td>
<td><b>Result out of range</b>: the result of an operation did not fit
in the space provided or could not be represented. Usually
used with numeric values. String values that don't fit usually
result in ENAMETOOLONG, or in its specific case,
E2BIG.</td></tr>
<tr><td valign=top>EILSEQ</td>
<td><b>Invalid multibyte character sequence</b>: the input string
contained a byte sequence whose value is undefined or whose
use is restricted. Only applicable when a multibyte character
set is in use, and if someone has added locale
support.</td></tr>
<tr><td valign=top>ENOTSOCK</td>
<td><b>Not a socket</b>: the file handle in question does not refer to
a socket, but a socket was expected.</td></tr>
<tr><td valign=top>EISSOCK</td>
<td><b>Is a socket</b>: the file handle in question refers to a
socket, but a socket was not expected. In Unix this is spelled
EOPNOTSUPP, and prints as "Operation not supported on
socket".</td></tr>
<tr><td valign=top>EISCONN</td>
<td><b>Socket is already connected</b>: given the protocol in use, the
operation requires a socket that has not yet been connected,
but the socket provided is in fact connected.</td></tr>
<tr><td valign=top>ENOTCONN</td>
<td><b>Socket is not connected</b>: given the protocol in use, the
operation requires a connected socket, but no connection has
yet been made.</td></tr>
<tr><td valign=top>ESHUTDOWN</td>
<td><b>Socket has been shut down</b>: the operation requires a running
socket, but the socket provided has been closed
down.</td></tr>
<tr><td valign=top>EPFNOSUPPORT</td>
<td><b>Protocol family not supported</b>: the requested protocol
family (PF_INET, PF_LOCAL, etc.) is not supported by the
system.</td></tr>
<tr><td valign=top>ESOCKTNOSUPPORT</td>
<td><b>Socket type not supported</b>: the requested socket type
(SOCK_STREAM, SOCK_DGRAM, etc.) is not supported by the
system.</td></tr>
<tr><td valign=top>EPROTONOSUPPORT</td>
<td><b>Protocol not supported</b>: the protocol requested for a socket
was not one supported by the system.</td></tr>
<tr><td valign=top>EPROTOTYPE</td>
<td><b>Protocol wrong type for socket</b>: the protocol requested for
a socket was not one supported by the requested socket type
and protocol family.</td></tr>
<tr><td valign=top>EAFNOSUPPORT</td>
<td><b>Address family not supported by protocol family</b>: the
address family named in a struct sockaddr (AF_INET, AF_LOCAL,
etc.) is not supported by the protocol family used to create
the socket (PF_INET, PF_LOCAL, etc.). In practice each
protocol family has exactly one address family and the values
of AF_* and PF_* are often, if incorrectly, used
interchangeably. If you run into this error in real life, it
usually means you didn't initialize your sockaddr structures
correctly.</td></tr>
<tr><td valign=top>ENOPROTOOPT</td>
<td><b>Protocol option not available</b>: the protocol option that was
requested is not supported or cannot be activated.</td></tr>
<tr><td valign=top>EADDRINUSE</td>
<td><b>Address already in use</b>: the requested socket address is
already in use by another socket somewhere on the
system.</td></tr>
<tr><td valign=top>EADDRNOTAVAIL</td>
<td><b>Cannot assign requested address</b>: the requested socket
address is unavailable. Usually caused by attempting to bind a
socket to the IP address of another machine. </td></tr>
<tr><td valign=top>ENETDOWN</td>
<td><b>Network is down</b>: the network or subnet needed is
offline.</td></tr>
<tr><td valign=top>ENETUNREACH</td>
<td><b>Network is unreachable</b>: the network or subnet needed cannot
be reached from here, possibly due to routing problems on the
network, possibly due to local configuration
trouble.</td></tr>
<tr><td valign=top>EHOSTDOWN</td>
<td><b>Host is down</b>: the specific machine requested is
offline.</td></tr>
<tr><td valign=top>EHOSTUNREACH</td>
<td><b>Host is unreachable</b>: the specific machine requested cannot
be reached from here.</td></tr>
<tr><td valign=top>ECONNREFUSED</td>
<td><b>Connection refused</b>: the remote machine is not listening for
connections on the requested port.</td></tr>
<tr><td valign=top>ETIMEDOUT</td>
<td><b>Connection timed out</b>: there was no response from the remote
machine. It may be down, it may not be listening, or it may
not be receiving our packets at all.</td></tr>
<tr><td valign=top>ECONNRESET</td>
<td><b>Connection reset by peer</b>: the connection was abandoned by
the remote host. Usually seen on already-open connections
after the remote machine reboots and thereby loses its network
state. Sometimes also caused by defective network devices
between the local and remote hosts.</td></tr>
<tr><td valign=top>EMSGSIZE</td>
<td><b>Message too large</b>: an internal protocol length limit was
exceeded.</td></tr>
<tr><td valign=top>ENOTSUP</td>
<td><b>Threads operation not supported</b>: a special error code
defined by the POSIX threads standard, which is a "special"
interface.</td></tr>
</table>
</p>
</body>
</html>

171
man/syscall/execv.html Normal file
View File

@@ -0,0 +1,171 @@
<!--
Copyright (c) 2000, 2001, 2002, 2003, 2004, 2005, 2008, 2009, 2013
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.
-->
<html>
<head>
<title>execv</title>
<link rel="stylesheet" type="text/css" media="all" href="../man.css">
</head>
<body bgcolor=#ffffff>
<h2 align=center>execv</h2>
<h4 align=center>OS/161 Reference Manual</h4>
<h3>Name</h3>
<p>
execv - execute a program
</p>
<h3>Library</h3>
<p>
Standard C Library (libc, -lc)
</p>
<h3>Synopsis</h3>
<p>
<tt>#include &lt;unistd.h&gt;</tt><br>
<br>
<tt>int</tt><br>
<tt>execv(const char *</tt><em>program</em><tt>,
char **</tt><em>args</em><tt>);</tt>
<br>
<tt>int</tt><br>
<tt>execve(const char *</tt><em>program</em><tt>,
char **</tt><em>args</em>,
char **</tt><em>environ</em><tt>);</tt>
</p>
<h3>Description</h3>
<p>
<tt>execv</tt> replaces the currently executing program with a newly
loaded program image. This occurs within one process; the process id
is unchanged.
</p>
<p>
The pathname of the program to run is passed as <em>program</em>. The
<em>args</em> argument is an array of 0-terminated strings. The array
itself should be terminated by a <tt>NULL</tt> pointer.
</p>
<p>
The argument strings should be copied into the new process as the new
process's <tt>argv[]</tt> array. In the new process,
<tt>argv[argc]</tt> must be <tt>NULL</tt>.
</p>
<p>
By convention, <tt>argv[0]</tt> in new processes contains the name
that was used to invoke the program. This is not necessarily the same
as <em>program</em>, and furthermore is only a convention and should
not be enforced by the kernel.
</p>
<p>
The process file table and current working directory are not modified
by <tt>execv</tt>.
</p>
<p>
The <tt>execve</tt> call is the same as <tt>execv</tt> except that a
<tt>NULL</tt>-terminated list of environment strings (of the form
<tt>var=value</tt>) is also passed through. In Unix, <tt>execv</tt> is
a small wrapper for <tt>execve</tt> that supplies the current process
environment. <b>In OS/161, <tt>execv</tt> is the primary exec call and
<tt>execve</tt> is not supported or needed</b> unless you put in extra
work to implement it.
</p>
<p>
The maximum total size of the argv (and environment, if any) data is
given by the system constant <tt>ARG_MAX</tt>. This comes set to 64K
by default. You may change this limit, but don't reduce it without
asking your course staff. The fact that argv blocks can be large is
part of the design problem; while it's possible to set the limit to 4K
and still have most things work, you are probably supposed to put at
least some thought into engineering a real solution. (One problem to
consider is that after the system has been up a while and system
memory starts to become fragmented, you still need to be able to
allocate enough memory to handle exec. Another is to make sure the
system doesn't choke if too many processes are trying to exec at
once. There are lots of ways to tackle this; be creative.)
</p>
<p>
Whether the size of the pointers appearing in the <tt>argv</tt> array
count towards the <tt>ARG_MAX</tt> limit is implementation-defined.
Either way it should be possible to pass a lot of small arguments
without bumping into some other limit on the number of pointers.
</p>
<h3>Return Values</h3>
<p>
On success, <tt>execv</tt> does not return; instead, the new program
begins executing. On failure, <tt>execv</tt> returns -1, and sets
<A HREF=errno.html>errno</A> to a suitable error code for the error
condition encountered.
</p>
<h3>Errors</h3>
<p>
The following error codes should be returned under the conditions
given. Other error codes may be returned for other errors not
mentioned here.
<table width=90%>
<tr><td width=5% rowspan=9>&nbsp;</td>
<td width=10% valign=top>ENODEV</td>
<td>The device prefix of <em>program</em> did
not exist.</td></tr>
<tr><td valign=top>ENOTDIR</td>
<td>A non-final component of <em>program</em>
was not a directory.</td></tr>
<tr><td valign=top>ENOENT</td>
<td><em>program</em> did not exist.</td></tr>
<tr><td valign=top>EISDIR</td>
<td><em>program</em> is a directory.</td></tr>
<tr><td valign=top>ENOEXEC</td>
<td><em>program</em> is not in a recognizable
executable file format, was for the
wrong platform, or contained invalid
fields.</td></tr>
<tr><td valign=top>ENOMEM</td>
<td>Insufficient virtual memory is available.</td></tr>
<tr><td valign=top>E2BIG</td>
<td>The total size of the argument strings
exceeeds <tt>ARG_MAX</tt>.</td></tr>
<tr><td valign=top>EIO</td>
<td>A hard I/O error occurred.</td></tr>
<tr><td valign=top>EFAULT</td>
<td>One of the arguments is an invalid
pointer.</td></tr>
</table>
</p>
</body>
</html>

112
man/syscall/fork.html Normal file
View File

@@ -0,0 +1,112 @@
<!--
Copyright (c) 2000, 2001, 2002, 2003, 2004, 2005, 2008, 2009, 2013
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.
-->
<html>
<head>
<title>fork</title>
<link rel="stylesheet" type="text/css" media="all" href="../man.css">
</head>
<body bgcolor=#ffffff>
<h2 align=center>fork</h2>
<h4 align=center>OS/161 Reference Manual</h4>
<h3>Name</h3>
<p>
fork - copy the current process
</p>
<h3>Library</h3>
<p>
Standard C Library (libc, -lc)
</p>
<h3>Synopsis</h3>
<p>
<tt>#include &lt;unistd.h&gt;</tt><br>
<br>
<tt>pid_t</tt><br>
<tt>fork(void);</tt>
</p>
<h3>Description</h3>
<p>
<tt>fork</tt> duplicates the currently running process. The two copies
are identical, except that one (the "new" one, or "child"), has a new,
unique process id, and in the other (the "parent") the process id is
unchanged.
</p>
<p>
The process id must be greater than 0.
</p>
<p>
The two processes do not share memory or open file tables; this state
is copied into the new process, and subsequent modification in one
process does not affect the other.
</p>
<p>
However, the file handle objects the file tables point to are shared,
so, for instance, calls to lseek in one process can affect the other.
</p>
<h3>Return Values</h3>
<p>
On success, <tt>fork</tt> returns twice, once in the parent process
and once in the child process. In the child process, 0 is returned. In
the parent process, the process id of the new child process is
returned.
</p>
<p>
On error, no new process is created. <tt>fork,</tt> only returns once,
returning -1, and <A HREF=errno.html>errno</A> is set according to the
error encountered.
</p>
<h3>Errors</h3>
<p>
The following error codes should be returned under the conditions
given. Other error codes may be returned for other errors not
mentioned here.
<table width=90%>
<tr><td width=5% rowspan=3>&nbsp;</td>
<td width=10% valign=top>EMPROC</td>
<td>The current user already has too
many processes.</td></tr>
<tr><td valign=top>ENPROC</td> <td>There are already too many
processes on the system.</td></tr>
<tr><td valign=top>ENOMEM</td> <td>Sufficient virtual memory for the new
process was not available.</td></tr>
</table>
</p>
</body>
</html>

99
man/syscall/fstat.html Normal file
View File

@@ -0,0 +1,99 @@
<!--
Copyright (c) 2000, 2001, 2002, 2003, 2004, 2005, 2008, 2009, 2013
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.
-->
<html>
<head>
<title>fstat</title>
<link rel="stylesheet" type="text/css" media="all" href="../man.css">
</head>
<body bgcolor=#ffffff>
<h2 align=center>fstat</h2>
<h4 align=center>OS/161 Reference Manual</h4>
<h3>Name</h3>
<p>
fstat - get file state information
</p>
<h3>Library</h3>
<p>
Standard C Library (libc, -lc)
</p>
<h3>Synopsis</h3>
<p>
<tt>#include &lt;sys/stat.h&gt;</tt><br>
<br>
<tt>int</tt><br>
<tt>fstat(int </tt><em>fd</em><tt>,
struct stat *</tt><em>statbuf</em><tt>);</tt>
</p>
<h3>Description</h3>
<p>
<tt>fstat</tt> retrieves status information about the file referred to
by the file handle <em>fd</em> and stores it in the stat structure
pointed to by <em>statbuf</em>.
</p>
<p>
The call (like all system calls) should be atomic; that is, the
information retrieved should come from a single point in time.
</p>
<h3>Return Values</h3>
<p>
On success, <tt>fstat</tt> returns 0. On error, -1 is returned, and <A
HREF=errno.html>errno</A> is set according to the error encountered.
</p>
<h3>Errors</h3>
<p>
The following error codes should be returned under the conditions
given. Other error codes may be returned for other cases not
mentioned here.
<table width=90%>
<tr><td width=5% rowspan=3>&nbsp;</td>
<td width=10% valign=top>EBADF</td>
<td><em>fd</em> is not a valid file
handle.</td></tr>
<tr><td valign=top>EIO</td> <td>A hard I/O error occurred.</td></tr>
<tr><td valign=top>EFAULT</td> <td><em>statbuf</em> points to an
invalid address.</td></tr>
</table>
</p>
<h3>See Also</h3>
<p>
<A HREF=lstat.html>lstat</A>,
<A HREF=stat.html>stat</A>
</p>
</body>
</html>

90
man/syscall/fsync.html Normal file
View File

@@ -0,0 +1,90 @@
<!--
Copyright (c) 2000, 2001, 2002, 2003, 2004, 2005, 2008, 2009, 2013
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.
-->
<html>
<head>
<title>fsync</title>
<link rel="stylesheet" type="text/css" media="all" href="../man.css">
</head>
<body bgcolor=#ffffff>
<h2 align=center>fsync</h2>
<h4 align=center>OS/161 Reference Manual</h4>
<h3>Name</h3>
<p>
fsync - flush filesystem data for a specific file to disk
</p>
<h3>Library</h3>
<p>
Standard C Library (libc, -lc)
</p>
<h3>Synopsis</h3>
<p>
<tt>#include &lt;unistd.h&gt;</tt><br>
<br>
<tt>int</tt><br>
<tt>fsync(int </tt><em>fd</em><tt>);</tt>
</p>
<h3>Description</h3>
<p>
The <tt>fsync</tt> function forces a write of dirty filesystem buffers
and other dirty filesystem state associated with the object referred
to by <em>fd</em> to be written to disk.
</p>
<p>
<tt>fsync</tt> should not return until the writes are complete.
</p>
<h3>Return Values</h3>
<p>
On success, <tt>fsync</tt> returns 0. On error, -1 is returned, and
<A HREF=errno.html>errno</A> is set according to the error
encountered.
</p>
<h3>Errors</h3>
<p>
The following error codes should be returned under the conditions
given. Other error codes may be returned for other cases not
mentioned here.
<table width=90%>
<tr><td width=5% rowspan=2>&nbsp;</td>
<td width=10% valign=top>EBADF</td>
<td><em>fd</em> is not a valid file
handle.</td></tr>
<tr><td valign=top>EIO</td> <td>A hard I/O error occurred.</td></tr>
</table>
</p>
</body>
</html>

View File

@@ -0,0 +1,99 @@
<!--
Copyright (c) 2000, 2001, 2002, 2003, 2004, 2005, 2008, 2009, 2013
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.
-->
<html>
<head>
<title>ftruncate</title>
<link rel="stylesheet" type="text/css" media="all" href="../man.css">
</head>
<body bgcolor=#ffffff>
<h2 align=center>ftruncate</h2>
<h4 align=center>OS/161 Reference Manual</h4>
<h3>Name</h3>
<p>
ftruncate - set size of a file
</p>
<h3>Library</h3>
<p>
Standard C Library (libc, -lc)
</p>
<h3>Synopsis</h3>
<p>
<tt>#include &lt;unistd.h&gt;</tt><br>
<br>
<tt>int</tt><br>
<tt>ftruncate(int </tt><em>fd</em><tt>, off_t </tt><em>filesize</em><tt>);</tt>
</p>
<h3>Description</h3>
<p>
<tt>ftruncate</tt> forcibly sets the size of the file referred to by
<em>fd</em> to <em>filesize</em>. If this expands the file, the new
data appears as if it is zero-filled. (On file systems that support
sparse files, the new space does not need to be physically allocated.)
If the action shrinks the file, the excess data is discarded.
</p>
<p>
The file must be open for write.
</p>
<p>
<tt>ftruncate</tt> must be atomic. For recoverable file systems, this
includes after crashing and running recovery.
</p>
<h3>Return Values</h3>
<p>
On success, <tt>ftruncate</tt> returns 0. On error, -1 is returned,
and <A HREF=errno.html>errno</A> is set according to the error
encountered.
</p>
<h3>Errors</h3>
<p>
The following error codes should be returned under the conditions
given. Other error codes may be returned for other cases not
mentioned here.
<table width=90%>
<tr><td width=5% rowspan=3>&nbsp;</td>
<td width=10% valign=top>EBADF</td>
<td><em>fd</em> is not a valid file handle, or
it is not open for writing.</td></tr>
<tr><td valign=top>EIO</td> <td>A hard I/O error occurred.</td></tr>
<tr><td valign=top>EFAULT</td> <td><em>buf</em> points to an invalid
address.</td></tr>
</table>
</p>
</body>
</html>

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