munlock()

Unlock the range of process address space already allocated

Synopsis:

#include <sys/mman.h>

int munlock(const void * addr, 
            size_t len);

Arguments:

addr
The starting address for the range of process address space.
len
The amount of memory to unlock, in bytes.

Library:

libc

Use the -l c option to qcc to link against this library. This library is usually included automatically.

Description:

The munlock() function unlocks the specified range of address space, which was locked by a call to mlock() or mlockall(). Memory locks don't stack; the memory is unlocked, no matter how many times the same process locked it.


Note: The full POSIX implementation for this function was added in the QNX Neutrino Core OS 6.3.2.

The munlock() function doesn't affect those pages that have been mapped and locked into the address spaces of other processes.

Returns:

0
Success.
-1
An error occurred (errno is set).

Errors:

ENOMEM
Some or all of the address range specified by the addr and len arguments doesn't correspond to valid mapped pages in the address space of the process.

Classification:

POSIX 1003.1 MLR

Safety:
Cancellation point No
Interrupt handler No
Signal handler Yes
Thread Yes

See also:

mlock(), mlockall(), munlockall()

Locking memory in the Process Manager chapter of the System Architecture guide