diff --git a/src/java.base/unix/native/libjava/io_util_md.c b/src/java.base/unix/native/libjava/io_util_md.c index 794c3b7cd7c..e207c57d49b 100644 --- a/src/java.base/unix/native/libjava/io_util_md.c +++ b/src/java.base/unix/native/libjava/io_util_md.c @@ -32,6 +32,9 @@ #if defined(__linux__) || defined(_ALLBSD_SOURCE) || defined(_AIX) #include +#endif + +#if defined(__linux__) #include #include #endif @@ -250,7 +253,7 @@ handleGetLength(FD fd) if (result < 0) { return -1; } - #ifdef BLKGETSIZE64 +#if defined(__linux__) && defined(BLKGETSIZE64) if (S_ISBLK(sb.st_mode)) { uint64_t size; if(ioctl(fd, BLKGETSIZE64, &size) < 0) { @@ -258,6 +261,6 @@ handleGetLength(FD fd) } return (jlong)size; } - #endif +#endif return sb.st_size; }