Portability | non-portable (requires POSIX) |
---|---|
Stability | provisional |
Maintainer | Vincent Hanquez |
Safe Haskell | None |
Functions defined by the POSIX standards for manipulating memory maps
When a function that calls an underlying POSIX function fails, the errno
code is converted to an IOError
using errnoToIOError
.
For a list of which errno codes may be generated, consult the POSIX
documentation for the underlying function.
- memoryMap :: Maybe (Ptr a) -> CSize -> [MemoryProtection] -> MemoryMapFlag -> Maybe Fd -> COff -> IO (Ptr a)
- memoryUnmap :: Ptr a -> CSize -> IO ()
- memoryAdvise :: Ptr a -> CSize -> MemoryAdvice -> IO ()
- memoryLock :: Ptr a -> CSize -> IO ()
- memoryUnlock :: Ptr a -> CSize -> IO ()
- memoryProtect :: Ptr a -> CSize -> [MemoryProtection] -> IO ()
- memorySync :: Ptr a -> CSize -> [MemorySyncFlag] -> IO ()
- data MemoryMapFlag
- data MemoryProtection
- data MemoryAdvice
- data MemorySyncFlag
- sysconfPageSize :: Int
Documentation
:: Maybe (Ptr a) | The address to map to if MapFixed is used. |
-> CSize | The length of the mapping |
-> [MemoryProtection] | the memory protection associated with the mapping |
-> MemoryMapFlag | |
-> Maybe Fd | |
-> COff | |
-> IO (Ptr a) |
Map pages of memory.
If fd is present, this memory will represent the file associated. Otherwise, the memory will be an anonymous mapping.
use mmap
memoryUnmap :: Ptr a -> CSize -> IO ()Source
memoryAdvise :: Ptr a -> CSize -> MemoryAdvice -> IO ()Source
give advice to the operating system about use of memory
call madvise
memoryLock :: Ptr a -> CSize -> IO ()Source
lock a range of process address space
call mlock
memoryUnlock :: Ptr a -> CSize -> IO ()Source
unlock a range of process address space
call munlock
memoryProtect :: Ptr a -> CSize -> [MemoryProtection] -> IO ()Source
set protection of memory mapping
call mprotect
memorySync :: Ptr a -> CSize -> [MemorySyncFlag] -> IO ()Source
memorySync synchronize memory with physical storage.
On an anonymous mapping this function doesn't have any effect.
call msync
data MemoryMapFlag Source
Mapping flag
MemoryMapShared | memory changes are shared between process |
MemoryMapPrivate | memory changes are private to process |
data MemoryProtection Source
Memory protection
data MemoryAdvice Source
Advice to put on memory.
only define the posix one.
MemoryAdviceNormal | no specific advice, the default. |
MemoryAdviceRandom | Expect page references in random order. No readahead should occur. |
MemoryAdviceSequential | Expect page references in sequential order. Page should be readahead aggressively. |
MemoryAdviceWillNeed | Expect access in the near future. Probably a good idea to readahead early |
MemoryAdviceDontNeed | Do not expect access in the near future. |
data MemorySyncFlag Source
Memory synchronization flags
MemorySyncAsync | perform asynchronous write. |
MemorySyncSync | perform synchronous write. |
MemorySyncInvalidate | invalidate cache data. |
Return the operating system page size.
call sysconf