public static HANDLE gethandle(FileDescriptor descriptor) { if (descriptor == null || ReflectiveAccess.FILE_DESCRIPTOR_HANDLE == null) return HANDLE.valueOf(-1); try { return gethandle(ReflectiveAccess.FILE_DESCRIPTOR_HANDLE.getLong(descriptor)); } catch (SecurityException e) { } catch (IllegalArgumentException e) { } catch (IllegalAccessException e) { } return HANDLE.valueOf(-1); }
@Override public boolean isatty(FileDescriptor fd) { HANDLE handle = JavaLibCHelper.gethandle(fd); int type = wlibc().GetFileType(handle); return type == FILE_TYPE_CHAR; }
@Override public boolean isatty(FileDescriptor fd) { HANDLE handle = JavaLibCHelper.gethandle(fd); int type = wlibc().GetFileType(handle); return type == FILE_TYPE_CHAR; }
@Override public int isatty(int fd) { HANDLE handle = JavaLibCHelper.gethandle(fd); int type = wlibc().GetFileType(handle); return type == FILE_TYPE_CHAR ? 1 : 0; }
@Override public boolean isatty(FileDescriptor fd) { HANDLE handle = JavaLibCHelper.gethandle(fd); int type = wlibc().GetFileType(handle); return type == FILE_TYPE_CHAR; }
@Override public boolean isatty(FileDescriptor fd) { HANDLE handle = helper.gethandle(fd); int type = wlibc().GetFileType(handle); return type == FILE_TYPE_CHAR; }
@Override public int fstat(FileDescriptor fileDescriptor, FileStat stat) { WindowsByHandleFileInformation info = new WindowsByHandleFileInformation(getRuntime()); if (wlibc().GetFileInformationByHandle(JavaLibCHelper.gethandle(fileDescriptor), info) == 0) return -1; ((WindowsRawFileStat) stat).setup(info); return 0; }
@Override public int fstat(FileDescriptor fileDescriptor, FileStat stat) { WindowsByHandleFileInformation info = new WindowsByHandleFileInformation(getRuntime()); if (wlibc().GetFileInformationByHandle(JavaLibCHelper.gethandle(fileDescriptor), info) == 0) return -1; ((WindowsRawFileStat) stat).setup(info); return 0; }
@Override public int fstat(FileDescriptor fileDescriptor, FileStat stat) { WindowsByHandleFileInformation info = new WindowsByHandleFileInformation(getRuntime()); if (wlibc().GetFileInformationByHandle(JavaLibCHelper.gethandle(fileDescriptor), info) == 0) return -1; ((WindowsRawFileStat) stat).setup(info); return 0; }
@Override public int fstat(FileDescriptor fileDescriptor, FileStat stat) { int fd = ((WindowsLibC) libc())._open_osfhandle(helper.gethandle(fileDescriptor), 0); try { return libc().fstat(fd, stat); } finally { ((WindowsLibC) libc())._close(fd); } }