File Open Flags Decoder
Compose an open(2) flag value from an access mode and flags, or decode a value such as 0x241 back into the flags it sets.
Access modes
Flags on x86-64 Linux
Values are the Linux x86-64 constants from asm-generic/fcntl.h as glibc exposes them; other architectures differ (O_DIRECT is 0o200000 on SPARC, for example), so check your headers when porting. O_SYNC is 0o4010000 and already contains the O_DSYNC bit, and O_TMPFILE is 0o20200000 and already contains O_DIRECTORY, so each of those is reported as one flag instead of two. O_CREAT and O_TMPFILE need the third mode argument. O_PATH honours only O_CLOEXEC, O_DIRECTORY and O_NOFOLLOW. A value typed without 0x is read as octal — the decimal figure is shown so a decimal paste is easy to spot. The page only does arithmetic on the number: nothing is opened, executed, stored or sent anywhere.