private static String libraryName() { switch (Platform.getNativePlatform().getOS()) { case WINDOWS: return "libsodium"; default: return "sodium"; } }
private String locateLibrary(String libraryName) { if (new File(libraryName).isAbsolute()) { return libraryName; } return Platform.getNativePlatform().locateLibrary(libraryName, searchPaths); }
private static String libraryName() { switch (Platform.getNativePlatform().getOS()) { case WINDOWS: return "libsodium"; default: return "sodium"; } }
private String locateLibrary(String libraryName) { if (new File(libraryName).isAbsolute()) { return libraryName; } return Platform.getNativePlatform().locateLibrary(libraryName, searchPaths); }
private String locateLibrary(String libraryName) { if (new File(libraryName).isAbsolute()) { return libraryName; } return Platform.getNativePlatform().locateLibrary(libraryName, searchPaths); }
private static Class<? extends LibC> libraryInterface() { switch (jnr.ffi.Platform.getNativePlatform().getOS()) { case LINUX: return LinuxLibC.class; case AIX: return AixLibC.class; case SOLARIS: return SolarisLibC.class; case WINDOWS: return WindowsLibC.class; default: return UnixLibC.class; } }
private static Class<? extends LibC> libraryInterface() { switch (jnr.ffi.Platform.getNativePlatform().getOS()) { case LINUX: return LinuxLibC.class; case AIX: return AixLibC.class; case SOLARIS: return SolarisLibC.class; case WINDOWS: return WindowsLibC.class; default: return UnixLibC.class; } }
private static Class<? extends LibC> libraryInterface() { switch (jnr.ffi.Platform.getNativePlatform().getOS()) { case LINUX: return LinuxLibC.class; case AIX: return AixLibC.class; case SOLARIS: return SolarisLibC.class; case WINDOWS: return WindowsLibC.class; default: return UnixLibC.class; } }
/** * Creates a new instance of <tt>SockAddrUnix</tt> * * @return An instance of <tt>SockAddrUnix</tt> */ static SockAddrUnix create() { return Platform.getNativePlatform().isBSD() ? new BSDSockAddrUnix() : new DefaultSockAddrUnix(); }
@Override public AbstractSelector openSelector() throws IOException { return Platform.getNativePlatform().isBSD() ? new KQSelector(this) : new PollSelector(this); }
public static void main(String[] args) { MemoryFS memfs = new MemoryFS(); try { String path; switch (Platform.getNativePlatform().getOS()) { case WINDOWS: path = "J:\\"; break; default: path = "/tmp/mntm"; } memfs.mount(Paths.get(path), true, true); } finally { memfs.umount(); } }
public static void main(String[] args) { MemoryFS memfs = new MemoryFS(); try { String path; switch (Platform.getNativePlatform().getOS()) { case WINDOWS: path = "J:\\"; break; default: path = "/tmp/mntm"; } memfs.mount(Paths.get(path), true, true); } finally { memfs.umount(); } }
private static String[] libraries() { switch (jnr.ffi.Platform.getNativePlatform().getOS()) { case LINUX: return new String[] { "libc.so.6" }; case SOLARIS: return new String[] { "socket", "nsl", "c" }; case AIX: return jnr.ffi.Runtime.getSystemRuntime().addressSize() == 4 ? new String[] { "libc.a(shr.o)" } : new String[] { "libc.a(shr_64.o)" }; case WINDOWS: return new String[] { "msvcrt", "kernel32" }; default: return new String[] { "c" }; } }
public static void main(String[] args) { HelloFuse stub = new HelloFuse(); try { String path; switch (Platform.getNativePlatform().getOS()) { case WINDOWS: path = "J:\\"; break; default: path = "/tmp/mnth"; } stub.mount(Paths.get(path), true, true); } finally { stub.umount(); } } }
public static void main(String[] args) { HelloFuse stub = new HelloFuse(); try { String path; switch (Platform.getNativePlatform().getOS()) { case WINDOWS: path = "J:\\"; break; default: path = "/tmp/mnth"; } stub.mount(Paths.get(path), true, true); } finally { stub.umount(); } } }
private static String convert(String sql) { if (Platform.getNativePlatform().getOS().equals(OS.WINDOWS)) { // '"' should be '\"' and '\' should be '\\' in Windows return sql.replace("\\\\", "\\").replace("\\", "\\\\").replace("\"", "\\\""); } return sql; } }
@Override public int statfs(String path, Statvfs stbuf) { if (Platform.getNativePlatform().getOS() == WINDOWS) { // statfs needs to be implemented on Windows in order to allow for copying // data from other devices because winfsp calculates the volume size based // on the statvfs call. // see https://github.com/billziss-gh/winfsp/blob/14e6b402fe3360fdebcc78868de8df27622b565f/src/dll/fuse/fuse_intf.c#L654 if ("/".equals(path)) { stbuf.f_blocks.set(1024 * 1024); // total data blocks in file system stbuf.f_frsize.set(1024); // fs block size stbuf.f_bfree.set(1024 * 1024); // free blocks in fs } } return super.statfs(path, stbuf); }
@Override public int statfs(String path, Statvfs stbuf) { if (Platform.getNativePlatform().getOS() == WINDOWS) { // statfs needs to be implemented on Windows in order to allow for copying // data from other devices because winfsp calculates the volume size based // on the statvfs call. // see https://github.com/billziss-gh/winfsp/blob/14e6b402fe3360fdebcc78868de8df27622b565f/src/dll/fuse/fuse_intf.c#L654 if ("/".equals(path)) { stbuf.f_blocks.set(1024 * 1024); // total data blocks in file system stbuf.f_frsize.set(1024); // fs block size stbuf.f_bfree.set(1024 * 1024); // free blocks in fs } } return super.statfs(path, stbuf); }
private static void assertPlatfomValue(Function<jnr.ffi.Runtime, Struct> structFunction) { Struct struct = structFunction.apply(Runtime.getSystemRuntime()); jnr.ffi.Platform.OS os = jnr.ffi.Platform.getNativePlatform().getOS(); PlatformSize size = sizes.get(struct.getClass()).get(os); assertEquals(Platform.IS_32_BIT ? size.x32 : size.x64, Struct.size(struct)); }
private static POSIX loadNativePOSIX(POSIXHandler handler) { switch (jnr.ffi.Platform.getNativePlatform().getOS()) { case DARWIN: return loadMacOSPOSIX(handler); case LINUX: return loadLinuxPOSIX(handler); case FREEBSD: return loadFreeBSDPOSIX(handler); case OPENBSD: return loadOpenBSDPOSIX(handler); case SOLARIS: return loadSolarisPOSIX(handler); case AIX: return loadAixPOSIX(handler); case WINDOWS: return loadWindowsPOSIX(handler); } return null; }