off_t because it is dependent upon features
selected at compile-time. This class provides helper methods that safely
avoid these types by using 64-bit mappings when available.
| Modifier and Type | Field and Description |
|---|---|
| private static Function | |
| private static boolean | |
| private static final NativeLibrary | |
| private static Function | |
| private static boolean |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| public static int | Returns: On success, zero is returned. On error, -1 is returned, anderrno is set appropriately.a file descriptor fd, long the number of bytes to truncate or extend the file to length)Causes the regular file referenced by |
| public static Pointer | Returns: On success, returns a pointer to the mapped area. On error, the valueMAP_FAILED (that is, (void *) -1) is returned, and
errno is set to indicate the cause of the error.The starting address for the new mapping.
addr, long
If Specifies the length of the mapping (which must be greater than
0). length, int describes the desired memory protection of the mapping (and must
not conflict with the open mode of the file). It is either
prot, int PROT_NONE or the bitwise OR of one or more of
PROT_READ, PROT_WRITE, or PROT_EXEC.determines whether updates to the mapping are visible to other
processes mapping the same region, and whether updates are carried
through to the underlying file. This behavior is determined by
including exactly one of flags, int MAP_SHARED,
MAP_SHARED_VALIDATE, or MAP_PRIVATE. In addition,
0 or more additional flags can be ORed in flags.The file descriptor for the object to be mapped. After the
fd, long mmap() call has returned, the file descriptor can be
closed immediately without invalidating the mapping.The contents of a file mapping (as opposed to an anonymous
mapping), are initialized using offset)length bytes starting at
offset offset in the file (or other object) referred to by
the file descriptor, fd. offset must be a multiple
of the page size as returned by sysconf(_SC_PAGE_SIZE).Creates a new mapping in the virtual address space of the calling process. |
| public static void | require32Bit(long
The value to test val, String The name of the value, to be inserted in the exception message if
not 32-bit value)Test that a value is 32-bit, throwing a custom exception otherwise |
| ftruncate | back to summary |
|---|---|
| private static Function ftruncate | |
| ftruncate64 | back to summary |
|---|---|
| private static boolean ftruncate64 | |
| LIBC | back to summary |
|---|---|
| private static final NativeLibrary LIBC | |
| mmap | back to summary |
|---|---|
| private static Function mmap | |
| mmap64 | back to summary |
|---|---|
| private static boolean mmap64 | |
| LibCUtil | back to summary |
|---|---|
| private LibCUtil() | |
| ftruncate | back to summary |
|---|---|
| public static int ftruncate(int fd, long length) Causes the regular file referenced by If the file previously was larger than this size, the extra data is lost. If the file previously was shorter, it is extended, and the extended part reads as null bytes ('\0'). The file must be open for writing
| |
| mmap | back to summary |
|---|---|
| public static Pointer mmap(Pointer addr, long length, int prot, int flags, int fd, long offset) Creates a new mapping in the virtual address space of the calling process.
| |
| require32Bit | back to summary |
|---|---|
| public static void require32Bit(long val, String value) Test that a value is 32-bit, throwing a custom exception otherwise
| |