-
Notifications
You must be signed in to change notification settings - Fork 17.8k
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
x/sys/unix: does not define O_LARGEFILE for FreeBSD #48160
Comments
FreeBSD doesn't seem to have O_LARGEFILE defined. I don't see O_LARGEFILE in https://www.freebsd.org/cgi/man.cgi?query=open&sektion=2&format=html |
Correct, FreeBSD does not have (and does not need) |
I realise that it doesn't exist. But it exists on many other Unices, and might just be used by people who expect it to be there, without regard for platforms that have no need for it. so perhaps it would make sense to just define it 0 if it doesn't make sense, and is better solved in downstream wrappers like modernc, then we can close this issue. |
I think x/sys/unix is intentionally for OS-dependent stuff. You probably want to use build tags if you use an OS-specific feature. |
O_LARGEFILE is generally not a good idea on Linux these days anyway. It's meaningless on systems with 64-bit off_t by default, and gated behind _LARGEFILE64_SOURCE in C, though the documentation states that setting _FILE_OFFSET_BITS to 64 instead of using O_LARGEFILE is preferred (but if you're not careful can bite you when it comes to headers that use the non-LFS off_t). So, O_LARGEFILE needs to be phased out, not made more prevalent (and providing a stub definition that's 0 because software can't be bothered to check for Linux before using a Linux-specific define is just a lazy non-solution; somewhat ok in a leaf package, or internal to a library, but not something that should ever be exported by a library that others consume). |
Thanks. Sounds like we should not add O_LARGEFILE on FreeBSD. Closing. cc @ianlancetaylor @bradfitz @tklauser . Feel free to chime in if this is mistaken. Thanks. |
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
yes (this is the latest version)
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
I tried to use unix.O_LARGEFILE:
What did you expect to see?
like on the playground: https://play.golang.org/p/9EYN2Wd4xGD
What did you see instead?
in modernc or ccgo there's a work-around in place to define O_LARGEFILE as 0: https://gitlab.com/cznic/libc/-/issues/10
we believe this should be in x/sys/unix
The text was updated successfully, but these errors were encountered: