Next: close, Up: List of Supported Calls
int open(const char *pathname, int flags); int open(const char *pathname, int flags, mode_t mode);
flags is the bitwise OR
of the following values:
O_CREAT
O_EXCL
O_CREAT
, if the file already exists it is
an error and open() fails.
O_TRUNC
O_RDWR
or O_WRONLY
is given) it will be
truncated to zero length.
O_APPEND
O_RDONLY
O_WRONLY
O_RDWR
Other bits are silently ignored.
mode is the bitwise OR
of the following values:
S_IRUSR
S_IWUSR
S_IRGRP
S_IWGRP
S_IROTH
S_IWOTH
Other bits are silently ignored.
open
returns the new file descriptor or -1 if an error
occurred.
EEXIST
O_CREAT
and O_EXCL
were used.
EISDIR
EACCES
ENAMETOOLONG
ENOENT
ENODEV
EROFS
EFAULT
ENOSPC
EMFILE
ENFILE
EINTR