mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-28 07:14:30 +02:00
8313368: (fc) FileChannel.size returns 0 on block special files
Reviewed-by: vtewari, alanb
This commit is contained in:
parent
c1a3f143bf
commit
4ba81f631f
2 changed files with 11 additions and 5 deletions
|
@ -45,6 +45,11 @@
|
|||
#define fstatvfs64 fstatvfs
|
||||
#endif
|
||||
|
||||
#if defined(__linux__)
|
||||
#include <linux/fs.h>
|
||||
#include <sys/ioctl.h>
|
||||
#endif
|
||||
|
||||
#include "jni.h"
|
||||
#include "nio.h"
|
||||
#include "nio_util.h"
|
||||
|
@ -169,7 +174,7 @@ Java_sun_nio_ch_UnixFileDispatcherImpl_size0(JNIEnv *env, jobject this, jobject
|
|||
if (fstat64(fd, &fbuf) < 0)
|
||||
return handle(env, -1, "Size failed");
|
||||
|
||||
#ifdef BLKGETSIZE64
|
||||
#if defined(__linux__)
|
||||
if (S_ISBLK(fbuf.st_mode)) {
|
||||
uint64_t size;
|
||||
if (ioctl(fd, BLKGETSIZE64, &size) < 0)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue