flags | | 32 bit |
|
| bit | hex | octal | decimal | c++ name | Description |
| 0=0 | 0 | 0 | 0 | O_RDONLY | Readonly |
| 0=1 | 1 | 1 | 1 | O_WRONLY | Writeonly |
| 1 | 2 | 2 | 2 | O_RDWR | Read and write |
| 6 | 40 | 100 | 64 | O_CREAT | If the file does not exist it will be created |
| 7 | 80 | 200 | 128 | O_EXCL | When used with O_CREAT, if the file already exists it is an error |
| 8 | 100 | 400 | 256 | O_NOCTTY | If pathname refers to a terminal device it will not become the process's controlling terminal |
| 9 | 200 | 1000 | 512 | O_TRUNC | If the file already exists and is a regular file and the open mode allows writing it will be truncated to length 0 |
| 10 | 400 | 2000 | 1024 | O_APPEND | The file is opened in append mode |
| 11 | 800 | 4000 | 2048 | O_NONBLOCK | When possible, the file is opened in non-blocking mode |
| 12 | 1000 | 10000 | 4096 | O_SYNC | The file is opened for synchronous I/O |
| 13 | 2000 | 20000 | 8192 | FASYNC | Generate a signal SIGIO by default |
| 14 | 4000 | 40000 | 16384 | O_DIRECT | Try to minimize cache effects of the I/O |
| 15 | 8000 | 100000 | 32768 | O_LARGEFILE | Allow files whose sizes cannot be represented in 31 bits to be opened |
| 16 | 10000 | 200000 | 65536 | O_DIRECTORY | If pathname is not a directory, cause the open to fail |
| 17 | 20000 | 400000 | 131072 | O_NOFOLLOW | If pathname is a symbolic link, then the open fails |