Open System Services System Calls Reference Manual (G06.25+, H06.03+)
open(2) OSS System Calls Reference Manual
NAME
open - Opens a file for reading or writing, creates a regular file 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 file to be opened or created.
The files /lost+found, /dev, /dev/tty, and /dev/null cannot be specified for this
parameter when the O_CREAT flag is set for the oflag parameter. Attempts to
create these files 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 file
pointed to by the symbolic link.
If the path parameter refers to a file in the Guardian file system (/G), additional
restrictions apply. See the subsection Opening Guardian Files in the
DESCRIPTION section of this reference page for more information.
oflag Specifies the type of access, special open processing, the type of update, and the
initial state of the open file. The parameter value is constructed by logically
ORing special open processing flags. These flags are defined in the fcntl.h
header file and are described in DESCRIPTION.
mode Specifies the read, write, and execute permissions of the file and the file type
flags for the file.
This parameter is required if the file does not exist and the O_CREAT flag is set
in the oflag parameter. If the file already exists but O_CREAT is set, this
parameter must be specified and must have a valid value but has no effect.
If this parameter is specified when values other than O_CREAT are used in the
oflag parameter, the values specified for mode have no effect on whether the file
is opened for reading or writing.
The permission bits are set according to the value of this parameter modified by
the process’s file creation mask (see the umask(2) reference page). The value of
this parameter is constructed by logically ORing flags that are defined in the
sys/stat.h header file.
The file type flags are described in DESCRIPTION.
5−4 Hewlett-Packard Company 527186-003