Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ creat(2) — sys5 — Apollo Domain/OS SR10.3.5

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

chmod(2)

close(2)

dup(2)

fcntl(2)

lseek(2)

open(2)

read(2)

umask(2)

write(2)

CREAT(2)                             SysV                             CREAT(2)



NAME
     creat - create a new file or rewrite an existing one

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

DESCRIPTION
     creat creates a new ordinary file or prepares to rewrite an existing file
     named by the pathname pointed to by path.

     If the file exists, the length is truncated to 0 and the mode and owner
     are unchanged.  Otherwise, the file's owner ID is set to the effective
     user ID, the group ID of the process is set to the effective group ID, of
     the process and the low-order 12 bits of the file mode are set to the
     value of mode modified as follows:

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

     ⊕  The "save text image after execution bit" of the mode is cleared (see
        chmod(2)).

     Upon successful completion, a write-only file descriptor is returned and
     the file is open for writing, even if the mode does not permit writing.
     The file pointer is set to the beginning of the file.  The file
     descriptor is set to remain open across exec system calls (see fcntl(2)).
     No process may have more than 128 files open simultaneously.  A new file
     can be created with a mode that forbids writing.

ERRORS
     creat fails if one or more of the following are 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 which the file
                  is to be created does not permit 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]     NOFILES file descriptors are currently open.

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

     [ENFILE]     The system file table is full.

     [EAGAIN]     The file exists, mandatory file/record locking is set, and
                  there are outstanding record locks on the file (see
                  chmod(2)).

     [EINTR]      A signal was caught during the creat system call.

     [ENOSPC]     No space left on device.

SEE ALSO
     chmod(2), close(2), dup(2), fcntl(2), lseek(2), open(2), read(2),
     umask(2), write(2).

DIAGNOSTICS
     A successful call returns a non-negative integer, the file descriptor.
     An unsuccessful call returns -1 and sets errno as indicated under
     "Errors".

NOTES
     Under other implementations, creat fails if any of the following are
     true:

     [ENOLINK]     path points to a remote machine and the link to that
                   machine is no longer active.

     [EMULTIHOP]   Components of path require hopping to multiple remote
                   machines.

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