for (int i = 1; i <= numTries; i++) { try { if (Platform.is64Bit()) { StatFS64 stat = new StatFS64(); StatFS64.statfs(path, stat);
private static String getMultiArchPath() { String cpu = Platform.ARCH; String kernel = Platform.iskFreeBSD() ? "-kfreebsd" : (Platform.isGNU() ? "" : "-linux"); String libc = "-gnu"; if (Platform.isIntel()) { cpu = (Platform.is64Bit() ? "x86_64" : "i386"); } else if (Platform.isPPC()) { cpu = (Platform.is64Bit() ? "powerpc64" : "powerpc"); } else if (Platform.isARM()) { cpu = "arm"; libc = "-gnueabi"; } else if (Platform.ARCH.equals("mips64el")) { libc = "-gnuabi64"; } return cpu + kernel + libc; }
public static boolean is64Bit() { return com.sun.jna.Platform.is64Bit(); } }
public static boolean is64Bit() { return com.sun.jna.Platform.is64Bit(); } }
public static boolean is64Bit() { return Platform.is64Bit(); }
public static boolean is64Bit() { return Platform.is64Bit(); }
/** * Instantiates a new media info exception. * * @param e * the e */ public MediaInfoException(LinkageError e) { this(String.format("Unable to load %d-bit native library 'mediainfo'", Platform.is64Bit() ? 64 : 32), e); }
public static String getCurrentOSAndArchString() { String os = System.getProperty("os.name"), arch = System.getProperty("os.arch"); if (os.equals("Mac OS X")) { os = "darwin"; arch = "fat"; //arch = Platform.is64Bit() ? "64" : "32"; } else if (os.startsWith("Windows")) { return "win" + (Platform.is64Bit() ? "64" : "32"); } else if (os.matches("SunOS|Solaris")) os = "solaris"; return os + "-" + arch; } public static String getLibraryPath(String libraryName, boolean extractAllLibraries, Class<?> cl) {
public static String getCurrentOSAndArchString() { String os = System.getProperty("os.name"), arch = System.getProperty("os.arch"); if (os.equals("Mac OS X")) { os = "darwin"; arch = "fat"; //arch = Platform.is64Bit() ? "64" : "32"; } else if (os.startsWith("Windows")) { return "win" + (Platform.is64Bit() ? "64" : "32"); } else if (os.matches("SunOS|Solaris")) os = "solaris"; return os + "-" + arch; } public static String getLibraryPath(String libraryName, boolean extractAllLibraries, Class<?> cl) {
@NotNull static String getPlatformArchFolderName() { // Handle special cases (xp, ppc64le) if (isWinXp()) return "xp"; if (System.getProperty("os.arch").equals("ppc64le")) return "ppc64le"; // Special cases handled, assume x86 return Platform.is64Bit() ? "x86_64" : "x86"; }
public static File getMicrosoftWindowsProgramFilesDirectory() { String propName = com.sun.jna.Platform.is64Bit() ? "ProgramFiles(x86)" : "ProgramFiles"; return new File(getProp(propName, "C:\\Program Files", true)); }
public static File getMicrosoftWindowsProgramFilesDirectory() { String propName = com.sun.jna.Platform.is64Bit() ? "ProgramFiles(x86)" : "ProgramFiles"; return new File(getProp(propName, "C:\\Program Files", true)); }
/** * Uses the OS architecture to reproduce the following logic from the epoll header: * <code><pre> * #ifdef __x86_64__ * #define EPOLL_PACKED __attribute__((packed)) * #else * #define EPOLL_PACKED * #endif * </pre></code> * * On x86-64 (amd64) platforms, {@code ALIGN_NONE} is used (to emulate {@code __attribute__((packed))}), * and on all other platforms {@code ALIGN_GNUC} is used. */ private static int detectAlignment() { return Platform.isIntel() && Platform.is64Bit() ? ALIGN_NONE : ALIGN_GNUC; }
private String readFileNameFromInput(LPARAM lParam) { Class structPlatformClass = (Platform.is64Bit()) ? PuttyStruct64.class : PuttyStruct32.class; PuttyStruct ps = (PuttyStruct) PuttyStruct.newInstance(structPlatformClass, new Pointer(lParam.longValue())); ps.read(); return new String(ps.lpData.getString(0).getBytes(Charset.forName("US-ASCII"))); }
private static String getMultiArchPath() { String cpu = Platform.ARCH; String kernel = Platform.iskFreeBSD() ? "-kfreebsd" : (Platform.isGNU() ? "" : "-linux"); String libc = "-gnu"; if (Platform.isIntel()) { cpu = (Platform.is64Bit() ? "x86_64" : "i386"); } else if (Platform.isPPC()) { cpu = (Platform.is64Bit() ? "powerpc64" : "powerpc"); } else if (Platform.isARM()) { cpu = "arm"; libc = "-gnueabi"; } else if (Platform.ARCH.equals("mips64el")) { libc = "-gnuabi64"; } return cpu + kernel + libc; }
public static void init() { File targetDirectory = extractJNABinariesIfAvailable(); addShutdownCleanupHook(targetDirectory); // this makes things work in Eclipse String classpath = System.getProperty("java.class.path"); String[] classpathEntries = classpath.split(File.pathSeparator); for(String entry : classpathEntries) { addNativePath(entry); } if(Platform.is64Bit()) { log.info("64-bit JVM detected - loading 64-bit libraries"); tryBitDepth(BitDepth.BIT_64, targetDirectory); } else { log.info("32-bit JVM detected - loading 32-bit libraries"); tryBitDepth(BitDepth.BIT_32, targetDirectory); } }
/** * Returns whether Microsoft Visual C++ 2012 Redistributable Package is * installed. * * @return */ public static boolean isWindowsVCRedist2012Installed() { if (SystemUtil.getOsName() != OsName.WINDOWS) { throw new UnreachableException(); } try { if (Platform.is64Bit()) { return Advapi32Util.registryGetIntValue( Advapi32Util.registryGetKey( WinReg.HKEY_LOCAL_MACHINE, "SOFTWARE\\Microsoft\\VisualStudio\\11.0\\VC\\Runtimes\\x64", WinNT.KEY_READ | WinNT.KEY_WOW64_32KEY).getValue(), "Installed") == 1; } else { return Advapi32Util.registryGetIntValue( WinReg.HKEY_LOCAL_MACHINE, "SOFTWARE\\Microsoft\\VisualStudio\\11.0\\VC\\Runtimes\\x86", "Installed") == 1; } } catch (Win32Exception e) { logger.error("Failed to read windows registry", e); return false; } }
public static void sched_setaffinity(final BitSet affinity) { final CLibrary lib = CLibrary.INSTANCE; final cpu_set_t cpuset = new cpu_set_t(); final int size = version.isSameOrNewer(VERSION_2_6) ? cpu_set_t.SIZE_OF_CPU_SET_T : NativeLong.SIZE; final long[] bits = affinity.toLongArray(); for (int i = 0; i < bits.length; i++) { if (Platform.is64Bit()) { cpuset.__bits[i].setValue(bits[i]); } else { cpuset.__bits[i * 2].setValue(bits[i] & 0xFFFFFFFFL); cpuset.__bits[i * 2 + 1].setValue((bits[i] >>> 32) & 0xFFFFFFFFL); } } try { if (lib.sched_setaffinity(0, size, cpuset) != 0) { throw new IllegalStateException("sched_setaffinity(0, " + size + ", 0x" + Utilities.toHexString(affinity) + ") failed; errno=" + Native.getLastError()); } } catch (LastErrorException e) { throw new IllegalStateException("sched_setaffinity(0, " + size + ", 0x" + Utilities.toHexString(affinity) + ") failed; errno=" + e.getErrorCode(), e); } }
if (lee.getErrorCode() == 38 && Platform.is64Bit()) { // unknown call final Pointer getcpuAddr = new Pointer((-10L << 20) + 1024L * 2L); final Function getcpu = Function.getFunction(getcpuAddr, Function.C_CONVENTION);
for (int i = 1; i <= numTries; i++) { try { if (Platform.is64Bit()) { StatFS64 stat = new StatFS64(); StatFS64.statfs(path, stat);