Open System Services System Calls Reference Manual (G06.25+, H06.03+)
open(2) OSS System Calls Reference Manual
O_EXCL Open the file in exclusive access mode.
If the file exists and the O_EXCL and O_CREAT flags are set, the open fails. If
the file exists and the O_EXCL flag is set and the O_CREAT flag is not set, the
open succeeds.
O_NOCTTY Open the file but not as a controlling terminal. If the path parameter identifies a
terminal device, this flag ensures that the terminal device does not become the
controlling terminal for the process.
When opening a file that is not a terminal device, the O_NOCTTY flag is
ignored.
O_TRUNC Open the file and empty it. If the file does not exist or if the file is not a regular
file, this flag has no effect. If the file exists and is a regular file, and if the file is
successfully opened with either read/write access or write-only access, then:
• The length of the file is truncated to 0 (zero).
• The owner and group of the file are unchanged.
• The set user ID attribute of the file mode is cleared.
The open fails if any of these conditions are true:
• The file supports enforced record locks, and another process has locked a
portion of the file.
• The file does not allow write access.
• The oflag parameter also specifies the O_RDONLY flag.
If the oflag parameter also specifies the O_SYNC flag, the truncation is a syn-
chronous update.
A program can request some control over when updates should be made per-
manent for a regular file opened for write access.
The file status flags that define the initial state of the open file are:
O_APPEND Open the file only for append access. If set, the file pointer is set to the end of
the file before each write.
This flag is ignored for Telserv terminal devices.
O_NONBLOCK
Open the file for nonblocked access. If set, the call to open() does not block,
and subsequent read() or write() operations on the file are nonblocking.
When opening a regular disk file or an OSS directory, the O_NONBLOCK flag
is ignored.
Calling the open() function with the O_NONBLOCK flag for FIFO files and for
character special devices that support nonblocking opens is supported.
Calling the open() function with the O_NONBLOCK flag is supported for Tel-
serv terminal devices (tty) as listed:
• For a static window, the open operation is always allowed; it finishes
when the connection is established.
5−6 Hewlett-Packard Company 527186-003