Loading...
Searching...
No Matches
MMAP (Memory Map) Routines
Apache Portability Runtime library
Collaboration diagram for MMAP (Memory Map) Routines:

## Data Structures

struct | apr_mmap_t

## Macros

#define | APR_MMAP_READ 1
#define | APR_MMAP_WRITE 2
#define | APR_MMAP_THRESHOLD 1
#define | APR_MMAP_LIMIT (4*1024*1024)
#define | APR_MMAP_CANDIDATE(filelength) ((filelength >= APR_MMAP_THRESHOLD) && (filelength < APR_MMAP_LIMIT))

## Typedefs

typedef struct apr_mmap_t | apr_mmap_t

## Functions

apr_status_t | apr_mmap_create (apr_mmap_t **newmmap, apr_file_t *file, apr_off_t offset, apr_size_t size, apr_int32_t flag, apr_pool_t *cntxt)
apr_status_t | apr_mmap_dup (apr_mmap_t **new_mmap, apr_mmap_t *old_mmap, apr_pool_t *p)
apr_status_t | apr_mmap_delete (apr_mmap_t *mm)
apr_status_t | apr_mmap_offset (void **addr, apr_mmap_t *mm, apr_off_t offset)

## Detailed Description

## Macro Definition Documentation

## APR_MMAP_CANDIDATE

#define APR_MMAP_CANDIDATE | ( |  | filelength | ) | ((filelength >= APR_MMAP_THRESHOLD) && (filelength < APR_MMAP_LIMIT))

Can this file be MMaped

## APR_MMAP_LIMIT

#define APR_MMAP_LIMIT (4*1024*1024)

Maximum size of MMap region

## APR_MMAP_READ

#define APR_MMAP_READ 1

MMap opened for reading

## APR_MMAP_THRESHOLD

#define APR_MMAP_THRESHOLD 1

Files have to be at least this big before they're mmap()d. This is to deal with systems where the expense of doing an mmap() and an munmap() outweighs the benefit for small files. It shouldn't be set lower than 1.

## APR_MMAP_WRITE

#define APR_MMAP_WRITE 2

MMap opened for writing

## Typedef Documentation

## apr_mmap_t

typedef struct apr_mmap_t apr_mmap_t

See also
  apr_mmap_t

## Function Documentation

## apr_mmap_create()

apr_status_t apr_mmap_create | ( | apr_mmap_t ** | newmmap,
|  | apr_file_t * | file,
|  | apr_off_t | offset,
|  | apr_size_t | size,
|  | apr_int32_t | flag,
|  | apr_pool_t * | cntxt
| ) |  |

Create a new mmap'ed file out of an existing APR file.

Parameters

  newmmap | The newly created mmap'ed file.
  file | The file to turn into an mmap.
  offset | The offset into the file to start the data pointer at.
  size | The size of the file

  flag

  bit-wise or of:

               APR_MMAP_READ       MMap opened for reading
               APR_MMAP_WRITE      MMap opened for writing

  cntxt | The pool to use when creating the mmap.

## apr_mmap_delete()

apr_status_t apr_mmap_delete | ( | apr_mmap_t * | mm | ) |

Remove a mmap'ed.

Parameters

  mm | The mmap'ed file.

## apr_mmap_dup()

apr_status_t apr_mmap_dup | ( | apr_mmap_t ** | new_mmap,
|  | apr_mmap_t * | old_mmap,
|  | apr_pool_t * | p
| ) |  |

Duplicate the specified MMAP.

Parameters

  new_mmap | The structure to duplicate into.
  old_mmap | The mmap to duplicate.
  p | The pool to use for new_mmap.

## apr_mmap_offset()

apr_status_t apr_mmap_offset | ( | void ** | addr,
|  | apr_mmap_t * | mm,
|  | apr_off_t | offset
| ) |  |

Move the pointer into the mmap'ed file to the specified offset.

Parameters

  addr | The pointer to the offset specified.
  mm | The mmap'ed file.
  offset | The offset to move to.