Annotation of researchv10dc/dist/man/v4/man2/creat.2, revision 1.1.1.1

1.1       root        1: .th CREAT II 8/5/73
                      2: .sh NAME
                      3: creat  \*-  create a new file
                      4: .sh SYNOPSIS
                      5: (creat = 8.)
                      6: .br
                      7: .ft B
                      8: sys creat; name; mode
                      9: .br
                     10: (file descriptor in r0)
                     11: .s3
                     12: creat(name, mode)
                     13: .br
                     14: char *name;
                     15: .ft R
                     16: .sh DESCRIPTION
                     17: .it Creat
                     18: creates a new file or prepares to rewrite an existing
                     19: file called 
                     20: .it name,
                     21: given as the address of a null-terminated string.
                     22: If the file did not exist, it is given
                     23: mode
                     24: .it mode.
                     25: See
                     26: chmod(II) for the
                     27: construction of the
                     28: .it mode
                     29: argument.
                     30: .s3
                     31: If the file did exist, its mode and owner remain unchanged
                     32: but it is truncated to 0 length.
                     33: .s3
                     34: The file is also opened for writing, and its file descriptor
                     35: is returned (in r0).
                     36: .s3
                     37: The
                     38: .it mode
                     39: given is arbitrary; it need not allow
                     40: writing.
                     41: This feature is used by programs which deal with temporary
                     42: files of fixed names.
                     43: The creation is done with
                     44: a mode that forbids writing.
                     45: Then if a second
                     46: instance of the program attempts a
                     47: .it creat,
                     48: an error is
                     49: returned and the program knows that the name is unusable
                     50: for the moment.
                     51: .sh "SEE ALSO"
                     52: write(II), close(II), stat(II)
                     53: .sh DIAGNOSTICS
                     54: The error bit
                     55: (c-bit) may be set if: a needed directory is not searchable;
                     56: the file does not exist and the directory
                     57: in which it is to be created is not writable; the file
                     58: does exist and is unwritable;
                     59: the file is a directory;
                     60: there are already 10 files open.
                     61: .s3
                     62: From C, a \*-1 return indicates an error.

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.