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

open(2) OSS System Calls Reference Manual
NAME
open - Opens a le for reading or writing, creates a regular le in the OSS environment
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 open(
const char *path,
int oflag
[ , mode_t mode ]);
PARAMETERS
path Points to the pathname of the le to be opened or created.
The les /lost+found, /dev, /dev/tty, and /dev/null cannot be specied for this
parameter when the O_CREAT ag is set for the oflag parameter. Attempts to
create these les cause the function call to fail and errno to be set to [EINVAL].
If the path parameter refers to a symbolic link, the open() function opens the le
pointed to by the symbolic link.
If the path parameter refers to a le in the Guardian le system (/G), additional
restrictions apply. See the subsection Opening Guardian Files in the
DESCRIPTION section of this reference page for more information.
oflag Species the type of access, special open processing, the type of update, and the
initial state of the open le. The parameter value is constructed by logically
ORing special open processing ags. These ags are dened in the fcntl.h
header le and are described in DESCRIPTION.
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 and the O_CREAT ag is set
in the oflag parameter. If the le already exists but O_CREAT is set, this
parameter must be specied and must have a valid value but has no effect.
If this parameter is specied when values other than O_CREAT are used in the
oflag parameter, the values specied for mode have no effect on whether the le
is opened for reading or writing.
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.
54 Hewlett-Packard Company 527186-003