Ensure that the locked memory limit is bigger than a huge page before trying
the test.

Signed-off-by: Eric Munson <[EMAIL PROTECTED]>

---
Changes from v1: use check_hugepagesize to avoid 32 bit overflow

 tests/mlock.c |    7 +++++++
 1 file changed, 7 insertions(+)

diff -upNr libhugetlbfs-1.3-pre1.orig/tests/mlock.c 
libhugetlbfs-1.3-pre1/tests/mlock.c
--- libhugetlbfs-1.3-pre1.orig/tests/mlock.c    2008-04-10 20:30:26.000000000 
-0700
+++ libhugetlbfs-1.3-pre1/tests/mlock.c 2008-04-15 10:34:29.000000000 -0700
@@ -25,6 +25,7 @@
 #include <string.h>
 #include <errno.h>
 #include <sys/mman.h>
+#include <sys/resource.h>
 
 #include <hugetlbfs.h>
 #include "hugetests.h"
@@ -57,6 +58,12 @@ static void test_simple_mlock(int flags)
 
 int main(int argc, char *argv[])
 {
+       struct rlimit limit_info;
+       if(getrlimit(RLIMIT_MEMLOCK, &limit_info))
+               ERROR("Unable to read locked memory rlimit: %s", 
strerror(errno));
+       if(limit_info.rlim_cur < check_hugepagesize())
+               CONFIG("Locked memory ulimit set below huge page size");
+
        test_simple_mlock(MAP_PRIVATE);
        test_simple_mlock(MAP_SHARED);
        test_simple_mlock(MAP_PRIVATE|MAP_LOCKED);

Attachment: signature.asc
Description: This is a digitally signed message part

-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
Don't miss this year's exciting event. There's still time to save $100. 
Use priority code J8TL2D2. 
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
Libhugetlbfs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/libhugetlbfs-devel

Reply via email to