public Timeval allocateTimeval() { return new DefaultNativeTimeval(getRuntime()); }
private FileTime unixTimeToFileTime(long unixTimeSeconds) { // FILETIME is a 64-bit unsigned integer representing // the number of 100-nanosecond intervals since January 1, 1601 // UNIX timestamp is number of seconds since January 1, 1970 // 116444736000000000 = 10_000_000 * 60 * 60 * 24 * 365 * 369 + 89 leap days long ft = (unixTimeSeconds + 11644473600L) * 10000000L; //long ft = CommonFileInformation.asNanoSeconds(unixTimeSeconds); FileTime fileTime = new FileTime(getRuntime()); fileTime.dwLowDateTime.set(ft & 0xFFFFFFFFL); fileTime.dwHighDateTime.set((ft >> 32) & 0xFFFFFFFFL); return fileTime; }
private FileTime unixTimeToFileTime(long unixTime) { // FILETIME is a 64-bit unsigned integer representing // the number of 100-nanosecond intervals since January 1, 1601 // UNIX timestamp is number of seconds since January 1, 1970 // 116444736000000000 = 10000000 * 60 * 60 * 24 * 365 * 369 + 89 leap days long ft = (unixTime + 11644473600L) * 10000000L; FileTime fileTime = new FileTime(getRuntime()); fileTime.dwLowDateTime.set(ft & 0xFFFFFFFFL); fileTime.dwHighDateTime.set((ft >> 32) & 0xFFFFFFFFL); return fileTime; }
private FileTime nullFileTime() { FileTime fileTime = new FileTime(getRuntime()); fileTime.dwLowDateTime.set(0); fileTime.dwHighDateTime.set(0); return fileTime; }
private FileTime unixTimeToFileTime(long unixTimeSeconds) { // FILETIME is a 64-bit unsigned integer representing // the number of 100-nanosecond intervals since January 1, 1601 // UNIX timestamp is number of seconds since January 1, 1970 // 116444736000000000 = 10_000_000 * 60 * 60 * 24 * 365 * 369 + 89 leap days long ft = (unixTimeSeconds + 11644473600L) * 10000000L; //long ft = CommonFileInformation.asNanoSeconds(unixTimeSeconds); FileTime fileTime = new FileTime(getRuntime()); fileTime.dwLowDateTime.set(ft & 0xFFFFFFFFL); fileTime.dwHighDateTime.set((ft >> 32) & 0xFFFFFFFFL); return fileTime; }
/** * * @param unixEpochIn100ns epoch time in 100-ns precision * @return associated FILETIME structure */ private FileTime unixTimeToFileTime(long unixEpochIn100ns) { // FILETIME is a 64-bit unsigned integer representing // the number of 100-nanosecond intervals since January 1, 1601 // UNIX timestamp is number of seconds since January 1, 1970 // 116444736000000000 = 10_000_000 * 60 * 60 * 24 * 365 * 369 + 89 leap days long ft = 116444736000000000L + unixEpochIn100ns; //long ft = CommonFileInformation.asNanoSeconds(unixTimeSeconds); FileTime fileTime = new FileTime(getRuntime()); fileTime.dwLowDateTime.set(ft & 0xFFFFFFFFL); fileTime.dwHighDateTime.set((ft >> 32) & 0xFFFFFFFFL); return fileTime; }
@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 Pointer environ() { return getRuntime().getMemoryManager().newPointer(wlibc()._environ().get()); }
@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 Pointer environ() { return getRuntime().getMemoryManager().newPointer(wlibc()._environ().get()); }
@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 Pointer environ() { return getRuntime().getMemoryManager().newPointer(wlibc()._environ().get()); }
public int findFirstFile(String path, FileStat stat) { byte[] wpath = WString.path(path, true); WindowsFindData findData = new WindowsFindData(getRuntime()); HANDLE handle = wlibc().FindFirstFileW(wpath, findData); if (!handle.isValid()) return -1; wlibc().FindClose(handle); ((WindowsRawFileStat) stat).setup(path, findData); return 0; }
public int findFirstFile(String path, FileStat stat) { byte[] wpath = WString.path(path, true); WindowsFindData findData = new WindowsFindData(getRuntime()); HANDLE handle = wlibc().FindFirstFileW(wpath, findData); if (!handle.isValid()) return -1; wlibc().FindClose(handle); ((WindowsRawFileStat) stat).setup(path, findData); return 0; }
public int findFirstFile(String path, FileStat stat) { byte[] wpath = WString.path(path, true); WindowsFindData findData = new WindowsFindData(getRuntime()); HANDLE handle = wlibc().FindFirstFileW(wpath, findData); if (!handle.isValid()) return -1; wlibc().FindClose(handle); ((WindowsRawFileStat) stat).setup(path, findData); return 0; }
@Override public int stat(String path, FileStat stat) { WindowsFileInformation info = new WindowsFileInformation(getRuntime()); byte[] wpath = WString.path(path, true); if (wlibc().GetFileAttributesExW(wpath, 0, info) != 0) { ((WindowsRawFileStat) stat).setup(path, info); } else { int e = errno(); if (e == ERROR_FILE_NOT_FOUND.intValue() || e == ERROR_PATH_NOT_FOUND.intValue() || e == ERROR_BAD_NETPATH.intValue()) { return -1; } return findFirstFile(path, stat); } return 0; }
securityAttributes = new WindowsSecurityAttributes(getRuntime()); WindowsStartupInfo startupInfo = new WindowsStartupInfo(getRuntime()); WindowsProcessInformation processInformation = new WindowsProcessInformation(getRuntime());
securityAttributes = new WindowsSecurityAttributes(getRuntime()); WindowsStartupInfo startupInfo = new WindowsStartupInfo(getRuntime()); WindowsProcessInformation processInformation = new WindowsProcessInformation(getRuntime());
@Override public int stat(String path, FileStat stat) { WindowsFileInformation info = new WindowsFileInformation(getRuntime()); byte[] wpath = WString.path(path, true); if (wlibc().GetFileAttributesExW(wpath, 0, info) != 0) { ((WindowsRawFileStat) stat).setup(path, info); } else { int e = errno(); if (e == ERROR_FILE_NOT_FOUND.intValue() || e == ERROR_PATH_NOT_FOUND.intValue() || e == ERROR_BAD_NETPATH.intValue()) { return -1; } return findFirstFile(path, stat); } return 0; }
@Override public int stat(String path, FileStat stat) { WindowsFileInformation info = new WindowsFileInformation(getRuntime()); byte[] wpath = WString.path(path, true); if (wlibc().GetFileAttributesExW(wpath, 0, info) != 0) { ((WindowsRawFileStat) stat).setup(path, info); } else { int e = errno(); if (e == ERROR_FILE_NOT_FOUND.intValue() || e == ERROR_PATH_NOT_FOUND.intValue() || e == ERROR_BAD_NETPATH.intValue()) { return -1; } return findFirstFile(path, stat); } return 0; }