shm_open

shm_open -- opens shared memory objects.

Syntax

shm_open (share_name, open_flags, create_mode, size?)

		

Arguments

share_name

The name of the shared memory object.

open_flags

Open control flags.

create_mode

Creation mode.

size

The size of the shared object in bytes.

Returns

A handle to the shared memory object, or nil on failure.

Description

This function is a wrapper for the C function shm_open. It is currently only available in QNX 4.

The name of the shared memory object is usually a name found under the /dev/shmem directory. Direct shared memory access to devices is acheived through a shm_open call to the existing Physical shared memory.

Important

If you are accessing the existing Physical shared memory region (/dev/shmem/Physical) DO NOT use the size argument, as you may inadvertantly resize this shared memory. The size argument is added as a convenience, and can be used to specify the size of a newly created object.

Valid open-flags are OR-ed combinations of:

The creation mode is usually an octal number in the range 0o000 - 0o777 defining the access privledges for the shared memory object. Require the 'const/filesys' file to load constants to make this arg easier

Possible errno values 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

mmap, shm_unlink

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