mlockall, munlockall

NAME

mlockall, munlockall - lock/unlock the address space of a process ( REALTIME)
 SYNOPSIS


#include <sys/mman.h>

int mlockall(int flags);
int munlockall(void);

 DESCRIPTION
The function mlockall() causes all of the pages mapped by the address space of a process to be memory resident until unlocked or until the process exits or execs another process image. The flags argument determines whether the pages to be locked are those currently mapped by the address space of the process, those that will be mapped in the future, or both. The flags argument is constructed from the inclusive OR of one or more of the following symbolic constants, defined in <sys/mman.h>:
MCL_CURRENT
Lock all of the pages currently mapped into the address space of the process.
MCL_FUTURE
Lock all of the pages that become mapped into the address space of the process in the future, when those mappings are established.

If MCL_FUTURE is specified, and the automatic locking of future mappings eventually causes the amount of locked memory to exceed the amount of available physical memory or any other implementation-dependent limit, the behaviour is implementation-dependent. The manner in which the implementation informs the application of these situations is also implementation-dependent.

The munlockall() function unlocks all currently mapped pages of the address space of the process. Any pages that become mapped into the address space of the process after a call to munlockall() will not be locked, unless there is an intervening call to mlockall() specifying MCL_FUTURE or a subsequent call to mlockall() MCL_CURRENT. If pages mapped into the address space of the process are also mapped into the address spaces of other processes and are locked by those processes, the locks established by the other processes are unaffected by a call by this process to munlockall().

Upon successful return from the mlockall() function that specifies MCL_CURRENT, all currently mapped pages of the process's address space will be memory resident and locked. Upon return from the munlockall() function, all currently mapped pages of the process's address space will be unlocked with respect to the process's address space. The memory residency of unlocked pages is unspecified.

The appropriate privilege is required to lock process memory with mlockall().

 RETURN VALUE
Upon successful completion, the mlockall() function returns a value of zero. Otherwise, no additional memory is locked, and the function returns a value of -1 and sets errno to indicate the error. The effect of failure of mlockall() on previously existing locks in the address space is unspecified.

If it is supported by the implementation, the munlockall() function always returns a value of zero. Otherwise, the function returns a value of -1 and sets errno to indicate the error.

 ERRORS
The mlockall() and munlockall() functions will fail if:
[ENOSYS]
The implementation does not support this memory locking interface.

The mlockall() function will fail if:

[EAGAIN]
Some or all of the memory identified by the operation could not be locked when the call was made.
[EINVAL]
The flags argument is zero, or includes unimplemented flags.

The mlockall() function may fail if:

[ENOMEM]
Locking all of the pages currently mapped into the address space of the process would exceed an implementation-dependent limit on the amount of memory that the process may lock.
[EPERM]
The calling process does not have the appropriate privilege to perform the requested operation.
 EXAMPLES
None.
 APPLICATION USAGE
None.
 SEE ALSO
exec, _exit(), fork(), mlock(), munmap(), <sys/mman.h>.
DERIVATION
Derived from the POSIX Realtime Extension (1003.1b-1993/1003.1i-1995)
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值