I am looking at the linux manual for the open
function here but I am not able to find the integer values to the various flags such as O_WRONLY, O_CREAT, O_RDONLY
. Is there a way to find this information?
Here's how I found the definitions:
$ find /usr/include -type f -name '*.h' -exec grep -E '^#define.*O_(WRONLY|RDONLY|RDWR)' {} +
/usr/include/asm-generic/fcntl.h:#define O_RDONLY 00000000
/usr/include/asm-generic/fcntl.h:#define O_WRONLY 00000001
/usr/include/asm-generic/fcntl.h:#define O_RDWR 00000002
/usr/include/x86_64-linux-gnu/bits/fcntl-linux.h:#define O_RDONLY 00
/usr/include/x86_64-linux-gnu/bits/fcntl-linux.h:#define O_WRONLY 01
/usr/include/x86_64-linux-gnu/bits/fcntl-linux.h:#define O_RDWR 02
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.