diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..f7d8fbe --- /dev/null +++ b/.gitignore @@ -0,0 +1,5 @@ +*.o +lib*so* +.*.sw* +~* +tags diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..3722a96 --- /dev/null +++ b/Makefile @@ -0,0 +1,13 @@ +all: libmlockall.so.0.0 + +libmlockall.so.0.0: Makefile libmlockall.c + ${CC} -fPIC -shared -Wl,-soname,libmlockall.so.0 -o libmlockall.so.0.0 -lc libmlockall.c # -Wl,-export-dynamic + ln -fs libmlockall.so.0.0 libmlockall.so + ln -fs libmlockall.so.0.0 libmlockall.so.0 +clean: + rm -Rf *.o lib*.so* + +# for checkinstall +install: + install lib*.so* /usr/lib/ + install mlockall /usr/bin/ diff --git a/README b/README new file mode 100644 index 0000000..e6cfe6f --- /dev/null +++ b/README @@ -0,0 +1 @@ +Lock all pages in memory for a process tree diff --git a/libmlockall.c b/libmlockall.c new file mode 100644 index 0000000..18a6992 --- /dev/null +++ b/libmlockall.c @@ -0,0 +1,8 @@ +#include +#include + +void __attribute__((constructor)) init() { + if(mlockall(MCL_CURRENT|MCL_FUTURE)) { + perror("mlockall"); + } +} diff --git a/mlockall b/mlockall new file mode 100755 index 0000000..f6201e0 --- /dev/null +++ b/mlockall @@ -0,0 +1,2 @@ +#!/bin/sh +LD_PRELOAD="$LD_PRELOAD /usr/lib/libmlockall.so" "$@"