Package com.kenai.jffi
Class PageManager.Unix
java.lang.Object
com.kenai.jffi.PageManager
com.kenai.jffi.PageManager.Unix
- Enclosing class:
PageManager
-
Nested Class Summary
Nested classes/interfaces inherited from class com.kenai.jffi.PageManager
PageManager.Unix, PageManager.Windows
-
Field Summary
Fields inherited from class com.kenai.jffi.PageManager
PROT_EXEC, PROT_READ, PROT_WRITE
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionlong
allocatePages
(int npages, int protection) Allocates native memory pages.void
freePages
(long address, int npages) Free pages allocated viaPageManager.allocatePages(int, int)
void
protectPages
(long address, int npages, int protection) Sets the protection mask on a memory region.Methods inherited from class com.kenai.jffi.PageManager
getInstance, pageSize
-
Constructor Details
-
Unix
Unix()
-
-
Method Details
-
allocatePages
public long allocatePages(int npages, int protection) Description copied from class:PageManager
Allocates native memory pages. The memory allocated is aligned on a page boundary, and the size of the allocated memory isnpages
*PageManager.pageSize
.- Specified by:
allocatePages
in classPageManager
- Parameters:
npages
- The number of pages to allocate.protection
- The initial protection for the page. This must be a bitmask ofPageManager.PROT_READ
,PageManager.PROT_WRITE
andPageManager.PROT_EXEC
.- Returns:
- The native address of the allocated memory.
-
freePages
public void freePages(long address, int npages) Description copied from class:PageManager
Free pages allocated viaPageManager.allocatePages(int, int)
- Specified by:
freePages
in classPageManager
- Parameters:
address
- The memory address as returned fromPageManager.allocatePages(int, int)
npages
- The number of pages to free.
-
protectPages
public void protectPages(long address, int npages, int protection) Description copied from class:PageManager
Sets the protection mask on a memory region.- Specified by:
protectPages
in classPageManager
- Parameters:
address
- The start of the memory region.npages
- The number of pages to protect.protection
- The protection mask.
-