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

System Functions (a - d) creat(2)
The returned le descriptor is the lowest-numbered le descriptor not currently open for that pro-
cess. 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 );
You cannot use the creat() function to create a rst-in, rst-out (FIFO) special le. Use the
mkfifo() function instead.
If the le does not exist, a regular le is created with these characteristics:
The owner ID of the le is set to the effective user ID of the process.
The group ID of the le is determined by the value of the S_ISGID ag in the parent
directory. If S_ISGID is set, the group ID of the le is set to the group ID of the parent
directory; otherwise, the group ID of the le is set to the effective group ID of the calling
process. If the le is a Guardian le (that is, in the /G le system), the group ID is set to
that of the primary group of the effective user ID.
If ACLs are supported, ACL entries are added to the le ACL as described in "ACL |
Inheritance" in the acl(5) reference page.
The attribute bits and le permission bits are set to the value of the mode parameter,
modied as listed:
File permission bits are set as described in "ACL Inheritance" in the acl(5) refer-
ence page.
The set user ID attribute (S_ISUID bit) is cleared.
The set group ID attribute (S_ISGID bit) is cleared.
If bits other than the le permission and appropriate le-type ags are set in the mode
parameter, errno is set to [EINVAL].
If the le exists and is a regular le that is successfully opened:
The length of the le is truncated to 0 (zero).
The owner and group of the le are unchanged.
The set user ID attribute of the le mode is cleared.
The open fails if any of these conditions is true:
The le supports enforced record locks, and another process has locked a portion of the
le.
The le does not allow write access.
527186-007 Hewlett-Packard Company 139