mmap(9E)
NAME
mmap − check virtual mapping for memory mapped device
SYNOPSIS
#include <sys/types.h>
#include <sys/cred.h>
#include <sys/mman.h>
#include <sys/vm.h>
#include <sys/ddi.h>
#include <sys/sunddi.h>
int prefixmmap(dev_t dev, off_t off
, int prot);
ARGUMENTS
dev Device whose memory is to be mapped.
off Offset within device memory at which mapping begins.
prot Protection flag from mman.h (for example, PROT_WRITE, PROT_READ).
INTERFACE LEVEL
Architecture independent level 2 (DKI only).
DESCRIPTION
The mmap() entry point is a required entry point for character drivers supporting memory-mapped devices. A memory mapped device has memory that can be mapped into a process’s address space. The mmap(2) system call, when applied to a character special file, allows this device memory to be mapped into user space for direct access by the user application.
An mmap() routine checks if the offset is within the range of pages supported by the device. For example, a device that has 512 bytes of memory that can be mapped into user space should not support offsets greater than 512. If the offset does not exist, then -1 is returned. If the offset does exist, mmap() returns the value returned by hat_getkpfnum(9F) for the page at offset off in the device’s memory.
mmap should only be supported for memory-mapped devices or pseudo-devices. See the segmap(9E) reference page for further information on memory-mapped device drivers.
RETURN VALUES
If the protection and offset are valid for the device, the driver should return the value returned by hat_getkpfnum(9F), for the page at offset off in the device’s memory. If not, -1 should be returned.
SEE ALSO
mmap(2), hat_getkpfnum(9F), segmap(9E)
SunOS 5.2 — Last change: 11 Apr 1991