Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

O_RDONLY and friends are missing #3

Closed
ncw opened this issue Apr 28, 2017 · 9 comments
Closed

O_RDONLY and friends are missing #3

ncw opened this issue Apr 28, 2017 · 9 comments

Comments

@ncw
Copy link
Contributor

ncw commented Apr 28, 2017

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.

@ncw
Copy link
Contributor Author

ncw commented Apr 28, 2017

If you want I'll send a PR for this - I just wanted to make a note of this before a forgot!

@billziss-gh
Copy link
Collaborator

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.

@billziss-gh
Copy link
Collaborator

Ok, I am finishing some testing using CGODEBUG=cgocheck=2 (as per your suggestion in the rclone issue) and I will add those flags.

@billziss-gh
Copy link
Collaborator

Commit 67b4cc0 just added these flags. Testing it now.

@billziss-gh
Copy link
Collaborator

Merged into master.

@ncw
Copy link
Contributor Author

ncw commented Apr 28, 2017

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.

@billziss-gh
Copy link
Collaborator

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.

@billziss-gh
Copy link
Collaborator

Added with commit 3650807.

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.

@ncw
Copy link
Contributor Author

ncw commented Apr 28, 2017

That seems very sensible - thanks 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants