public FileStat allocateStat() { return posix().allocateStat(); }
public FileStat allocateStat() { try { return posix.allocateStat(); } catch (UnsatisfiedLinkError ule) { return unimplementedNull(); } }
public FileStat allocateStat() { return posix().allocateStat(); }
public FileStat allocateStat() { try { return posix.allocateStat(); } catch (UnsatisfiedLinkError ule) { return unimplementedNull(); } }
public FileStat allocateStat() { return posix().allocateStat(); }
public FileStat allocateStat() { try { return posix.allocateStat(); } catch (UnsatisfiedLinkError ule) { return unimplementedNull(); } }
public FileStat allocateStat() { return posix().allocateStat(); }
public FileStat allocateStat() { try { return posix.allocateStat(); } catch (UnsatisfiedLinkError ule) { return unimplementedNull(); } }
@Override public FileStat stat() { FileStat stat = posix.allocateStat(); return posix.stat(file.getAbsolutePath(), stat) < 0 ? null : stat; }
@Override public FileStat lstat() { FileStat stat = posix.allocateStat(); return posix.lstat(file.getAbsolutePath(), stat) < 0 ? null : stat; }
@Override public FileStat lstat() { FileStat stat = posix.allocateStat(); return posix.lstat(file.getAbsolutePath(), stat) < 0 ? null : stat; }
@Override public FileStat stat() { FileStat stat = posix.allocateStat(); return posix.stat(file.getAbsolutePath(), stat) < 0 ? null : stat; }
public ChannelFD getWrapperFromFileno(int fileno) { ChannelFD fd = filenoMap.get(fileno); // This is a hack to get around stale ChannelFD that are closed when a descriptor is reused. // It appears to happen for openpty, and in theory could happen for any IO call that produces // a new descriptor. if (fd != null && !fd.ch.isOpen() && !isFake(fileno)) { FileStat stat = posix.allocateStat(); if (posix.fstat(fileno, stat) >= 0) { // found ChannelFD is closed, but actual fileno is open; clear it. filenoMap.remove(fileno); fd = null; } } return fd; }
public ChannelFD getWrapperFromFileno(int fileno) { ChannelFD fd = filenoMap.get(fileno); // This is a hack to get around stale ChannelFD that are closed when a descriptor is reused. // It appears to happen for openpty, and in theory could happen for any IO call that produces // a new descriptor. if (fd != null && !fd.ch.isOpen() && !isFake(fileno)) { FileStat stat = posix.allocateStat(); if (posix.fstat(fileno, stat) >= 0) { // found ChannelFD is closed, but actual fileno is open; clear it. filenoMap.remove(fileno); fd = null; } } return fd; }
public long size(ChannelFD fd) { if (fd.chNative != null) { // native fd, use fstat FileStat stat = posix.allocateStat(); int ret = posix.fstat(fd.chNative.getFD(), stat); if (ret == -1) { errno = Errno.valueOf(posix.errno()); return -1; } return stat.st_size(); } else if (fd.chSeek != null) { // if it is seekable, get size directly try { return fd.chSeek.size(); } catch (IOException ioe) { errno = Helpers.errnoFromException(ioe); return -1; } } else { // otherwise just return -1 (should be rare, since size is only defined on File errno = Errno.EINVAL; return -1; } }
public long size(ChannelFD fd) { if (fd.chNative != null) { // native fd, use fstat FileStat stat = posix.allocateStat(); int ret = posix.fstat(fd.chNative.getFD(), stat); if (ret == -1) { errno = Errno.valueOf(posix.errno()); return -1; } return stat.st_size(); } else if (fd.chSeek != null) { // if it is seekable, get size directly try { return fd.chSeek.size(); } catch (IOException ioe) { errno = Helpers.errnoFromException(ioe); return -1; } } else { // otherwise just return -1 (should be rare, since size is only defined on File errno = Errno.EINVAL; return -1; } }