aboutsummaryrefslogtreecommitdiffstats
path: root/mm/mlock.c
diff options
context:
space:
mode:
Diffstat (limited to 'mm/mlock.c')
-rw-r--r--mm/mlock.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/mm/mlock.c b/mm/mlock.c
index 3446b7ef731e..4d3fea267e0d 100644
--- a/mm/mlock.c
+++ b/mm/mlock.c
@@ -10,7 +10,18 @@
10#include <linux/mm.h> 10#include <linux/mm.h>
11#include <linux/mempolicy.h> 11#include <linux/mempolicy.h>
12#include <linux/syscalls.h> 12#include <linux/syscalls.h>
13#include <linux/sched.h>
14#include <linux/module.h>
13 15
16int can_do_mlock(void)
17{
18 if (capable(CAP_IPC_LOCK))
19 return 1;
20 if (current->signal->rlim[RLIMIT_MEMLOCK].rlim_cur != 0)
21 return 1;
22 return 0;
23}
24EXPORT_SYMBOL(can_do_mlock);
14 25
15static int mlock_fixup(struct vm_area_struct *vma, struct vm_area_struct **prev, 26static int mlock_fixup(struct vm_area_struct *vma, struct vm_area_struct **prev,
16 unsigned long start, unsigned long end, unsigned int newflags) 27 unsigned long start, unsigned long end, unsigned int newflags)