@SuppressWarnings("unchecked") public <T> FromNativeConverter<T, Pointer> getNativeConveter(Class<T> closureClass) { FromNativeConverter<T, Pointer> result = (FromNativeConverter<T, Pointer>) cache.get(closureClass); if (result != null) { return result; } result = (FromNativeConverter<T, Pointer>) ClosureFromNativeConverter. getInstance(Runtime.getSystemRuntime(), DefaultSignatureType.create(closureClass, (FromNativeContext) ctx), classLoader, ctm); cache.putIfAbsent(closureClass, result); return result; }
@SuppressWarnings("unchecked") public <T> FromNativeConverter<T, Pointer> getNativeConveter(Class<T> closureClass) { FromNativeConverter<T, Pointer> result = (FromNativeConverter<T, Pointer>) cache.get(closureClass); if (result != null) { return result; } result = (FromNativeConverter<T, Pointer>) ClosureFromNativeConverter. getInstance(Runtime.getSystemRuntime(), DefaultSignatureType.create(closureClass, (FromNativeContext) ctx), classLoader, ctm); cache.putIfAbsent(closureClass, result); return result; }
public static Timespec of(jnr.ffi.Pointer pointer) { Timespec timespec = new Timespec(jnr.ffi.Runtime.getSystemRuntime()); timespec.useMemory(pointer); return timespec; } }
public static FusePollhandle of(jnr.ffi.Pointer pointer) { FusePollhandle ph = new FusePollhandle(jnr.ffi.Runtime.getSystemRuntime()); ph.useMemory(pointer); return ph; } }
public static Flock of(jnr.ffi.Pointer pointer) { Flock flock = new Flock(jnr.ffi.Runtime.getSystemRuntime()); flock.useMemory(pointer); return flock; } }
public static Flock of(jnr.ffi.Pointer pointer) { Flock flock = new Flock(jnr.ffi.Runtime.getSystemRuntime()); flock.useMemory(pointer); return flock; } }
public static Statvfs of(jnr.ffi.Pointer pointer) { Statvfs statvfs = new Statvfs(jnr.ffi.Runtime.getSystemRuntime()); statvfs.useMemory(pointer); return statvfs; } }
public static FileStat of(jnr.ffi.Pointer memory) { FileStat stat = new FileStat(Runtime.getSystemRuntime()); stat.useMemory(memory); return stat; } }
public static FuseFileInfo of(jnr.ffi.Pointer pointer) { FuseFileInfo fi = new FuseFileInfo(jnr.ffi.Runtime.getSystemRuntime()); fi.useMemory(pointer); return fi; } }
public static FuseBufvec of(jnr.ffi.Pointer pointer) { FuseBufvec buf = new FuseBufvec(jnr.ffi.Runtime.getSystemRuntime()); buf.useMemory(pointer); return buf; }
public static FileStat of(jnr.ffi.Pointer memory) { FileStat stat = new FileStat(Runtime.getSystemRuntime()); stat.useMemory(memory); return stat; } }
public static FuseBufvec of(jnr.ffi.Pointer pointer) { FuseBufvec buf = new FuseBufvec(jnr.ffi.Runtime.getSystemRuntime()); buf.useMemory(pointer); return buf; }
public static FusePollhandle of(jnr.ffi.Pointer pointer) { FusePollhandle ph = new FusePollhandle(jnr.ffi.Runtime.getSystemRuntime()); ph.useMemory(pointer); return ph; } }
public static int setsockopt(int s, SocketLevel level, SocketOption optname, int optval) { if (optname == SocketOption.SO_RCVTIMEO || optname == SocketOption.SO_SNDTIMEO) { DefaultNativeTimeval t = new DefaultNativeTimeval(Runtime.getSystemRuntime()); t.setTime(new long [] {optval / 1000, ((long)optval % 1000) * 1000}); return libsocket().setsockopt(s, level.intValue(), optname.intValue(), t, DefaultNativeTimeval.size(t)); } else { ByteBuffer buf = ByteBuffer.allocate(4); buf.order(ByteOrder.nativeOrder()); buf.putInt(optval).flip(); return libsocket().setsockopt(s, level.intValue(), optname.intValue(), buf, buf.remaining()); } }
public void setName(String name) { if (name == null) { setNamePointer(null); setNameLen(0); return; } byte[] nameBytes = name.getBytes(Charset.forName("US-ASCII")); Pointer p = Runtime.getSystemRuntime().getMemoryManager().allocateTemporary(nameBytes.length, true); p.put(0, nameBytes, 0, nameBytes.length); setNamePointer(p); setNameLen(nameBytes.length); }
protected static void rb_sys_fail(Ruby runtime, String message) { final int n = LastError.getLastError(jnr.ffi.Runtime.getSystemRuntime()); RubyClass instance = runtime.getErrno(n); if(instance == null) { throw runtime.newSystemCallError(message); } else { throw runtime.newErrnoFromInt(n, message); } }
protected static void rb_sys_fail(Ruby runtime, String message) { final int n = LastError.getLastError(jnr.ffi.Runtime.getSystemRuntime()); RubyClass instance = runtime.getErrno(n); if(instance == null) { throw runtime.newSystemCallError(message); } else { throw runtime.newErrnoFromInt(n, message); } }
public void setIov(ByteBuffer[] buffers) { Pointer iov = Runtime.getSystemRuntime().getMemoryManager().allocateDirect(BaseIovec.layout.size() * buffers.length); for (int i = 0; i < buffers.length; ++i) { Pointer eachIovecPtr = iov.slice(BaseIovec.layout.size() * i); BaseIovec eachIovec = new BaseIovec(posix, eachIovecPtr); eachIovec.set(buffers[i]); } setIovPointer(iov); setIovLen(buffers.length); }
public void setIov(ByteBuffer[] buffers) { Pointer iov = Runtime.getSystemRuntime().getMemoryManager().allocateDirect(BaseIovec.layout.size() * buffers.length); for (int i = 0; i < buffers.length; ++i) { Pointer eachIovecPtr = iov.slice(BaseIovec.layout.size() * i); BaseIovec eachIovec = new BaseIovec(posix, eachIovecPtr); eachIovec.set(buffers[i]); } setIovPointer(iov); setIovLen(buffers.length); }
public void setIov(ByteBuffer[] buffers) { Pointer iov = Runtime.getSystemRuntime().getMemoryManager().allocateDirect(BaseIovec.layout.size() * buffers.length); for (int i = 0; i < buffers.length; ++i) { Pointer eachIovecPtr = iov.slice(BaseIovec.layout.size() * i); BaseIovec eachIovec = new BaseIovec(posix, eachIovecPtr); eachIovec.set(buffers[i]); } setIovPointer(iov); setIovLen(buffers.length); }