From 9e4cf71371187927a6eb7cc4fe32b67d58a93010 Mon Sep 17 00:00:00 2001 From: Daniel Borkmann Date: Tue, 4 Jun 2013 00:04:15 +0200 Subject: xutils: break out string handling and locking Break out all string handling functions and lockme stuff in order to further eliminate the big code blob in xutils, so that it can be easier maintained. Signed-off-by: Daniel Borkmann --- lockme.h | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 lockme.h (limited to 'lockme.h') 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 + +#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 */ -- cgit v1.2.3-54-g00ecf