summaryrefslogtreecommitdiff
path: root/lockme.h
diff options
context:
space:
mode:
Diffstat (limited to 'lockme.h')
-rw-r--r--lockme.h19
1 files changed, 19 insertions, 0 deletions
diff --git a/lockme.h b/lockme.h
new file mode 100644
index 0000000..7cce97b
--- /dev/null
+++ b/lockme.h
@@ -0,0 +1,19 @@
+#ifndef LOCKME_H
+#define LOCKME_H
+
+#include <sys/mman.h>
+
+#include "die.h"
+
+static inline void xlockme(void)
+{
+ if (mlockall(MCL_CURRENT | MCL_FUTURE) != 0)
+ panic("Cannot lock pages!\n");
+}
+
+static inline void xunlockme(void)
+{
+ munlockall();
+}
+
+#endif /* LOCKME_H */