Open System Services System Calls Reference Manual (G06.25+, H06.03+)

System Functions (a - d) creat(2)
NAME
creat - Creates a regular le in the OSS environment or rewrites an existing le
LIBRARY
G-series native Guardian processes: system library
G-series native OSS processes: system library
H-series native Guardian processes: implicit libraries
H-series OSS processes: implicit libraries
SYNOPSIS
#include <sys/types.h> /* optional except for POSIX.1 */
#include <sys/stat.h> /* optional except for POSIX.1 */
#include <fcntl.h>
int creat(
const char *path,
mode_t mode);
PARAMETERS
path Points to the pathname of the le to be created or opened for writing.
The les /lost+found, /dev, /dev/tty, and /dev/null cannot be specied for this
parameter. Attempts to create these les cause the function call to fail with
errno set to [EINVAL].
If the path parameter refers to a symbolic link, the creat() function opens the le
pointed to by the symbolic link.
mode Species the read, write, and execute permissions of the le and the le type
ags for the le.
This parameter is required if the le does not exist. If the le already exists, this
parameter must be specied and must have a valid value but has no effect.
The permission bits are set according to the value of this parameter modied by
the processs le creation mask (see the umask(2) reference page). The value of
this parameter is constructed by logically ORing ags that are dened in the
sys/stat.h header le.
The le type ags are described in DESCRIPTION.
DESCRIPTION
The creat() function establishes a connection between the le indicated by the path parameter
and the returned le descriptor. The opened le descriptor is used by subsequent I/O function
calls, such as read() and write(), to access that le.
The returned le descriptor is the lowest-numbered le descriptor not previously open for that
process. A corresponding Guardian environment le number is also assigned.
The le offset, marking the current position within the le, is set to the beginning of the le. The
new le descriptor is set to remain open across the processing of any of the exec or tdm_exec set
of functions. (See the fcntl(2) reference page.)
A call to the creat() function is equivalent to this call:
open( path, O_WRONLY |O_CREAT | O_TRUNC,mode );
The creat() function cannot be used to create a FIFO special le. Use the mkfo() function
instead.
If the le does not exist, a regular le is created with these characteristics:
527186-003 Hewlett-Packard Company 131