Open System Services System Calls Reference Manual (G06.29+, H06.08+, J06.03+)
creat(2) OSS System Calls Reference Manual
The returned file descriptor is the lowest-numbered file descriptor not currently open for that pro-
cess. A corresponding Guardian environment file number is also assigned.
The file offset, marking the current position within the file, is set to the beginning of the file. The
new file 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 first-in, first-out (FIFO) special file. Use the
mkfifo() function instead.
If the file does not exist, a regular file is created with these characteristics:
• The owner ID of the file is set to the effective user ID of the process.
• The group ID of the file is determined by the value of the S_ISGID flag in the parent
directory. If S_ISGID is set, the group ID of the file is set to the group ID of the parent
directory; otherwise, the group ID of the file is set to the effective group ID of the calling
process. If the file is a Guardian file (that is, in the /G file 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 file ACL as described in "ACL
Inheritance" in the acl(5) reference page.
• The attribute bits and file permission bits are set to the value of the mode parameter,
modified 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 file permission and appropriate file-type flags are set in the mode
parameter, errno is set to [EINVAL].
If the file exists and is a regular file that is successfully opened:
• 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 is true:
• The file supports enforced record locks, and another process has locked a portion of the
file.
• The file does not allow write access.
1−44 Hewlett-Packard Company 527186-023