com.github.bloodshura.ignitium.ntv.lib.Unix Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of ignitium-native Show documentation
Show all versions of ignitium-native Show documentation
An API for working with native system APIs, with a higher-level interface.
The newest version!
package com.github.bloodshura.ignitium.ntv.lib;
import com.sun.jna.LastErrorException;
import com.sun.jna.Native;
import com.sun.jna.NativeLibrary;
import com.sun.jna.Pointer;
import com.sun.jna.Structure;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import java.util.List;
public final class Unix {
static {
Native.register(NativeLibrary.getInstance("c"));
}
private Unix() {
}
public static native int getpid();
public static native int getuid();
public static native long mrand48();
public static native long process_vm_readv(int pid, iovec local, long liovcnt, iovec remote, long riovcnt, long flags) throws LastErrorException;
public static native long process_vm_writev(int pid, iovec local, long liovcnt, iovec remote, long riovcnt, long flags) throws LastErrorException;
public static native void srand48(long seedval);
public static class iovec extends Structure {
public static final List FIELDS = createFieldsOrder("iov_base", "iov_len");
public Pointer iov_base;
public int iov_len;
@Override
protected List getFieldOrder() {
return FIELDS;
}
}
public static class Shm {
static {
Native.register(NativeLibrary.getInstance("c"));
}
@Nonnull
public static native Pointer shmat(int shmid, @Nullable Pointer shmaddr, int shmflg);
public static native int shmctl(int shmid, int cmd, @Nullable Pointer bufStructure);
public static native int shmdt(@Nonnull Pointer shmaddr);
public static native int shmget(int key, /* size_t */ int size, int shmflg);
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy