public interface LinuxNativeUtil extends PosixNativeUtil
| Modifier and Type | Interface and Description |
|---|---|
static class |
LinuxNativeUtil.lseek_whence |
| Modifier and Type | Method and Description |
|---|---|
String |
__get_cpuid_count_model()
Returns the CPU Model string.
|
int[] |
__get_cpuid_count(int code,
int subcode)
queries the cpu for info.
|
void |
bind(int fd,
Sockaddr sockaddr)
Binds a socket to a address.
|
void |
chdir(String path)
Changes the work directory of the entire jvm process.
|
void |
chmod(String path,
int mode)
change file modifier
|
void |
chown(String path,
int uid,
int gid) |
void |
close(int fd)
Close a file descriptor
|
void |
connect(int fd,
Sockaddr sockaddr)
calls connect using a generic socket address.
|
void |
fchmod(int fd,
int mode) |
void |
fchown(int fd,
int uid,
int gid) |
int |
fcntl(int fd,
int code) |
int |
fcntl(int fd,
int code,
byte[] param,
int off) |
int |
fcntl(int fd,
int code,
int param) |
int |
fcntl(int fd,
int code,
long param) |
int |
fcntl(int fd,
int code,
NativeMemory param,
long off) |
InetSocketAddress |
from_sockaddr_in(Sockaddr sockaddr)
returns a
InetSocketAddress for the given native socket address |
String |
from_sockaddr_un(Sockaddr sockaddr)
returns the String path from a native unix socket address.
|
long |
from_struct_timeval(byte[] timeval)
Converts a native timeval to a long (milliseconds)
|
Stat |
fstat(int descriptor)
Gets information about a opened file descriptor
|
void |
fsync(int fd) |
void |
ftruncate(int fd,
long len) |
String |
getenv(String key)
Get an environment variable.
|
long |
geteuid()
returns the effective uid of the user running the process.
|
int |
getFD(FileDescriptor fd) |
Group |
getgrgid_r(long group)
Returns info about a group.
|
long[] |
getgrouplist(String user,
long group)
Returns group list for given username
|
LinuxConstProvider |
getLinuxConstProvider() |
String |
getlogin_r()
Returns the username of the current user
|
int |
getpagesize()
Returns the page size of the operating system in bytes.
|
int |
getPointerSize()
Returns size of void* datatype in bytes.
|
Passwd |
getpwnam_r(String user)
Returns user information about a given user.
|
Passwd |
getpwuid_r(long id)
Returns user information about a given user by uid
|
void |
getsockname(int fd,
Sockaddr sockaddr)
Writes the socket address the socket is bound to into the given Sockaddr object.
|
int |
getsockopt(int fd,
int level,
int optname)
returns a "int" socket option.
|
byte[] |
getsockopt(int fd,
int level,
int optname,
int payloadSize)
returns a custom payload socket option.
|
long |
getuid()
returns the real uid of the user running the process.
|
String |
if_indextoname(int index)
Returns the interface name as a string or null if the index is not found.
|
Collection<IfNameIndex> |
if_nameindex()
returns all network interface indices
|
int |
if_nametoindex(String name)
returns the interface index or 0 if the interface is not found
|
InputStream |
inputStreamFromFD(int fd,
boolean close)
Returns a input stream that will read bytes from the filedescriptor by calling the read method.
|
int |
ioctl(int fd,
int code)
trigger an ioctl with a device.
|
int |
ioctl(int fd,
int code,
byte[] buf,
int off)
trigger an ioctl with a device.
|
int |
ioctl(int fd,
int code,
long param)
trigger an ioctl with a device.
|
int |
ioctl(int fd,
int code,
NativeMemory mem,
long off)
trigger an ioctl with a device.
|
void |
lchown(String path,
int uid,
int gid) |
void |
link(String target,
String linkpath)
Creates a hard link pointing to target.
|
long |
lseek(int fd,
long off,
LinuxNativeUtil.lseek_whence whence) |
Stat |
lstat(String path)
Identical to stat.
|
void |
madvise(long ptr,
long length,
int advice) |
boolean |
malloc_trim(long pad)
Note: this method throws
UnsupportedOperationException on libc musl! |
NativeMemory |
malloc(long size)
Allocates a new pointer of the given size
|
int |
memfd_create(String name,
int flags) |
void |
mkfifo(String name,
int mode) |
long |
mmap(int fd,
long length,
int flags,
boolean read,
boolean write,
long offset)
Maps a file descriptor into memory.
|
void |
msync(long ptr,
long off,
long len,
boolean invalidate)
Sync memory mapping to disk
|
void |
munmap(long ptr,
long size)
Unmap a pointer
|
int |
open(String path,
int flags)
returns the fd
|
int |
open(String path,
int flags,
int mode)
returns the fd
|
OutputStream |
outputStreamFromFD(int fd,
boolean close)
Returns a output stream that will write bytes to the filedescriptor by calling the write method.
|
Collection<Cmsghdr> |
parseCMSG_HDR(byte[] msg_control,
int msg_controllen)
Parse the CMSG header in the byte array.
|
NativeMemory |
pointer(long ptr,
long size,
PointerHandler handler)
Any calls to the resulting NativeMemory may cause the JVM to die due to a SEGFAULT is size is not specified correctly.
|
int |
poll(PollFD[] fds,
int timeout)
timeout in milliseconds
|
void |
pthread_cond_broadcast(long condition) |
void |
pthread_cond_destroy(long condition) |
void |
pthread_cond_init(long condition,
long attributes) |
void |
pthread_cond_signal(long condition) |
boolean |
pthread_cond_timedwait(long condition,
long mutex,
long timeout) |
void |
pthread_cond_wait(long condition,
long mutex) |
void |
pthread_condattr_destroy(long attributes) |
int |
pthread_condattr_getpshared(long attributes) |
void |
pthread_condattr_init(long attributes) |
void |
pthread_condattr_setpshared(long attributes,
int value) |
void |
pthread_mutex_consistent(long mutex) |
void |
pthread_mutex_destroy(long mutex) |
void |
pthread_mutex_init(long mutex,
long attributes) |
void |
pthread_mutex_lock(long mutex) |
boolean |
pthread_mutex_timedlock(long mutex,
long timeout) |
boolean |
pthread_mutex_trylock(long mutex) |
void |
pthread_mutex_unlock(long mutex) |
void |
pthread_mutexattr_destroy(long attributes) |
int |
pthread_mutexattr_getpshared(long attributes) |
int |
pthread_mutexattr_getrobust(long attributes) |
int |
pthread_mutexattr_gettype(long attributes) |
void |
pthread_mutexattr_init(long attributes) |
void |
pthread_mutexattr_setpshared(long attributes,
int value) |
void |
pthread_mutexattr_setrobust(long attributes,
int value) |
void |
pthread_mutexattr_settype(long attributes,
int value) |
int |
read(int fd,
byte[] buffer,
int off,
int len)
Reads from a file descriptor.
|
int |
read(int fd,
ByteBuffer buf,
int len)
Reads from a file descriptor.
|
int |
read(int fd,
NativeMemory mem,
long off,
int len)
Reads from a file descriptor.
|
String |
readlink(String path)
returns the resolved path of the symlink
|
String |
realpath(String path)
resolves all symbolic links in the given path.
|
int |
recvfrom(int fd,
byte[] buffer,
int off,
int len,
int flags,
Sockaddr sockaddr)
The Output parameter sockaddr may be null if you are not interested in this information.
|
int |
recvmsg(int fd,
Msghdr msghdr,
int flags)
receive a message on a socket.
|
void |
sem_close(long sem) |
void |
sem_destroy(long sem) |
int |
sem_getvalue(long sem) |
void |
sem_init(long sem,
boolean interprocess,
int value)
Initializes an unnamed semaphore.
|
long |
sem_open(String name,
int oflags) |
long |
sem_open(String name,
int oflags,
int mode,
int value) |
void |
sem_post(long sem) |
int |
sem_t_size()
Returns the size of sem_t in bytes.
|
boolean |
sem_timedwait(long sem,
long timeoutInMillis) |
boolean |
sem_trywait(long sem) |
void |
sem_unlink(String name) |
void |
sem_wait(long sem) |
int |
sendmsg(int fd,
Msghdr msghdr,
int flags)
send a message on a socket.
|
void |
setenv(String key,
String value,
boolean overwrite)
Set an environment variable.
|
void |
setsockopt(int fd,
int level,
int optname,
byte[] payload)
Sets a custom payload socket option.
|
void |
setsockopt(int fd,
int level,
int optname,
int payload)
sets a int socket option.
|
int |
shm_open(String name,
int oflag,
int mode) |
void |
shm_unlink(String name) |
long |
sizeof_pthread_cond_t() |
long |
sizeof_pthread_condattr_t() |
long |
sizeof_pthread_mutex_t() |
long |
sizeof_pthread_mutexattr_t() |
int |
socket(int domain,
int type,
int protocol)
See man socket for information on the parameters.
|
Stat |
stat(String path)
Gets information about a file for a given path.
|
Statvfs |
statvfs(String path) |
String |
strerror_r(int errno)
Returns a english string repesentation of the native error code
|
void |
symlink(String target,
String linkpath)
Creates a symlink pointing to target.
|
Sockaddr |
to_sockaddr_in(InetSocketAddress address)
returns a native struct sockaddr_in or sockaddr_in6 for the given address
|
Sockaddr |
to_sockaddr_un(String path)
returns native struct sockaddr_un for given path.
|
byte[] |
to_struct_timeval(long milliseconds)
Converts a time value in milliseconds to a native timeval.
|
void |
truncate(String name,
long len) |
void |
unlink(String path)
Unlinks a link
|
void |
unsetenv(String key)
removes a enviroment variable if it exists.
|
String[] |
wordexp(String expression,
boolean allowCommands,
boolean useStdErr,
boolean allowUndef)
performs word expansion like a posix-shell.
|
int |
write(int fd,
byte[] buffer,
int off,
int len)
Write to a file descriptor
returns the number of bytes written from the buffer.
|
int |
write(int fd,
ByteBuffer buf,
int len)
Write to a file descriptor
returns the number of bytes written from the buffer.
|
int |
write(int fd,
NativeMemory mem,
long off,
int len)
Write to a file descriptor
returns the number of bytes written from the buffer.
|
unameLinuxConstProvider getLinuxConstProvider()
int getFD(FileDescriptor fd)
int getPointerSize()
InputStream inputStreamFromFD(int fd, boolean close)
OutputStream outputStreamFromFD(int fd, boolean close)
int[] __get_cpuid_count(int code,
int subcode)
__get_cpuid_count in interface PosixNativeUtilString __get_cpuid_count_model()
__get_cpuid_count_model in interface PosixNativeUtilint if_nametoindex(String name) throws UnknownNativeErrorException
UnknownNativeErrorExceptionString if_indextoname(int index) throws UnknownNativeErrorException
UnknownNativeErrorExceptionCollection<IfNameIndex> if_nameindex() throws UnknownNativeErrorException
UnknownNativeErrorExceptionint open(String path, int flags) throws AccessDeniedException, QuotaExceededException, IOException, FileSystemLoopException, InvalidPathException, FileNotFoundException, ReadOnlyFileSystemException, UnknownNativeErrorException
int open(String path, int flags, int mode) throws AccessDeniedException, QuotaExceededException, IOException, FileSystemLoopException, InvalidPathException, FileNotFoundException, ReadOnlyFileSystemException, UnknownNativeErrorException
long lseek(int fd,
long off,
LinuxNativeUtil.lseek_whence whence)
throws IOException,
InvalidFileDescriptorException,
UnknownNativeErrorException
byte[] to_struct_timeval(long milliseconds)
long from_struct_timeval(byte[] timeval)
NullPointerException - if the array is nullArrayIndexOutOfBoundsException - if the array is too small.Sockaddr to_sockaddr_in(InetSocketAddress address) throws IllegalArgumentException
IllegalArgumentException - if the address returns invalid/null/non ipv4|6 values for port or address.InetSocketAddress from_sockaddr_in(Sockaddr sockaddr) throws IllegalArgumentException
InetSocketAddress for the given native socket addressIllegalArgumentException - if Sockaddr is not AF_INET or AF_INET6 or Sockaddr.address has wrong length for its respective protocol.Sockaddr to_sockaddr_un(String path) throws IllegalArgumentException
IllegalArgumentException - if path is too long (>107 characters)String from_sockaddr_un(Sockaddr sockaddr) throws IllegalArgumentException
IllegalArgumentException - if Sockaddr is not AF_UNIX, has invalid size or last byte in address is not 0.int socket(int domain,
int type,
int protocol)
throws IllegalArgumentException,
UnsupportedOperationException,
AccessDeniedException,
QuotaExceededException,
UnknownNativeErrorException
IllegalArgumentException - if the arguments are invalidUnsupportedOperationException - if the protocol or address family is not supported by the operating system.AccessDeniedException - if the process does not have permission to create a socket of the requested type.QuotaExceededException - if the limit of file descriptors/sockets has been reached for the process/systemUnknownNativeErrorException - protocol specific errors depends on input parameters.OperationInProgressException - if a timeout has been specified.
call poll with POLLOUT+POLLERR to check if it is done
or call close() to cancel.int poll(PollFD[] fds, int timeout) throws IllegalArgumentException, UnknownNativeErrorException
int read(int fd,
byte[] buffer,
int off,
int len)
throws InvalidFileDescriptorException,
IllegalArgumentException,
IOException,
UnknownNativeErrorException
int read(int fd,
NativeMemory mem,
long off,
int len)
throws InvalidFileDescriptorException,
IllegalArgumentException,
IOException,
UnknownNativeErrorException
int read(int fd,
ByteBuffer buf,
int len)
throws InvalidFileDescriptorException,
IllegalArgumentException,
IOException,
UnknownNativeErrorException
void fsync(int fd)
throws InvalidFileDescriptorException,
IOException,
ReadOnlyFileSystemException
int write(int fd,
byte[] buffer,
int off,
int len)
throws InvalidFileDescriptorException,
IllegalArgumentException,
IOException,
UnknownNativeErrorException
int write(int fd,
NativeMemory mem,
long off,
int len)
throws InvalidFileDescriptorException,
IllegalArgumentException,
IOException,
UnknownNativeErrorException
int write(int fd,
ByteBuffer buf,
int len)
throws InvalidFileDescriptorException,
IllegalArgumentException,
IOException,
UnknownNativeErrorException
int recvfrom(int fd,
byte[] buffer,
int off,
int len,
int flags,
Sockaddr sockaddr)
throws InvalidFileDescriptorException,
IllegalArgumentException,
IOException,
UnknownNativeErrorException
fd - file descriptor to the socket.buffer - the buffer, must not be null.off - offset in the bufferlen - max len of bytes to fill into buffer. If you are receiving datagrams then any excess bytes may be discarded.flags - flags for recvfrom.sockaddr - This param will contain the info from where the data was received. Pass null if you don't care about this info.InvalidFileDescriptorExceptionIllegalArgumentExceptionIOExceptionUnknownNativeErrorExceptionint recvmsg(int fd,
Msghdr msghdr,
int flags)
throws InvalidFileDescriptorException,
IllegalArgumentException,
IOException,
ConnectException,
UnknownNativeErrorException
fd - the file descriptorInvalidFileDescriptorExceptionIllegalArgumentExceptionIOExceptionConnectExceptionUnknownNativeErrorExceptionint sendmsg(int fd,
Msghdr msghdr,
int flags)
throws InvalidFileDescriptorException,
IllegalArgumentException,
IOException,
ConnectException,
UnknownNativeErrorException
int getpagesize()
Collection<Cmsghdr> parseCMSG_HDR(byte[] msg_control, int msg_controllen)
msg_control - from Msghdrlong mmap(int fd,
long length,
int flags,
boolean read,
boolean write,
long offset)
throws IllegalArgumentException,
QuotaExceededException,
InvalidFileDescriptorException,
AccessDeniedException,
IllegalStateException,
UnsupportedOperationException
fd - the file descriptor.length - flags - read - write - offset - file offset for the memory mapping. Only matters if the fd refers to a file.IllegalArgumentExceptionQuotaExceededExceptionInvalidFileDescriptorExceptionAccessDeniedExceptionIllegalStateExceptionUnsupportedOperationExceptionvoid msync(long ptr,
long off,
long len,
boolean invalidate)
throws AccessDeniedException,
IllegalStateException,
IllegalArgumentException,
UnknownNativeErrorException
ptr - pointer to the addressoff - offset from the pointerlen - length of the memory to syncinvalidate - invalidate memory mappings of other processesAccessDeniedException - if a memory lock exists for the region and the invalidate flag is set to true.IllegalStateException - if the memory or a part of it is not mapped by mmapIllegalArgumentException - if ptr+off % getpagesize() != 0UnknownNativeErrorExceptionvoid munmap(long ptr,
long size)
throws UnknownNativeErrorException
ptr - pointer to the addresssize - size of the memory mappingIllegalArgumentException - if ptr/size do not correspond to a valid memory mapping.UnknownNativeErrorExceptionNativeMemory malloc(long size) throws OutOfMemoryError, IllegalArgumentException
malloc in interface PosixNativeUtilOutOfMemoryError - if malloc returns NULLIllegalArgumentException - if size is <= 0NativeMemory pointer(long ptr, long size, PointerHandler handler) throws NullPointerException
pointer in interface PosixNativeUtilptr - pointer to the datasize - -1 if unknown.NullPointerExceptionvoid connect(int fd,
Sockaddr sockaddr)
throws InvalidFileDescriptorException,
IllegalArgumentException,
UnsupportedOperationException,
OperationInProgressException
fd - obtained from "socket"sockaddr - socket address to connect to.InvalidFileDescriptorExceptionIllegalArgumentExceptionUnsupportedOperationExceptionOperationInProgressExceptionvoid bind(int fd,
Sockaddr sockaddr)
throws InvalidFileDescriptorException,
IllegalArgumentException,
SocketException,
AccessDeniedException,
FileSystemLoopException,
NotDirectoryException,
ReadOnlyFileSystemException,
IOException,
UnknownNativeErrorException
fd - socket fdsockaddr - the address to bind toInvalidFileDescriptorException - if fd is not valid or not a socketIllegalArgumentException - if sockaddr is not validSocketException - if the address is already in useAccessDeniedException - if the address cannot be accessedFileSystemLoopException - (AF_UNIX) if too many symbolic links were encountered when resolving the pathNotDirectoryException - (AF_UNIX) if a component of the path is not a directoryReadOnlyFileSystemException - (AF_UNIX) the file system where the socket should be bound to is read onlyIOException - if the requested address cannot be assigned for various other reasonsUnknownNativeErrorException - if anything else goes wrongvoid getsockname(int fd,
Sockaddr sockaddr)
throws InvalidFileDescriptorException,
IllegalArgumentException,
UnknownNativeErrorException
fd - socket fdsockaddr - output porameter.InvalidFileDescriptorException - if the fd is not validIllegalArgumentException - if the fd does not refer to a socketUnknownNativeErrorException - if anything else goes wrongint getsockopt(int fd,
int level,
int optname)
throws InvalidFileDescriptorException,
IllegalArgumentException,
UnsupportedOperationException
byte[] getsockopt(int fd,
int level,
int optname,
int payloadSize)
throws InvalidFileDescriptorException,
IllegalArgumentException,
UnsupportedOperationException
payloadSize - the maximum size of the payload. This is used to allocate a temporary buffer in native code. The actual returned payload may have a smaller size.InvalidFileDescriptorExceptionIllegalArgumentExceptionUnsupportedOperationExceptionvoid setsockopt(int fd,
int level,
int optname,
int payload)
throws InvalidFileDescriptorException,
IllegalArgumentException,
UnsupportedOperationException
void setsockopt(int fd,
int level,
int optname,
byte[] payload)
throws InvalidFileDescriptorException,
IllegalArgumentException,
UnsupportedOperationException
void close(int fd)
throws InvalidFileDescriptorException,
IOException
void chdir(String path) throws FileNotFoundException, NotDirectoryException, InvalidPathException, AccessDeniedException, FileSystemLoopException, IOException, UnknownNativeErrorException
IllegalArgumentException - If path is nullOutOfMemoryError - when ENOMEM occurs -> Insufficient kernel memory was available.FileNotFoundException - when ENOENT occurs (The path file does not exist at all)NotDirectoryException - when ENOTDIR occurs (The path or part of it is not a directory)InvalidPathException - if NAMETOOLONG occrusAccessDeniedException - when EACCESS occurs (Process does not have search persmission to the given path)FileSystemLoopException - when ELOOP occurs (The given path loops to itself with symlinks)IOException - when EIO occursUnknownNativeErrorException - when an unexpected errno occursvoid symlink(String target, String linkpath) throws IOException, InvalidPathException, ReadOnlyFileSystemException, AccessDeniedException, FileAlreadyExistsException, UnknownNativeErrorException
symlink in interface PosixNativeUtilIOException - If an IOError occurs when creating the symlinkInvalidPathException - If any of the two paths is invalidIllegalArgumentException - If target or linkpath is nullReadOnlyFileSystemException - If the file system of linkpath is read only.AccessDeniedException - If the process lacks permission to write to linkpath. (and/or do path resolving)FileAlreadyExistsException - If the file at "linkpath" already existsUnknownNativeErrorException - If any unexpected native error occures.QuotaExceededException - If any os enforced quota limit is violated by creating the link.void unlink(String path) throws IOException, AccessDeniedException, ResourceBusyException, FileIsDirectoryException, FileSystemLoopException, ReadOnlyFileSystemException
unlink in interface PosixNativeUtilpath - specifies the path to the link to unlink.IOException - If an IOError occurs when unlinkingAccessDeniedException - If EACCESS occursResourceBusyException - if EBUSY occursFileIsDirectoryException - If path is a directory and not a symlink (Linux Only)FileSystemLoopException - If the path contains a loop of symbolic linksReadOnlyFileSystemException - If the file system is read onlyvoid link(String target, String linkpath) throws IOException, InvalidPathException, ReadOnlyFileSystemException, AccessDeniedException, FileAlreadyExistsException, UnknownNativeErrorException, QuotaExceededException
IOException - If an IOError occurs when creating the symlinkInvalidPathException - If any of the two paths is invalidIllegalArgumentException - If target or linkpath is nullReadOnlyFileSystemException - If the file system of linkpath is read only.AccessDeniedException - If the process lacks permission to write to linkpath. (and/or do path resolving)FileAlreadyExistsException - If the file at "linkpath" already existsUnknownNativeErrorException - If any unexpected native error occures.QuotaExceededException - If any os enforced quota limit is violated by creating the link.Stat stat(String path) throws FileNotFoundException, InvalidPathException, FileSystemLoopException, AccessDeniedException, UnknownNativeErrorException, IOException
stat in interface PosixNativeUtilpath - the path to the fileIllegalArgumentException - If path is nullFileNotFoundException - If the file cannot be foundFileSystemLoopException - If too many sym links had to be followed to resolve the pathInvalidPathException - If the path is invalid (empty string, parent is not a directory etc)AccessDeniedException - If the process lacks permission to resolve the path. (Parent directory does not have permission to list files for example)IOException - If a unspecified IO error occures while reading the info from disc.UnknownNativeErrorException - If any unexpected native error occures.Statvfs statvfs(String path) throws AccessDeniedException, IOException, FileSystemLoopException, FileNotFoundException, UnknownNativeErrorException
Stat lstat(String path) throws FileNotFoundException, InvalidPathException, FileSystemLoopException, AccessDeniedException, UnknownNativeErrorException, IOException
path - the path to the file/symbolic linkIllegalArgumentException - If path is nullFileNotFoundException - If the file cannot be foundFileSystemLoopException - If too many sym links had to be followed to resolve the pathInvalidPathException - If the path is invalid (empty string, parent is not a directory etc)AccessDeniedException - If the process lacks permission to resolve the path. (Parent directory does not have permission to list files for example)IOException - If a unspecified IO error occures while reading the info from disc.UnknownNativeErrorException - If any unexpected native error occures.Stat fstat(int descriptor) throws InvalidFileDescriptorException, UnknownNativeErrorException, IOException
IllegalArgumentException - If descriptor is nullInvalidFileDescriptorException - If the given file descriptor is invalidIOException - If a unspecified IO error occures while reading the info from disc.UnknownNativeErrorException - If any unexpected native error occures.String strerror_r(int errno)
void setenv(String key, String value, boolean overwrite) throws UnknownNativeErrorException
key - name of the variablevalue - new value of the variableoverwrite - overwrite the variable if it is present already or not.NullPointerException - if key or value is nullIllegalArgumentException - if key contains "=" or is emptyUnknownNativeErrorException - if an unexpected error occurs.String getenv(String key) throws UnknownNativeErrorException
key - name of the variableNullPointerException - if key is nullIllegalArgumentException - if key contains "=" or is emptyUnknownNativeErrorException - if an unexpected error occurs.void unsetenv(String key) throws UnknownNativeErrorException
NullPointerException - if key is nullIllegalArgumentException - if key contains "=" or is emptyUnknownNativeErrorException - if an unexpected native error occurs.String[] wordexp(String expression, boolean allowCommands, boolean useStdErr, boolean allowUndef) throws IllegalArgumentException
allowCommands - if true then commands are allowed. Do not use this for untrusted user input as they can run any system command they want. example "$(ls)" would insert the output of "ls" into the result.useStdErr - if true then errors that occur during command execution are passed to stderr. if false then the errors are ignored. if allowCommands is false then this parameter is meaningless.allowUndef - if true then undefined variables are substituted with "". If false then an IllegalArgumentException is thrown when an unknown variable is encountered.IllegalArgumentException - if the argument has invalid syntax, contains commands when not allowed or contains undefined variable when not allowed.long geteuid()
String getlogin_r() throws IOException, UnknownNativeErrorException, IllegalStateException
IOException - if an IOError occurs while gathering infos (syscall queries a buch of files)UnknownNativeErrorException - If something enexpected occursIllegalStateException - If ENOTTY/ENXIO occurslong[] getgrouplist(String user, long group)
user - the usernamegroup - the first group of the user. (This is usually equal to the UID but call getpwnam to be safe)Group getgrgid_r(long group)
group - groupidPasswd getpwnam_r(String user)
Passwd getpwuid_r(long id)
long getuid()
String readlink(String path) throws NotLinkException, UnknownNativeErrorException, InvalidPathException, IOException, FileSystemLoopException, AccessDeniedException, FileNotFoundException, NotDirectoryException
path - the path of the sym link to resolveNullPointerException - if path is nullNotLinkException - if path exists but is not a symbolic linkUnknownNativeErrorException - if an unexpected native error occursInvalidPathException - if the path is invalid (too long for example)IOException - if an io error occurs while reading the link location from the physical diskFileSystemLoopException - if too many symlinks have to be followed to resolve components of the pathAccessDeniedException - if the current process does not have permission to resolve the path or read the target of the linkFileNotFoundException - if the path does not exist.NotDirectoryException - if a component of the path is not a directory (or link to a directory) but rather a file/something else.String realpath(String path) throws AccessDeniedException, IOException, FileSystemLoopException, InvalidPathException, FileNotFoundException, NotDirectoryException, UnknownNativeErrorException
path - path to be resolvedNullPointerException - if path is nullAccessDeniedException - if read or search permission was denied for a component of the path prefixIOException - If an io error occurs while reading from the file systemFileSystemLoopException - if too many symlinks have to be followed to resolve components of the pathInvalidPathException - if the path is too longFileNotFoundException - if the file referenced by the path does not existNotDirectoryException - if a component of the path is not a directoryUnknownNativeErrorException - if an unexpected native error occursvoid chmod(String path, int mode) throws AccessDeniedException, PermissionDeniedException, IOException, FileSystemLoopException, InvalidPathException, FileNotFoundException, NotDirectoryException
path - the path to the filemode - the new file modeNullPointerException - if path is nullAccessDeniedException - if the process does not have permissions to resolve pathPermissionDeniedException - if the process does not have permissions the change the file modeIOException - if an io error occurs while changing the file modeFileSystemLoopException - if too many symlinks have to be followed to resolve components of the pathInvalidPathException - if the path is too longFileNotFoundException - if the file does not existNotDirectoryException - if a component of the path is not a directoryvoid fchmod(int fd,
int mode)
void chown(String path, int uid, int gid)
void fchown(int fd,
int uid,
int gid)
void lchown(String path, int uid, int gid)
int ioctl(int fd,
int code)
throws InvalidFileDescriptorException,
UnknownNativeErrorException
fd - the file descriptor to the devicecode - the device specific request codeInvalidFileDescriptorExceptionUnknownNativeErrorExceptionint ioctl(int fd,
int code,
byte[] buf,
int off)
throws InvalidFileDescriptorException,
UnknownNativeErrorException
fd - the file descriptor to the devicecode - the device specific request codebuf - the bufferoff - offset in the buffer.
Warning: ioctl may overflow the buffer and corrupt heap!
Using too small a buffer may cause the memory corruption and result in undefined behavior of the VM.InvalidFileDescriptorExceptionUnknownNativeErrorExceptionint ioctl(int fd,
int code,
long param)
throws InvalidFileDescriptorException,
UnknownNativeErrorException
fd - the file descriptor to the devicecode - the device specific request codeparam - the param to ioctl. Will be cast to void* but does not have to be a pointer.InvalidFileDescriptorExceptionUnknownNativeErrorExceptionint ioctl(int fd,
int code,
NativeMemory mem,
long off)
throws InvalidFileDescriptorException,
UnknownNativeErrorException
fd - filedescriptorcode - ioctl request codemem - memory to pass to ioctloff - offset in the memoryInvalidFileDescriptorExceptionUnknownNativeErrorExceptionint fcntl(int fd,
int code)
throws InvalidFileDescriptorException,
UnknownNativeErrorException
int fcntl(int fd,
int code,
int param)
throws InvalidFileDescriptorException,
UnknownNativeErrorException
int fcntl(int fd,
int code,
long param)
throws InvalidFileDescriptorException,
UnknownNativeErrorException
int fcntl(int fd,
int code,
byte[] param,
int off)
throws InvalidFileDescriptorException,
UnknownNativeErrorException
int fcntl(int fd,
int code,
NativeMemory param,
long off)
throws InvalidFileDescriptorException,
UnknownNativeErrorException
long sem_open(String name, int oflags) throws AccessDeniedException, QuotaExceededException, FileNotFoundException, FileAlreadyExistsException, UnknownNativeErrorException
long sem_open(String name, int oflags, int mode, int value) throws AccessDeniedException, QuotaExceededException, FileNotFoundException, FileAlreadyExistsException, UnknownNativeErrorException
void sem_close(long sem)
throws UnknownNativeErrorException
UnknownNativeErrorExceptionvoid sem_unlink(String name) throws AccessDeniedException, FileNotFoundException, UnknownNativeErrorException
int sem_t_size()
void sem_init(long sem,
boolean interprocess,
int value)
throws UnknownNativeErrorException
sem - ptr to allocated memory. This memory must be able to hold sem_t_size bytes.interprocess - should the semaphore be interprocess? (ptr must reside in shared memory)value - initial value of the semaphore.UnknownNativeErrorExceptionvoid sem_destroy(long sem)
throws UnknownNativeErrorException
UnknownNativeErrorExceptionvoid sem_post(long sem)
throws UnknownNativeErrorException
UnknownNativeErrorExceptionvoid sem_wait(long sem)
throws UnknownNativeErrorException
UnknownNativeErrorExceptionint sem_getvalue(long sem)
throws UnknownNativeErrorException
UnknownNativeErrorExceptionboolean sem_trywait(long sem)
throws UnknownNativeErrorException
UnknownNativeErrorExceptionboolean sem_timedwait(long sem,
long timeoutInMillis)
throws UnknownNativeErrorException
UnknownNativeErrorExceptionint shm_open(String name, int oflag, int mode) throws FileAlreadyExistsException, FileNotFoundException, UnknownNativeErrorException, AccessDeniedException, QuotaExceededException
void shm_unlink(String name) throws FileNotFoundException, AccessDeniedException, UnknownNativeErrorException
void ftruncate(int fd,
long len)
void truncate(String name, long len)
void mkfifo(String name, int mode) throws AccessDeniedException, QuotaExceededException, FileAlreadyExistsException, FileNotFoundException, NotDirectoryException, ReadOnlyFileSystemException
long sizeof_pthread_mutex_t()
long sizeof_pthread_mutexattr_t()
long sizeof_pthread_cond_t()
long sizeof_pthread_condattr_t()
void pthread_condattr_destroy(long attributes)
throws UnknownNativeErrorException
UnknownNativeErrorExceptionvoid pthread_condattr_init(long attributes)
throws UnknownNativeErrorException
UnknownNativeErrorExceptionvoid pthread_mutexattr_destroy(long attributes)
throws UnknownNativeErrorException
UnknownNativeErrorExceptionvoid pthread_mutexattr_init(long attributes)
throws UnknownNativeErrorException
UnknownNativeErrorExceptionint pthread_condattr_getpshared(long attributes)
throws UnknownNativeErrorException
UnknownNativeErrorExceptionvoid pthread_condattr_setpshared(long attributes,
int value)
throws UnknownNativeErrorException
UnknownNativeErrorExceptionvoid pthread_mutexattr_setpshared(long attributes,
int value)
throws UnknownNativeErrorException
UnknownNativeErrorExceptionint pthread_mutexattr_getpshared(long attributes)
throws UnknownNativeErrorException
UnknownNativeErrorExceptionint pthread_mutexattr_getrobust(long attributes)
throws UnknownNativeErrorException
UnknownNativeErrorExceptionvoid pthread_mutexattr_setrobust(long attributes,
int value)
throws UnknownNativeErrorException
UnknownNativeErrorExceptionvoid pthread_mutex_consistent(long mutex)
throws UnknownNativeErrorException
UnknownNativeErrorExceptionvoid pthread_mutexattr_settype(long attributes,
int value)
throws UnknownNativeErrorException
UnknownNativeErrorExceptionint pthread_mutexattr_gettype(long attributes)
throws UnknownNativeErrorException
UnknownNativeErrorExceptionvoid pthread_mutex_init(long mutex,
long attributes)
throws UnknownNativeErrorException,
QuotaExceededException
void pthread_mutex_destroy(long mutex)
throws UnknownNativeErrorException
UnknownNativeErrorExceptionvoid pthread_mutex_lock(long mutex)
throws UnknownNativeErrorException,
InconsistentMutexException,
UnrecoverableMutexException
boolean pthread_mutex_trylock(long mutex)
throws UnknownNativeErrorException,
InconsistentMutexException,
UnrecoverableMutexException
void pthread_mutex_unlock(long mutex)
throws UnknownNativeErrorException
UnknownNativeErrorExceptionboolean pthread_mutex_timedlock(long mutex,
long timeout)
throws UnknownNativeErrorException,
InconsistentMutexException,
UnrecoverableMutexException
void pthread_cond_broadcast(long condition)
throws UnknownNativeErrorException
UnknownNativeErrorExceptionvoid pthread_cond_signal(long condition)
throws UnknownNativeErrorException
UnknownNativeErrorExceptionvoid pthread_cond_wait(long condition,
long mutex)
throws UnknownNativeErrorException,
InconsistentMutexException,
UnrecoverableMutexException
boolean pthread_cond_timedwait(long condition,
long mutex,
long timeout)
throws UnknownNativeErrorException,
InconsistentMutexException,
UnrecoverableMutexException
void pthread_cond_destroy(long condition)
throws UnknownNativeErrorException
UnknownNativeErrorExceptionvoid pthread_cond_init(long condition,
long attributes)
throws UnknownNativeErrorException
UnknownNativeErrorExceptionint memfd_create(String name, int flags) throws QuotaExceededException, PermissionDeniedException, UnknownNativeErrorException
boolean malloc_trim(long pad)
UnsupportedOperationException on libc musl!void madvise(long ptr,
long length,
int advice)
throws AccessDeniedException,
IOException,
PermissionDeniedException,
ResourceTemporarilyUnavailableException,
ResourceBusyException,
MemoryFaultException,
UnknownNativeErrorException
Copyright © 2024. All rights reserved.