|
ginnOS
The reference: libc, the libraries and the kernel
|
file open flags and open(). More...
#include <sys/types.h>Go to the source code of this file.
Macros | |
| #define | O_RDONLY 0x0000 |
| #define | O_WRONLY 0x0001 |
| #define | O_RDWR 0x0002 |
| #define | O_ACCMODE 0x0003 |
| #define | O_CREAT 0x0040 |
| #define | O_EXCL 0x0080 |
| #define | O_TRUNC 0x0200 |
| #define | O_APPEND 0x0400 |
| #define | O_NONBLOCK 0x0800 |
| #define | O_DIRECTORY 0x10000 |
| #define | O_CLOEXEC 0x80000 |
| #define | AT_FDCWD (-100) |
| #define | AT_SYMLINK_NOFOLLOW 0x100 |
| #define | AT_REMOVEDIR 0x200 |
| #define | AT_SYMLINK_FOLLOW 0x400 |
| #define | AT_EACCESS 0x200 |
| #define | F_DUPFD 0 |
| #define | F_GETFD 1 |
| #define | F_SETFD 2 |
| #define | F_GETFL 3 |
| #define | F_SETFL 4 |
| #define | F_DUPFD_CLOEXEC 1030 |
| #define | FD_CLOEXEC 1 |
Functions | |
| int | openat (int dirfd, const char *path, int flags,...) |
| int | fcntl (int fd, int cmd,...) |
| control an open file descriptor. | |
| int | open (const char *path, int flags,...) |
| open a file. | |
| int | creat (const char *path, mode_t mode) |
| create a file, or truncate it if it exists, and open it for writing: open(path, O_WRONLY | O_CREAT | O_TRUNC, mode). | |
file open flags and open().
the O_ values are ABI and must match the kernel side in src/kernel/vfs/file.h exactly.
| #define O_RDONLY 0x0000 |
| #define O_WRONLY 0x0001 |
| #define O_RDWR 0x0002 |
| #define O_ACCMODE 0x0003 |
| #define O_CREAT 0x0040 |
| #define O_EXCL 0x0080 |
| #define O_TRUNC 0x0200 |
| #define O_APPEND 0x0400 |
| #define O_NONBLOCK 0x0800 |
| #define O_DIRECTORY 0x10000 |
| #define O_CLOEXEC 0x80000 |
| #define AT_FDCWD (-100) |
| #define AT_SYMLINK_NOFOLLOW 0x100 |
| #define AT_REMOVEDIR 0x200 |
| #define AT_SYMLINK_FOLLOW 0x400 |
| #define AT_EACCESS 0x200 |
| #define F_DUPFD 0 |
| #define F_GETFD 1 |
| #define F_SETFD 2 |
| #define F_GETFL 3 |
| #define F_SETFL 4 |
| #define F_DUPFD_CLOEXEC 1030 |
| #define FD_CLOEXEC 1 |
| int openat | ( | int | dirfd, |
| const char * | path, | ||
| int | flags, | ||
| ... ) |
| int fcntl | ( | int | fd, |
| int | cmd, | ||
| ... ) |
control an open file descriptor.
| fd | the descriptor. |
| cmd | an F_ command. |
| ... | the command's int argument, if it takes one. |
| int open | ( | const char * | path, |
| int | flags, | ||
| ... ) |
open a file.
| path | the file's path. |
| flags | one access mode, plus creation and status flags. |
| ... | with O_CREAT, the mode_t for a new file. |
| int creat | ( | const char * | path, |
| mode_t | mode ) |
create a file, or truncate it if it exists, and open it for writing: open(path, O_WRONLY | O_CREAT | O_TRUNC, mode).