[crac] RFR: Adapted some FileDescriptor tests for Win

Radim Vansa rvansa at openjdk.org
Mon Jul 24 07:50:07 UTC 2023


On Mon, 24 Jul 2023 07:22:00 GMT, Roman Marchenko <rmarchenko at openjdk.org> wrote:

> Made changes regarding FileDescriptor for Win platorm, adapted some tests.

Did you have to alter JarFileFactory for windows specifically, or did you experience any rare failures on Linux, too?

src/java.base/windows/native/libjava/FileDescriptor_md.c line 118:

> 116:     }
> 117: 
> 118:     typedef NTSTATUS(WINAPI* NtQueryObjectFunc)(HANDLE, OBJECT_INFORMATION_CLASS, PVOID, ULONG, PULONG);

Rather than using a non-public function, would `GetFileInformationByHandle` work here? You can just test the file attributes matching https://learn.microsoft.com/en-us/windows/win32/fileio/file-attribute-constants

src/java.base/windows/native/libjava/FileDescriptor_md.c line 119:

> 117: 
> 118:     typedef NTSTATUS(WINAPI* NtQueryObjectFunc)(HANDLE, OBJECT_INFORMATION_CLASS, PVOID, ULONG, PULONG);
> 119:     typedef BOOL(WINAPI* GetFinalPathNameByHandleFunc)(HANDLE, LPSTR, DWORD, DWORD);

Do you need to load this function dynamically? Contrary to `NtQueryObject` it should be public, present in `fileapi.h`... https://learn.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-getvolumepathnamesforvolumenamew?redirectedfrom=MSDN

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

PR Review: https://git.openjdk.org/crac/pull/91#pullrequestreview-1542862763
PR Review Comment: https://git.openjdk.org/crac/pull/91#discussion_r1271865209
PR Review Comment: https://git.openjdk.org/crac/pull/91#discussion_r1271861151


More information about the crac-dev mailing list