BSD 3 development
authorBill Joy <wnj@ucbvax.Berkeley.EDU>
Sun, 25 Nov 1979 09:32:22 +0000 (01:32 -0800)
committerBill Joy <wnj@ucbvax.Berkeley.EDU>
Sun, 25 Nov 1979 09:32:22 +0000 (01:32 -0800)
Work on file usr/man/man2/close.2
Work on file usr/man/man2/creat.2

Synthesized-from: 3bsd

usr/man/man2/close.2 [new file with mode: 0644]
usr/man/man2/creat.2 [new file with mode: 0644]

diff --git a/usr/man/man2/close.2 b/usr/man/man2/close.2
new file mode 100644 (file)
index 0000000..fe82a67
--- /dev/null
@@ -0,0 +1,43 @@
+.TH CLOSE 2 
+.SH NAME
+close \- close a file
+.SH SYNOPSIS
+.B close(fildes)
+.PP
+.SH DESCRIPTION
+Given
+a file descriptor such as returned from an
+.I open,
+.I creat,
+.I dup
+or
+.IR pipe (2)
+call,
+.I close
+closes the associated file.
+A close of all files is automatic on
+.I exit,
+but since
+there is a limit on the number of open files per process,
+.I close
+is necessary for programs which deal with many files.
+.PP
+Files are closed upon termination of a process, and
+certain high-numbered file descriptors are closed by
+.IR exec (2).
+.SH "SEE ALSO"
+creat(2), open(2), pipe(2), exec(2)
+.SH DIAGNOSTICS
+Zero is returned if a file is closed;
+\-1 is returned for an unknown file descriptor.
+.SH "ASSEMBLER (PDP-11)"
+(close = 6.)
+.br
+(file descriptor in r0)
+.br
+.B sys close
+.PP
+.SH BUGS
+A file cannot be closed while there are pages which have been
+.I vread
+but not referenced.
diff --git a/usr/man/man2/creat.2 b/usr/man/man2/creat.2
new file mode 100644 (file)
index 0000000..e387c7c
--- /dev/null
@@ -0,0 +1,66 @@
+.TH CREAT 2 
+.SH NAME
+creat \- create a new file
+.SH SYNOPSIS
+.B creat(name, mode)
+.br
+.B char *name;
+.SH DESCRIPTION
+.I Creat
+creates a new file or prepares to rewrite an existing
+file called 
+.I name,
+given as the address of a null-terminated string.
+If the file did not exist, it is given
+mode
+.IR mode ,
+as modified by the process's mode mask (see
+.IR umask (2)).
+Also see
+.IR  chmod (2)
+for the
+construction of the
+.I mode
+argument.
+.PP
+If the file did exist, its mode and owner remain unchanged
+but it is truncated to 0 length.
+.PP
+The file is also opened for writing, and its file descriptor
+is returned.
+.PP
+The
+.I 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
+.I creat,
+an error is
+returned and the program knows that the name is unusable
+for the moment.
+.SH "SEE ALSO"
+write(2), close(2), chmod(2), umask (2)
+.SH DIAGNOSTICS
+The value \-1 is returned 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.
+.SH "ASSEMBLER (PDP-11)"
+(creat = 8.)
+.br
+.B sys creat; name; mode
+.br
+(file descriptor in r0)
+.SH BUGS
+A file cannot be truncated while any process
+has pages set up by a
+.I vread
+on that file which have not been referenced.