I know open offers these mutually exclusive flags: O_RDONLY, O_WRONLY and O_RDWR.
I want to know: Are there any performance issues (even of it's just a fraction of a ms) or different ways of treating the file if the file is opened as O_RDWR and
First, you seem to have mistyped (inverted) in the two cases of your description the write/read tags. As to what you ask, the VFS, in its various structures, keeps track of desired access rights by flags. The read/write flag is typically a different bit in the same flag (multi) byte. When a process request access as read or write, the kernel checks if it has the requested access rights, and proceeds accordingly. As setting 2 bits doesn't increase your execution time, you should see no difference as later access is the same. Using the proper tag is simply good style and part of file protection.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With