mmap

mmap --  implements the C mmap function call.

Syntax

mmap (size, prot_flags, share_flags, shm_file, offset)

		

Arguments

size

The size (in bytes) of the shared memory segment to map.

prot_flags

Access capability flags.

share_flags

Sharing flags.

shm_file

A file descriptor as returned by shm_open.

offset

An offset from the beginning of the shared memory area.

Returns

A buffer which is mapped to the shared memory region, or nil on failure with errno set.

Description

This function is currently only available in QNX 4. It implements the C mmap function call, returning a buffer which maps to the shared memory region. The shm_open function needs to be called before using this function.

The prot_flags specifies the access capability. Valid prot_flags are bitwise OR-ed combinations of:

The share_flags specify the handling of the memory region. Valid share_flags are bitwise OR-ed combinations of:

Remember to require the "const/mman.lsp" file before using these constants.

Possible errors when using this function are:

Example

    
    //This code maps the first 1000 bytes from video
    //memory (0xA0000) into a buffer named buf.
    
    require_lisp("const/filesys");
    require_lisp("const/mman");
    fd = shm_open("Physical",O_RDONLY, 0o777);
    buf = mmap(1000, PROT_READ , MAP_SHARED, fd, 0xA0000);
    
    
    		

See Also

shm_open

Copyright 1995-2002 by Cogent Real-Time Systems, Inc.