shared-memory-0.1.0.0: POSIX shared memory

Safe HaskellSafe-Inferred
LanguageHaskell98

MMAP

Description

Provides mmap: mapping files into memory.

Synopsis

Documentation

c_mmap Source

Arguments

:: Ptr ()

void *addr

-> CSize

size_t length

-> ProtOption

int prot

-> MmapFlags

int flags,

-> Fd

int fd

-> COff

off_t offset

-> IO (Ptr ()) 

mmap - map files or devices into memory.

The returned memory should be freed with c_munmap after use.

This is the raw C function, and its return value must be checked according to man mmap.

See mmap for a variant that turns bad return values into exceptions.

c_munmap Source

Arguments

:: Ptr ()

void *addr

-> CSize

size_t length

-> IO CInt 

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

unProtOption :: CInt
 

protExec :: ProtOption Source

Pages may be executed.

protRead :: ProtOption Source

Pages may be read.

protWrite :: ProtOption Source

Pages may be written.

protNone :: ProtOption Source

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 

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.

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.

newtype MmapFlags Source

An MmapSharedFlag with one or more MmapOptionalFlags.

Constructors

MmapFlags 

Fields

unMmapFlags :: CInt
 

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).