Open System Services System Calls Reference Manual (G06.28+, H06.05+)

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.
You cannot specify the les /lost+found, /dev, /dev/tty, and /dev/null 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 and O_CREAT is set, this
parameter is required and must have a valid value, but this parameter has no
effect on the le (you cannot use this parameter to change the permissions of the
le).
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 value of this parameter is constructed by logically ORing ags that are |
dened in the sys/stat.h header le. |
If the parent directory of the created le does not have default OSS access con- |
trol list (ACL) entries, the permissions for the new le are the bit-wise AND of |
this mode parameter with the complement of the process umask (see the |
umask(2) reference page). If the parent directory of the created le has default |
ACL entries, the permissions for the new le are affected by the value of this |
parameter but depend on both the support for OSS ACLs on the system on which |
54 Hewlett-Packard Company 527186-007