open.2 (2010 09)
o
open(2) open(2)
time) too are the same as their image on disk.
RETURN VALUE
open() returns the following values:
n Successful completion. n is a file descriptor for the opened file.
-1 Failure.
errno is set to indicate the error.
ERRORS
If
open() fails, errno is set to one of the following values.
[EACCES] oflag permission is denied for the named file.
[EACCES] A component of the path prefix denies search permission.
[EACCES] The file does not exist and the directory in which the file is to be created does not
permit writing.
[EACCES]
O_TRUNC is specified and write permission is denied.
[EAGAIN] The file exists, enforcement mode file/record locking is set (see chmod(2)), there are
outstanding record locks on the file with the
flock(), lockf(),orfcntl() sys-
tem calls, and
O_TRUNC is set.
[EDQUOT] User’s disk quota block or inode limit has been reached for this file system.
[EEXIST]
O_CREAT and O_EXCL are set and the named file exists.
[EFAULT] path points outside the allocated address space of the process.
[EINTR] A signal was caught during the
open() system call, and the system call was not
restarted (see signal (5)).
[EINVAL] oflag specifies both
O_WRONLY and
O_RDWR.
[EISDIR] The named file is a directory and oflag is write or read/write.
[ELOOP] Too many symbolic links are encountered in translating the path name.
[EMFILE] The maximum number of file descriptors allowed are currently open.
[ENAMETOOLONG]
The length of the specified path name exceeds
PATH_MAX bytes, or the length of a
component of the path name exceeds NAME_MAX bytes while _POSIX_NO_TRUNC
is in effect.
[ENFILE] The system file table is full.
[ENODEV] The named file is a character special or block special file, and the driver associated
with this special file has not been configured into the kernel or the DLKM driver
associated with this special file failed to load.
[ENOENT] The named file does not exist (for example, path is null or a component of path does
not exist, or the file itself does not exist and
O_CREAT is not set).
[ENOTDIR] A component of the path prefix is not a directory.
[ENOTSUP] The last component of path is a sybolic link and
O_NOFOLLOW was set.
[ENXIO]
O_NDELAY is set, the named file is a FIFO, O_WRONLY is set, and no process has
the file open for reading.
[ENXIO] The named file is a character special or block special file, and the device associated
with this special file does not exist.
[ENOSPC]
O_CREAT is specified, the file does not already exist, and the directory that would
contain the file cannot be extended.
[EOVERFLOW]
The named file is a regular file and the size of the file cannot be represented
correctly in an object of size
off_t.
[EROFS] The named file resides on a read-only file system and oflag is write or read/write.
[ETXTBSY] The file is open for execution and oflag is write or read/write. Normal executable
files are only open for a short time when they start execution. Other executable file
HP-UX 11i Version 3: September 2010 − 3 − Hewlett-Packard Company 3