[RFC] 4950302: (fs spec) Random write produces different results on Linux vs Windows from same .class

Florian Weimer fweimer at redhat.com
Tue Dec 17 11:58:45 UTC 2019


* David Lloyd:

> If toggling the mode is unacceptable, an
> also-not-so-great-but-should-work alternative workaround would be to
> open `/proc/self/fd/<fdnum>` and write to that (basically this works
> more or less like dup() but doesn't share file offset and flags).
> Then you're not toggling file modes - though it will of course fail if
> you run out of file descriptors.

And you cannot close the alternate descriptor because doing so would
release advisory locks on the first descriptor (as required by POSIX).

Thanks,
Florian



More information about the nio-dev mailing list