RFR: 8356127: (fs) UnixFileSystemProvider.implDelete could save a syscall in some cases [v2]

Alan Bateman alanb at openjdk.org
Thu May 8 19:12:52 UTC 2025


On Thu, 8 May 2025 18:23:37 GMT, Brian Burkhalter <bpb at openjdk.org> wrote:

>> Modify `UnixFileSystemProvider.implDelete` to attempt first to delete the file using `unlink` and, if that fails, fall back to using `rmdir` if the file is a directory.
>
> Brian Burkhalter has updated the pull request incrementally with one additional commit since the last revision:
> 
>   8356127: Add capability check for EISDIR

src/java.base/unix/classes/sun/nio/fs/UnixNativeDispatcher.java line 552:

> 550:      */
> 551:     static boolean eisdirSupported() {
> 552:         return (capabilities & SUPPORTS_EISDIR) != 0;

The approach in this version looks much better. Need to find a better name for the capability and method name as "EISDIR" is supported on all Unix/like platforms. I think we want something to convey unlink detects directories or fails for directories.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/25107#discussion_r2080318690


More information about the nio-dev mailing list