public LinuxServent(jnr.ffi.Runtime runtime) { super(runtime); this.buf = Memory.allocateDirect(runtime, BUFLEN, true); } }
public Pointer toNative(WString value, ToNativeContext context) { if (value == null) { return null; } Pointer memory = Memory.allocateDirect(runtime, value.bytes.length + 1, true); memory.put(0, value.bytes, 0, value.bytes.length); return memory; }
LinuxNativeProtocolsDB(LinuxLibProto lib) { this.lib = lib; this.runtime = Library.getRuntime(lib); this.buf = Memory.allocateDirect(runtime, BUFLEN); }
LinuxServicesDB(LibServices lib) { super(lib); this.lib = (LinuxLibServices) lib; this.runtime = Library.getRuntime(lib); this.buf = Memory.allocateDirect(runtime, BUFLEN); }
public Pointer toNative(WString value, ToNativeContext context) { if (value == null) { return null; } Pointer memory = Memory.allocateDirect(runtime, value.bytes.length + 1, true); memory.put(0, value.bytes, 0, value.bytes.length); return memory; }
public Pointer allocatePosixSpawnattr() { return Memory.allocateDirect(getRuntime(), 8); } }
public Pointer toNative(WString value, ToNativeContext context) { if (value == null) { return null; } Pointer memory = Memory.allocateDirect(runtime, value.bytes.length + 1, true); memory.put(0, value.bytes, 0, value.bytes.length); return memory; }
public Pointer toNative(WString value, ToNativeContext context) { if (value == null) { return null; } Pointer memory = Memory.allocateDirect(runtime, value.bytes.length + 1, true); memory.put(0, value.bytes, 0, value.bytes.length); return memory; }
private X86Disassembler(UDis86 udis86) { this.udis86 = udis86; this.ud = Memory.allocateDirect(Runtime.getRuntime(udis86), 1024, true); this.udis86.ud_init(this.ud); }
private X86Disassembler(UDis86 udis86) { this.udis86 = udis86; this.ud = Memory.allocateDirect(Runtime.getRuntime(udis86), 1024, true); this.udis86.ud_init(this.ud); }
private X86Disassembler(UDis86 udis86) { this.udis86 = udis86; this.ud = Memory.allocateDirect(Runtime.getRuntime(udis86), 1024, true); this.udis86.ud_init(this.ud); }
void put(int idx, CharSequence str) { if (str == null) { memory.putAddress(idx * getRuntime().addressSize(), 0L); } else { ByteBuffer buf = charset.encode(CharBuffer.wrap(str)); Pointer ptr = Memory.allocateDirect(getRuntime(), buf.remaining() + 4, true); ptr.put(0, buf.array(), 0, buf.remaining()); stringMemory.add(idx, ptr); memory.putPointer(idx * getRuntime().addressSize(), ptr); } }
void put(int idx, CharSequence str) { if (str == null) { memory.putAddress(idx * getRuntime().addressSize(), 0L); } else { ByteBuffer buf = charset.encode(CharBuffer.wrap(str)); Pointer ptr = Memory.allocateDirect(getRuntime(), buf.remaining() + 4, true); ptr.put(0, buf.array(), 0, buf.remaining()); stringMemory.add(idx, ptr); memory.putPointer(idx * getRuntime().addressSize(), ptr); } }
private Pointer nativeFileActions(Collection<? extends SpawnFileAction> fileActions) { Pointer nativeFileActions = Memory.allocateDirect(getRuntime(), 128); ((UnixLibC) libc()).posix_spawn_file_actions_init(nativeFileActions); for (SpawnFileAction action : fileActions) { action.act(this, nativeFileActions); } return nativeFileActions; }
private Pointer nativeSpawnAttributes(Collection<? extends SpawnAttribute> spawnAttributes) { Pointer nativeSpawnAttributes = Memory.allocateDirect(getRuntime(), 128); ((UnixLibC) libc()).posix_spawnattr_init(nativeSpawnAttributes); for (SpawnAttribute action : spawnAttributes) { action.set(this, nativeSpawnAttributes); } return nativeSpawnAttributes; }
private Pointer nativeFileActions(Collection<? extends SpawnFileAction> fileActions) { Pointer nativeFileActions = Memory.allocateDirect(getRuntime(), 128); ((UnixLibC) libc()).posix_spawn_file_actions_init(nativeFileActions); for (SpawnFileAction action : fileActions) { action.act(this, nativeFileActions); } return nativeFileActions; }
public synchronized Protocol getProtocolByName(String name) { UnixProtoent protoent = new UnixProtoent(runtime); Pointer result = Memory.allocateDirect(runtime, runtime.addressSize()); if (lib.getprotobyname_r(name, protoent, buf, new NativeLong(BUFLEN), result) == 0) { return result.getPointer(0) != null ? protocolFromNative(protoent) : null; } throw new RuntimeException("getprotobyname_r failed"); }
public synchronized Service getServiceByName(String name, String proto) { UnixServent servent = new UnixServent(runtime); Pointer result = Memory.allocateDirect(runtime, runtime.addressSize()); if (lib.getservbyname_r(name, proto, servent, buf, new NativeLong(BUFLEN), result) == 0) { return result.getPointer(0) != null ? serviceFromNative(servent) : null; } throw new RuntimeException("getservbyname_r failed"); }
public KQSelector(NativeSelectorProvider provider) { super(provider); changebuf = Memory.allocateDirect(runtime, MAX_EVENTS * io.size()); eventbuf = Memory.allocateDirect(runtime, MAX_EVENTS * io.size()); Native.libc().pipe(pipefd); kqfd = Native.libc().kqueue(); io.put(changebuf, 0, pipefd[0], EVFILT_READ, EV_ADD); Native.libc().kevent(kqfd, changebuf, 1, null, 0, ZERO_TIMESPEC); }
public synchronized Service getServiceByPort(Integer port, String proto) { UnixServent servent = new UnixServent(runtime); Pointer result = Memory.allocateDirect(runtime, runtime.addressSize()); if (lib.getservbyport_r(htons(port), proto, servent, buf, new NativeLong(BUFLEN), result) == 0) { return result.getPointer(0) != null ? serviceFromNative(servent) : null; } throw new RuntimeException("getservbyport_r failed"); }