| Safe Haskell | Safe-Inferred |
|---|---|
| Language | Haskell98 |
MMAP
Description
Provides mmap: mapping files into memory.
- data MmapException = MmapException
- data MunmapException = MunmapException {}
- c_mmap :: Ptr () -> CSize -> ProtOption -> MmapFlags -> Fd -> COff -> IO (Ptr ())
- c_munmap :: Ptr () -> CSize -> IO CInt
- mmap :: Ptr () -> CSize -> ProtOption -> MmapFlags -> Fd -> COff -> IO (Ptr ())
- munmap :: Ptr () -> CSize -> IO ()
- newtype ProtOption = ProtOption {
- unProtOption :: CInt
- protExec :: ProtOption
- protRead :: ProtOption
- protWrite :: ProtOption
- protNone :: ProtOption
- newtype MmapSharedFlag = MmapSharedFlag {}
- mapShared :: MmapSharedFlag
- mapPrivate :: MmapSharedFlag
- newtype MmapOptionalFlag = MmapOptionalFlag {}
- map32Bit :: MmapOptionalFlag
- mapAnonymous :: MmapOptionalFlag
- mapDenywrite :: MmapOptionalFlag
- mapFile :: MmapOptionalFlag
- mapFixed :: MmapOptionalFlag
- mapHugetlb :: MmapOptionalFlag
- mapLocked :: MmapOptionalFlag
- mapNonblock :: MmapOptionalFlag
- mapNoreserve :: MmapOptionalFlag
- mapStack :: MmapOptionalFlag
- newtype MmapFlags = MmapFlags {
- unMmapFlags :: CInt
- mkMmapFlags :: MmapSharedFlag -> MmapOptionalFlag -> MmapFlags
Documentation
data MunmapException Source
Exception thrown when munmap fails.
Constructors
| MunmapException | |
Fields
| |
munmap - unmap mmap'ed memory.
This is the raw C function, and its return value must be checked
according to man mmap.
See munmap for a variant that turns bad return values into exceptions.
mmap :: Ptr () -> CSize -> ProtOption -> MmapFlags -> Fd -> COff -> IO (Ptr ()) Source
Convenience around c_mmap, throwing a MmapException on a negative return value.
munmap :: Ptr () -> CSize -> IO () Source
Convenience around c_munmap, throwing a MunmapException on a negative return value.
newtype ProtOption Source
Describes the desired memory protection of the mapping (and must not conflict with the open mode of the file).
Can be combined using the Monoid instance `(<>)`.
Constructors
| ProtOption | |
Fields
| |
Instances
Pages may be executed.
Pages may be read.
protWrite :: ProtOption Source
Pages may be written.
Pages may not be accessed.
newtype MmapSharedFlag Source
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
mapShared and mapPrivate.
Constructors
| MmapSharedFlag | |
Fields | |
mapShared :: MmapSharedFlag Source
Share this mapping. Updates to the mapping are visible to
other processes that map the file, and are carried through to
the underlying file. The file may not actually be updated
until msync(2) or munmap() is called..
mapPrivate :: MmapSharedFlag Source
Create a private copy-on-write mapping. Updates to the mapping
are not visible to other processes mapping the same file, and
are not carried through to the underlying file. It is unspecified
whether changes made to the file after the mmap() call are
visible in the mapped region.
newtype MmapOptionalFlag Source
And MmapSharedFlag with one or more MmapOptionalFlags.
Constructors
| MmapOptionalFlag | |
Fields | |
map32Bit :: MmapOptionalFlag Source
See man mmap for a description.
mapAnonymous :: MmapOptionalFlag Source
See man mmap for a description.
mapDenywrite :: MmapOptionalFlag Source
See man mmap for a description.
mapFile :: MmapOptionalFlag Source
See man mmap for a description.
mapFixed :: MmapOptionalFlag Source
See man mmap for a description.
mapHugetlb :: MmapOptionalFlag Source
See man mmap for a description.
mapLocked :: MmapOptionalFlag Source
See man mmap for a description.
mapNonblock :: MmapOptionalFlag Source
See man mmap for a description.
mapNoreserve :: MmapOptionalFlag Source
See man mmap for a description.
mapStack :: MmapOptionalFlag Source
See man mmap for a description.
An MmapSharedFlag with one or more MmapOptionalFlags.
Constructors
| MmapFlags | |
Fields
| |
mkMmapFlags :: MmapSharedFlag -> MmapOptionalFlag -> MmapFlags Source
Create MmapFlags to be passed to c_mmap from an MmapSharedFlag
and one or more MmapOptionalFlags (combine them via `(<>)`,
mempty for none).