Initial Spring 2016 commit.
This commit is contained in:
16
man/syscall/Makefile
Normal file
16
man/syscall/Makefile
Normal 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
109
man/syscall/__getcwd.html
Normal 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 <unistd.h></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> </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
89
man/syscall/__time.html
Normal 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 <time.h></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> </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
78
man/syscall/_exit.html
Normal 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 <unistd.h></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
97
man/syscall/chdir.html
Normal 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 <unistd.h></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> </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
96
man/syscall/close.html
Normal 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 <unistd.h></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> </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
134
man/syscall/dup2.html
Normal 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 <unistd.h></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> </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
435
man/syscall/errno.html
Normal 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 <errno.h></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> </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
171
man/syscall/execv.html
Normal 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 <unistd.h></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> </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
112
man/syscall/fork.html
Normal 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 <unistd.h></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> </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
99
man/syscall/fstat.html
Normal 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 <sys/stat.h></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> </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
90
man/syscall/fsync.html
Normal 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 <unistd.h></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> </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>
|
99
man/syscall/ftruncate.html
Normal file
99
man/syscall/ftruncate.html
Normal 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 <unistd.h></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> </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>
|
125
man/syscall/getdirentry.html
Normal file
125
man/syscall/getdirentry.html
Normal file
@@ -0,0 +1,125 @@
|
||||
<!--
|
||||
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>getdirentry</title>
|
||||
<link rel="stylesheet" type="text/css" media="all" href="../man.css">
|
||||
</head>
|
||||
<body bgcolor=#ffffff>
|
||||
<h2 align=center>getdirentry</h2>
|
||||
<h4 align=center>OS/161 Reference Manual</h4>
|
||||
|
||||
<h3>Name</h3>
|
||||
<p>
|
||||
getdirentry - read filename from directory
|
||||
</p>
|
||||
|
||||
<h3>Library</h3>
|
||||
<p>
|
||||
Standard C Library (libc, -lc)
|
||||
</p>
|
||||
|
||||
<h3>Synopsis</h3>
|
||||
<p>
|
||||
<tt>#include <unistd.h></tt><br>
|
||||
<br>
|
||||
<tt>int</tt><br>
|
||||
<tt>getdirentry(int </tt><em>fd</em><tt>, char *</tt><em>buf</em><tt>,
|
||||
size_t </tt><em>buflen</em><tt>);</tt>
|
||||
</p>
|
||||
|
||||
<h3>Description</h3>
|
||||
<p>
|
||||
<tt>getdirentry</tt> retrieves the next filename from a directory
|
||||
referred to by the file handle <em>filehandle</em>. The name is stored
|
||||
in <em>buf</em>, an area of size <em>buflen</em>. The length of of the
|
||||
name actually found is returned.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Note: this call behaves like read() - the name stored in <em>buf</em>
|
||||
is not null-terminated.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Which filename is the "next" is chosen based on the seek pointer
|
||||
associated with the file handle. The meaning of the seek pointer on a
|
||||
directory is defined by the filesystem in use and should not be
|
||||
interpreted - the only ways in which <A HREF=lseek.html>lseek</A>
|
||||
should be used are with SEEK_SET and an offset previously returned by
|
||||
lseek, or with any of SEEK_SET, SEEK_CUR, or SEEK_EOF with an offset
|
||||
of 0.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<tt>getdirentry</tt> (like all system calls) should be atomic. In this
|
||||
case this means that each <tt>getdirentry</tt> call should return a
|
||||
name that was in the directory at the point in time when the call
|
||||
happened relative to other calls. <tt>getdirentry</tt> should never
|
||||
return names that have only been partially written or that have been
|
||||
partially erased.
|
||||
Note that the kernel is not obliged to (and generally cannot) make the
|
||||
getdirentry call atomic with respect to other threads in the same
|
||||
process accessing the transfer buffer during the operation.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
In general it is desirable for directory iteration to be stable; that
|
||||
is, opening a directory and reading it should yield a consistent
|
||||
snapshot of the directory state. Implementing this is a nuisance in
|
||||
general, and is worse in OS/161 since the system call we have can only
|
||||
return one name at a time. Therefore, it isn't required by default.
|
||||
(However, always check your course materials for the official word,
|
||||
just in case.)
|
||||
</p>
|
||||
|
||||
<h3>Return Values</h3>
|
||||
<p>
|
||||
On success, <tt>getdirentry</tt> returns the length of the name
|
||||
transferred. On error, -1 is returned, and
|
||||
<A HREF=errno.html>errno</A> is set according to the error
|
||||
encountered.
|
||||
</p>
|
||||
|
||||
<h3>Errors</h3>
|
||||
|
||||
<table width=90%>
|
||||
<tr><td width=5% rowspan=4> </td>
|
||||
<td width=10% valign=top>EBADF</td>
|
||||
<td><em>fd</em> is not a valid file
|
||||
handle.</td></tr>
|
||||
<tr><td valign=top>ENOTDIR</td> <td><em>fd</em> does not refer to a
|
||||
directory.</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>
|
||||
|
||||
</body>
|
||||
</html>
|
67
man/syscall/getpid.html
Normal file
67
man/syscall/getpid.html
Normal 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>getpid</title>
|
||||
<link rel="stylesheet" type="text/css" media="all" href="../man.css">
|
||||
</head>
|
||||
<body bgcolor=#ffffff>
|
||||
<h2 align=center>getpid</h2>
|
||||
<h4 align=center>OS/161 Reference Manual</h4>
|
||||
|
||||
<h3>Name</h3>
|
||||
<p>
|
||||
getpid - get process id
|
||||
</p>
|
||||
|
||||
<h3>Library</h3>
|
||||
<p>
|
||||
Standard C Library (libc, -lc)
|
||||
</p>
|
||||
|
||||
<h3>Synopsis</h3>
|
||||
<p>
|
||||
<tt>#include <unistd.h></tt><br>
|
||||
<br>
|
||||
<tt>pid_t</tt><br>
|
||||
<tt>getpid(void);</tt>
|
||||
</p>
|
||||
|
||||
<h3>Description</h3>
|
||||
<p>
|
||||
<tt>getpid</tt> returns the process id of the current process.
|
||||
</p>
|
||||
|
||||
<h3>Errors</h3>
|
||||
<p>
|
||||
<tt>getpid</tt> does not fail.
|
||||
</p>
|
||||
|
||||
</body>
|
||||
</html>
|
91
man/syscall/index.html
Normal file
91
man/syscall/index.html
Normal 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>OS/161 System calls</title>
|
||||
<link rel="stylesheet" type="text/css" media="all" href="../manindex.css">
|
||||
</head>
|
||||
<body bgcolor=#ffffff>
|
||||
|
||||
<h2 align=center>OS/161 System calls</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=../libc>C standard library</A> |
|
||||
<A HREF=../dev>Device drivers</A> |
|
||||
<A HREF=../misc>Miscellaneous</A>
|
||||
</p>
|
||||
<br>
|
||||
|
||||
<ul>
|
||||
<li> <A HREF=errno.html>errno</A> - error code reporting
|
||||
</ul>
|
||||
|
||||
<ul>
|
||||
<li> <A HREF=_exit.html>_exit</A> - terminate process
|
||||
<li> <A HREF=chdir.html>chdir</A> - change current directory
|
||||
<li> <A HREF=close.html>close</A> - close file
|
||||
<li> <A HREF=dup2.html>dup2</A> - clone file handles
|
||||
<li> <A HREF=execv.html>execv</A> - execute a program
|
||||
<li> <A HREF=fork.html>fork</A> - copy the current process
|
||||
<li> <A HREF=fstat.html>fstat</A> - get file state information
|
||||
<li> <A HREF=fsync.html>fsync</A> - flush filesystem data for a
|
||||
specific file to disk
|
||||
<li> <A HREF=ftruncate.html>ftruncate</A> - set size of a file
|
||||
<li> <A HREF=__getcwd.html>__getcwd</A> - get name of current working
|
||||
directory (backend)
|
||||
<li> <A HREF=getdirentry.html>getdirentry</A> - read filename from directory
|
||||
<li> <A HREF=getpid.html>getpid</A> - get process id
|
||||
<li> <A HREF=ioctl.html>ioctl</A> - miscellaneous device I/O operations
|
||||
<li> <A HREF=link.html>link</A> - create hard link to a file
|
||||
<li> <A HREF=lseek.html>lseek</A> - change current position in file
|
||||
<li> <A HREF=lstat.html>lstat</A> - get file state information
|
||||
<li> <A HREF=mkdir.html>mkdir</A> - create directory
|
||||
<li> <A HREF=open.html>open</A> - open a file
|
||||
<li> <A HREF=pipe.html>pipe</A> - create pipe object
|
||||
<li> <A HREF=read.html>read</A> - read data from file
|
||||
<li> <A HREF=readlink.html>readlink</A> - fetch symbolic link contents
|
||||
<li> <A HREF=reboot.html>reboot</A> - reboot or halt system
|
||||
<li> <A HREF=remove.html>remove</A> - delete (unlink) a file
|
||||
<li> <A HREF=rename.html>rename</A> - rename or move a file
|
||||
<li> <A HREF=rmdir.html>rmdir</A> - remove directory
|
||||
<li> <A HREF=sbrk.html>sbrk</A> - set process break (allocate memory)
|
||||
<li> <A HREF=stat.html>stat</A> - get file state information
|
||||
<li> <A HREF=symlink.html>symlink</A> - create symbolic link
|
||||
<li> <A HREF=sync.html>sync</A> - flush filesystem data to disk
|
||||
<li> <A HREF=__time.html>__time</A> - get time of day
|
||||
<li> <A HREF=waitpid.html>waitpid</A> - wait for a process to exit
|
||||
<li> <A HREF=write.html>write</A> - write data to file
|
||||
</ul>
|
||||
|
||||
</body>
|
||||
</html>
|
106
man/syscall/ioctl.html
Normal file
106
man/syscall/ioctl.html
Normal file
@@ -0,0 +1,106 @@
|
||||
<!--
|
||||
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>ioctl</title>
|
||||
<link rel="stylesheet" type="text/css" media="all" href="../man.css">
|
||||
</head>
|
||||
<body bgcolor=#ffffff>
|
||||
<h2 align=center>ioctl</h2>
|
||||
<h4 align=center>OS/161 Reference Manual</h4>
|
||||
|
||||
<h3>Name</h3>
|
||||
<p>
|
||||
ioctl - miscellaneous device I/O operations
|
||||
</p>
|
||||
|
||||
<h3>Library</h3>
|
||||
<p>
|
||||
Standard C Library (libc, -lc)
|
||||
</p>
|
||||
|
||||
<h3>Synopsis</h3>
|
||||
<p>
|
||||
<tt>#include <sys/ioctl.h></tt><br>
|
||||
<br>
|
||||
<tt>int</tt><br>
|
||||
<tt>ioctl(int </tt><em>fd</em><tt>, int </tt><em>code</em><tt>,
|
||||
void *</tt><em>data</em><tt>);</tt>
|
||||
</p>
|
||||
|
||||
<h3>Description</h3>
|
||||
<p>
|
||||
<tt>ioctl</tt> performs an object-specific operation <em>code</em> on
|
||||
the object referred to by the file handle <em>fd</em>. The
|
||||
<em>data</em> argument may point to supplemental data required or
|
||||
returned by the operation. The size of buffer required, if any, and
|
||||
other such matters are operation-specific.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Traditionally, ioctl is a catchall function for performing operations
|
||||
that don't fit neatly into any other model.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
The ioctl codes are defined in <kern/ioctl.h>, which should be
|
||||
included via <sys/ioctl.h> by user-level code. As of this
|
||||
writing, the base OS/161 system defines no ioctls. However, it may
|
||||
prove useful to implement some, particularly in connection with some
|
||||
less conventional possible projects.
|
||||
</p>
|
||||
|
||||
<h3>Return Values</h3>
|
||||
<p>
|
||||
On success, <tt>ioctl</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> </td>
|
||||
<td width=10% valign=top>EBADF</td>
|
||||
<td><em>fd</em> was not a valid file
|
||||
handle.</td></tr>
|
||||
<tr><td valign=top>EIOCTL</td> <td><em>code</em> was an invalid ioctl for the
|
||||
object referenced.</td></tr>
|
||||
<tr><td valign=top>EFAULT</td> <td><em>data</em> was required by the
|
||||
operation requested, but was an
|
||||
invalid pointer.</td></tr>
|
||||
</table>
|
||||
</p>
|
||||
|
||||
</body>
|
||||
</html>
|
106
man/syscall/link.html
Normal file
106
man/syscall/link.html
Normal file
@@ -0,0 +1,106 @@
|
||||
<!--
|
||||
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>link</title>
|
||||
<link rel="stylesheet" type="text/css" media="all" href="../man.css">
|
||||
</head>
|
||||
<body bgcolor=#ffffff>
|
||||
<h2 align=center>link</h2>
|
||||
<h4 align=center>OS/161 Reference Manual</h4>
|
||||
|
||||
<h3>Name</h3>
|
||||
<p>
|
||||
link - create hard link to a file
|
||||
</p>
|
||||
|
||||
<h3>Library</h3>
|
||||
<p>
|
||||
Standard C Library (libc, -lc)
|
||||
</p>
|
||||
|
||||
<h3>Synopsis</h3>
|
||||
<p>
|
||||
<tt>#include <unistd.h></tt><br>
|
||||
<br>
|
||||
<tt>int</tt><br>
|
||||
<tt>link(const char *</tt><em>oldname</em><tt>,
|
||||
const char *</tt><em>newname</em><tt>);</tt>
|
||||
</p>
|
||||
|
||||
<h3>Description</h3>
|
||||
<p>
|
||||
<tt>link</tt> creates a new name, <em>newname</em>, for the file
|
||||
referred to by <em>oldname</em>. Henceforth, both names are equally
|
||||
valid ways to refer to the same file. The file is only deleted when
|
||||
all names are removed. This is a "hard link".
|
||||
</p>
|
||||
|
||||
<p>
|
||||
The creation of the new name is atomic. The two names must be on the
|
||||
same filesystem. Directories may not be hard-linked.
|
||||
</p>
|
||||
|
||||
<h3>Return Values</h3>
|
||||
<p>
|
||||
On success, <tt>link</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=11> </td>
|
||||
<td width=10% valign=top>ENODEV</td>
|
||||
<td>The device prefix of one of the names did
|
||||
not exist.</td></tr>
|
||||
<tr><td valign=top>ENOTDIR</td> <td>A non-final component of one of the names
|
||||
was not a directory.</td></tr>
|
||||
<tr><td valign=top>ENOENT</td> <td>A non-final component of <em>newname</em>
|
||||
did not exist.</td></tr>
|
||||
<tr><td valign=top>ENOENT</td> <td><em>oldname</em> does not exist.</td></tr>
|
||||
<tr><td valign=top>EEXIST</td> <td><em>newname</em> already exists.</td></tr>
|
||||
<tr><td valign=top>EISDIR</td> <td><em>oldname</em> is a directory.</td></tr>
|
||||
<tr><td valign=top>EXDEV</td> <td>The two names are on different
|
||||
filesystems.</td></tr>
|
||||
<tr><td valign=top>EMLINK</td> <td>There are already too many links to
|
||||
<em>oldname</em>.</td></tr>
|
||||
<tr><td valign=top>ENOSPC</td> <td>The filesystem involved is full.</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 was an
|
||||
invalid pointer.</td></tr>
|
||||
</table>
|
||||
</p>
|
||||
|
||||
</body>
|
||||
</html>
|
135
man/syscall/lseek.html
Normal file
135
man/syscall/lseek.html
Normal file
@@ -0,0 +1,135 @@
|
||||
<!--
|
||||
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>lseek</title>
|
||||
<link rel="stylesheet" type="text/css" media="all" href="../man.css">
|
||||
</head>
|
||||
<body bgcolor=#ffffff>
|
||||
<h2 align=center>lseek</h2>
|
||||
<h4 align=center>OS/161 Reference Manual</h4>
|
||||
|
||||
<h3>Name</h3>
|
||||
<p>
|
||||
lseek - change current position in file
|
||||
</p>
|
||||
|
||||
<h3>Library</h3>
|
||||
<p>
|
||||
Standard C Library (libc, -lc)
|
||||
</p>
|
||||
|
||||
<h3>Synopsis</h3>
|
||||
<p>
|
||||
<tt>#include <unistd.h></tt><br>
|
||||
<br>
|
||||
<tt>off_t</tt><br>
|
||||
<tt>lseek(int </tt><em>fd</em><tt>, off_t </tt><em>pos</em><tt>,
|
||||
int </tt><em>whence</em><tt>);</tt>
|
||||
</p>
|
||||
|
||||
<h3>Description</h3>
|
||||
<p>
|
||||
<tt>lseek</tt> alters the current seek position of the file handle
|
||||
<em>filehandle</em>, seeking to a new position based on <em>pos</em>
|
||||
and <em>whence</em>.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
If <em>whence</em> is
|
||||
<ul>
|
||||
<li> SEEK_SET, the new position is <em>pos</em>.
|
||||
<li> SEEK_CUR, the new position is the current position plus <em>pos</em>.
|
||||
<li> SEEK_END, the new position is the position of end-of-file
|
||||
plus <em>pos</em>.
|
||||
<li> anything else, lseek fails.
|
||||
</ul>
|
||||
Note that <em>pos</em> is a signed quantity.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
It is not meaningful to seek on certain objects, such as the console
|
||||
device. All seeks on these objects fail.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Seek positions less than zero are invalid. Seek positions beyond EOF
|
||||
are legal, at least on regular files.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
As discussed under <A HREF=getdirentry.html>getdirentry</A>, seek
|
||||
positions on directories are defined by the file system and should not
|
||||
be interpreted.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Note that each distinct open of a file should have an independent seek
|
||||
pointer.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<tt>lseek</tt> (like all system calls) should be atomic. In this case
|
||||
this means that multiple threads or processes sharing the same seek
|
||||
pointer should be able to update it without seeing or generating
|
||||
invalid intermediate states. There is no provision for making pairs of
|
||||
<tt>lseek</tt> and <tt>read</tt> or <tt>write</tt> calls atomic. The
|
||||
<tt>pread</tt> and <tt>pwrite</tt> calls in Unix were invented to
|
||||
address this issue. (These are not in OS/161 by default but are easy
|
||||
to implement.)
|
||||
</p>
|
||||
|
||||
<h3>Return Values</h3>
|
||||
<p>
|
||||
On success, <tt>lseek</tt> returns the new position. 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=4> </td>
|
||||
<td width=10% valign=top>EBADF</td>
|
||||
<td><em>fd</em> is not a valid file
|
||||
handle.</td></tr>
|
||||
<tr><td valign=top>ESPIPE</td> <td><em>fd</em> refers to an object
|
||||
which does not support seeking.</td></tr>
|
||||
<tr><td valign=top>EINVAL</td> <td><em>whence</em> is invalid.</td></tr>
|
||||
<tr><td valign=top>EINVAL</td> <td>The resulting seek position would
|
||||
be negative.</td></tr>
|
||||
</table>
|
||||
</p>
|
||||
|
||||
</body>
|
||||
</html>
|
112
man/syscall/lstat.html
Normal file
112
man/syscall/lstat.html
Normal 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>lstat</title>
|
||||
<link rel="stylesheet" type="text/css" media="all" href="../man.css">
|
||||
</head>
|
||||
<body bgcolor=#ffffff>
|
||||
<h2 align=center>lstat</h2>
|
||||
<h4 align=center>OS/161 Reference Manual</h4>
|
||||
|
||||
<h3>Name</h3>
|
||||
<p>
|
||||
lstat - get file state information
|
||||
</p>
|
||||
|
||||
<h3>Library</h3>
|
||||
<p>
|
||||
Standard C Library (libc, -lc)
|
||||
</p>
|
||||
|
||||
<h3>Synopsis</h3>
|
||||
<p>
|
||||
<tt>#include <sys/stat.h></tt><br>
|
||||
<br>
|
||||
<tt>int</tt><br>
|
||||
<tt>lstat(const char *</tt><em>pathname</em><tt>,
|
||||
struct stat *</tt><em>statbuf</em><tt>);</tt>
|
||||
</p>
|
||||
|
||||
<h3>Description</h3>
|
||||
<p>
|
||||
lstat retrieves status information about the file referred to by
|
||||
<em>pathname</em> and stores it in the stat structure pointed to
|
||||
by <em>statbuf</em>.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
If <em>pathname</em> refers to a symbolic link, information about the
|
||||
link is retrieved rather than about the object the link points to.
|
||||
</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, lstat 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=5> </td>
|
||||
<td width=10% valign=top>ENODEV</td>
|
||||
<td>The device prefix of <em>filename</em> did
|
||||
not exist.</td></tr>
|
||||
<tr><td valign=top>ENOTDIR</td>
|
||||
<td>A non-final component of <em>pathname</em>
|
||||
was not a directory.</td></tr>
|
||||
<tr><td valign=top>ENOENT</td>
|
||||
<td>The named file does not exist.</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=fstat.html>fstat</A>,
|
||||
<A HREF=stat.html>stat</A>
|
||||
</p>
|
||||
|
||||
</body>
|
||||
</html>
|
106
man/syscall/mkdir.html
Normal file
106
man/syscall/mkdir.html
Normal file
@@ -0,0 +1,106 @@
|
||||
<!--
|
||||
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>Library</h3>
|
||||
<p>
|
||||
Standard C Library (libc, -lc)
|
||||
</p>
|
||||
|
||||
<h3>Synopsis</h3>
|
||||
<p>
|
||||
<tt>#include <sys/stat.h></tt><br>
|
||||
<br>
|
||||
<tt>int</tt><br>
|
||||
<tt>mkdir(const char *</tt><em>pathname</em><tt>,
|
||||
mode_t </tt><em>mode</em><tt>);</tt>
|
||||
</p>
|
||||
|
||||
<h3>Description</h3>
|
||||
<p>
|
||||
<tt>mkdir</tt> creates a directory named <em>name</em>, where
|
||||
<em>name</em> is the last filename component in <em>pathname</em>. All
|
||||
the directories named in the prefix portion of <em>pathname</em> must
|
||||
exist and must in fact be directories, not ordinary files. The name
|
||||
<em>name</em> must not already exist. The new directory must be
|
||||
created atomically.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
The <em>mode</em> argument gives the file permissions to use and can
|
||||
be ignored in OS/161.
|
||||
</p>
|
||||
|
||||
<h3>Return Values</h3>
|
||||
<p>
|
||||
On success, <tt>mkdir</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=8> </td>
|
||||
<td width=10% valign=top>ENODEV</td>
|
||||
<td>The device prefix of <em>pathname</em> did
|
||||
not exist.</td></tr>
|
||||
<tr><td valign=top>ENOTDIR</td> <td>A non-final component of <em>pathname</em>
|
||||
was not a directory.</td></tr>
|
||||
<tr><td valign=top>ENOENT</td> <td>A non-final component of <em>pathname</em>
|
||||
did not exist.</td></tr>
|
||||
<tr><td valign=top>EEXIST</td> <td>An object by the name <em>pathname</em>
|
||||
already exists.</td></tr>
|
||||
<tr><td valign=top>ENOSPC</td> <td>The filesystem the directory was to be
|
||||
created on is full.</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>pathname</em> was an invalid
|
||||
pointer.</td></tr>
|
||||
<tr><td valign=top>EINVAL</td> <td><em>mode</em> was invalid.</td></tr>
|
||||
</table>
|
||||
</p>
|
||||
|
||||
</body>
|
||||
</html>
|
176
man/syscall/open.html
Normal file
176
man/syscall/open.html
Normal file
@@ -0,0 +1,176 @@
|
||||
<!--
|
||||
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>open</title>
|
||||
<link rel="stylesheet" type="text/css" media="all" href="../man.css">
|
||||
</head>
|
||||
<body bgcolor=#ffffff>
|
||||
<h2 align=center>open</h2>
|
||||
<h4 align=center>OS/161 Reference Manual</h4>
|
||||
|
||||
<h3>Name</h3>
|
||||
<p>
|
||||
open - open a file
|
||||
</p>
|
||||
|
||||
<h3>Library</h3>
|
||||
<p>
|
||||
Standard C Library (libc, -lc)
|
||||
</p>
|
||||
|
||||
<h3>Synopsis</h3>
|
||||
<p>
|
||||
<tt>#include <unistd.h></tt><br>
|
||||
<tt>#include <fcntl.h></tt><br>
|
||||
<br>
|
||||
<tt>int</tt><br>
|
||||
<tt>open(const char *</tt><em>filename</em><tt>,
|
||||
int </tt><em>flags</em><tt>);</tt><br>
|
||||
<tt>int</tt><br>
|
||||
<tt>open(const char *</tt><em>filename</em><tt>, int </tt><em>flags</em><tt>,
|
||||
mode_t </tt><em>mode</em><tt>);</tt><br>
|
||||
</p>
|
||||
|
||||
<h3>Description</h3>
|
||||
<p>
|
||||
<tt>open</tt> opens the file, device, or other kernel object named by
|
||||
the pathname <em>filename</em>. The <em>flags</em> argument specifies
|
||||
how to open the file. The optional <em>mode</em> argument provides the
|
||||
file permissions to use and is only meaningful in Unix, or if you
|
||||
choose to implement Unix-style security later on. it can be ignored in
|
||||
OS/161.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
The flags argument should consist of one of
|
||||
<table width=90%>
|
||||
<tr><td width=5% rowspan=3> </td>
|
||||
<td width=30%>O_RDONLY</td> <td>Open for reading only.</td></tr>
|
||||
<tr><td>O_WRONLY</td> <td>Open for writing only.</td></tr>
|
||||
<tr><td>O_RDWR</td> <td>Open for reading and writing.</td></tr>
|
||||
</table>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
It may also have any of the following flags OR'd in:
|
||||
<table width=90%>
|
||||
<tr><td width=5% rowspan=4> </td>
|
||||
<td width=20%>O_CREAT</td>
|
||||
<td>Create the file if it doesn't exist.</td></tr>
|
||||
<tr><td>O_EXCL</td> <td>Fail if the file already exists.</td></tr>
|
||||
<tr><td>O_TRUNC</td> <td>Truncate the file to length 0 upon open.</td></tr>
|
||||
<tr><td>O_APPEND</td> <td>Open the file in append mode.</td></tr>
|
||||
</table>
|
||||
O_EXCL is only meaningful if O_CREAT is also used.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
O_APPEND causes all writes to the file to occur at the end of file, no
|
||||
matter what gets written to the file by whoever else, including
|
||||
concurrently. (This functionality may be optional; consult your
|
||||
course's assignments.)
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<tt>open</tt> returns a file handle suitable for passing to
|
||||
<A HREF=read.html>read</A>,
|
||||
<A HREF=write.html>write</A>,
|
||||
<A HREF=close.html>close</A>,
|
||||
etc. This file handle must be greater than or equal to zero. Note
|
||||
that file handles 0 (STDIN_FILENO), 1 (STDOUT_FILENO), and 2
|
||||
(STDERR_FILENO) are used in special ways and are typically assumed by
|
||||
user-level code to always be open.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
If you are implementing symbolic links, there are some additional
|
||||
points to take note of. If <em>filename</em> refers to a symbolic
|
||||
link, that link does not point to an existing object, and O_CREAT is
|
||||
specified, a new file is created <i>at the name the link points
|
||||
to</i>. However, if in this case both O_CREAT and O_EXCL are
|
||||
specified, <tt>open</tt> fails with EEXIST. These semantics are a
|
||||
nuisance to implement but important for correct functioning.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<tt>open</tt> (like all system calls) should be atomic. It is
|
||||
important for the handling of O_EXCL in the destination directory to
|
||||
be atomic. Note, however, that in practice looking up directories that
|
||||
contain <tt>..</tt> is usually not quite atomic.
|
||||
</p>
|
||||
|
||||
<h3>Return Values</h3>
|
||||
<p>
|
||||
On success, <tt>open</tt> returns a nonnegative file handle. 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=15> </td>
|
||||
<td width=10% valign=top>ENODEV</td>
|
||||
<td>The device prefix of <em>filename</em> did
|
||||
not exist.</td></tr>
|
||||
<tr><td valign=top>ENOTDIR</td> <td>A non-final component of <em>filename</em>
|
||||
was not a directory.</td></tr>
|
||||
<tr><td valign=top>ENOENT</td> <td>A non-final component of <em>filename</em>
|
||||
did not exist.</td></tr>
|
||||
<tr><td valign=top>ENOENT</td> <td>The named file does not exist, and O_CREAT
|
||||
was not specified.</td></tr>
|
||||
<tr><td valign=top>EEXIST</td> <td>The named file exists, and O_EXCL was
|
||||
specified.</td></tr>
|
||||
<tr><td valign=top>EISDIR</td> <td>The named object is a directory, and it
|
||||
was to be opened for writing.</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 file table is full, if such a
|
||||
thing exists, or a system-wide limit
|
||||
on open files was reached.</td></tr>
|
||||
<tr><td valign=top>ENXIO</td> <td>The named object is a block device with no
|
||||
filesystem mounted on it.</td></tr>
|
||||
<tr><td valign=top>ENOSPC</td> <td>The file was to be created, and the
|
||||
filesystem involved is full.</td></tr>
|
||||
<tr><td valign=top>EINVAL</td> <td><em>flags</em> contained invalid
|
||||
values.</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>filename</em> was an invalid
|
||||
pointer.</td></tr>
|
||||
</table>
|
||||
</p>
|
||||
|
||||
</body>
|
||||
</html>
|
120
man/syscall/pipe.html
Normal file
120
man/syscall/pipe.html
Normal file
@@ -0,0 +1,120 @@
|
||||
<!--
|
||||
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>pipe</title>
|
||||
<link rel="stylesheet" type="text/css" media="all" href="../man.css">
|
||||
</head>
|
||||
<body bgcolor=#ffffff>
|
||||
<h2 align=center>pipe</h2>
|
||||
<h4 align=center>OS/161 Reference Manual</h4>
|
||||
|
||||
<h3>Name</h3>
|
||||
<p>
|
||||
pipe - create pipe object
|
||||
</p>
|
||||
|
||||
<h3>Library</h3>
|
||||
<p>
|
||||
Standard C Library (libc, -lc)
|
||||
</p>
|
||||
|
||||
<h3>Synopsis</h3>
|
||||
<p>
|
||||
<tt>#include <unistd.h></tt><br>
|
||||
<br>
|
||||
<tt>int</tt><br>
|
||||
<tt>pipe(int *</tt><em>fds</em><tt>);</tt>
|
||||
</p>
|
||||
|
||||
<h3>Description</h3>
|
||||
<p>
|
||||
The <tt>pipe</tt> call creates an anonymous pipe object in the system,
|
||||
and binds it to two file handles in the current process, one for the
|
||||
read end and one for the write end. (Pipes are unidirectional.)
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Data written on the write end may be read from the read end. Once all
|
||||
references to the write end are closed, and all remaining data is
|
||||
read, further reads return EOF. If all references to the read end are
|
||||
closed before the write end is closed, further writes generate EPIPE.
|
||||
The pipe object itself is destroyed when all references to both ends
|
||||
are closed.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<em>fds</em> is a pointer to space for two integers. A file handle for
|
||||
the read end of the pipe is stored in <em>fds</em>[0], and a file
|
||||
handle for the write end is stored in <em>fds</em>[1].
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<tt>pipe</tt> is most often used in conjunction with <A
|
||||
HREF=dup2.html>dup2</A> and <A HREF=fork.html>fork</A> to send the
|
||||
standard output of one process to the standard input of another.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
In POSIX, pipe I/O of data blocks smaller than a standard constant
|
||||
PIPE_BUF is guaranteed to be atomic. If you implement pipes, you need
|
||||
not necessarily implement POSIX semantics, but you should decide what
|
||||
sort of atomicity guarantees you wish to make and specify them
|
||||
carefully.
|
||||
</p>
|
||||
|
||||
<h3>Return Values</h3>
|
||||
<p>
|
||||
On success, pipe 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> </td>
|
||||
<td width=10% 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 file table is full, if such a
|
||||
thing exists, or a system-wide limit
|
||||
on open files was reached.</td></tr>
|
||||
<tr><td valign=top>EFAULT</td> <td><em>fds</em> was an invalid
|
||||
pointer.</td></tr>
|
||||
</table>
|
||||
</p>
|
||||
|
||||
</body>
|
||||
</html>
|
115
man/syscall/read.html
Normal file
115
man/syscall/read.html
Normal file
@@ -0,0 +1,115 @@
|
||||
<!--
|
||||
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>read</title>
|
||||
<link rel="stylesheet" type="text/css" media="all" href="../man.css">
|
||||
</head>
|
||||
<body bgcolor=#ffffff>
|
||||
<h2 align=center>read</h2>
|
||||
<h4 align=center>OS/161 Reference Manual</h4>
|
||||
|
||||
<h3>Name</h3>
|
||||
<p>
|
||||
read - read data from file
|
||||
</p>
|
||||
|
||||
<h3>Library</h3>
|
||||
<p>
|
||||
Standard C Library (libc, -lc)
|
||||
</p>
|
||||
|
||||
<h3>Synopsis</h3>
|
||||
<p>
|
||||
<tt>#include <unistd.h></tt><br>
|
||||
<br>
|
||||
<tt>ssize_t</tt><br>
|
||||
<tt>read(int </tt><em>fd</em><tt>, void *</tt><em>buf</em><tt>,
|
||||
size_t </tt><em>buflen</em><tt>);</tt>
|
||||
</p>
|
||||
|
||||
<h3>Description</h3>
|
||||
<p>
|
||||
<tt>read</tt> reads up to <em>buflen</em> bytes from the file
|
||||
specified by <em>fd</em>, at the location in the file specified by the
|
||||
current seek position of the file, and stores them in the space
|
||||
pointed to by <em>buf</em>. The file must be open for reading.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
The current seek position of the file is advanced by the number of
|
||||
bytes read.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Each read (or <A HREF=write.html>write</A>) operation is atomic
|
||||
relative to other I/O to the same file.
|
||||
Note that the kernel is not obliged to (and generally cannot) make the
|
||||
read atomic with respect to other threads in the same process
|
||||
accessing the I/O buffer during the read.
|
||||
</p>
|
||||
|
||||
<h3>Return Values</h3>
|
||||
<p>
|
||||
The count of bytes read is returned. This count should be
|
||||
positive. A return value of 0 should be construed as signifying
|
||||
end-of-file. On error, <tt>read</tt> returns -1 and sets
|
||||
<A HREF=errno.html>errno</A> to a suitable error code for the error
|
||||
condition encountered.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Note that in some cases, particularly on devices, fewer than
|
||||
<em>buflen</em> (but greater than zero) bytes may be returned. This
|
||||
depends on circumstances and does not necessarily signify
|
||||
end-of-file.
|
||||
</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> </td>
|
||||
<td width=10% valign=top>EBADF</td>
|
||||
<td><em>fd</em> is not a valid file descriptor, or was
|
||||
not opened for reading.</td></tr>
|
||||
<tr><td valign=top>EFAULT</td>
|
||||
<td>Part or all of the address space pointed to by
|
||||
<em>buf</em> is invalid.</td></tr>
|
||||
<tr><td valign=top>EIO</td>
|
||||
<td>A hardware I/O error occurred reading the
|
||||
data.</td></tr>
|
||||
</table>
|
||||
</p>
|
||||
|
||||
</body>
|
||||
</html>
|
104
man/syscall/readlink.html
Normal file
104
man/syscall/readlink.html
Normal 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>readlink</title>
|
||||
<link rel="stylesheet" type="text/css" media="all" href="../man.css">
|
||||
</head>
|
||||
<body bgcolor=#ffffff>
|
||||
<h2 align=center>readlink</h2>
|
||||
<h4 align=center>OS/161 Reference Manual</h4>
|
||||
|
||||
<h3>Name</h3>
|
||||
<p>
|
||||
readlink - fetch symbolic link contents
|
||||
</p>
|
||||
|
||||
<h3>Library</h3>
|
||||
<p>
|
||||
Standard C Library (libc, -lc)
|
||||
</p>
|
||||
|
||||
<h3>Synopsis</h3>
|
||||
<p>
|
||||
<tt>#include <unistd.h></tt><br>
|
||||
<br>
|
||||
<tt>int</tt><br>
|
||||
<tt>readlink(const char *</tt><em>path</em><tt>, char *</tt><em>buf</em><tt>,
|
||||
size_t </tt><em>len</em><tt>);</tt>
|
||||
</p>
|
||||
|
||||
<h3>Description</h3>
|
||||
<p>
|
||||
<tt>readlink</tt> retrieves the contents of the symbolic link named by
|
||||
<em>path</em> and places them in the buffer <em>buf</em>. At most
|
||||
<em>len</em> bytes are written.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<tt>readlink</tt> does not include a null terminator in <em>buf</em>.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
The call (like all system calls) should be atomic.
|
||||
Note that the kernel is not obliged to (and generally cannot) make the
|
||||
read atomic with respect to other threads in the same process
|
||||
accessing the buffer during the operation.
|
||||
</p>
|
||||
|
||||
<h3>Return Values</h3>
|
||||
<p>
|
||||
<tt>readlink</tt> returns the number of characters transferred. If an
|
||||
error occurs, -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=6> </td>
|
||||
<td width=10% valign=top>ENODEV</td>
|
||||
<td>The device prefix of <em>filename</em> did
|
||||
not exist.</td></tr>
|
||||
<tr><td valign=top>ENOTDIR</td> <td>A non-final component of <em>path</em>
|
||||
was not a directory.</td></tr>
|
||||
<tr><td valign=top>ENOENT</td> <td>The named file does not exist.</td></tr>
|
||||
<tr><td valign=top>EINVAL</td> <td>The named file is not a symlink.</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> or <em>path</em> points to an
|
||||
invalid address.</td></tr>
|
||||
</table>
|
||||
</p>
|
||||
|
||||
</body>
|
||||
</html>
|
93
man/syscall/reboot.html
Normal file
93
man/syscall/reboot.html
Normal file
@@ -0,0 +1,93 @@
|
||||
<!--
|
||||
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 or halt system
|
||||
</p>
|
||||
|
||||
<h3>Library</h3>
|
||||
<p>
|
||||
Standard C Library (libc, -lc)
|
||||
</p>
|
||||
|
||||
<h3>Synopsis</h3>
|
||||
<p>
|
||||
<tt>#include <unistd.h></tt><br>
|
||||
<br>
|
||||
<tt>int</tt><br>
|
||||
<tt>reboot(int </tt><em>code</em><tt>);</tt>
|
||||
</p>
|
||||
|
||||
<h3>Description</h3>
|
||||
<p>
|
||||
<tt>reboot</tt> reboots or shuts down the system. The specific action
|
||||
depends on the <em>code</em> passed:
|
||||
<table width=90%>
|
||||
<tr><td width=5% rowspan=3> </td>
|
||||
<td width=15%>RB_REBOOT</td> <td>The system is rebooted.</td></tr>
|
||||
<tr><td width=15%>RB_HALT</td> <td>The system is halted.</td></tr>
|
||||
<tr><td width=15%>RB_POWEROFF</td> <td>The system is powered off.</td></tr>
|
||||
</table>
|
||||
</p>
|
||||
|
||||
<h3>Return Values</h3>
|
||||
<p>
|
||||
On success, reboot does not return. 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> </td>
|
||||
<td width=10% valign=top>EINVAL</td>
|
||||
<td><em>code</em> was not a valid
|
||||
value.</td></tr>
|
||||
<tr><td valign=top>EPERM</td> <td>The current process does not have
|
||||
sufficient privilege to halt the
|
||||
system.</td></tr>
|
||||
</table>
|
||||
</p>
|
||||
|
||||
</body>
|
||||
</html>
|
107
man/syscall/remove.html
Normal file
107
man/syscall/remove.html
Normal file
@@ -0,0 +1,107 @@
|
||||
<!--
|
||||
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>remove</title>
|
||||
<link rel="stylesheet" type="text/css" media="all" href="../man.css">
|
||||
</head>
|
||||
<body bgcolor=#ffffff>
|
||||
<h2 align=center>remove</h2>
|
||||
<h4 align=center>OS/161 Reference Manual</h4>
|
||||
|
||||
<h3>Name</h3>
|
||||
<p>
|
||||
remove - delete (unlink) a file
|
||||
</p>
|
||||
|
||||
<h3>Library</h3>
|
||||
<p>
|
||||
Standard C Library (libc, -lc)
|
||||
</p>
|
||||
|
||||
<h3>Synopsis</h3>
|
||||
<p>
|
||||
<tt>#include <unistd.h></tt><br>
|
||||
<br>
|
||||
<tt>int</tt><br>
|
||||
<tt>remove(const char *</tt><em>pathname</em><tt>);</tt>
|
||||
</p>
|
||||
|
||||
<h3>Description</h3>
|
||||
<p>
|
||||
The name of the file referred to by <em>pathname</em> is removed from
|
||||
the filesystem. The actual file itself is not removed until no further
|
||||
references to it exist, whether those references are on disk or in
|
||||
memory.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
It is an error for <em>pathname</em> to not specify an existing file
|
||||
or to refer to a directory.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
The call (like all system calls) should be atomic. Other processes
|
||||
should not be able to see a half-removed file. If implementing a
|
||||
recoverable filesystem, recovery must yield a volume where the
|
||||
<tt>remove</tt> either has been fully completed or has not been done
|
||||
at all.
|
||||
</p>
|
||||
|
||||
<h3>Return Values</h3>
|
||||
<p>
|
||||
On success, <tt>remove</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=6> </td>
|
||||
<td width=10% valign=top>ENODEV</td>
|
||||
<td>The device prefix of <em>filename</em> did
|
||||
not exist.</td></tr>
|
||||
<tr><td valign=top>ENOTDIR</td> <td>A non-final component of <em>pathname</em>
|
||||
was not a directory.</td></tr>
|
||||
<tr><td valign=top>EISDIR</td> <td><em>pathname</em> referred to a
|
||||
directory.</td></tr>
|
||||
<tr><td valign=top>ENOENT</td> <td>The target file did not exist.</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>pathname</em> was an invalid
|
||||
pointer.</td></tr>
|
||||
</table>
|
||||
</p>
|
||||
|
||||
</body>
|
||||
</html>
|
155
man/syscall/rename.html
Normal file
155
man/syscall/rename.html
Normal file
@@ -0,0 +1,155 @@
|
||||
<!--
|
||||
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>rename</title>
|
||||
<link rel="stylesheet" type="text/css" media="all" href="../man.css">
|
||||
</head>
|
||||
<body bgcolor=#ffffff>
|
||||
<h2 align=center>rename</h2>
|
||||
<h4 align=center>OS/161 Reference Manual</h4>
|
||||
|
||||
<h3>Name</h3>
|
||||
<p>
|
||||
rename - rename or move a file
|
||||
</p>
|
||||
|
||||
<h3>Library</h3>
|
||||
<p>
|
||||
Standard C Library (libc, -lc)
|
||||
</p>
|
||||
|
||||
<h3>Synopsis</h3>
|
||||
<p>
|
||||
<tt>#include <unistd.h></tt><br>
|
||||
<br>
|
||||
<tt>int</tt><br>
|
||||
<tt>rename(const char *</tt><em>oldname</em><tt>,
|
||||
const char *</tt><em>newname</em><tt>);</tt>
|
||||
</p>
|
||||
|
||||
<h3>Description</h3>
|
||||
<p>
|
||||
The file (or other object) referenced by <em>oldname</em> is given the
|
||||
name <em>newname</em>, and the name <em>oldname</em> is removed. If
|
||||
<em>newname</em> already exists, it is removed as well. (The semantics
|
||||
for removing files and directories described under
|
||||
<A HREF=remove.html>remove</A> and <A HREF=rmdir.html>rmdir</A>
|
||||
must be honored.)
|
||||
</p>
|
||||
|
||||
<p>
|
||||
If <em>newname</em> exists, it must be a directory if and only if
|
||||
<em>oldname</em> also is.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
If components of the path prefix of <em>newname</em> do not exist or
|
||||
are not directories, rename fails. Additionally, <em>oldname</em> and
|
||||
<em>newname</em> must refer to names on the same filesystem.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
If <em>oldname</em> and <em>newname</em> are the same file, rename
|
||||
succeeds and the state of the filesystem is not altered. This is true
|
||||
even if they are not in the same directory. (POSIX says so. This is
|
||||
widely considered a bug in POSIX.)
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Rename must be atomic; no other process on the system should be able
|
||||
to see the filesystem in a state where both (or neither)
|
||||
<em>oldname</em> and <em>newname</em> name the file. Additionally, if
|
||||
the system crashes, at least one name for the file must remain.
|
||||
(If you are implementing a file system with crash recovery, a crash
|
||||
during rename must, after recovery, produce a volume where the rename
|
||||
has either occurred or not occurred; no intermediate states may be
|
||||
exposed.)
|
||||
</p>
|
||||
|
||||
<p>
|
||||
If <em>oldname</em> is a directory, <em>newname</em> must not refer to
|
||||
a subdirectory of <em>oldname</em>, as this would create a (detached)
|
||||
cycle in the directory tree.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Renaming (or overwriting) the <tt>.</tt> or <tt>..</tt> entries in
|
||||
directories is prohibited.
|
||||
</p>
|
||||
|
||||
<h3>Return Values</h3>
|
||||
<p>
|
||||
On success, <tt>rename</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 errors not
|
||||
mentioned here.
|
||||
|
||||
<table width=90%>
|
||||
<tr><td width=5% rowspan=13> </td>
|
||||
<td width=10% valign=top>ENODEV</td>
|
||||
<td>The device prefix of one of the names did
|
||||
not exist.</td></tr>
|
||||
<tr><td valign=top>ENOTDIR</td> <td>A non-final component of one of the names
|
||||
was not a directory.</td></tr>
|
||||
<tr><td valign=top>ENOENT</td> <td>A non-final component of <em>newname</em>
|
||||
did not exist.</td></tr>
|
||||
<tr><td valign=top>ENOENT</td> <td><em>oldname</em> does not exist.</td></tr>
|
||||
<tr><td valign=top>ENOTDIR</td> <td><em>oldname</em> is a directory, and
|
||||
<em>newname</em> is not.</td></tr>
|
||||
<tr><td valign=top>EISDIR</td> <td><em>oldname</em> is not a directory, and
|
||||
<em>newname</em> is.</td></tr>
|
||||
<tr><td valign=top>ENOTEMPTY</td><td><em>newname</em> is a directory, and it is
|
||||
not empty.</td>
|
||||
<tr><td valign=top>EXDEV</td> <td>The two names are on different
|
||||
filesystems.</td></tr>
|
||||
<tr><td valign=top>EINVAL</td> <td><em>newname</em> is a subdirectory of
|
||||
<em>oldname</em>.</td></tr>
|
||||
<tr><td valign=top>EINVAL</td> <td>An attempt was made to rename a
|
||||
<tt>.</tt> or <tt>..</tt> entry.</td></tr>
|
||||
<tr><td valign=top>ENOSPC</td> <td>The filesystem involved is full.</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 was an
|
||||
invalid pointer.</td></tr>
|
||||
</table>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
As with rmdir, attempts to rename with <em>newname</em> equal to
|
||||
<tt>..</tt> may generate either EINVAL or ENOTEMPTY.
|
||||
</p>
|
||||
|
||||
</body>
|
||||
</html>
|
133
man/syscall/rmdir.html
Normal file
133
man/syscall/rmdir.html
Normal file
@@ -0,0 +1,133 @@
|
||||
<!--
|
||||
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>Library</h3>
|
||||
<p>
|
||||
Standard C Library (libc, -lc)
|
||||
</p>
|
||||
|
||||
<h3>Synopsis</h3>
|
||||
<p>
|
||||
<tt>#include <unistd.h></tt><br>
|
||||
<br>
|
||||
<tt>int</tt><br>
|
||||
<tt>rmdir(const char *</tt><em>pathname</em><tt>);</tt>
|
||||
</p>
|
||||
|
||||
<h3>Description</h3>
|
||||
<p>
|
||||
<tt>rmdir</tt> removes the directory named by <em>pathname</em>. The directory
|
||||
(and all the components in its path prefix) must exist. The directory
|
||||
must be empty, except for the <tt>.</tt> and <tt>..</tt> entries, and
|
||||
may not be the root directory of the filesystem.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
It is invalid to attempt to remove the <tt>.</tt> or <tt>..</tt>
|
||||
entries in a directory. What rmdir actually removes is a name in some
|
||||
(other, containing) directory; removing the <tt>.</tt> or <tt>..</tt>
|
||||
<i>names</i> would make a mess. It is not invalid for a process to
|
||||
remove its own current directory, but it does not work to do so by
|
||||
calling <tt>rmdir(".")</tt>.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
It is impossible in any event to remove a directory named with
|
||||
<tt>..</tt>, because it is impossible to name a directory with
|
||||
<tt>..</tt> unless it is not empty.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
If a directory is in use (e.g. being read by <tt>ls</tt>, or is some
|
||||
process's current directory, etc.) when it is removed, all further
|
||||
accesses to it should be rejected (with ENOENT). Like a file deleted
|
||||
while in use, it should only be fully removed when all remaining
|
||||
references to it are dropped.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
The removal must be atomic, both with respect to other running
|
||||
processes, and (if implementing a recoverable file system) with
|
||||
respect to crash recovery.
|
||||
</p>
|
||||
|
||||
<h3>Return Values</h3>
|
||||
<p>
|
||||
On success, <tt>rmdir</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 errors not
|
||||
mentioned here.
|
||||
|
||||
<table width=90%>
|
||||
<tr><td width=5% rowspan=8> </td>
|
||||
<td width=10% valign=top>ENODEV</td>
|
||||
<td>The device prefix of <em>filename</em> did
|
||||
not exist.</td></tr>
|
||||
<tr><td valign=top>ENOTDIR</td> <td>A non-final component of <em>pathname</em>
|
||||
was not a directory.</td></tr>
|
||||
<tr><td valign=top>ENOTDIR</td> <td><em>pathname</em> referred to an
|
||||
object that was not a directory.</td></tr>
|
||||
<tr><td valign=top>ENOENT</td> <td>The target directory did not
|
||||
exist.</td></tr>
|
||||
<tr><td valign=top>EINVAL</td> <td>An attempt was made to remove a
|
||||
<tt>.</tt> or <tt>..</tt> entry.</td></tr>
|
||||
<tr><td valign=top>ENOTEMPTY</td><td>The target directory was not
|
||||
empty.</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>pathname</em> was an invalid
|
||||
pointer.</td></tr>
|
||||
</table>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Attempts to remove <tt>..</tt> may generate either EINVAL or
|
||||
ENOTEMPTY.
|
||||
</p>
|
||||
|
||||
</body>
|
||||
</html>
|
144
man/syscall/sbrk.html
Normal file
144
man/syscall/sbrk.html
Normal file
@@ -0,0 +1,144 @@
|
||||
<!--
|
||||
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>sbrk</title>
|
||||
<link rel="stylesheet" type="text/css" media="all" href="../man.css">
|
||||
</head>
|
||||
<body bgcolor=#ffffff>
|
||||
<h2 align=center>sbrk</h2>
|
||||
<h4 align=center>OS/161 Reference Manual</h4>
|
||||
|
||||
<h3>Name</h3>
|
||||
<p>
|
||||
sbrk - set process break (allocate memory)
|
||||
</p>
|
||||
|
||||
<h3>Library</h3>
|
||||
<p>
|
||||
Standard C Library (libc, -lc)
|
||||
</p>
|
||||
|
||||
<h3>Synopsis</h3>
|
||||
<p>
|
||||
<tt>#include <unistd.h></tt><br>
|
||||
<br>
|
||||
<tt>void *</tt><br>
|
||||
<tt>sbrk(intptr_t </tt><em>amount</em><tt>);</tt>
|
||||
</p>
|
||||
|
||||
<h3>Description</h3>
|
||||
<p>
|
||||
The "break" is the end address of a process's heap region. The
|
||||
<tt>sbrk</tt> call adjusts the "break" by the amount <em>amount</em>.
|
||||
It returns the old "break". Thus, to determine the current "break",
|
||||
call <tt>sbrk(0)</tt>.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
The heap region is initially empty, so at process startup, the
|
||||
beginning of the heap region is the same as the end and may thus be
|
||||
retrieved using sbrk(0).
|
||||
</p>
|
||||
|
||||
<p>
|
||||
In OS/161, the initial "break" must be page-aligned, and <tt>sbrk</tt>
|
||||
only need support values of <em>amount</em> that result in
|
||||
page-aligned "break" addresses. Other values of <em>amount</em> may be
|
||||
rejected. This may simplify the implementation. You may place the
|
||||
heap wherever you like in a process's address space (though obviously
|
||||
not on top of something else) and it need not appear at the same
|
||||
location in every process.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Traditionally, the initial "break" is specifically defined to be the
|
||||
end of the BSS (uninitialized data) region, and traditionally any
|
||||
<em>amount</em>, page-aligned or not, may legally be used with
|
||||
<tt>sbrk</tt>.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Ordinarily, user-level code should call
|
||||
<A HREF=../libc/malloc.html>malloc</A> for memory allocation. The
|
||||
<tt>sbrk</tt> interface is intended only to be the back-end interface
|
||||
for <tt>malloc</tt>. Mixing calls to <tt>malloc</tt> and <tt>sbrk</tt>
|
||||
will likely confuse <tt>malloc</tt> and produces undefined behavior.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
While one can lower the "break" by passing negative values of
|
||||
<em>amount</em>, one may not set the end of the heap to an address
|
||||
lower than the beginning of the heap. Attempts to do so must be
|
||||
rejected.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
The call (like all system calls) should be atomic. In this case, that
|
||||
means that if you have a multithreaded process, simultaneous calls to
|
||||
<tt>sbrk</tt> from different threads should not interfere with each
|
||||
other and should update the "break" state atomically.
|
||||
</p>
|
||||
|
||||
<h3>Return Values</h3>
|
||||
<p>
|
||||
On success, <tt>sbrk</tt> returns the previous value of the "break".
|
||||
On error, ((void *)-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> </td>
|
||||
<td with=10% valign=top>ENOMEM</td>
|
||||
<td>Sufficient virtual memory to satisfy the
|
||||
request was not available, or the
|
||||
process has reached the limit of the
|
||||
memory it is allowed to allocate.</td></tr>
|
||||
<tr><td valign=top>EINVAL</td>
|
||||
<td>The request would move the "break" below
|
||||
its initial value.</td></tr>
|
||||
</table>
|
||||
</p>
|
||||
|
||||
<h3>Restrictions</h3>
|
||||
<p>
|
||||
While you can return pages that happen to be at the end of the heap to
|
||||
the system, there is no way to use the <tt>sbrk</tt> interface to
|
||||
return unused pages in the middle of the heap. If you wish to do this,
|
||||
you will need to design a new or supplemental interface.
|
||||
</p>
|
||||
|
||||
</body>
|
||||
</html>
|
103
man/syscall/stat.html
Normal file
103
man/syscall/stat.html
Normal file
@@ -0,0 +1,103 @@
|
||||
<!--
|
||||
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>stat</title>
|
||||
<link rel="stylesheet" type="text/css" media="all" href="../man.css">
|
||||
</head>
|
||||
<body bgcolor=#ffffff>
|
||||
<h2 align=center>stat</h2>
|
||||
<h4 align=center>OS/161 Reference Manual</h4>
|
||||
|
||||
<h3>Name</h3>
|
||||
<p>
|
||||
stat - get file state information
|
||||
</p>
|
||||
|
||||
<h3>Library</h3>
|
||||
<p>
|
||||
Standard C Library (libc, -lc)
|
||||
</p>
|
||||
|
||||
<h3>Synopsis</h3>
|
||||
<p>
|
||||
<tt>#include <sys/stat.h></tt><br>
|
||||
<br>
|
||||
<tt>int</tt><br>
|
||||
<tt>stat(const char *</tt><em>pathname</em><tt>,
|
||||
struct stat *</tt><em>statbuf</em><tt>);</tt>
|
||||
</p>
|
||||
|
||||
<h3>Description</h3>
|
||||
<p>
|
||||
<tt>stat</tt> retrieves status information about the file referred to
|
||||
by <em>pathname</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>stat</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=5> </td>
|
||||
<td width=10% valign=top>ENODEV</td>
|
||||
<td>The device prefix of <em>filename</em> did
|
||||
not exist.</td></tr>
|
||||
<tr><td valign=top>ENOTDIR</td> <td>A non-final component of <em>pathname</em>
|
||||
was not a directory.</td></tr>
|
||||
<tr><td valign=top>ENOENT</td> <td>The named file does not exist.</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=fstat.html>fstat</A>,
|
||||
<A HREF=lstat.html>lstat</A>
|
||||
</p>
|
||||
|
||||
</body>
|
||||
</html>
|
107
man/syscall/symlink.html
Normal file
107
man/syscall/symlink.html
Normal file
@@ -0,0 +1,107 @@
|
||||
<!--
|
||||
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>symlink</title>
|
||||
<link rel="stylesheet" type="text/css" media="all" href="../man.css">
|
||||
</head>
|
||||
<body bgcolor=#ffffff>
|
||||
<h2 align=center>symlink</h2>
|
||||
<h4 align=center>OS/161 Reference Manual</h4>
|
||||
|
||||
<h3>Name</h3>
|
||||
<p>
|
||||
symlink - create symbolic link
|
||||
</p>
|
||||
|
||||
<h3>Library</h3>
|
||||
<p>
|
||||
Standard C Library (libc, -lc)
|
||||
</p>
|
||||
|
||||
<h3>Synopsis</h3>
|
||||
<p>
|
||||
<tt>#include <unistd.h></tt><br>
|
||||
<br>
|
||||
<tt>int</tt><br>
|
||||
<tt>symlink(const char *</tt><em>oldname</em><tt>,
|
||||
const char *</tt><em>linkname</em><tt>);</tt>
|
||||
</p>
|
||||
|
||||
<h3>Description</h3>
|
||||
<p>
|
||||
<tt>symlink</tt> creates a symbolic link. The symlink itself is named
|
||||
<em>linkname</em>, and it points to <em>oldname</em>.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<em>oldname</em> need not exist or be on the same filesystem.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
The call (like all system calls) must be atomic; that is, the symlink
|
||||
should either be created or not created, and no other process should
|
||||
see an intermediate state (such as, for example, a blank symlink whose
|
||||
name hasn't been written out yet...) For recoverable file systems,
|
||||
this includes after crash recovery.
|
||||
</p>
|
||||
|
||||
<h3>Return Values</h3>
|
||||
<p>
|
||||
On success, <tt>symlink</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=7> </td>
|
||||
<td width=10% valign=top>ENODEV</td>
|
||||
<td>The device prefix of <em>filename</em> did
|
||||
not exist.</td></tr>
|
||||
<tr><td valign=top>ENOTDIR</td> <td>A non-final component of <em>linkname</em>
|
||||
was not a directory.</td></tr>
|
||||
<tr><td valign=top>ENOENT</td> <td>A non-final component of <em>linkname</em>
|
||||
did not exist.</td></tr>
|
||||
<tr><td valign=top>EEXIST</td> <td><em>linkname</em> already exists.</td></tr>
|
||||
<tr><td valign=top>ENOSPC</td> <td>The filesystem that was to hold the link
|
||||
is full.</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>linkname</em> or <em>oldname</em> was
|
||||
an invalid pointer.</td></tr>
|
||||
</table>
|
||||
</p>
|
||||
|
||||
</body>
|
||||
</html>
|
73
man/syscall/sync.html
Normal file
73
man/syscall/sync.html
Normal 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>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 - flush filesystem data to disk
|
||||
</p>
|
||||
|
||||
<h3>Library</h3>
|
||||
<p>
|
||||
Standard C Library (libc, -lc)
|
||||
</p>
|
||||
|
||||
<h3>Synopsis</h3>
|
||||
<p>
|
||||
<tt>#include <unistd.h></tt><br>
|
||||
<br>
|
||||
<tt>void</tt><br>
|
||||
<tt>sync(void);</tt>
|
||||
</p>
|
||||
|
||||
<h3>Description</h3>
|
||||
<p>
|
||||
The <tt>sync</tt> function forces a write of all dirty filesystem
|
||||
buffers and dirty filesystem state to disk.
|
||||
</p>
|
||||
|
||||
<h3>Return Values</h3>
|
||||
<p>
|
||||
No value is returned, and <tt>sync</tt> does not fail.
|
||||
</p>
|
||||
|
||||
<h3>Errors</h3>
|
||||
<p>
|
||||
None.
|
||||
</p>
|
||||
|
||||
</body>
|
||||
</html>
|
204
man/syscall/waitpid.html
Normal file
204
man/syscall/waitpid.html
Normal file
@@ -0,0 +1,204 @@
|
||||
<!--
|
||||
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>waitpid</title>
|
||||
<link rel="stylesheet" type="text/css" media="all" href="../man.css">
|
||||
</head>
|
||||
<body bgcolor=#ffffff>
|
||||
<h2 align=center>waitpid</h2>
|
||||
<h4 align=center>OS/161 Reference Manual</h4>
|
||||
|
||||
<h3>Name</h3>
|
||||
<p>
|
||||
waitpid - wait for a process to exit
|
||||
</p>
|
||||
|
||||
<h3>Library</h3>
|
||||
<p>
|
||||
Standard C Library (libc, -lc)
|
||||
</p>
|
||||
|
||||
<h3>Synopsis</h3>
|
||||
<p>
|
||||
<tt>#include <sys/wait.h></tt><br>
|
||||
<br>
|
||||
<tt>pid_t</tt><br>
|
||||
<tt>waitpid(pid_t </tt><em>pid</em><tt>, int *</tt><em>status</em><tt>,
|
||||
int </tt><em>options</em><tt>);</tt>
|
||||
</p>
|
||||
|
||||
<h3>Description</h3>
|
||||
<p>
|
||||
Wait for the process specified by <em>pid</em> to exit, and return an
|
||||
encoded exit status in the integer pointed to by <em>status</em>. If
|
||||
that process has exited already, <tt>waitpid</tt> returns
|
||||
immediately. If that process does not exist, <tt>waitpid</tt> fails.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
It is explicitly allowed for <em>status</em> to be <tt>NULL</tt>, in
|
||||
which case waitpid operates normally but the status value is not
|
||||
produced.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
A process moves from "has exited already" to "does not exist" when
|
||||
every process that is expected to collect its exit status with
|
||||
<tt>waitpid</tt> has done so.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
In the standard Unix model of processes, the only process that is
|
||||
expected to collect another process's exit status is its parent.
|
||||
(If you feel this is restrictive, you might try to extend the model or
|
||||
define a new one; however, this is not recommended. The only other
|
||||
model that really makes much sense is to let any process wait for any
|
||||
other process; but then you need to check for and reject combinations
|
||||
that would cause deadlock.)
|
||||
</p>
|
||||
|
||||
<p>
|
||||
There are several semi-standard and messy/ugly ways in Unix for a
|
||||
process to indicate that it doesn't want to collect the exit status of
|
||||
a child it forks and therefore shouldn't be expected to. You do not
|
||||
need to implement any of these, but you might find it convenient for
|
||||
your own purposes to provide this functionality.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
If a parent process exits before one or more of its children, it can
|
||||
no longer be expected collect their exit status. There are several
|
||||
ways to handle this case in practice, of which the traditional Unix
|
||||
method is only one. This is something you should design.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
The <em>options</em> argument should be 0. You are not required to
|
||||
implement any options. (However, your system should check to make sure
|
||||
that requests for options you do not support are rejected.)
|
||||
</p>
|
||||
|
||||
<p>
|
||||
If you desire, you may implement the Unix option WNOHANG; this causes
|
||||
waitpid, when called for a process that has not yet exited, to return
|
||||
0 immediately instead of waiting.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
The Unix option WUNTRACED, to ask for reporting of processes that stop
|
||||
as well as exit, is also defined in the header files, but implementing
|
||||
this feature is not required or necessary unless you are implementing
|
||||
job control.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
You may also make up your own options if you find them helpful.
|
||||
However, please, document anything you make up.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
The encoding of the exit status is comparable to Unix and is defined
|
||||
by the flags found in <kern/wait.h>. (Userlevel code should
|
||||
include <sys/wait.h> to get these definitions.) A process can
|
||||
exit by calling <A HREF=_exit.html>_exit()</A> or it can exit by
|
||||
receiving a fatal signal. In the former case the
|
||||
<tt>_MKWAIT_EXIT()</tt> macro should be used with the user-supplied
|
||||
exit code value to prepare the exit status; in the latter, the
|
||||
<tt>_MKWAIT_SIG()</tt> macro (or <tt>_MKWAIT_CORE()</tt> if a core
|
||||
file was generated) should be used with the signal number. The result
|
||||
encoding also allows notification of processes that have stopped; this
|
||||
would be used in connection with job control and with
|
||||
<tt>ptrace</tt>-based debugging if you were to implement those things.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
The <tt>_MKWAIT</tt> flags are not standard and should be considered
|
||||
part of the implementation.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
To <em>read</em> the wait status, use the macros <tt>WIFEXITED()</tt>,
|
||||
<tt>WIFSIGNALED()</tt>, and/or <tt>WIFSTOPPED()</tt> to find out what
|
||||
happened, and then <tt>WEXITSTATUS()</tt>, <tt>WTERMSIG()</tt>, or
|
||||
<tt>WSTOPSIG()</tt> respectively to get the exit code or signal
|
||||
number. If <tt>WIFSIGNALED()</tt> is true, <tt>WCOREDUMP()</tt> can be
|
||||
used to check if a core file was generated. This is the same as Unix,
|
||||
although the value encoding is different from the historic Unix
|
||||
format.
|
||||
</p>
|
||||
|
||||
<h3>Return Values</h3>
|
||||
<p>
|
||||
<tt>waitpid</tt> returns the process id whose exit status is reported in
|
||||
<em>status</em>. In OS/161, this is always the value of <em>pid</em>.
|
||||
<p>
|
||||
|
||||
<p>
|
||||
(In Unix, but not by default OS/161, you can wait for any of several
|
||||
processes by passing magic values of <em>pid</em>, so this return
|
||||
value can actually be useful.)
|
||||
</p>
|
||||
|
||||
<p>
|
||||
If you implement WNOHANG, and WNOHANG is given, and the process
|
||||
specified by <em>pid</em> has not yet exited, waitpid returns 0.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
On error, -1 is returned, and <A HREF=errno.html>errno</A> is set 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 cases not
|
||||
mentioned here.
|
||||
|
||||
<table width=90%>
|
||||
<tr><td width=5% rowspan=4> </td>
|
||||
<td width=10% valign=top>EINVAL</td>
|
||||
<td>The <em>options</em> argument requested invalid or
|
||||
unsupported options.</td></tr>
|
||||
<tr><td valign=top>ECHILD</td>
|
||||
<td>The <em>pid</em> argument named a process
|
||||
that was not a child of the current
|
||||
process.</td></tr>
|
||||
<tr><td valign=top>ESRCH</td>
|
||||
<td>The <em>pid</em> argument named a
|
||||
nonexistent process.</td></tr>
|
||||
<tr><td valign=top>EFAULT</td>
|
||||
<td>The <em>status</em> argument was an
|
||||
invalid pointer.</td></tr>
|
||||
</table>
|
||||
</p>
|
||||
|
||||
</body>
|
||||
</html>
|
120
man/syscall/write.html
Normal file
120
man/syscall/write.html
Normal file
@@ -0,0 +1,120 @@
|
||||
<!--
|
||||
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>write</title>
|
||||
<link rel="stylesheet" type="text/css" media="all" href="../man.css">
|
||||
</head>
|
||||
<body bgcolor=#ffffff>
|
||||
<h2 align=center>write</h2>
|
||||
<h4 align=center>OS/161 Reference Manual</h4>
|
||||
|
||||
<h3>Name</h3>
|
||||
<p>
|
||||
write - write data to file
|
||||
</p>
|
||||
|
||||
<h3>Library</h3>
|
||||
<p>
|
||||
Standard C Library (libc, -lc)
|
||||
</p>
|
||||
|
||||
<h3>Synopsis</h3>
|
||||
<p>
|
||||
<tt>#include <unistd.h></tt><br>
|
||||
<br>
|
||||
<tt>ssize_t</tt><br>
|
||||
<tt>write(int </tt><em>fd</em><tt>, const void *</tt><em>buf</em><tt>,
|
||||
size_t </tt><em>nbytes</em><tt>);</tt>
|
||||
</p>
|
||||
|
||||
<h3>Description</h3>
|
||||
<p>
|
||||
<tt>write</tt> writes up to <em>buflen</em> bytes to the file
|
||||
specified by <em>fd</em>, at the location in the file specified by the
|
||||
current seek position of the file, taking the data from the space
|
||||
pointed to by <em>buf</em>. The file must be open for writing.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
The current seek position of the file is advanced by the number of
|
||||
bytes written.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Each write (or <A HREF=read.html>read</A>) operation is atomic
|
||||
relative to other I/O to the same file.
|
||||
Note that the kernel is not obliged to (and generally cannot) make the
|
||||
write atomic with respect to other threads in the same process
|
||||
accessing the I/O buffer during the write.
|
||||
</p>
|
||||
|
||||
<h3>Return Values</h3>
|
||||
<p>
|
||||
The count of bytes written is returned. This count should be
|
||||
positive. A return value of 0 means that nothing could be written,
|
||||
but that no error occurred; this only occurs at end-of-file on
|
||||
fixed-size objects. On error, <tt>write</tt> returns -1 and sets
|
||||
<A HREF=errno.html>errno</A> to a suitable error code for the error
|
||||
condition encountered.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Note that in some cases, particularly on devices, fewer than
|
||||
<em>buflen</em> (but greater than zero) bytes may be written. This
|
||||
depends on circumstances and does not necessarily signify
|
||||
end-of-file. In most cases, one should loop to make sure that all
|
||||
output has actually been written.
|
||||
</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=4> </td>
|
||||
<td width=10% valign=top>EBADF</td>
|
||||
<td><em>fd</em> is not a valid file descriptor, or was
|
||||
not opened for writing.</td></tr>
|
||||
<tr><td valign=top>EFAULT</td>
|
||||
<td>Part or all of the address space pointed to by
|
||||
<em>buf</em> is invalid.</td></tr>
|
||||
<tr><td valign=top>ENOSPC</td>
|
||||
<td>There is no free space remaining on the filesystem
|
||||
containing the file.</td></tr>
|
||||
<tr><td valign=top>EIO</td>
|
||||
<td>A hardware I/O error occurred writing
|
||||
the data.</td></tr>
|
||||
</table>
|
||||
</p>
|
||||
|
||||
</body>
|
||||
</html>
|
Reference in New Issue
Block a user