public interface PosixAPI
| Modifier and Type | Method and Description |
|---|---|
default long |
clock_gettime()
Returns the current wall clock time in nanoseconds.
|
default long |
clock_gettime(ClockId clockId)
Returns the current wall clock time for a specific clock ID in nanoseconds.
|
long |
clock_gettime(int clockId)
Returns the current wall clock time for a specific clock ID in nanoseconds.
|
int |
close(int fd)
Closes a file descriptor.
|
default long |
du(String filename)
Calculates disk usage for a given filename.
|
int |
fallocate(int fd,
int mode,
long offset,
long length)
Allocates space for a file descriptor.
|
void |
free(long ptr)
Frees allocated memory.
|
int |
ftruncate(int fd,
long offset)
Truncates a file descriptor to a specified length.
|
int |
get_nprocs_conf()
Returns the number of configured processors.
|
int |
get_nprocs()
Returns the number of available processors.
|
int |
getpid()
Returns the process ID.
|
int |
gettid()
Returns the thread ID.
|
default long |
gettimeofday()
Returns the current wall clock time in microseconds.
|
int |
gettimeofday(long timeval)
Gets the current time of day.
|
int |
lastError()
Returns the last error code.
|
default String |
lastErrorStr()
Returns the last error message.
|
int |
lockf(int fd,
int cmd,
long len)
Locks a section of a file descriptor.
|
long |
lseek(int fd,
long offset,
int whence)
Repositions the read/write file offset.
|
default long |
lseek(int fd,
long offset,
WhenceFlag whence)
Repositions the read/write file offset.
|
int |
madvise(long addr,
long length,
int advice)
Advises the kernel about how to handle paging input/output.
|
default int |
madvise(long addr,
long length,
MAdviseFlag advice)
Advises the kernel about how to handle paging input/output.
|
long |
malloc(long size)
Allocates memory of a specified size.
|
default boolean |
mlock(long addr,
long length)
Locks a range of the process's virtual address space into RAM.
|
default boolean |
mlock2(long addr,
long length,
boolean lockOnFault)
Locks a range of the process's virtual address space into RAM.
|
default void |
mlockall(int flags)
Locks all current and future pages into RAM.
|
default void |
mlockall(MclFlag flags)
Locks all current and future pages into RAM.
|
long |
mmap(long addr,
long length,
int prot,
int flags,
int fd,
long offset)
Maps files or devices into memory.
|
default long |
mmap(long addr,
long length,
MMapProt prot,
MMapFlag flags,
int fd,
long offset)
Maps files or devices into memory.
|
int |
msync(long address,
long length,
int mode)
Synchronizes changes to a file with the storage device.
|
default int |
msync(long address,
long length,
MSyncFlag flags)
Synchronizes changes to a file with the storage device.
|
int |
munmap(long addr,
long length)
Unmaps files or devices from memory.
|
int |
open(CharSequence path,
int flags,
int perm)
Opens a file descriptor.
|
default int |
open(CharSequence path,
OpenFlag flags,
int perm)
Opens a file descriptor.
|
static PosixAPI |
posix() |
long |
read(int fd,
long dst,
long len)
Reads from a file descriptor.
|
default String |
sched_getaffinity_summary(int pid)
Returns a summary of the CPU affinity for a given process ID.
|
int |
sched_getaffinity(int pid,
int cpusetsize,
long mask)
Gets the CPU affinity for a process.
|
default int |
sched_setaffinity_as(int pid,
int cpu)
Sets the CPU affinity for a process to a specific CPU.
|
default int |
sched_setaffinity_range(int pid,
int from,
int to)
Sets the CPU affinity for a process to a range of CPUs.
|
int |
sched_setaffinity(int pid,
int cpusetsize,
long mask)
Sets the CPU affinity for a process.
|
String |
strerror(int errno)
Returns the error message for a given error code.
|
static void |
useNoOpPosixApi()
Sets the PosixAPI to a no-op implementation.
|
long |
write(int fd,
long src,
long len)
Writes to a file descriptor.
|
static PosixAPI posix()
static void useNoOpPosixApi()
int close(int fd)
fd - The file descriptor to close.int fallocate(int fd,
int mode,
long offset,
long length)
fd - The file descriptor.mode - The allocation mode.offset - The offset in the file.length - The length of the allocation.int ftruncate(int fd,
long offset)
fd - The file descriptor.offset - The length to truncate to.default long lseek(int fd,
long offset,
WhenceFlag whence)
fd - The file descriptor.offset - The offset to seek to.whence - The directive for how to seek.long lseek(int fd,
long offset,
int whence)
fd - The file descriptor.offset - The offset to seek to.whence - The directive for how to seek.int lockf(int fd,
int cmd,
long len)
fd - The file descriptor.cmd - The command to perform.len - The length of the section to lock.default int madvise(long addr,
long length,
MAdviseFlag advice)
addr - The address.length - The length.advice - The advice directive.int madvise(long addr,
long length,
int advice)
addr - The address.length - The length.advice - The advice directive.default long mmap(long addr,
long length,
MMapProt prot,
MMapFlag flags,
int fd,
long offset)
addr - The address.length - The length.prot - The desired memory protection.flags - The flags.fd - The file descriptor.offset - The offset.long mmap(long addr,
long length,
int prot,
int flags,
int fd,
long offset)
addr - The address.length - The length.prot - The desired memory protection.flags - The flags.fd - The file descriptor.offset - The offset.default boolean mlock(long addr,
long length)
addr - The address.length - The length.default boolean mlock2(long addr,
long length,
boolean lockOnFault)
addr - The address.length - The length.lockOnFault - Whether to lock on fault.default void mlockall(MclFlag flags)
flags - The flags.default void mlockall(int flags)
flags - The flags.default int msync(long address,
long length,
MSyncFlag flags)
address - The address.length - The length.flags - The flags.int msync(long address,
long length,
int mode)
address - The address.length - The length.mode - The synchronization mode.int munmap(long addr,
long length)
addr - The address.length - The length.default int open(CharSequence path, OpenFlag flags, int perm)
path - The path to the file.flags - The flags.perm - The permissions.int open(CharSequence path, int flags, int perm)
path - The path to the file.flags - The flags.perm - The permissions.long read(int fd,
long dst,
long len)
fd - The file descriptor.dst - The destination address.len - The number of bytes to read.long write(int fd,
long src,
long len)
fd - The file descriptor.src - The source address.len - The number of bytes to write.default long du(String filename) throws IOException
filename - The filename to calculate disk usage for.IOException - If an I/O error occurs.int gettimeofday(long timeval)
timeval - The address of the timeval structure.int sched_setaffinity(int pid,
int cpusetsize,
long mask)
pid - The process ID.cpusetsize - The size of the CPU set.mask - The CPU set mask.int sched_getaffinity(int pid,
int cpusetsize,
long mask)
pid - The process ID.cpusetsize - The size of the CPU set.mask - The CPU set mask.default String sched_getaffinity_summary(int pid)
pid - The process ID.int lastError()
default int sched_setaffinity_as(int pid,
int cpu)
pid - The process ID.cpu - The CPU to set affinity to.default int sched_setaffinity_range(int pid,
int from,
int to)
pid - The process ID.from - The starting CPU.to - The ending CPU.default long gettimeofday()
default long clock_gettime()
default long clock_gettime(ClockId clockId) throws IllegalArgumentException
clockId - The clock ID.IllegalArgumentException - If the clock ID is invalid.long clock_gettime(int clockId)
throws IllegalArgumentException
clockId - The clock ID.IllegalArgumentException - If the clock ID is invalid.long malloc(long size)
size - The size of the memory to allocate.void free(long ptr)
ptr - The address of the memory to free.int get_nprocs()
int get_nprocs_conf()
int getpid()
int gettid()
String strerror(int errno)
errno - The error code.default String lastErrorStr()
Copyright © 2024. All rights reserved.