test: add hook macro test

From issue #357.
This commit is contained in:
Josh Poimboeuf 2014-08-13 14:19:30 -05:00
parent ae04b84f51
commit eb62038e92
2 changed files with 23 additions and 0 deletions

View File

@ -0,0 +1,3 @@
#!/bin/bash
[[ $(cat /proc/sys/fs/aio-max-nr) = 262144 ]]

View File

@ -0,0 +1,20 @@
Index: src/fs/aio.c
===================================================================
--- src.orig/fs/aio.c
+++ src/fs/aio.c
@@ -1642,3 +1642,15 @@ SYSCALL_DEFINE5(io_getevents, aio_contex
}
return ret;
}
+
+void kpatch_load_aio_max_nr(void)
+{
+ aio_max_nr = 0x40000;
+}
+void kpatch_unload_aio_max_nr(void)
+{
+ aio_max_nr = 0x10000;
+}
+#include "kpatch-macros.h"
+KPATCH_LOAD_HOOK(kpatch_load_aio_max_nr);
+KPATCH_UNLOAD_HOOK(kpatch_unload_aio_max_nr);