Closed ncw closed 7 years ago
If you want I'll send a PR for this - I just wanted to make a note of this before a forgot!
Good catch. We would have to make it cross-platform (constants are not same on UNIX and Windows).
If you have the code ready you can send a PR. Otherwise I will add it and make sure it is correct on all supported platforms.
Ok, I am finishing some testing using CGODEBUG=cgocheck=2
(as per your suggestion in the rclone issue) and I will add those flags.
Commit 67b4cc0079281d71c50adc57badb53685a84f225 just added these flags. Testing it now.
Merged into master.
Super - thank you :-)
O_ACCMODE would be useful too for masking whether the mode is read or write. Here is the libc doc it says GNU only, but it is mentioned in the posix fnctl docs. Note sure whether that is supported on Windows though.
MSVC does not define O_ACCMODE
. It turns out that Mingw does as:
#define _O_ACCMODE (_O_RDONLY|_O_WRONLY|_O_RDWR)
So I will add a similar definition to fuse.go
.
Added with commit 3650807204ba06ebebf426b2a22b0f4b177ff595.
Please note that on Windows O_RDONLY == 0
, O_WRONLY == 1
and O_RDWR == 2
. So do not assume that O_RDONLY|O_WRONLY == O_RDWR
.
That seems very sensible - thanks :+1:
Normally I'd read O_RDONLY from syscall, but I don't think that will work on Windows, so thsese constants need to be duplicated in cgofuse.
These are necessary when working out which mode to open a file in (read or write) when the flags just can't be passed on.