*nix Documentation Project
·  Home
 +   man pages
·  Linux HOWTOs
·  FreeBSD Tips
·  *niX Forums

  man pages->IRIX man pages -> mlock (3c)              
Title
Content
Arch
Section
 

Contents


mlock(3C)							     mlock(3C)


NAME    [Toc]    [Back]

     mlock, munlock - lock or unlock pages in memory

SYNOPSIS    [Toc]    [Back]

     #include <sys/types.h>
     #include <sys/mman.h>

     int mlock(const void *addr<b>, size_t	len<b>);
     int munlock(const void *addr<b>, size_t len<b>);

DESCRIPTION    [Toc]    [Back]

     mlock locks the pages associated with the address range (addr, addr +
     len) into memory.	The super-user can lock	as many	pages as it wishes,
     other users are limited to	a per process maximum {PLOCK_MAX}. Locks
     established with mlock are	not inherited by a child process after a fork.

     munlock unlocks the pages associated with the address range (addr,	addr +
     len), regardless of the number of times the pages were locked. Page locks
     established by other processes are	unaffected, when the pages are shared
     amongst multiple processes.

     Address addr is not required to be	page aligned, as the system
     automatically rounds the address down to the nearest page boundary.

     mlock or munlock will fail	if one or more of the following	are true:

     [EAGAIN]	 There was insufficient	lockable memory	to lock	the entire
		 address range (addr, addr + len).  This may occur even	though
		 the amount requested was less than the	system-imposed maximum
		 number	of locked pages.

     [EBUSY]	 munlock will fail with	this error if the address range
		 specified has some active I/O initiated by some other process
		 belonging to same share group.

     [ENOMEM]	 The addresses specified by (addr, addr	+ len) are not mapped
		 into the user's address space.

     [ENOMEM]	 The caller was	not super-user and the number of pages to be
		 locked	exceeded the per process limit {PLOCK_MAX} [see
		 intro(2)].

     [ENOMEM]	 The total number of pages locked by the caller	would exceed
		 the maximum resident size for the process [see	setrlimit(2)].

     [ENOSPC]	 The address range (addr, addr + len) contains a memory-mapped
		 file, and there is insufficient space on the device to
		 allocate the entire file.







									Page 1






mlock(3C)							     mlock(3C)



SEE ALSO
     exec(2), exit(2), fork(2),	mlockall(3C), munlockall(3C), mmap(2),
     mpin(2), munpin(2), plock(2)

DIAGNOSTICS    [Toc]    [Back]

     Upon successful completion, the functions mlock and munlock return	0,
     otherwise,	they return -1 and set errno to	indicate the error.

WARNING    [Toc]    [Back]

     The functions mlock/munlock and mpin/munpin provide similar
     functionality.  The major difference between the two sets is that
     mpin/munpin maintains a per page lock counter and mlock/munlock does not.
     Developers	should choose the set that best	suites their application and
     stick with	it, as mixing the interfaces may result	in unexpected
     behavior.


									PPPPaaaaggggeeee 2222
[ Back ]
 Similar pages
Name OS Title
munlock FreeBSD lock (unlock) physical pages in memory
munlock OpenBSD lock (unlock) physical pages in memory
mlock FreeBSD lock (unlock) physical pages in memory
mlock NetBSD lock (unlock) physical pages in memory
mlock OpenBSD lock (unlock) physical pages in memory
munlock NetBSD lock (unlock) physical pages in memory
vsunlock FreeBSD lock/unlock user space addresses in memory
plock IRIX lock into memory or unlock process, text, or data
vslock FreeBSD lock/unlock user space addresses in memory
mpin IRIX lock pages in memory
Copyright © 2004-2005 DeniX Solutions SRL
newsletter delivery service