Museum

Home

Lab Overview

Retrotechnology Articles

⇒ Online Manual

Media Vault

Software Library

Restoration Projects

Artifacts Sought



CREAT(2)        DOMAIN/IX Reference Manual (SYS5)        CREAT(2)



NAME
     creat - create a new file or write over an existing one

USAGE
     int creat (path, mode)
     char *path;
     int mode;

DESCRIPTION
     Creat creates a new file or writes over an existing file.
     The file is specified by path.

     When creat is called and the file exists, the file's con-
     tents are discarded, and the length of the file is set to
     zero.  The file's owner and mode are not changed.

     If the file does not exist, creat sets the file's owner ID
     to the effective user ID of the process, and the group ID of
     the process to the effective group ID of the process.  The
     call also sets the low-order 12 bits of the file mode to the
     value of mode, modified as follows:

          All bits set in the process' file mode creation mask
          are cleared.  See umask(2).

     Upon successful completion, creat returns the file descrip-
     tor and the file is open for writing, even if the mode does
     not permit writing.  The file pointer is set to the begin-
     ning of the file.  The file descriptor is set to remain open
     across exec system calls.  See fcntl(2).  A new file may be
     created with a mode that forbids writing.

RETURN VALUE
     Upon successful completion, creat returns the file descrip-
     tor, a non-negative integer.  Otherwise, it returns a value
     of -1 and sets errno to indicate the error.

ERRORS
     Creat fails if one or more of the following is true:

     [ENOTDIR]      A component of the path prefix is not a
                    directory.

     [ENOENT]       A component of the path prefix does not
                    exist.

     [EACCES]       Search permission is denied on a component of
                    the path prefix.

     [ENOENT]       The pathname is null.

     [EACCES]       The file does not exist and the directory in



Printed 5/10/85                                           CREAT-1





CREAT(2)        DOMAIN/IX Reference Manual (SYS5)        CREAT(2)



                    which the file is to be created does not per-
                    mit writing.

     [EROFS]        The named file resides (or would reside) on a
                    read-only file system.

     [ETXTBSY]      The file is a pure procedure (shared text)
                    file that is being executed.

     [EACCES]       The file exists and write permission is
                    denied.

     [EISDIR]       The named file is an existing directory.

     [EMFILE]       The maximum number of open file descriptors
                    would be exceeded.

     [EFAULT]       Path points outside the allocated address
                    space of the process.

     [ENFILE]       The system file table is full.

RELATED INFORMATION
     chmod(2), close(2), dup(2), fcntl(2), lseek(2), open(2),
     read(2), umask(2), write(2)






























CREAT-2                                           Printed 5/10/85



Typewritten Software • bear@typewritten.org • Edmonds, WA 98026