RFR: 8233451: (fs) Files.newInputStream() cannot be used with character special files

Brian Burkhalter bpb at openjdk.org
Tue Oct 15 15:21:13 UTC 2024


On Tue, 15 Oct 2024 05:15:53 GMT, Alan Bateman <alanb at openjdk.org> wrote:

>> Add `isOther` and `available` methods to `FileChannelImpl` and the interfaces to native code and use these in `ChannelInputStream` to work around cases where a wrapped `FileChannelImpl` is not really seekable.
>
> src/java.base/windows/native/libjava/io_util_md.h line 44:
> 
>> 42: WCHAR* currentDir(int di);
>> 43: int currentDirLength(const WCHAR* path, int pathlen);
>> 44: JNIEXPORT int handleAvailable(FD fd, jlong *pbytes);
> 
> This should not be exported.

Okay.

> src/java.base/windows/native/libnio/ch/FileDispatcherImpl.c line 402:
> 
>> 400:     HANDLE handle = (HANDLE)(handleval(env, fdo));
>> 401:     jlong available;
>> 402:     if (handleAvailable((jlong)handle, &available)) {
> 
> Ugh, we shouldn't be using handleAvailable here. This native method needs to stand on its own.

Yeah, I was not sure about that. I had a standalone version before this.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/21508#discussion_r1801398538
PR Review Comment: https://git.openjdk.org/jdk/pull/21508#discussion_r1801397285


More information about the nio-dev mailing list