From 8aabf59b114fcd474271d13f7a45c763d9dc05e2 Mon Sep 17 00:00:00 2001 From: Ken Thompson Date: Thu, 26 Jun 1975 19:36:09 -0500 Subject: [PATCH] Research V6 development Work on file usr/doc/man/man1/tp.1 Work on file usr/doc/man/man1/yacc.1 Work on file usr/doc/man/man2/fork.2 Work on file usr/doc/man/man2/exit.2 Work on file usr/doc/man/man2/exec.2 Work on file usr/doc/man/man2/chmod.2 Work on file usr/doc/man/man2/chown.2 Work on file usr/doc/man/man2/close.2 Work on file usr/doc/man/man2/dup.2 Work on file usr/doc/man/man2/fstat.2 Work on file usr/doc/man/man2/break.2 Work on file usr/doc/man/man2/chdir.2 Work on file usr/doc/man/man2/csw.2 Work on file usr/doc/man/man2/creat.2 Work on file usr/doc/man/man2/link.2 Work on file usr/doc/man/man2/indir.2 Work on file usr/doc/man/man2/getuid.2 Work on file usr/doc/man/man2/gtty.2 Work on file usr/doc/man/man2/intro.2 Work on file usr/doc/man/man2/kill.2 Work on file usr/doc/man/man2/getgid.2 Work on file usr/doc/man/man2/getpid.2 Work on file usr/doc/man/man2/mknod.2 Work on file usr/doc/man/man2/times.2 Work on file usr/doc/man/man2/signal.2 Work on file usr/doc/man/man2/time.2 Work on file usr/doc/man/man2/unlink.2 Work on file usr/doc/man/man2/umount.2 Work on file usr/doc/man/man2/mount.2 Work on file usr/doc/man/man2/seek.2 Work on file usr/doc/man/man2/wait.2 Work on file usr/doc/man/man2/profil.2 Work on file usr/doc/man/man2/ptrace.2 Work on file usr/doc/man/man2/read.2 Work on file usr/doc/man/man2/setuid.2 Work on file usr/doc/man/man2/sync.2 Work on file usr/doc/man/man2/nice.2 Work on file usr/doc/man/man2/pipe.2 Work on file usr/doc/man/man2/stty.2 Work on file usr/doc/man/man2/setgid.2 Work on file usr/doc/man/man2/write.2 Work on file usr/doc/man/man2/open.2 Work on file usr/doc/man/man2/sleep.2 Work on file usr/doc/man/man2/stat.2 Work on file usr/doc/man/man2/stime.2 Co-Authored-By: Dennis Ritchie Synthesized-from: v6 --- usr/doc/man/man1/tp.1 | 158 +++++++++++++++++++++++++++ usr/doc/man/man1/yacc.1 | 85 +++++++++++++++ usr/doc/man/man2/break.2 | 58 ++++++++++ usr/doc/man/man2/chdir.2 | 27 +++++ usr/doc/man/man2/chmod.2 | 45 ++++++++ usr/doc/man/man2/chown.2 | 34 ++++++ usr/doc/man/man2/close.2 | 37 +++++++ usr/doc/man/man2/creat.2 | 65 +++++++++++ usr/doc/man/man2/csw.2 | 14 +++ usr/doc/man/man2/dup.2 | 61 +++++++++++ usr/doc/man/man2/exec.2 | 175 +++++++++++++++++++++++++++++ usr/doc/man/man2/exit.2 | 33 ++++++ usr/doc/man/man2/fork.2 | 50 +++++++++ usr/doc/man/man2/fstat.2 | 31 ++++++ usr/doc/man/man2/getgid.2 | 29 +++++ usr/doc/man/man2/getpid.2 | 27 +++++ usr/doc/man/man2/getuid.2 | 29 +++++ usr/doc/man/man2/gtty.2 | 37 +++++++ usr/doc/man/man2/indir.2 | 35 ++++++ usr/doc/man/man2/intro.2 | 224 ++++++++++++++++++++++++++++++++++++++ usr/doc/man/man2/kill.2 | 39 +++++++ usr/doc/man/man2/link.2 | 39 +++++++ usr/doc/man/man2/mknod.2 | 42 +++++++ usr/doc/man/man2/mount.2 | 63 +++++++++++ usr/doc/man/man2/nice.2 | 53 +++++++++ usr/doc/man/man2/open.2 | 50 +++++++++ usr/doc/man/man2/pipe.2 | 69 ++++++++++++ usr/doc/man/man2/profil.2 | 56 ++++++++++ usr/doc/man/man2/ptrace.2 | 168 ++++++++++++++++++++++++++++ usr/doc/man/man2/read.2 | 54 +++++++++ usr/doc/man/man2/seek.2 | 60 ++++++++++ usr/doc/man/man2/setgid.2 | 25 +++++ usr/doc/man/man2/setuid.2 | 25 +++++ usr/doc/man/man2/signal.2 | 151 +++++++++++++++++++++++++ usr/doc/man/man2/sleep.2 | 22 ++++ usr/doc/man/man2/stat.2 | 88 +++++++++++++++ usr/doc/man/man2/stime.2 | 25 +++++ usr/doc/man/man2/stty.2 | 180 ++++++++++++++++++++++++++++++ usr/doc/man/man2/sync.2 | 25 +++++ usr/doc/man/man2/time.2 | 26 +++++ usr/doc/man/man2/times.2 | 41 +++++++ usr/doc/man/man2/umount.2 | 31 ++++++ usr/doc/man/man2/unlink.2 | 35 ++++++ usr/doc/man/man2/wait.2 | 69 ++++++++++++ usr/doc/man/man2/write.2 | 45 ++++++++ 45 files changed, 2735 insertions(+) create mode 100644 usr/doc/man/man1/tp.1 create mode 100644 usr/doc/man/man1/yacc.1 create mode 100644 usr/doc/man/man2/break.2 create mode 100644 usr/doc/man/man2/chdir.2 create mode 100644 usr/doc/man/man2/chmod.2 create mode 100644 usr/doc/man/man2/chown.2 create mode 100644 usr/doc/man/man2/close.2 create mode 100644 usr/doc/man/man2/creat.2 create mode 100644 usr/doc/man/man2/csw.2 create mode 100644 usr/doc/man/man2/dup.2 create mode 100644 usr/doc/man/man2/exec.2 create mode 100644 usr/doc/man/man2/exit.2 create mode 100644 usr/doc/man/man2/fork.2 create mode 100644 usr/doc/man/man2/fstat.2 create mode 100644 usr/doc/man/man2/getgid.2 create mode 100644 usr/doc/man/man2/getpid.2 create mode 100644 usr/doc/man/man2/getuid.2 create mode 100644 usr/doc/man/man2/gtty.2 create mode 100644 usr/doc/man/man2/indir.2 create mode 100644 usr/doc/man/man2/intro.2 create mode 100644 usr/doc/man/man2/kill.2 create mode 100644 usr/doc/man/man2/link.2 create mode 100644 usr/doc/man/man2/mknod.2 create mode 100644 usr/doc/man/man2/mount.2 create mode 100644 usr/doc/man/man2/nice.2 create mode 100644 usr/doc/man/man2/open.2 create mode 100644 usr/doc/man/man2/pipe.2 create mode 100644 usr/doc/man/man2/profil.2 create mode 100644 usr/doc/man/man2/ptrace.2 create mode 100644 usr/doc/man/man2/read.2 create mode 100644 usr/doc/man/man2/seek.2 create mode 100644 usr/doc/man/man2/setgid.2 create mode 100644 usr/doc/man/man2/setuid.2 create mode 100644 usr/doc/man/man2/signal.2 create mode 100644 usr/doc/man/man2/sleep.2 create mode 100644 usr/doc/man/man2/stat.2 create mode 100644 usr/doc/man/man2/stime.2 create mode 100644 usr/doc/man/man2/stty.2 create mode 100644 usr/doc/man/man2/sync.2 create mode 100644 usr/doc/man/man2/time.2 create mode 100644 usr/doc/man/man2/times.2 create mode 100644 usr/doc/man/man2/umount.2 create mode 100644 usr/doc/man/man2/unlink.2 create mode 100644 usr/doc/man/man2/wait.2 create mode 100644 usr/doc/man/man2/write.2 diff --git a/usr/doc/man/man1/tp.1 b/usr/doc/man/man1/tp.1 new file mode 100644 index 0000000000..7e030f2005 --- /dev/null +++ b/usr/doc/man/man1/tp.1 @@ -0,0 +1,158 @@ +.th TP I 10/15/73 +.sh NAME +tp \*- manipulate DECtape and magtape +.sh SYNOPSIS +.bd tp +[ key ] [ name ... ] +.sh DESCRIPTION +.it Tp +saves and restores files +on DECtape or magtape. +Its actions are controlled by the +.it key +argument. +The key is a string of characters containing +at most one function letter and possibly +one or more function modifiers. +Other arguments to the command are file or directory +names specifying which files are to be dumped, restored, +or listed. +In all cases, appearance of a directory name refers to +the files and (recursively) subdirectories of that directory. +.s3 +The function portion of +the key is specified by one of the following letters: +.s3 +.lp +8 4 +\fBr\fR The named files +are written +on the tape. +If files with the same names +already exist, they are replaced. +`Same' is determined by string comparison, so +`./abc' can never be the same as `/usr/dmr/abc' even +if `/usr/dmr' is the current directory. +If no file argument is given, `\fB.\fR' is the default. +.s3 +.lp +8 4 +\fBu\fR updates the tape. +.bd u +is like +.bd r, +but a file is replaced only if its +modification date is later than the date stored on the tape; +that is to say, if it has changed since it was dumped. +.bd u +is the default command if none is given. +.s3 +.lp +8 4 +\fBd\fR deletes the named files from +the tape. +At least one name argument must be given. +This function is not permitted on magtapes. +.s3 +.lp +8 4 +\fBx\fR extracts the named files from the tape to the file system. +The owner and mode are restored. +If no file argument is given, the entire contents of the +tape are extracted. +.s3 +.lp +8 4 +\fBt\fR lists the names of the specified files. +If no file argument is given, +the entire contents of the tape is listed. +.s3 +.i0 +The following characters may be used in addition to the letter +which selects the function desired. +.s3 +.lp +10 6 +\fBm\fR Specifies magtape as opposed to DECtape. +.s3 +.lp +10 6 +\fB0,...,7\fR This +modifier selects the drive on which the tape is mounted. +For DECtape, `x' is default; for magtape +`0' is the default. +.s3 +.lp +10 6 +\fBv\fR Normally +.it tp +does its work silently. +The +.bd v +(verbose) +option causes it to type the name of each file it treats +preceded by the function letter. +With the +.bd t +function, +.bd v +gives more information about the +tape entries than just the name. +.s3 +.lp +10 6 +\fBc\fR means a fresh dump is being created; the tape directory +is zeroed before beginning. +Usable only with +.bd r +and +.bd u. +This option is assumed with magtape since +it is impossible to selectively overwrite +magtape. +.s3 +.lp +10 6 +\fBf\fR causes new entries on tape to be `fake' in that +no data is present for these entries. +Such fake entries cannot be extracted. +Usable only with +.bd r +and +.bd u. +.s3 +.lp +10 6 +\fBi\fR Errors reading and writing the +tape are noted, but no action is taken. +Normally, errors cause a return to the command level. +.s3 +.lp +10 6 +\fBw\fR causes +.it tp +to pause before treating each file, type +the indicative letter and the file name (as with v) +and await the user's response. +Response +.bd y +means `yes', so the file is treated. +Null response +means `no', and the file does not take part +in whatever is being done. +Response +.bd x +means `exit'; +the +.it tp +command terminates immediately. +In the +.bd x +function, +files previously asked about +have been extracted already. +With +.bd "r, u," +and +.bd d +no change has been made to the tape. +.s3 +.i0 +.sh FILES +/dev/tap? +.br +/dev/mt? +.sh DIAGNOSTICS +Several; the non-obvious one is +`Phase error', which means the file changed after it was selected for +dumping but before it was dumped. +.sh BUGS +A single file with several links to it is treated like several files. diff --git a/usr/doc/man/man1/yacc.1 b/usr/doc/man/man1/yacc.1 new file mode 100644 index 0000000000..305ed21572 --- /dev/null +++ b/usr/doc/man/man1/yacc.1 @@ -0,0 +1,85 @@ +.th YACC I 11/25/74 +.sh NAME +yacc \*- yet another compiler-compiler +.sh SYNOPSIS +.bd yacc +[ +.bd \*-vor +] +[ grammar ] +.sh DESCRIPTION +.it Yacc +converts a context-free grammar into a set of +tables for a simple automaton which executes an LR(1) parsing +algorithm. +The grammar may be ambiguous; +specified precedence rules are used to break ambiguities. +.s3 +The output is +.it y.tab.c, +which must be compiled by the C compiler +and loaded with any other routines +required (perhaps a lexical analyzer) and the Yacc library: +.s3 + cc y.tab.c other.o \*-ly +.s3 +If the +.bd \*-v +flag is given, the file +.it y.output +is prepared, which contains a description of the parsing tables +and a report on +conflicts generated by ambiguities in the grammar. +.s3 +The +.bd \*-o +flag calls an optimizer for the tables; +the optimized tables, with parser included, appear on file +.it y.tab.c +.s3 +The +.bd \*-r +flag causes Yacc to accept grammars with Ratfor actions, +and produce Ratfor output on +.it y.tab.r; +.bd \*-r +implies the +.bd \*-o +flag. +Typical usage is then +.s3 + rc y.tab.r other.o +.s3 +.sh "SEE ALSO" +``LR Parsing'', by A. V. Aho and S. C. Johnson, +Computing Surveys, June, 1974. +``The YACC Compiler-compiler'', internal memorandum. +.sh AUTHOR +S. C. Johnson +.sh FILES +y.output +.br +y.tab.c +.br +y.tab.r when ratfor output is obtained +.br +yacc.tmp when optimizer is called +.br +/lib/liby.a runtime library for compiler +.br +/usr/yacc/fpar.r ratfor parser +.br +/usr/yacc/opar.c parser for optimized tables +.br +/usr/yacc/yopti optimizer postpass +.sh DIAGNOSTICS +The number of reduce-reduce and shift-reduce conflicts +is reported on the standard output; +a more detailed report is +found in the +.it y.output +file. +.sh BUGS +Because file names are fixed, at most one Yacc +process can be active in a given directory at +a time. diff --git a/usr/doc/man/man2/break.2 b/usr/doc/man/man2/break.2 new file mode 100644 index 0000000000..c732b58b26 --- /dev/null +++ b/usr/doc/man/man2/break.2 @@ -0,0 +1,58 @@ +.th BREAK II 8/5/73 +.sh NAME +break, brk, sbrk \*- change core allocation +.sh SYNOPSIS +(break = 17.) +.br +.ft B +sys break; addr +.s3 +char *brk(addr) +.s3 +char *sbrk(incr) +.ft R +.sh DESCRIPTION +.it Break +sets the system's idea of the lowest location not used by the program +(called the break) +to +.it addr +(rounded up to the next multiple of 64 bytes). +Locations not less than +.it addr +and below the stack pointer +are not in the address space and will thus +cause a memory violation if accessed. +.s3 +From C, +.it brk +will set the break to +.it addr. +The old break is returned. +.s3 +In the alternate entry +.it sbrk, +.it incr +more bytes are added to the +program's data space and a pointer to the +start of the new area is returned. +.s3 +When a program begins execution via +.it exec +the break is set at the +highest location defined by the program +and data storage areas. +Ordinarily, therefore, only programs with growing +data areas need to use +.it break. +.sh "SEE ALSO" +exec (II), alloc (III), end (III) +.sh DIAGNOSTICS +The c-bit is set if the program requests more +memory than the system limit +or if more than 8 segmentation +registers would be required to implement the break. +From C, \*-1 is returned for these errors. +.sh BUGS +Setting the break in the range +0177700 to 0177777 is the same as setting it to zero. diff --git a/usr/doc/man/man2/chdir.2 b/usr/doc/man/man2/chdir.2 new file mode 100644 index 0000000000..160edae450 --- /dev/null +++ b/usr/doc/man/man2/chdir.2 @@ -0,0 +1,27 @@ +.th CHDIR II 8/5/73 +.sh NAME +chdir \*- change working directory +.sh SYNOPSIS +(chdir = 12.) +.br +.ft B +sys chdir; dirname +.s3 +chdir(dirname) +.br +char *dirname; +.ft R +.sh DESCRIPTION +.it Dirname +is the address of the pathname of a directory, terminated by a null byte. +.it Chdir +causes this directory +to become the current working directory. +.sh "SEE ALSO" +chdir (I) +.sh DIAGNOSTICS +The error bit (c-bit) +is set if the given name is not that of a directory +or is not readable. +From C, a \*-1 returned value indicates an error, +0 indicates success. diff --git a/usr/doc/man/man2/chmod.2 b/usr/doc/man/man2/chmod.2 new file mode 100644 index 0000000000..f269d83224 --- /dev/null +++ b/usr/doc/man/man2/chmod.2 @@ -0,0 +1,45 @@ +.th CHMOD II 12/15/74 +.sh NAME +chmod \*- change mode of file +.sh SYNOPSIS +(chmod = 15.) +.br +.ft B +sys chmod; name; mode +.s3 +chmod(name, mode) +.br +char *name; +.ft R +.sh DESCRIPTION +The file whose name +is given as the null-terminated string pointed to by +.it name +has its mode changed to +.it mode. +Modes are constructed by ORing together some +combination of the following: +.s3 +.in +3 + 4000 set user ID on execution + 2000 set group ID on execution + 1000 save text image after execution + 0400 read by owner + 0200 write by owner + 0100 execute (search on directory) by owner + 0070 read, write, execute (search) by group + 0007 read, write, execute (search) by others +.in -3 +.s3 +Only the owner of a file (or the super-user) may change the mode. +Only the super-user can set the 1000 mode. +.sh "SEE ALSO" +chmod (I) +.sh DIAGNOSTIC +Error bit +(c-bit) set if +.it name +cannot be found or if current user +is neither the owner of the file nor the super-user. +From C, a \*-1 returned value indicates an +error, 0 indicates success. diff --git a/usr/doc/man/man2/chown.2 b/usr/doc/man/man2/chown.2 new file mode 100644 index 0000000000..1132b59fac --- /dev/null +++ b/usr/doc/man/man2/chown.2 @@ -0,0 +1,34 @@ +.th CHOWN II 12/15/74 +.sh NAME +chown \*- change owner and group of a file +.sh SYNOPSIS +(chmod = 16.) +.br +.ft B +sys chown; name; owner +.s3 +chown(name, owner) +.br +char *name; +.ft R +.sh DESCRIPTION +The file +whose name is given by the null-terminated string pointed +to by +.it name +has its owner and group changed to +the low and high bytes of +.it owner +respectively. +Only the super-user may +execute this call, +because if users were able to give files away, +they could defeat the (nonexistent) +file-space accounting procedures. +.sh "SEE ALSO" +chown (VIII), chgrp (VIII), passwd (V) +.sh DIAGNOSTICS +The error bit (c-bit) is set +on illegal owner changes. +From C a \*-1 returned value indicates error, +0 indicates success. diff --git a/usr/doc/man/man2/close.2 b/usr/doc/man/man2/close.2 new file mode 100644 index 0000000000..5532e2cce5 --- /dev/null +++ b/usr/doc/man/man2/close.2 @@ -0,0 +1,37 @@ +.th CLOSE II 8/5/73 +.sh NAME +close \*- close a file +.sh SYNOPSIS +(close = 6.) +.br +(file descriptor in r0) +.br +.ft B +sys close +.s3 +close(fildes) +.s3 +.ft R +.sh DESCRIPTION +Given +a file descriptor such as returned from an +.it open, +.it creat, +or +.it pipe +call, +.it close +closes the associated file. +A close of all files is automatic on +.it exit, +but since +processes are limited to 15 simultaneously open files, +.it close +is necessary for programs which deal with many files. +.sh "SEE ALSO" +creat (II), open (II), pipe (II) +.sh DIAGNOSTICS +The error bit +(c-bit) is set for an unknown file descriptor. +From C a \*-1 indicates an error, 0 indicates +success. diff --git a/usr/doc/man/man2/creat.2 b/usr/doc/man/man2/creat.2 new file mode 100644 index 0000000000..5b2def02a3 --- /dev/null +++ b/usr/doc/man/man2/creat.2 @@ -0,0 +1,65 @@ +.th CREAT II 8/5/73 +.sh NAME +creat \*- create a new file +.sh SYNOPSIS +(creat = 8.) +.br +.ft B +sys creat; name; mode +.br +.ft R +(file descriptor in r0) +.ft B +.s3 +creat(name, mode) +.br +char *name; +.ft R +.sh DESCRIPTION +.it Creat +creates a new file or prepares to rewrite an existing +file called +.it name, +given as the address of a null-terminated string. +If the file did not exist, it is given +mode +.it mode. +See +.it chmod +(II) for the +construction of the +.it mode +argument. +.s3 +If the file did exist, its mode and owner remain unchanged +but it is truncated to 0 length. +.s3 +The file is also opened for writing, and its file descriptor +is returned (in r0). +.s3 +The +.it mode +given is arbitrary; it need not allow +writing. +This feature is used by programs which deal with temporary +files of fixed names. +The creation is done with +a mode that forbids writing. +Then if a second +instance of the program attempts a +.it creat, +an error is +returned and the program knows that the name is unusable +for the moment. +.sh "SEE ALSO" +write (II), close (II), stat (II) +.sh DIAGNOSTICS +The error bit +(c-bit) may be set if: a needed directory is not searchable; +the file does not exist and the directory +in which it is to be created is not writable; the file +does exist and is unwritable; +the file is a directory; +there are already too many files open. +.s3 +From C, a \*-1 return indicates an error. diff --git a/usr/doc/man/man2/csw.2 b/usr/doc/man/man2/csw.2 new file mode 100644 index 0000000000..aea8143c82 --- /dev/null +++ b/usr/doc/man/man2/csw.2 @@ -0,0 +1,14 @@ +.th CSW II 8/5/73 +.sh NAME +csw \*- read console switches +.sh SYNOPSIS +(csw = 38.; not in assembler) +.br +.ft B +sys csw +.s3 +getcsw( ) +.ft R +.sh DESCRIPTION +The setting of +the console switches is returned (in r0). diff --git a/usr/doc/man/man2/dup.2 b/usr/doc/man/man2/dup.2 new file mode 100644 index 0000000000..12cb6a6cdb --- /dev/null +++ b/usr/doc/man/man2/dup.2 @@ -0,0 +1,61 @@ +.th DUP II 8/5/73 +.sh NAME +dup \*- duplicate an open file descriptor +.sh SYNOPSIS +(dup = 41.; not in assembler) +.br +(file descriptor in r0) +.br +.ft B +sys dup +.s3 +dup(fildes) +.br +int fildes; +.ft R +.sh DESCRIPTION +Given +a file descriptor returned from +an +.it open, +.it pipe, +or +.it creat +call, +.it dup +will allocate another file descriptor +synonymous +with +the original. +The new file descriptor is returned in r0. +.s3 +.it Dup +is used more to reassign the value +of file descriptors +than to genuinely +duplicate a file descriptor. +Since the algorithm to allocate +file descriptors +returns the +lowest available +value, +combinations of +.it dup +and +.it close +can be +used to +manipulate file descriptors +in a general way. +This is handy for +manipulating standard input and/or +standard output. +.sh "SEE ALSO" +creat (II), open (II), close (II), pipe (II) +.sh DIAGNOSTICS +The +error bit (c-bit) +is set if: +the given file descriptor is invalid; +there are already too many open files. +From C, a \*-1 returned value indicates an error. diff --git a/usr/doc/man/man2/exec.2 b/usr/doc/man/man2/exec.2 new file mode 100644 index 0000000000..74a1e73cf1 --- /dev/null +++ b/usr/doc/man/man2/exec.2 @@ -0,0 +1,175 @@ +.th EXEC II 8/5/73 +.sh NAME +exec, execl, execv \*- execute a file +.sh SYNOPSIS +(exec = 11.) +.br +.ft B +sys exec; name; args +.br +.li +... +.br +name: <...\\0> +.br +.li +... +.br +args: arg0; arg1; ...; 0 +.br +arg0: <...\\0> +.br +arg1: <...\\0> +.br + ... +.s3 +execl(name, arg0, arg1, ..., argn, 0) +.br +char *name, *arg0, *arg1, ..., *argn; +.s3 +execv(name, argv) +.br +char *name; +.br +char *argv[ ]; +.ft R +.sh DESCRIPTION +.it Exec +overlays the calling process with the named file, then +transfers to the +beginning of the core image of the file. +There can be no return from the file; the calling +core image is lost. +.s3 +Files remain open across +.it exec +calls. +Ignored signals remain ignored across +.it exec, +but +signals that are caught are reset +to their default values. +.s3 +Each user has a +.it real +user ID and group ID and an +.it effective +user ID and group ID. +The +real +ID +identifies the person using the system; +the +effective +ID +determines his access privileges. +.it Exec +changes the effective user and group ID to +the owner of the executed file if the file has the ``set-user-ID'' +or ``set-group-ID'' +modes. +The +real +user ID is not affected. +.s3 +The form of this call differs somewhat depending +on whether it is called from assembly language or C; +see below for the C version. +.s3 +The first argument to +.it exec +is a pointer to the name of the file +to be executed. +The second is the address of a null-terminated list of pointers to +arguments to be passed to the file. +Conventionally, the first argument is the name of the +file. +Each pointer addresses a string terminated by a null byte. +.s3 +Once the called file starts execution, the arguments are available +as follows. +The stack pointer points to a word containing the number of arguments. +Just above +this number is a list of pointers to the argument strings. +The arguments are placed as high as possible in core. +.s3 + sp\*> nargs +.br + arg0 +.br + ... +.br + argn +.br + \*-1 +.s3 + arg0: +.br + ... +.br + argn: +.s3 +From C, two interfaces are available. +.it execl +is useful when a known file with known arguments is +being called; +the arguments to +.it execl +are the character strings +constituting the file and the arguments; as in +the basic call, the first argument is conventionally +the same as the file name (or its last component). +A 0 argument must end the argument list. +.s3 +The +.it execv +version is useful when the number of arguments is unknown +in advance; +the arguments to +.it execv +are the name of the file to be +executed and a vector of strings containing +the arguments. +The last argument string must be followed +by a 0 pointer. +.s3 +When a C program is executed, +it is called as follows: +.s3 + main(argc, argv) +.br + int argc; +.br + char **argv; +.s3 +where \fIargc\fR is the argument count +and \fIargv\fR is an array of character pointers +to the arguments themselves. +As indicated, \fIargc\fR is conventionally at least one +and the first member of the array points to a +string containing the name of the file. +.s3 +.it Argv +is not directly usable in another +.it execv, +since +.it argv[argc] +is \*-1 and not 0. +.sh "SEE ALSO" +fork (II) +.sh DIAGNOSTICS +If the file cannot be found, +if it is not executable, +if it does not have a valid header (407, 410, or 411 octal as first word), +if maximum memory is exceeded, +or if the arguments require more than 512 bytes +a return from +.it exec +constitutes the diagnostic; +the error bit (c-bit) is set. +Even for the super-user, +at least one of the execute-permission bits must be set for +a file to be executed. +From C the returned value is \*-1. +.sh BUGS +Only 512 characters of arguments are allowed. diff --git a/usr/doc/man/man2/exit.2 b/usr/doc/man/man2/exit.2 new file mode 100644 index 0000000000..05ab1a8326 --- /dev/null +++ b/usr/doc/man/man2/exit.2 @@ -0,0 +1,33 @@ +.th EXIT II 8/5/73 +.sh NAME +exit \*- terminate process +.s3 +.sh SYNOPSIS +(exit = 1.) +.br +(status in r0) +.br +.ft B +sys exit +.s3 +exit(status) +.br +int status; +.ft R +.sh DESCRIPTION +.it Exit +is the normal means of terminating a process. +.it Exit +closes all the process's files and notifies the parent process +if it is executing a +.it wait. +The low byte of r0 +(resp. the argument to +\fIexit\fR) +is available as status to the parent process. +.s3 +This call can never return. +.sh "SEE ALSO" +wait (II) +.sh DIAGNOSTICS +None. diff --git a/usr/doc/man/man2/fork.2 b/usr/doc/man/man2/fork.2 new file mode 100644 index 0000000000..cec2fe1423 --- /dev/null +++ b/usr/doc/man/man2/fork.2 @@ -0,0 +1,50 @@ +.th FORK II 8/5/73 +.sh NAME +fork \*- spawn new process +.sh SYNOPSIS +(fork = 2.) +.br +.ft B +sys fork +.br +.ft R +(new process return) +.br +(old process return) +.s3 +.ft B +fork( ) +.ft R +.sh DESCRIPTION +.it Fork +is the only way new processes are created. +The new process's core image is a copy of +that of the caller of +.it fork. +The only distinction +is the return location and the fact +that r0 in the old (parent) process contains the process ID +of the new (child) process. +This process ID is used by +.it wait. +.s3 +The two returning processes share all open +files that existed before the call. +In particular, +this is the way that standard input and output +files are passed and also how +pipes are set up. +.s3 +From C, the child process receives a 0 return, +and the parent receives a non-zero number which is the process ID +of the child; +a return of \*-1 indicates inability +to create a new process. +.sh "SEE ALSO" +wait (II), exec (II) +.sh DIAGNOSTICS +The error bit +(c-bit) is set in the old process if a new process +could not be created because of lack of process space. +From C, a return of \*-1 (not just negative) +indicates an error. diff --git a/usr/doc/man/man2/fstat.2 b/usr/doc/man/man2/fstat.2 new file mode 100644 index 0000000000..3efa740d76 --- /dev/null +++ b/usr/doc/man/man2/fstat.2 @@ -0,0 +1,31 @@ +.th FSTAT II 8/5/73 +.sh NAME +fstat \*- get status of open file +.s3 +.sh SYNOPSIS +(fstat = 28.) +.br +(file descriptor in r0) +.ft B +.br +sys fstat; buf +.s3 +fstat(fildes, buf) +.br +struct inode *buf; +.ft R +.sh DESCRIPTION +This +call is identical to +.it stat, +except that it operates +on open files instead of files given by name. +It is most often used to get the status +of the standard input and output files, whose names +are unknown. +.sh "SEE ALSO" +stat (II) +.sh DIAGNOSTICS +The error bit +(c-bit) is set if the file descriptor is unknown; +from C, a \*-1 return indicates an error, 0 indicates success. diff --git a/usr/doc/man/man2/getgid.2 b/usr/doc/man/man2/getgid.2 new file mode 100644 index 0000000000..3b51530605 --- /dev/null +++ b/usr/doc/man/man2/getgid.2 @@ -0,0 +1,29 @@ +.th GETGID II 5/15/74 +.sh NAME +getgid \*- get group identifications +.sh SYNOPSIS +(getgid = 47.; not in assembler) +.br +.ft B +sys getgid +.ft B +.s3 +getgid( ) +.ft R +.sh DESCRIPTION +.it Getgid +returns a word (in r0), +the low byte of which contains +the real group ID of +the current process. +The high byte contains the effective group ID +of the current process. +The real group ID identifies the group of the person who is logged in, +in contradistinction to the effective group ID, which +determines his access permission at the moment. +It is thus useful to programs which operate using +the ``set group ID'' mode, to find out who invoked them. +.sh "SEE ALSO" +setgid (II) +.sh DIAGNOSTICS +\*- diff --git a/usr/doc/man/man2/getpid.2 b/usr/doc/man/man2/getpid.2 new file mode 100644 index 0000000000..8003d75514 --- /dev/null +++ b/usr/doc/man/man2/getpid.2 @@ -0,0 +1,27 @@ +.th GETPID II 2/8/75 +.sh NAME +getpid \*- get process identification +.sh SYNOPSIS +(getpid = 20.; not in assembler) +.br +.ft B +sys getpid +.ft R +.br +(pid in r0) +.ft B +.s3 +getpid( ) +.ft R +.sh DESCRIPTION +.it Getpid +returns +the process ID of +the current process. +Most often it is used to generate +uniquely-named +temporary files. +.sh "SEE ALSO" +\*- +.sh DIAGNOSTICS +\*- diff --git a/usr/doc/man/man2/getuid.2 b/usr/doc/man/man2/getuid.2 new file mode 100644 index 0000000000..8a9fa0cfde --- /dev/null +++ b/usr/doc/man/man2/getuid.2 @@ -0,0 +1,29 @@ +.th GETUID II 5/15/74 +.sh NAME +getuid \*- get user identifications +.sh SYNOPSIS +(getuid = 24.) +.br +.ft B +sys getuid +.ft B +.s3 +getuid( ) +.ft R +.sh DESCRIPTION +.it Getuid +returns a word (in r0), +the low byte of which contains +the real user ID of +the current process. +The high byte contains the effective user ID +of the current process. +The real user ID identifies the person who is logged in, +in contradistinction to the effective user ID, which +determines his access permission at the moment. +It is thus useful to programs which operate using +the ``set user ID'' mode, to find out who invoked them. +.sh "SEE ALSO" +setuid (II) +.sh DIAGNOSTICS +\*- diff --git a/usr/doc/man/man2/gtty.2 b/usr/doc/man/man2/gtty.2 new file mode 100644 index 0000000000..4cf5532124 --- /dev/null +++ b/usr/doc/man/man2/gtty.2 @@ -0,0 +1,37 @@ +.th GTTY II 8/5/73 +.sh NAME +gtty \*- get typewriter status +.sh SYNOPSIS +(gtty = 32.) +.br +(file descriptor in r0) +.ft B +.br +sys gtty; arg +.br +.li +... +.br +arg: .=.+6 +.s3 +gtty(fildes, arg) +.br +int arg[3]; +.ft R +.sh DESCRIPTION +.it Gtty +stores in the three words addressed by +.it arg +the status +of the typewriter whose file descriptor is given in r0 +(resp. given as the first argument). +The format is the same as that passed by +.it stty. +.sh "SEE ALSO" +stty (II) +.sh DIAGNOSTICS +Error bit +(c-bit) is set if the file descriptor does not refer +to a typewriter. +From C, a \*-1 value is returned for an +error, 0, for a successful call. diff --git a/usr/doc/man/man2/indir.2 b/usr/doc/man/man2/indir.2 new file mode 100644 index 0000000000..c1f31e8e2c --- /dev/null +++ b/usr/doc/man/man2/indir.2 @@ -0,0 +1,35 @@ +.th INDIR II 8/5/73 +.sh NAME +indir \*- indirect system call +.sh SYNOPSIS +(indir = 0.; not in assembler) +.br +.ft B +sys indir; syscall +.ft R +.sh DESCRIPTION +The system call at the location +.it syscall +is executed. +Execution resumes after the +.it indir +call. +.s3 +The main purpose of +.it indir +is to allow a program to +store arguments in system calls and execute them +out of line in the data segment. +This preserves the purity of the text segment. +.s3 +If +.it indir +is executed indirectly, +it is a no-op. +If the instruction at the indirect +location is not a system call, +the executing process will get a fault. +.sh "SEE ALSO" +\*- +.sh DIAGNOSTICS +\*- diff --git a/usr/doc/man/man2/intro.2 b/usr/doc/man/man2/intro.2 new file mode 100644 index 0000000000..a813ee9487 --- /dev/null +++ b/usr/doc/man/man2/intro.2 @@ -0,0 +1,224 @@ +.th INTRO II 11/5/73 +.de pg +.sp +.. +.de en +.pg +.in 3 +.ti 0 +\\$1\t\\$2\t\\$3 +.br +.. +.sp 2 +.in 0 +.if t .ta 3 10 +.ce +INTRODUCTION TO SYSTEM CALLS +.sp +Section II of this manual +lists all the entries into the system. +In most cases two calling sequences are specified, +one of which is usable from assembly language, and the other from C. +Most of these calls have an error return. +From assembly language an erroneous call is always +indicated by turning on the c-bit of the condition codes. +The presence of an error is most easily tested +by the instructions +.it bes +and +.it bec +(``branch on error set (or clear)''). +These are synonyms for +the +.it bcs +and +.it bcc +instructions. +.pg +From C, an error condition is indicated by an otherwise +impossible returned value. +Almost always this is \(mi1; +the individual sections specify the details. +.pg +In both cases an error number is also available. +In assembly language, +this number is returned in r0 on erroneous calls. +From C, +the external variable +.it errno +is set to the error number. +.it Errno +is not cleared on successful calls, so it should be tested only +after an error has occurred. +There is a table of messages +associated with each error, and a routine for printing the +message. +See +.it "perror (III)." +.pg +The possible error numbers +are not recited with each writeup in section II, since many +errors are possible for most of the calls. +Here is a list of the error numbers, +their names inside the system (for the benefit of +system-readers), +and the messages available using +.it perror. +A short explanation is also provided. +.en 0 \(mi (unused) +.en 1 EPERM "Not owner and not super-user" +Typically this error indicates +an attempt to modify a file in some way forbidden +except to its owner. +It is also returned for attempts +by ordinary users to do things +allowed only to the super-user. +.en 2 ENOENT "No such file or directory" +This error occurs when a file name is specified +and the file should exist but doesn't, or when one +of the directories in a path name does not exist. +.en 3 ESRCH "No such process" +The process whose number was given to +.it signal +does not exist, or is already dead. +.en 4 EINTR "Interrupted system call" +An asynchronous signal (such as interrupt or quit), +which the user has elected to catch, +occurred during a system call. +If execution is resumed +after processing the signal, +it will appear as if the interrupted system call +returned this error condition. +.en 5 EIO "I/O error" +Some physical I/O error occurred during a +.it read +or +.it write. +This error may in some cases occur +on a call following the one to which it actually applies. +.en 6 ENXIO "No such device or address" +I/O on a special file refers to a subdevice which does not +exist, +or beyond the limits of the device. +It may also occur when, for example, a tape drive +is not dialled in or no disk pack is loaded on a drive. +.en 7 E2BIG "Arg list too long" +An argument list longer than 512 bytes +(counting the null at the end of each argument) +is presented to +.it exec. +.en 8 ENOEXEC "Exec format error" +A request is made to execute a file +which, although it has the appropriate permissions, +does not start with one of the magic numbers +407 or 410. +.en 9 EBADF "Bad file number" +Either a file descriptor refers to no +open file, +or a read (resp. write) request is made to +a file which is open only for writing (resp. reading). +.en 10 ECHILD "No children" +.it Wait +and the process has no +living or unwaited-for children. +.en 11 EAGAIN "No more processes" +In a +.it fork, +the system's process table is full and no +more processes can for the moment be created. +.en 12 ENOMEM "Not enough core" +During an +.it exec +or +.it break, +a program asks for more core than the system is able to supply. +This is not a temporary condition; the maximum core size +is a system parameter. +The error may also occur if the arrangement +of text, data, and stack segments is such as to +require more than the existing 8 segmentation registers. +.en 13 EACCES "Permission denied" +An attempt was made to access a file in a way forbidden +by the protection system. +.en 14 \(mi (unused) +.en 15 ENOTBLK "Block device required" +A plain file was mentioned where a block device was required, +e.g. in +.it mount. +.en 16 EBUSY "Mount device busy" +An attempt to mount a device that was already mounted or +an attempt was made to dismount a device +on which there is an open file or some process's current +directory. +.en 17 EEXIST "File exists" +An existing file was mentioned in an inappropriate context, +e.g. +.it link. +.en 18 EXDEV "Cross-device link" +A link to a file on another device +was attempted. +.en 19 ENODEV "No such device" +An attempt was made to apply an inappropriate +system call to a device; +e.g. read a write-only device. +.en 20 ENOTDIR "Not a directory" +A non-directory was specified where a directory +is required, +for example in a path name or +as an argument to +.it chdir. +.en 21 EISDIR "Is a directory" +An attempt to write on a directory. +.en 22 EINVAL "Invalid argument" +Some invalid argument: +currently, dismounting a non-mounted +device, +mentioning an unknown signal in +.it signal, +and giving an unknown request in +.it stty +to the TIU special file. +.en 23 ENFILE "File table overflow" +The system's table of open files is full, +and temporarily no more +.it opens +can be accepted. +.en 24 EMFILE "Too many open files" +Only 15 files can be open per process. +.en 25 ENOTTY "Not a typewriter" +The file mentioned in +.it stty +or +.it gtty +is not a typewriter or one of the other +devices to which these calls apply. +.en 26 ETXTBSY "Text file busy" +An attempt to execute a pure-procedure +program which is currently open for writing +(or reading!). +Also an attempt to open for writing a pure-procedure +program that is being executed. +.en 27 EFBIG "File too large" +An attempt to make a file larger than the maximum of 32768 blocks. +.en 28 ENOSPC "No space left on device" +During a +.it write +to an ordinary file, +there is no free space left on the device. +.en 29 ESPIPE "Seek on pipe" +A +.it seek +was issued to a pipe. +This error should also be issued for +other non-seekable devices. +.en 30 EROFS "Read-only file system" +An attempt to modify a file or directory +was made +on a device mounted read-only. +.en 31 EMLINK "Too many links" +An attempt to make more than 127 links to a file. +.en 32 EPIPE "Write on broken pipe" +A write on a pipe for which there is no process +to read the data. +This condition normally generates a signal; +the error is returned if the signal is ignored. diff --git a/usr/doc/man/man2/kill.2 b/usr/doc/man/man2/kill.2 new file mode 100644 index 0000000000..9777cdeed9 --- /dev/null +++ b/usr/doc/man/man2/kill.2 @@ -0,0 +1,39 @@ +.th KILL II 12/15/74 +.sh NAME +kill \*- send signal to a process +.sh SYNOPSIS +(kill = 37.; not in assembler) +.br +(process number in r0) +.br +.ft B +sys kill; sig +.s3 +kill(pid, sig); +.ft R +.sh DESCRIPTION +.it Kill +sends the signal +.it sig +to the process specified by the +process number in r0. +See signal (II) for a list of signals. +.s3 +The sending and receiving processes must +have the same effective user ID, otherwise +this call is restricted to the super-user. +.s3 +If the process number is 0, +the signal is sent to all other processes which have the +same controlling typewriter and user ID. +.s3 +In no case is it possible for a process to kill itself. +.sh "SEE ALSO" +signal (II), kill (I) +.sh DIAGNOSTICS +The error bit (c-bit) +is set if the process does not +have the same effective user ID and the +user is not super-user, or if the process +does not exist. +From C, \-1 is returned. diff --git a/usr/doc/man/man2/link.2 b/usr/doc/man/man2/link.2 new file mode 100644 index 0000000000..457af987e7 --- /dev/null +++ b/usr/doc/man/man2/link.2 @@ -0,0 +1,39 @@ +.th LINK II 8/5/73 +.sh NAME +link \*- link to a file +.sh SYNOPSIS +(link = 9.) +.br +.ft B +sys link; name1; name2 +.s3 +link(name1, name2) +.br +char *name1, *name2; +.ft R +.sh DESCRIPTION +A link +to +.it name1 +is created; +the link has the name +.it name2. +Either name may be an arbitrary path name. +.sh "SEE ALSO" +link (I), unlink (II) +.sh DIAGNOSTICS +The error bit +(c-bit) is set when +.it name1 +cannot be found; when +.it name2 +already exists; when the directory of +.it name2 +cannot be written; when +an attempt is made to link to a directory by a user +other than the super-user; +when an attempt is made to link +to a file on another file system; +when more than 127 links are made. +From C, a \*-1 return indicates an error, +a 0 return indicates success. diff --git a/usr/doc/man/man2/mknod.2 b/usr/doc/man/man2/mknod.2 new file mode 100644 index 0000000000..ab42b3d5fe --- /dev/null +++ b/usr/doc/man/man2/mknod.2 @@ -0,0 +1,42 @@ +.th MKNOD II 8/5/73 +.sh NAME +mknod \*- make a directory or a special file +.sh SYNOPSIS +(mknod = 14.; not in assembler) +.br +.ft B +sys mknod; name; mode; addr +.s3 +mknod(name, mode, addr) +.br +char *name; +.ft R +.sh DESCRIPTION +.it Mknod +creates a new file +whose name is the null-terminated string pointed +to by +.it name. +The mode of the new file +(including directory and special file bits) +is initialized from +.it mode. +The first physical address of the file +is initialized from +.it addr. +Note that in the case of a directory, +.it addr +should be zero. +In the case of a special file, +.it addr +specifies which special file. +.s3 +.it Mknod +may be invoked only by the super-user. +.sh "SEE ALSO" +mkdir (I), mknod (VIII), fs (V) +.sh DIAGNOSTICS +Error bit (c-bit) +is set if the file already exists +or if the user is not the super-user. +From C, a \*-1 value indicates an error. diff --git a/usr/doc/man/man2/mount.2 b/usr/doc/man/man2/mount.2 new file mode 100644 index 0000000000..5af9d3e8a9 --- /dev/null +++ b/usr/doc/man/man2/mount.2 @@ -0,0 +1,63 @@ +.th MOUNT II 5/15/74 +.sh NAME +mount \*- mount file system +.sh SYNOPSIS +(mount = 21.) +.br +.ft B +sys mount; special; name; rwflag +.s3 +mount(special, name, rwflag) +.br +char *special, *name; +.br +.ft R +.sh DESCRIPTION +.it Mount +announces to the system that a removable file system has +been mounted on +the block-structured special file +.it special; +from now on, references to file +.it name +will refer to +the root file on the newly mounted file system. +.it Special +and +.it name +are pointers to null-terminated strings +containing the appropriate path names. +.s3 +.it Name +must exist already. +Its old contents +are inaccessible while the file system +is mounted. +.s3 +The +.it rwflag +argument determines whether +the file system can be written on; if it is 0 writing +is allowed, if non-zero no writing is done. +Physically write-protected and magnetic +tape file systems must be mounted read-only or +errors will occur when access times are updated, +whether or not any +explicit write is attempted. +.sh "SEE ALSO" +mount (VIII), umount (II) +.sh DIAGNOSTICS +Error bit +(c-bit) set if: +.it special +is inaccessible or not an appropriate file; +.it name +does not exist; +.it special +is already mounted; +.it name +is in use; +there are already too many +file systems mounted. +.sh BUGS +\- diff --git a/usr/doc/man/man2/nice.2 b/usr/doc/man/man2/nice.2 new file mode 100644 index 0000000000..8b30807323 --- /dev/null +++ b/usr/doc/man/man2/nice.2 @@ -0,0 +1,53 @@ +.th NICE II 8/5/73 +.sh NAME +nice \*- set program priority +.sh SYNOPSIS +(nice = 34.) +.br +(priority in r0) +.br +.ft B +sys nice +.s3 +nice(priority) +.ft R +.sh DESCRIPTION +The scheduling +.it priority +of the process is changed to the argument. +Positive priorities get less +service than normal; 0 is default. +Only the super-user may specify a negative priority. +The valid range of +.it priority +is 20 to \*-220. +The value of 4 is recommended to users +who wish to execute long-running programs +without flak from the administration. +.s3 +The effect of this call is +passed to a child process by the +.it fork +system call. +The effect can be cancelled by +another call to +.it nice +with a +.it priority +of 0. +.s3 +The actual running priority of a +process is the +.it priority +argument plus a number that +ranges from 100 to 119 depending on the +cpu usage of the process. +.sh "SEE ALSO" +nice (I) +.sh DIAGNOSTICS +The error bit +(c-bit) +is set if the user requests a +.it priority +outside the range of 0 to 20 +and is not the super-user. diff --git a/usr/doc/man/man2/open.2 b/usr/doc/man/man2/open.2 new file mode 100644 index 0000000000..8aa67a6e29 --- /dev/null +++ b/usr/doc/man/man2/open.2 @@ -0,0 +1,50 @@ +.th OPEN II 8/5/73 +.sh NAME +open \*- open for reading or writing +.sh SYNOPSIS +(open = 5.) +.br +.ft B +sys open; name; mode +.br +.ft R +(file descriptor in r0) +.s3 +.ft B +open(name, mode) +.br +char *name; +.ft R +.sh DESCRIPTION +.it Open +opens the file +.it name +for reading +(if +.it mode +is 0), +writing (if +.it mode +is 1) or for both reading and writing +(if +.it mode +is 2). +.it Name +is the address of a string of ASCII characters representing +a path name, terminated by a null character. +.s3 +The returned file descriptor should be saved for subsequent calls +to +.it read, +.it write, +and +.it close. +.sh "SEE ALSO" +creat (II), read (II), write (II), close (II) +.sh DIAGNOSTICS +The error bit +(c-bit) is set if the file does not exist, +if one of the necessary directories +does not exist or is unreadable, if the file is not +readable (resp. writable), or if too many files are open. +From C, a \*-1 value is returned on an error. diff --git a/usr/doc/man/man2/pipe.2 b/usr/doc/man/man2/pipe.2 new file mode 100644 index 0000000000..2a29572fc4 --- /dev/null +++ b/usr/doc/man/man2/pipe.2 @@ -0,0 +1,69 @@ +.th PIPE II 8/5/73 +.sh NAME +pipe \*- create an interprocess channel +.sh SYNOPSIS +(pipe = 42.) +.br +.ft B +sys pipe +.br +.ft R +(read file descriptor in r0) +.br +(write file descriptor in r1) +.s3 +.ft B +pipe(fildes) +.br +int fildes[2]; +.ft R +.sh DESCRIPTION +The +.it pipe +system call +creates an I/O mechanism called a pipe. +The file descriptors returned can +be used in read and write operations. +When the pipe is written using the descriptor +returned in r1 (resp. fildes[1]), +up to 4096 bytes of data are buffered +before the writing process is suspended. +A read using the descriptor returned in r0 +(resp. fildes[0]) +will pick up the data. +.s3 +It is assumed that after the +pipe has been set up, +two (or more) +cooperating processes +(created by subsequent +.it fork +calls) +will pass data through the +pipe with +.it read +and +.it write +calls. +.s3 +The Shell has a syntax +to set up a linear array of processes +connected by pipes. +.s3 +Read calls on an empty +pipe (no buffered data) with only one end +(all write file descriptors closed) +return an end-of-file. +Write calls under similar conditions generate +a fatal signal (signal (II)); if the signal is ignored, +an error is returned on the write. +.sh "SEE ALSO" +sh (I), read (II), write (II), fork (II) +.sh DIAGNOSTICS +The error +bit (c-bit) is set if +too many files are already open. +From C, a \*-1 returned value +indicates an error. +A signal is generated if a write on a pipe with only one end is attempted. +.sh BUGS diff --git a/usr/doc/man/man2/profil.2 b/usr/doc/man/man2/profil.2 new file mode 100644 index 0000000000..b9d2fdb8db --- /dev/null +++ b/usr/doc/man/man2/profil.2 @@ -0,0 +1,56 @@ +.th PROFIL II 5/15/74 +.sh NAME +profil \*- execution time profile +.sh SYNOPSIS +(profil = 44.; not in assembler) +.br +.ft B +sys profil; buff; bufsiz; offset; scale +.s3 +profil(buff, bufsiz, offset, scale) +.br +char buff[ ]; +.br +int bufsiz, offset, scale; +.ft R +.sh DESCRIPTION +.it Buff +points to an area of core whose length (in bytes) is given by +.it bufsiz. +After this call, the user's program counter (pc) +is examined each clock tick (60th second); +.it offset +is subtracted from it, and the result multiplied by +.it scale. +If the resulting number corresponds to a word +inside +.it buff, +that word is incremented. +.s3 +The scale is interpreted as an unsigned, +fixed-point fraction with binary point at the +left: 177777(8) gives a 1-1 mapping of pc's to words +in +.it buff; +77777(8) maps each pair of instruction words +together. +2(8) maps all instructions onto the beginning of +.it buff +(producing a non-interrupting core clock). +.s3 +Profiling is turned off by giving a +.it scale +of 0 or 1. +It is rendered +ineffective by giving a +.it bufsiz +of 0. +Profiling is also turned off when an +.it exec +is executed but remains on in child and parent both +after a +.it fork. +.sh "SEE ALSO" +monitor (III), prof (I) +.sh DIAGNOSTICS +\*- diff --git a/usr/doc/man/man2/ptrace.2 b/usr/doc/man/man2/ptrace.2 new file mode 100644 index 0000000000..66aa38b444 --- /dev/null +++ b/usr/doc/man/man2/ptrace.2 @@ -0,0 +1,168 @@ +.th PTRACE II 1/25/75 +.sh NAME +ptrace \*- process trace +.sh SYNOPSIS +.nf +(ptrace = 26.; not in assembler) +(data in r0) +.ft B +sys ptrace; pid; addr; request +.ft R +.br +(value in r0) +.ft B +.s3 +ptrace(request, pid, addr, data); +.ft R +.fi +.sh DESCRIPTION +.it Ptrace +provides a means by which a parent process +may control the execution of a child process, +and examine and change its core image. +Its primary use is for the implementation of breakpoint debugging, +but it should be adaptable for simulation of non-UNIX environments. +There are four arguments whose interpretation +depends on a +.it request +argument. +Generally, +.it pid +is the process ID of the traced process, +which must be a child (no more distant descendant) +of the tracing process. +A process being traced +behaves normally until it encounters some signal whether internally generated +like ``illegal instruction'' or externally generated like ``interrupt.'' +See signal (II) for the list. +Then the traced process enters a stopped state +and its parent is notified via +.it wait +(II). +When the child is in the stopped state, +its core image can be examined and modified +using +.it ptrace. +If desired, another +.it ptrace +request can then cause the child either to terminate +or to continue, possibly ignoring the signal. +.s3 +The value of the +.it request +argument determines the precise +action of the call: +.s3 +.lp +4 4 +0 This request is the only one used by the child process; +it declares that the process is to be traced by its parent. +All the other arguments are ignored. +Peculiar results will ensue +if the parent does not expect to trace the child. +.s3 +.lp +4 4 +1,2 The +word in the child process's address space +at +.it addr +is returned (in r0). +Request 1 indicates the data space (normally used); +2 indicates the instruction space (when I and D space are separated). +.it addr +must be even. +The child must be stopped. +The input +.it data +is ignored. +.s3 +.lp +4 4 +3 The word +of the system's per-process data area corresponding to +.it addr +is returned. +.it Addr +must be even and less than 512. +This space contains the registers and other information about +the process; +its layout corresponds to the +.it user +structure in the system. +.s3 +.lp +4 4 +4,5 The +given +.it data +is written at the word in the process's address space corresponding to +.it addr, +which must be even. +No useful value is returned. +Request 4 specifies data space (normally used), 5 specifies +instruction space. +Attempts to write in pure procedure result in termination of the +child, instead of going through or causing an error for the parent. +.s3 +.lp +4 4 +6 The process's system data is written, +as it is read with request 3. +Only a few locations can be written in this way: +the general registers, +the floating point status and registers, +and certain bits of the processor status word. +.s3 +.lp +4 4 +7 The +.it data +argument is taken as a signal number +and the child's execution continues +as if it had incurred that signal. +Normally the signal number will be +either 0 to indicate that the signal which caused the stop +should be ignored, +or that value fetched out of the +process's image indicating which signal caused +the stop. +.s3 +.lp +4 4 +8 The traced process terminates. +.s3 +.i0 +As indicated, +these calls +(except for request 0) +can be used only when the subject process has stopped. +The +.it wait +call is used to determine +when a process stops; +in such a case the ``termination'' status +returned by +.it wait +has the value 0177 to indicate stoppage rather +than genuine termination. +.s3 +To forestall possible fraud, +.it ptrace +inhibits the set-user-id facility +on subsequent +.it exec +(II) + calls. +.sh "SEE ALSO" +wait (II), signal (II), cdb (I) +.sh DIAGNOSTICS +From assembler, the c-bit (error bit) is set on errors; +from C, \-1 is returned and +.it errno +has the error code. +.sh BUGS +The request 0 call should be able to specify +signals which are to be treated normally and not cause a stop. +In this way, for example, +programs with simulated floating point (which +use ``illegal instruction'' signals at a very high rate) +could be efficiently debugged. +.s3 +Also, it should be possible to stop a process on occurrence of a system +call; +in this way a completely controlled environment could +be provided. diff --git a/usr/doc/man/man2/read.2 b/usr/doc/man/man2/read.2 new file mode 100644 index 0000000000..16dfe48e26 --- /dev/null +++ b/usr/doc/man/man2/read.2 @@ -0,0 +1,54 @@ +.th READ II 8/5/73 +.sh NAME +read \*- read from file +.sh SYNOPSIS +(read = 3.) +.br +(file descriptor in r0) +.ft B +.br +sys read; buffer; nbytes +.br +.s3 +read(fildes, buffer, nbytes) +.br +char *buffer; +.ft R +.sh DESCRIPTION +A file descriptor is a word +returned from a successful +.it "open, creat, dup," +or +.it pipe +call. +.it Buffer +is the location of +.it nbytes +contiguous +bytes into which the input will be placed. +It is not guaranteed +that all +.it nbytes +bytes will be read; for example +if the file refers to a typewriter at most one line +will be returned. +In any event the number of characters read is returned +(in r0). +.s3 +If the returned value is 0, then +end-of-file has been reached. +.sh "SEE ALSO" +open (II), creat (II), dup (II), pipe (II) +.sh DIAGNOSTICS +As mentioned, +0 is returned when the end of the file has been reached. +If the read was otherwise unsuccessful +the error bit (c-bit) is set. +Many conditions +can generate an error: +physical I/O errors, bad buffer address, +preposterous +.it nbytes, +file descriptor not that of +an input file. +From C, a \*-1 return indicates the error. diff --git a/usr/doc/man/man2/seek.2 b/usr/doc/man/man2/seek.2 new file mode 100644 index 0000000000..1737e913ec --- /dev/null +++ b/usr/doc/man/man2/seek.2 @@ -0,0 +1,60 @@ +.th SEEK II 8/5/73 +.sh NAME +seek \*- move read/write pointer +.sh SYNOPSIS +(seek = 19.) +.br +(file descriptor in r0) +.ft B +.br +sys seek; offset; ptrname +.s3 +seek(fildes, offset, ptrname) +.ft R +.sh DESCRIPTION +The file +descriptor refers to a file open for reading or writing. +The read (resp. write) pointer for the file is set as follows: +.s3 +.lp +6 3 +if +.it ptrname +is 0, the pointer is set to +.it offset. +.s3 +.lp +6 3 +if +.it ptrname +is 1, the pointer is set to its current location plus +.it offset. +.s3 +.lp +6 3 +if +.it ptrname +is 2, the pointer is set to the size of the +file plus +.it offset. +.s3 +.lp +6 3 +if +.it ptrname +is 3, 4 or 5, +the meaning is as above for +0, 1 and 2 except that +the offset is +multiplied by 512. +.s3 +.i0 +If +.it ptrname +is 0 or 3, +.it offset +is unsigned, +otherwise +it is signed. +.sh "SEE ALSO" +open (II), creat (II) +.sh DIAGNOSTICS +The error bit +(c-bit) is set for an undefined file descriptor. +From C, a \*-1 return indicates an error. diff --git a/usr/doc/man/man2/setgid.2 b/usr/doc/man/man2/setgid.2 new file mode 100644 index 0000000000..53f47ea6de --- /dev/null +++ b/usr/doc/man/man2/setgid.2 @@ -0,0 +1,25 @@ +.th SETGID II 8/5/73 +.sh NAME +setgid \*- set process group ID +.sh SYNOPSIS +(setgid = 46.; not in assembler) +.br +(group ID in r0) +.ft B +.br +sys setgid +.s3 +setgid(gid) +.ft R +.sh DESCRIPTION +The group ID of the current process is set to +the argument. +Both the effective and the real group ID are set. +This call is only permitted to the super-user +or if the argument is the real group ID. +.sh "SEE ALSO" +getgid (II) +.sh DIAGNOSTICS +Error bit +(c-bit) is set as indicated; +from C, a \*-1 value is returned. diff --git a/usr/doc/man/man2/setuid.2 b/usr/doc/man/man2/setuid.2 new file mode 100644 index 0000000000..f5e390fdf3 --- /dev/null +++ b/usr/doc/man/man2/setuid.2 @@ -0,0 +1,25 @@ +.th SETUID II 8/5/73 +.sh NAME +setuid \*- set process user ID +.sh SYNOPSIS +(setuid = 23.) +.br +(user ID in r0) +.ft B +.br +sys setuid +.s3 +setuid(uid) +.ft R +.sh DESCRIPTION +The user ID of the current process is set to +the argument. +Both the effective and the real user ID are set. +This call is only permitted to the super-user +or if the argument is the real user ID. +.sh "SEE ALSO" +getuid (II) +.sh DIAGNOSTICS +Error bit +(c-bit) is set as indicated; +from C, a \*-1 value is returned. diff --git a/usr/doc/man/man2/signal.2 b/usr/doc/man/man2/signal.2 new file mode 100644 index 0000000000..8d65e346b6 --- /dev/null +++ b/usr/doc/man/man2/signal.2 @@ -0,0 +1,151 @@ +.th SIGNAL II 8/5/73 +.sh NAME +signal \*- catch or ignore signals +.sh SYNOPSIS +(signal = 48.) +.br +.ft B +sys signal; sig; label +.ft R +.br +(old value in r0) +.s3 +.ft B +signal(sig, func) +.br +int (*func)( ); +.ft R +.sh DESCRIPTION +A +.it signal +is generated by some abnormal event, +initiated either by user at a typewriter (quit, interrupt), +by a program error (bus error, etc.), +or by request of another program (kill). +Normally all signals +cause termination of the receiving process, +but this call allows them either to be ignored +or to cause an interrupt to a specified location. +Here is the list of signals: +.s3 +.lp +10 5 +1 hangup +.lp +10 5 +2 interrupt +.lp +10 5 +3* quit +.lp +10 5 +4* illegal instruction (not reset when caught) +.lp +10 5 +5* trace trap (not reset when caught) +.lp +10 5 +6* IOT instruction +.lp +10 5 +7* EMT instruction +.lp +10 5 +8* floating point exception +.lp +10 5 +9 kill (cannot be caught or ignored) +.lp +10 5 +10* bus error +.lp +10 5 +11* segmentation violation +.lp +10 5 +12* bad argument to system call +.lp +10 5 +13 write on a pipe with no one to read it +.s3 +.i0 +In the assembler call, if +.it label +is 0, +the process is terminated +when the signal occurs; this is the default action. +If +.it label +is odd, the signal is ignored. +Any other even +.it label +specifies an address in the process +where an interrupt is simulated. +An RTI or RTT instruction will return from the +interrupt. +Except as indicated, +a signal is reset to 0 after being caught. +Thus if it is desired to +catch every such signal, +the catching routine must +issue another +.it signal +call. +.s3 +In C, +if +.it func +is 0, the default action +for signal +.it sig +(termination) +is reinstated. +If +.it func +is 1, +the signal is ignored. +If +.it func +is non-zero and +even, it is assumed to be the address +of a function entry point. +When the signal occurs, +the function will be called. +A return from the function will +continue the process at the point it was interrupted. +As in the assembler call, +.it signal +must in general be called again to catch subsequent signals. +.s3 +When a caught signal occurs +during certain system calls, the call terminates prematurely. +In particular this can occur +during a +.it read +or +.it write +on a slow device (like a typewriter; but not a file); +and during +.sleep +or +.it wait. +When such a signal occurs, the saved user status +is arranged in such a way that when return from the +signal-catching takes place, it will appear that the +system call returned a characteristic error status. +The user's program may then, if it wishes, +re-execute the call. +.s3 +The starred signals in the list above cause a core image +if not caught or ignored. +.s3 +The value of the call is the old action defined for the signal. +.s3 +After a +.it fork +(II) +the child inherits +all signals. +.it Exec +(II) +resets all +caught signals to default action. +.sh "SEE ALSO" +kill (I), kill (II), +ptrace (II), +reset (III) +.sh DIAGNOSTICS +The error bit +(c-bit) +is set if the +given signal is out of range. +In C, a \*-1 indicates an error; +0 indicates success. +.sh BUGS diff --git a/usr/doc/man/man2/sleep.2 b/usr/doc/man/man2/sleep.2 new file mode 100644 index 0000000000..50fee9de43 --- /dev/null +++ b/usr/doc/man/man2/sleep.2 @@ -0,0 +1,22 @@ +.th SLEEP II 8/5/73 +.sh NAME +sleep \*- stop execution for interval +.sh SYNOPSIS +(sleep = 35.; not in assembler) +.br +(seconds in r0) +.br +.ft B +sys sleep +.s3 +sleep(seconds) +.ft R +.sh DESCRIPTION +The +current process is suspended from execution +for the number of seconds specified +by the argument. +.sh "SEE ALSO" +sleep (I) +.sh DIAGNOSTICS +\*- diff --git a/usr/doc/man/man2/stat.2 b/usr/doc/man/man2/stat.2 new file mode 100644 index 0000000000..a0cddd93a3 --- /dev/null +++ b/usr/doc/man/man2/stat.2 @@ -0,0 +1,88 @@ +.th STAT II 8/5/73 +.sh NAME +stat \*- get file status +.sh SYNOPSIS +(stat = 18.) +.br +.ft B +sys stat; name; buf +.s3 +stat(name, buf) +.br +char *name; +.br +struct inode *buf; +.ft R +.sh DESCRIPTION +.it Name +points to a null-terminated string naming +a file; +.it buf +is the address of a 36(10) byte buffer +into which information is placed concerning the file. +It is unnecessary to have any +permissions at all with respect to the file, but all directories +leading to the file must be readable. +After +.it stat, +.it buf +has the following structure (starting offset given in bytes): +.s3 +.if t .ta .5i 1i 2.5i +.if n .ta 3 9 24 +.nf +struct inode { + char minor; /* +0: minor device of i-node */ + char major; /* +1: major device */ + int inumber; /* +2 */ + int flags; /* +4: see below */ + char nlinks; /* +6: number of links to file */ + char uid; /* +7: user ID of owner */ + char gid; /* +8: group ID of owner */ + char size0; /* +9: high byte of 24-bit size */ + int size1; /* +10: low word of 24-bit size */ + int addr[8]; /* +12: block numbers or device number */ + int actime[2]; /* +28: time of last access */ + int modtime[2]; /* +32: time of last modification */ +}; +.fi +.s3 +The flags are as follows: +.s3 +.lp +10 9 +100000 i-node is allocated +.lp +10 9 +060000 2-bit file type: +.lp +15 9 +000000 plain file +.lp +15 9 +040000 directory +.lp +15 9 +020000 character-type special file +.lp +15 9 +060000 block-type special file. +.lp +10 9 +010000 large file +.lp +10 9 +004000 set user-ID on execution +.lp +10 9 +002000 set group-ID on execution +.lp +10 9 +001000 save text image after execution +.lp +10 9 +000400 read (owner) +.lp +10 9 +000200 write (owner) +.lp +10 9 +000100 execute (owner) +.lp +10 9 +000070 read, write, execute (group) +.lp +10 9 +000007 read, write, execute (others) +.i0 +.sh "SEE ALSO" +ls (I), fstat (II), fs (V) +.sh DIAGNOSTICS +Error bit (c-bit) +is set if the file cannot be found. +From C, a \*-1 return indicates an error. diff --git a/usr/doc/man/man2/stime.2 b/usr/doc/man/man2/stime.2 new file mode 100644 index 0000000000..5e72cb2a7a --- /dev/null +++ b/usr/doc/man/man2/stime.2 @@ -0,0 +1,25 @@ +.th STIME II 8/5/73 +.sh NAME +stime \*- set time +.sh SYNOPSIS +(stime = 25.) +.br +(time in r0-r1) +.br +.ft B +sys stime +.s3 +stime(tbuf) +.br +int tbuf[2]; +.ft R +.sh DESCRIPTION +.it Stime +sets the system's idea of the time and date. +Time is measured in seconds from 0000 GMT Jan 1 1970. +Only the super-user may use this call. +.sh "SEE ALSO" +date (I), time (II), ctime (III) +.sh DIAGNOSTICS +Error bit (c-bit) +set if user is not the super-user. diff --git a/usr/doc/man/man2/stty.2 b/usr/doc/man/man2/stty.2 new file mode 100644 index 0000000000..63cd3a1b1a --- /dev/null +++ b/usr/doc/man/man2/stty.2 @@ -0,0 +1,180 @@ +.th STTY II 12/15/74 +.sh NAME +stty \*- set mode of typewriter +.sh SYNOPSIS +(stty = 31.) +.br +(file descriptor in r0) +.br +.ft B +sys stty; arg +.br +.li +... +.br +arg: .byte ispeed, ospeed; .byte erase, kill; mode +.s3 +.nf +stty(fildes, arg) +struct { + char ispeed, ospeed; + char erase, kill; + int mode; +} *arg; +.fi +.ft R +.s3 +.sh DESCRIPTION +.it Stty +sets mode bits and character speeds for the typewriter whose file descriptor +is passed in r0 (resp. is the first argument to the call). +First, the system delays until the typewriter is quiescent. +The input and output speeds are set from the first two bytes +of the argument structure +as indicated by the following table, +which corresponds to the +speeds supported by the DH-11 interface. +If DC-11, DL-11 or KL-11 interfaces are used, +impossible speed changes are ignored. +.s3 +.lp +8 4 +0 (hang up dataphone) +.lp +8 4 +1 50 baud +.lp +8 4 +2 75 baud +.lp +8 4 +3 110 baud +.lp +8 4 +4 134.5 baud +.lp +8 4 +5 150 baud +.lp +8 4 +6 200 baud +.lp +8 4 +7 300 baud +.lp +8 4 +8 600 baud +.lp +8 4 +9 1200 baud +.lp +8 4 +10 1800 baud +.lp +8 4 +11 2400 baud +.lp +8 4 +12 4800 baud +.lp +8 4 +13 9600 baud +.lp +8 4 +14 External A +.lp +8 4 +15 External B +.s3 +.i0 +In the current configuration, +only 110, 150 and 300 baud are really supported on dial-up lines, +in that the code conversion and line control required for +IBM 2741's (134.5 baud) +must be implemented by the user's +program, +and the half-duplex line discipline +required for the 202 dataset (1200 baud) +is not supplied. +.s3 +The next two characters of the argument structure +specify the erase and kill characters respectively. +(Defaults are # and @.) +.s3 +The +.it mode +contains several bits which determine the +system's treatment of the typewriter: +.s3 +.lp +12 7 +100000 Select one of two algorithms for backspace delays +.lp +12 7 +040000 Select one of two algorithms for form-feed and vertical-tab delays +.lp +12 7 +030000 Select one of four algorithms for carriage-return delays +.lp +12 7 +006000 Select one of four algorithms for tab delays +.lp +12 7 +001400 Select one of four algorithms for new-line delays +.lp +12 7 +000200 even parity allowed on input (e. g. for M37s) +.lp +12 7 +000100 odd parity allowed on input +.lp +12 7 +000040 raw mode: wake up on all characters +.lp +12 7 +000020 map CR into LF; echo LF or CR as CR-LF +.lp +12 7 +000010 echo (full duplex) +.lp +12 7 +000004 map upper case to lower on input (e. g. M33) +.lp +12 7 +000002 echo and print tabs as spaces +.lp +12 7 +000001 hang up (remove `data terminal ready,' lead CD) after last close +.i0 +.s3 +The delay bits specify how long +transmission stops to allow for mechanical or other movement +when certain characters are sent to the terminal. +In all cases a value of 0 indicates no delay. +.s3 +Backspace delays are currently ignored but will +be used for Terminet 300's. +.s3 +If a form-feed/vertical tab delay is specified, +it lasts for about 2 seconds. +.s3 +Carriage-return delay type 1 lasts about .08 seconds +and is suitable for the Terminet 300. +Delay type 2 lasts about .16 seconds and is suitable +for the VT05 and the TI 700. +Delay type 3 is unimplemented and is 0. +.s3 +New-line delay type 1 is dependent on the current column +and is tuned for Teletype model 37's. +Type 2 is useful for the VT05 and is about .10 seconds. +Type 3 is unimplemented and is 0. +.s3 +Tab delay type 1 is dependent on the amount of movement +and is tuned to the Teletype model +37. +Other types are unimplemented and are 0. +.s3 +Characters with the wrong parity, as determined by bits 200 and +100, are ignored. +.s3 +In raw mode, every character is passed immediately +to the program without waiting until a full line has been typed. +No erase or kill processing is done; +the end-of-file character (EOT), the interrupt character +(DEL) and the quit character (FS) are not treated specially. +.s3 +Mode 020 causes input carriage returns to be turned into +new-lines; +input of either CR or LF causes LF-CR both to +be echoed +(used for GE TermiNet 300's and other terminals without the newline function). +.s3 +The hangup mode 01 +causes the line to be disconnected +when the last process with the line open closes it or terminates. +It is useful when a port is to be used for some special +purpose; +for example, if it is associated +with an ACU used to place outgoing calls. +.s3 +This system call is also used with certain special +files other than typewriters, +but since none of them are part of the standard system +the specifications will not be given. +.sh "SEE ALSO" +stty (I), gtty (II) +.sh DIAGNOSTICS +The error bit +(c-bit) is set if the file descriptor does not refer to a typewriter. +From C, a negative value indicates an error. diff --git a/usr/doc/man/man2/sync.2 b/usr/doc/man/man2/sync.2 new file mode 100644 index 0000000000..ac320a6914 --- /dev/null +++ b/usr/doc/man/man2/sync.2 @@ -0,0 +1,25 @@ +.th SYNC II 8/5/73 +.sh NAME +sync \*- update super-block +.sh SYNOPSIS +(sync = 36.; not in assembler) +.br +.ft B +sys sync +.ft R +.sh DESCRIPTION +.it Sync +causes all information in core +memory that should be on disk to be written out. +This includes modified super blocks, +modified i-nodes, and delayed block I/O. +.s3 +It should be used by programs which examine a file system, +for example +.it "icheck, df," +etc. +It is mandatory before a boot. +.sh "SEE ALSO" +sync (VIII), update (VIII) +.sh DIAGNOSTICS +\*- diff --git a/usr/doc/man/man2/time.2 b/usr/doc/man/man2/time.2 new file mode 100644 index 0000000000..909e6caad3 --- /dev/null +++ b/usr/doc/man/man2/time.2 @@ -0,0 +1,26 @@ +.th TIME II 8/5/73 +.sh NAME +time \*- get date and time +.sh SYNOPSIS +(time = 13.) +.br +.ft B +sys time +.s3 +time(tvec) +.br +int tvec[2]; +.ft R +.sh DESCRIPTION +.it Time +returns the time since 00:00:00 GMT, Jan. 1, 1970, measured +in seconds. +From +.it as, +the high order word is in the r0 register and the low order +is in r1. +From C, the user-supplied vector is filled in. +.sh "SEE ALSO" +date (I), stime (II), ctime (III) +.sh DIAGNOSTICS +\*- diff --git a/usr/doc/man/man2/times.2 b/usr/doc/man/man2/times.2 new file mode 100644 index 0000000000..10553521df --- /dev/null +++ b/usr/doc/man/man2/times.2 @@ -0,0 +1,41 @@ +.th TIMES II 8/5/73 +.sh NAME +times \*- get process times +.sh SYNOPSIS +(times = 43.; not in assembler) +.br +.ft B +sys times; buffer +.s3 +times(buffer) +.br +struct tbuffer *buffer; +.ft R +.sh DESCRIPTION +.it Times +returns time-accounting information +for the current process +and for the terminated child processes +of the current process. +All times are in 1/60 seconds. +.s3 +After the call, the buffer will appear as follows: +.s3 +.nf +struct tbuffer { + int proc\*_user\*_time; + int proc\*_system\*_time; + int child\*_user\*_time[2]; + int child\*_system\*_time[2]; +}; +.s3 +.fi +The children times are the sum +of the children's process times and +their children's times. +.sh "SEE ALSO" +time (I) +.sh DIAGNOSTICS +\*- +.sh BUGS +The process times should be 32 bits as well. diff --git a/usr/doc/man/man2/umount.2 b/usr/doc/man/man2/umount.2 new file mode 100644 index 0000000000..d7adb8742c --- /dev/null +++ b/usr/doc/man/man2/umount.2 @@ -0,0 +1,31 @@ +.th UMOUNT II 8/5/73 +.sh NAME +umount \*- dismount file system +.sh SYNOPSIS +(umount = 22.) +.br +.ft B +sys umount; special +.ft R +.sh DESCRIPTION +.it Umount +announces to the system that special +file +.it special +is no longer to contain +a removable file system. +The file associated with the special +file reverts to its ordinary interpretation; +see +.it mount +(II). +.s3 +.sh "SEE ALSO" +umount (VIII), mount (II) +.sh DIAGNOSTICS +Error bit +(c-bit) set if +no +file system was mounted on the special file +or if there are still active files on the +mounted file system. diff --git a/usr/doc/man/man2/unlink.2 b/usr/doc/man/man2/unlink.2 new file mode 100644 index 0000000000..22e97df59d --- /dev/null +++ b/usr/doc/man/man2/unlink.2 @@ -0,0 +1,35 @@ +.th UNLINK II 8/5/73 +.sh NAME +unlink \*- remove directory entry +.sh SYNOPSIS +(unlink = 10.) +.br +.ft B +sys unlink; name +.s3 +unlink(name) +.br +char *name; +.ft R +.sh DESCRIPTION +.it Name +points to a null-terminated string. +.it Unlink +removes the entry for the file pointed to by +.it name +from its directory. +If this entry was the last link to the file, +the contents of the file are freed and the file is destroyed. +If, however, the file was open in any process, the actual +destruction is delayed until it is closed, even though +the directory entry has disappeared. +.sh "SEE ALSO" +rm (I), rmdir (I), link (II) +.sh DIAGNOSTICS +The error bit +(c-bit) is set to indicate that the file does not +exist or that its directory cannot be written. +Write permission is not required on the file itself. +It is also illegal to unlink a directory +(except for the super-user). +From C, a \*-1 return indicates an error. diff --git a/usr/doc/man/man2/wait.2 b/usr/doc/man/man2/wait.2 new file mode 100644 index 0000000000..1497d1eafb --- /dev/null +++ b/usr/doc/man/man2/wait.2 @@ -0,0 +1,69 @@ +.th WAIT II 2/9/75 +.sh NAME +wait \*- wait for process to terminate +.sh SYNOPSIS +(wait = 7.) +.br +.ft B +sys wait +.ft R +.br +(process ID in r0) +.br +(status in r1) +.s3 +.ft B +wait(status) +.br +int *status; +.ft R +.sh DESCRIPTION +.it Wait +causes its caller to delay until one of its child +processes terminates. +If any child has died since the last +.it wait, +return is immediate; +if there are no children, return is immediate with +the error bit set +(resp. with a value of \*-1 returned). +The normal return yields the process ID of the terminated child +(in r0). +In the case of several children several +.it wait +calls are needed +to learn of all the deaths. +.s3 +If no error is indicated on return, +the r1 high byte (resp. the high byte stored into +.it status +) contains the low byte of the +child process r0 (resp. the argument of +.it exit +) when it terminated. +The r1 (resp. +.it status +) low byte contains the termination status +of the process. +See signal (II) for +a list of termination statuses (signals); +0 status indicates normal termination. +A special status (0177) is returned for a stopped process +which has not terminated and can be restarted. +See ptrace (II). +If the 0200 bit of the termination status +is set, +a core image of the process was produced +by the system. +.s3 +If the parent process terminates without +waiting on its children, +the initialization process +(process ID = 1) +inherits the children. +.sh "SEE ALSO" +exit (II), fork (II), signal (II) +.sh DIAGNOSTICS +The error bit +(c-bit) is set if there are no children not previously waited for. +From C, a returned value of \*-1 indicates an error. diff --git a/usr/doc/man/man2/write.2 b/usr/doc/man/man2/write.2 new file mode 100644 index 0000000000..84b6fde45f --- /dev/null +++ b/usr/doc/man/man2/write.2 @@ -0,0 +1,45 @@ +.th WRITE II 8/5/73 +.sh NAME +write \*- write on a file +.sh SYNOPSIS +(write = 4.) +.br +(file descriptor in r0) +.br +.ft B +sys write; buffer; nbytes +.s3 +write(fildes, buffer, nbytes) +.br +char *buffer; +.ft R +.sh DESCRIPTION +A file descriptor is a word returned from a +successful +.it open, +.it creat, +.it dup, +or +.it pipe +call. +.s3 +.it Buffer +is the address of +.it nbytes +contiguous +bytes which are written on the output file. +The number of characters actually written is returned (in r0). +It should be regarded as an error +if this is not the same as requested. +.s3 +Writes which are multiples +of 512 characters long and begin on a 512-byte boundary +in the file +are more efficient than any others. +.sh "SEE ALSO" +creat (II), open (II), pipe (II) +.sh DIAGNOSTICS +The error bit +(c-bit) is set on an error: bad descriptor, buffer address, or +count; physical I/O errors. +From C, a returned value of \*-1 indicates an error. -- 2.20.1