On Fri, 3 Feb 2023 19:49:44 GMT, Justin King <jck...@openjdk.org> wrote:

> Avoid using `lseek` + `read` in favor of `pread`. For Windows, we can do the 
> same thing by using `OVERLAPPED`, as we are in synchronous mode we can use 
> `Offset` and `OffsetHigh` to achieve the same thing.
> 
> Additionally I updated open to use `O_CLOEXEC` when available, as that really 
> should be used.

Are you planning to include benchmark results to go with this change?

It should be okay to change readFullyAt to use pread, and ReadFile with an OV 
with the position. The latter has a side effect that it changes the file 
pointer but it should be okay in the zip code. One thing that the changes 
highlight is that this native file is begging to be refactoring into platform 
specific code (this isn't the PR to do that).

In passing, the JNI code use 4 space indent, not 2.

The O_CLOEXEC part is probably okay but if you look at the Runtime.exec/Process 
implementation you'll see that it isn't really because that code closes all 
file descriptors on exec.

-------------

PR: https://git.openjdk.org/jdk/pull/12417

Reply via email to