public class IgniteNativeIoLib extends Object
| Modifier and Type | Field and Description |
|---|---|
static int |
DEFAULT_OPEN_MODE
Default access mask for newly created files.
|
static int |
E_INVAL
Invalid argument.
|
static int |
O_CREAT
File shall be created.
|
static int |
O_DIRECT
Try to minimize cache effects of the I/O to and from this file.
|
static int |
O_EXCL
If O_CREAT and O_EXCL are set, open() shall fail if the file exists.
|
static int |
O_RDONLY
Open for reading only.
|
static int |
O_RDWR
Open for reading and writing.
|
static int |
O_SYNC
Write operations on the file will complete according to the requirements of synchronized I/O file integrity
completion.
|
static int |
O_TRUNC
If the file exists and is a regular file length shall be truncated to 0.
|
static int |
O_WRONLY
Open for writing only.
|
static int |
POSIX_FADV_DONTNEED
The specified data will not be accessed in the near future.
|
static int |
S_IRGRP
Flag for newly created files: group has read permission.
|
static int |
S_IROTH
Flag for newly created files: others have read permission.
|
static int |
S_IRUSR
Flag for newly created files: user has read permission.
|
static int |
S_IWUSR
Flag for newly created files: user has write permission.
|
static int |
SEEK_CUR
Seek option: change file position to offset
|
static int |
SEEK_SET
Seek option: set file offset to offset
|
| Constructor and Description |
|---|
IgniteNativeIoLib() |
| Modifier and Type | Method and Description |
|---|---|
static int |
close(int fd)
See "man 2 close".
|
static int |
fdatasync(int fd)
Synchronize a file's in-core state with storage device.
|
static void |
free(com.sun.jna.Pointer ptr)
Frees the memory space pointed to by ptr, which must have been returned by a previous call to native allocation
methods.
|
static int |
fsync(int fd)
Synchronize a file's in-core state with storage device.
|
static int |
ftruncate(int fd,
long len)
Causes regular file referenced by fd to be truncated to a size of precisely length bytes.
|
static int |
getDirectIOBlockSize(String storageDir,
IgniteLogger log)
Determines FS and OS block size.
|
static int |
getpagesize()
The function getpagesize() returns the number of bytes in a memory
page, where "page" is a fixed-length block, the unit for memory
allocation and file mapping
|
static boolean |
isJnaAvailable() |
static long |
lseek(int fd,
long off,
int whence)
Repositions the file offset of the open file description associated with the file descriptor
fd
to the argument offset according to the directive whence |
static int |
open(String pathname,
int flags,
int mode)
Open a file.
|
static com.sun.jna.NativeLong |
pathconf(String path,
int name)
Return path (FS) configuration parameter value.
|
static int |
posix_fadvise(int fd,
long off,
long len,
int flag)
Allows to announce an intention to access file data in a specific pattern in the future, thus allowing the
kernel to perform appropriate optimizations.
|
static int |
posix_memalign(com.sun.jna.ptr.PointerByReference memptr,
com.sun.jna.NativeLong alignment,
com.sun.jna.NativeLong size)
Allocates size bytes and places the address of the allocated memory in
memptr. |
static com.sun.jna.NativeLong |
pread(int fd,
com.sun.jna.Pointer buf,
com.sun.jna.NativeLong cnt,
com.sun.jna.NativeLong off)
Reads up to
cnt bytes from file descriptor fd at offset off (from the start of the file)
into the buffer starting at buf. |
static com.sun.jna.NativeLong |
pwrite(int fd,
com.sun.jna.Pointer buf,
com.sun.jna.NativeLong cnt,
com.sun.jna.NativeLong off)
Writes up to
cnt bytes to the buffer starting at buf to the file descriptor fd at offset
offset. |
static com.sun.jna.NativeLong |
read(int fd,
com.sun.jna.Pointer buf,
com.sun.jna.NativeLong cnt)
Reads up to
cnt bytes from file descriptor fd into the buffer starting at buf. |
static String |
strerror(int errnum)
Function returns a string that describes the error code passed in the argument
errnum. |
static com.sun.jna.NativeLong |
write(int fd,
com.sun.jna.Pointer buf,
com.sun.jna.NativeLong cnt)
Writes up to
cnt bytes to the buffer starting at buf to the file descriptor fd. |
public static final int O_RDONLY
public static final int O_WRONLY
public static final int O_RDWR
public static final int O_CREAT
public static final int O_EXCL
public static final int O_TRUNC
public static final int O_DIRECT
public static final int O_SYNC
public static final int POSIX_FADV_DONTNEED
public static final int S_IRUSR
public static final int S_IWUSR
public static final int S_IRGRP
public static final int S_IROTH
public static final int DEFAULT_OPEN_MODE
public static final int E_INVAL
public static final int SEEK_SET
public static final int SEEK_CUR
public static int getDirectIOBlockSize(String storageDir, IgniteLogger log)
storageDir - storage path, base path to check (FS) configuration parameters.log - Logger.public static boolean isJnaAvailable()
false for non linux systems.public static int open(String pathname, int flags, int mode)
pathname - pathname naming the file.flags - flag/open options. Flags are constructed by a bitwise-inclusive OR of flags.mode - create file mode creation mask.public static int close(int fd)
fd - The file descriptor of the file to close.public static com.sun.jna.NativeLong pwrite(int fd,
com.sun.jna.Pointer buf,
com.sun.jna.NativeLong cnt,
com.sun.jna.NativeLong off)
cnt bytes to the buffer starting at buf to the file descriptor fd at offset
offset. The file offset is not changed. See "man 2 pwrite".fd - file descriptor.buf - pointer to buffer with data.cnt - bytes to write.off - position in file to write data.public static com.sun.jna.NativeLong write(int fd,
com.sun.jna.Pointer buf,
com.sun.jna.NativeLong cnt)
cnt bytes to the buffer starting at buf to the file descriptor fd.
The file offset is changed. See "man 2 write".fd - file descriptor.buf - pointer to buffer with data.cnt - bytes to write.public static com.sun.jna.NativeLong pread(int fd,
com.sun.jna.Pointer buf,
com.sun.jna.NativeLong cnt,
com.sun.jna.NativeLong off)
cnt bytes from file descriptor fd at offset off (from the start of the file)
into the buffer starting at buf. The file offset is not changed. See "man 2 pread".fd - file descriptor.buf - pointer to buffer to place the data.cnt - bytes to read.public static com.sun.jna.NativeLong read(int fd,
com.sun.jna.Pointer buf,
com.sun.jna.NativeLong cnt)
cnt bytes from file descriptor fd into the buffer starting at buf. The file
offset is changed. See "man 2 read".fd - file descriptor.buf - pointer to buffer to place the data.cnt - bytes to read.public static int fsync(int fd)
fd - file descriptor.public static int fdatasync(int fd)
fsync(int), but does not flush modified metadata unless that metadata is needed in order to allow a subsequent data retrieval to be correctly handledfd - file descriptor.public static int posix_memalign(com.sun.jna.ptr.PointerByReference memptr,
com.sun.jna.NativeLong alignment,
com.sun.jna.NativeLong size)
memptr.
The address of the allocated memory will be a multiple of alignment.
See "man 3 posix_memalign".memptr - out memory pointer.alignment - memory alignment, must be a power of two and a multiple of sizeof(void *).size - size of buffer.public static void free(com.sun.jna.Pointer ptr)
posix_memalign(com.sun.jna.ptr.PointerByReference, com.sun.jna.NativeLong, com.sun.jna.NativeLong) can be freed using free. See "man 3
free".ptr - pointer to free.public static String strerror(int errnum)
errnum. See "man 3
strerror".errnum - error code.public static com.sun.jna.NativeLong pathconf(String path, int name)
path - base path to check settings.name - variable name to query.public static int getpagesize()
public static int posix_fadvise(int fd,
long off,
long len,
int flag)
off and extending for len bytes (or until the end of the file if len is 0)
within the file referred to by fd.
See "man 2 posix_fadvise".fd - file descriptor.off - region start.len - region end.flag - advice (option) to apply.public static int ftruncate(int fd,
long len)
fd - file descriptor.len - required length.public static long lseek(int fd,
long off,
int whence)
fd
to the argument offset according to the directive whencefd - file descriptor.off - required position offset.whence - position base.
Follow @ApacheIgnite
Ignite Database and Caching Platform : ver. 8.9.28 Release Date : December 12 2025