X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=mm%2Fmlock.c;h=4d3fea267e0dabde457091a2618a0efe8dba864d;hb=c12b3c62513ecf95c979d5c1785f99562b9dd10d;hp=3446b7ef731e6c419cc0cf2656829eeca6fea5a7;hpb=b361735043e3001eadb1d40916fd1a4fca1a9363;p=linux-2.6 diff --git a/mm/mlock.c b/mm/mlock.c index 3446b7ef73..4d3fea267e 100644 --- a/mm/mlock.c +++ b/mm/mlock.c @@ -10,7 +10,18 @@ #include #include #include +#include +#include +int can_do_mlock(void) +{ + if (capable(CAP_IPC_LOCK)) + return 1; + if (current->signal->rlim[RLIMIT_MEMLOCK].rlim_cur != 0) + return 1; + return 0; +} +EXPORT_SYMBOL(can_do_mlock); static int mlock_fixup(struct vm_area_struct *vma, struct vm_area_struct **prev, unsigned long start, unsigned long end, unsigned int newflags)