next up previous contents
Next: mlockall: lock all memory Up: MOSS system calls Previous: lseek: reposition current offset

mlock: lock a region of memory

SYNOPSIS

int mlock(const void *addr, size_t size);

DESCRIPTION

This system call implements the POSIX.1b mlock function, which locks down a range of a program's memory so that page faults will not occur in that area. This is needed by programs with real-time requirements, or when installing ``fast'' (non-signal-based) hardware interrupt handlers.

Neither the start address of the specified region nor its length need to be page-aligned; this function will lock all pages overlapping the specified region.

PARAMETERS

addr
The start address of the region to lock.
size
The size of the region to lock, in bytes.

RETURN VALUE

Returns 0 if successful, or -1 on error, in which case errno indicates the error.



Bryan Ford