mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-28 07:14:30 +02:00
8262957: (fs) Fail fast in UnixFileStore.isExtendedAttributesEnabled
Reviewed-by: alanb
This commit is contained in:
parent
e2106d5af6
commit
27dd88bf9e
3 changed files with 21 additions and 2 deletions
|
@ -179,6 +179,11 @@ abstract class UnixFileStore
|
|||
* @return <code>true</code> if enabled, <code>false</code> if disabled or unable to determine
|
||||
*/
|
||||
protected boolean isExtendedAttributesEnabled(UnixPath path) {
|
||||
if (!UnixNativeDispatcher.xattrSupported()) {
|
||||
// avoid I/O if native code doesn't support xattr
|
||||
return false;
|
||||
}
|
||||
|
||||
int fd = -1;
|
||||
try {
|
||||
fd = path.openForAttributeAccess(false);
|
||||
|
|
|
@ -614,8 +614,9 @@ class UnixNativeDispatcher {
|
|||
*/
|
||||
private static final int SUPPORTS_OPENAT = 1 << 1; // syscalls
|
||||
private static final int SUPPORTS_FUTIMES = 1 << 2;
|
||||
private static final int SUPPORTS_FUTIMENS = 1 << 4;
|
||||
private static final int SUPPORTS_LUTIMES = 1 << 8;
|
||||
private static final int SUPPORTS_FUTIMENS = 1 << 3;
|
||||
private static final int SUPPORTS_LUTIMES = 1 << 4;
|
||||
private static final int SUPPORTS_XATTR = 1 << 5;
|
||||
private static final int SUPPORTS_BIRTHTIME = 1 << 16; // other features
|
||||
private static final int capabilities;
|
||||
|
||||
|
@ -654,6 +655,13 @@ class UnixNativeDispatcher {
|
|||
return (capabilities & SUPPORTS_BIRTHTIME) != 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Supports extended attributes
|
||||
*/
|
||||
static boolean xattrSupported() {
|
||||
return (capabilities & SUPPORTS_XATTR) != 0;
|
||||
}
|
||||
|
||||
private static native int init();
|
||||
static {
|
||||
jdk.internal.loader.BootLoader.loadLibrary("nio");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue