M_MAP_FD(3)

EXPERIMENTAL_FUNC
m_map_fd - Map a file descriptor

SYNOPSIS
#include <karma_m.h>

void * m_map_fd

(int *fd, uaddr size, flag writable, flag update_on_write, flag warn_unsupported)

DESCRIPTION
Map a file descriptor

fd  A pointer to the file descriptor to map. If the descriptor is less than 0 then an appropriately chosen file is opened and the newly opened file descriptor is written here.

size
    The size of the region to map.

writable
    If the mapped pages are to be writable, this must be TRUE. If this is FALSE and the memory pages are written to, a segmentation fault occurs.

update_on_write
    If the disc file should be updated when the memory pages are written to, this must be TRUE. If this is FALSE, then a write to a memory page causes the page to be copied into swap space and the process retains a private copy of the page from this point on.

warn_unsupported
    If TRUE, attempts to use unsupported features will generate a warning message.

RETURN VALUE
A pointer to the mapped file on success, else NULL.

Multi-threading Level
Unsafe.

NOTE
If <<update_on_write>> is FALSE and <<writable>> is TRUE, then some systems require the allocation of normal virtual memory equal to the size of the disc file at the time of mapping, while others will dynamically allocate memory from swap space as pages are written into. In the latter case, some systems will cause a segmentation fault if swap space is exhausted, while other systems wait for space to be freed.

AUTHOR
Richard Gooch (rgooch@atnf.csiro.au)

AVAILABLITY
The Karma Distribution is available for anonymous ftp from: ftp://ftp.atnf.csiro.au/pub/software/karma/ ftp://wuarchive.wustl.edu/graphics/graphics/packages/karma/ ftp://ftp.pwr.wroc.pl/pub/karma/ The Karma Home Page is: http://www.atnf.csiro.au/karma/