Browse files

debug msgs# Explicit paths specified without -i nor -o; assuming --on…

…ly paths...
  • Loading branch information...
1 parent 763ff89 commit 220c5f1acd2bfafca40c3e89b5cd0c5f298645fc @abh1nay abh1nay committed Nov 26, 2012
Showing with 12 additions and 4 deletions.
  1. +12 −4 src/java/voldemort/store/readonly/io/jna/mman.java
View
16 src/java/voldemort/store/readonly/io/jna/mman.java
@@ -20,6 +20,8 @@
public static final int MAP_SHARED = 0x01; /* Share changes. */
public static final int MAP_PRIVATE = 0x02; /* Changes are private. */
+ public static final int MAP_ALIGN = 0x200; /* addr specifies alignment */
+
public static final int MAP_LOCKED = 0x02000; /* Lock the mapping. */
// http://linux.die.net/man/2/mmap
@@ -60,9 +62,12 @@ public static int munmap(Pointer addr, long len) throws IOException {
public static void mlock(Pointer addr, long len) throws IOException {
- if(Delegate.mlock(addr, len) != 0) {
+ int res = Delegate.mlock(addr, len);
+ if(res != 0) {
+ String error = errno.strerror();
logger.warn("Mlock failed probably because of insufficient privileges");
- logger.warn(errno.strerror());
+ logger.warn(error);
+ logger.warn(res);
} else {
logger.info("Mlock successfull");
@@ -112,8 +117,12 @@ public static void main(String[] args) throws Exception {
FileInputStream in = new FileInputStream(file);
int fd = voldemort.store.readonly.io.Native.getFd(in.getFD());
+ logger.info("File descriptor is: " + fd);
+
// mmap a large file...
- Pointer addr = mmap(file.length(), PROT_READ, mman.MAP_SHARED | mman.MAP_LOCKED, fd, 0);
+ Pointer addr = mmap(file.length(), PROT_READ, mman.MAP_SHARED | mman.MAP_ALIGN, fd, 0L);
+
+ logger.info("mmap address is: " + Pointer.nativeValue(addr));
// try to mlock it directly
mlock(addr, file.length());
@@ -122,5 +131,4 @@ public static void main(String[] args) throws Exception {
munmap(addr, file.length());
}
-
}

0 comments on commit 220c5f1

Please sign in to comment.