diff options
author | Nick Kralevich <nnk@google.com> | 2018-12-17 12:46:08 -0800 |
---|---|---|
committer | Nick Kralevich <nnk@google.com> | 2018-12-17 13:24:46 -0800 |
commit | 52671a787bbd94d14ac3bf7641c3976f4472ba30 (patch) | |
tree | d0bdf9e6a8f65d62146580222d7164f33395a814 /rs/java/android/renderscript/ProgramFragmentFixedFunction.java | |
parent | f98c2c41bd4e390756be5d057da165237323da99 (diff) |
FileUtils.java: Don't treat open access modes as flags
O_RDONLY, O_WRONLY, and O_RDWR are not flags. Rather, they are the
integer values 0, 1, and 2, respectively.
#define O_RDONLY 00000000
#define O_WRONLY 00000001
#define O_RDWR 00000002
Quoting "man 2 open"
* File access mode *
Unlike the other values that can be specified in flags,
the access mode values O_RDONLY, O_WRONLY, and O_RDWR do not
specify individual bits. Rather, they define the low order
two bits of flags, and are defined respectively as 0, 1, and
2. In other words, the combination O_RDONLY | O_WRONLY is a
logical error, and certainly does not have the same meaning
as O_RDWR.
Linux reserves the special, nonstandard access mode 3
(binary 11) in flags to mean: check for read and write
permission on the file and return a file descriptor that
can't be used for reading or writing. This nonstandard access
mode is used by some Linux drivers to return a file
descriptor that is to be used only for device-specific
ioctl(2) operations.
Rather than treat these values like flags, use O_ACCMODE to extract the
values and then perform the comparisons.
Introduced in 63280e06fc64672ab36d14f852b13df2274cc328.
Test: android compiles and boots.
Change-Id: I4d3185e835615ffba3a7854d3d58351e124599d0
Diffstat (limited to 'rs/java/android/renderscript/ProgramFragmentFixedFunction.java')
0 files changed, 0 insertions, 0 deletions