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

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

Contents


mlockall(3C)							  mlockall(3C)


NAME    [Toc]    [Back]

     mlockall, munlockall - lock or unlock address space

SYNOPSIS    [Toc]    [Back]

     #include <sys/mman.h>

     int mlockall(int flags<b>);
     int munlockall(void);

DESCRIPTION    [Toc]    [Back]

     mlockall locks all	pages mapped in	the address space of the calling
     process into memory, including: text, data, stack and mmaped regions.
     Locked pages are immune to	all routine swapping.

     The value of flags	determines whether the pages to	be locked are those
     currently mapped by the address space, those that will be mapped in the
     future, or	both:

	       MCL_CURRENT    Lock current mappings

	       MCL_FUTURE     Lock future mappings

     munlockall	unlocks	all memory mapped pages	in the address space of	the
     calling process, regardless of the	number of times	the pages were locked.
     Automatic memory locking of future	memory mappings	is disabled for	the
     process.

     Locks established with mlockall are not inherited by a child process
     after a fork.

     If	the address space contains autogrow regions [see mmap(2)], mlockall
     will only cause the pages through the current end of file to be locked
     down.

     In	the event automatic memory locking of future mappings is enabled for a
     process (MCL_FUTURE), and the locked memory of that process stack space
     exceeds either the	system's physical memory or the	maximum	amount of
     lockable pages per	process	as determined by the system variable maxlkmem,
     the process will receive a	SIGSEGV	with a signal code of ENOMEM [see
     sigaction(2) and signal(5)]. If the locked	memory of the process heap
     space exceeds either the system's physical	memory or the maximum amount
     of	lockable pages per process maxlkmem, the system	call which attempts
     the expansion will	fail without making a change to	the amount of
     allocated space, and errno	is set to ENOMEM.

     mlockall or munlockall will fail if one or	more of	the following are
     true:

     [EAGAIN]	 There was insufficient	lockable memory	to lock	the entire
		 address space.	 This may occur	even though the	amount
		 requested was less than the system-imposed maximum number of
		 locked	pages.



									Page 1






mlockall(3C)							  mlockall(3C)



     [EBUSY]	 munlockall will fail with this	error if a region of the
		 address space has some	active I/O initiated by	some other
		 process belonging to same share group.

     [EINVAL]	 The flags argument is zero or contains	invalid	flags.

     [ENOMEM]	 The caller was	not super-user and the number of pages to be
		 locked	exceeded the maximum number of lockable	pages per
		 process as defined by the system variable maxlkmem [see
		 systune(1M)].

     [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 space of the calling process contains a memorymapped
	file, and there	is insufficient	space on the device to
		 allocate the entire file.

SEE ALSO    [Toc]    [Back]

      
      
     exec(2), exit(2), fork(2),	mmap(2), mlock(3C), munlock(3C), mpin(2),
     munpin(2),	plock(2), sigaction(2),	sysconf(3C)

DIAGNOSTICS    [Toc]    [Back]

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

WARNING    [Toc]    [Back]

     The mlockall/munlockall pair and the plock	function provide similar
     functionality. 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
munlockall NetBSD lock (unlock) the address space of a process
mlockall OpenBSD lock (unlock) the address space of a process
munlockall FreeBSD lock (unlock) the address space of a process
mlockall FreeBSD lock (unlock) the address space of a process
munlockall OpenBSD lock (unlock) the address space of a process
mlockall NetBSD lock (unlock) the address space of a process
vslock FreeBSD lock/unlock user space addresses in memory
vsunlock FreeBSD lock/unlock user space addresses in memory
munlock HP-UX unlock a segment of the process virtual address space
munlockall HP-UX unlock the entire virtual address space of a process
Copyright © 2004-2005 DeniX Solutions SRL
newsletter delivery service