open(3)
DESCRIPTION
Opens path and returns a new descriptor. O_RDONLY, O_WRONLY, or O_RDWR select access; O_CREAT consumes a mode argument, and O_EXCL, O_TRUNC, O_APPEND, O_NONBLOCK, and O_CLOEXEC are forwarded.
SYNOPSIS
#include <fcntl.h> #include <sys/types.h> int open(const char *path, int flags, ...);
RETURN VALUE
- Returns a non-negative descriptor, or -1 and sets errno.
ERRORS
-EFAULT- The pathname cannot be read by the kernel.
-EINVAL- Path resolution fails.
-ENOENT- The path cannot be opened and creation was not requested.
-EACCES- The requested access is not allowed by the node's owner permission bits.
-EMFILE- The process descriptor table has no free entry.
NOTES
The optional mode argument is read only when O_CREAT is set. Relative paths are resolved against the current working directory.