summaryrefslogtreecommitdiffstats
path: root/testsuite/systemtap.syscall/swap.c
diff options
context:
space:
mode:
Diffstat (limited to 'testsuite/systemtap.syscall/swap.c')
-rwxr-xr-xtestsuite/systemtap.syscall/swap.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/testsuite/systemtap.syscall/swap.c b/testsuite/systemtap.syscall/swap.c
new file mode 100755
index 00000000..a2db301e
--- /dev/null
+++ b/testsuite/systemtap.syscall/swap.c
@@ -0,0 +1,29 @@
+/* COVERAGE: swapon swapoff */
+#include <unistd.h>
+#include <asm/page.h>
+#include <sys/swap.h>
+
+
+int main()
+{
+ swapon("foobar_swap", 0);
+ // swapon ("foobar_swap", 0) =
+
+ swapon("foobar_swap", ((1 << SWAP_FLAG_PRIO_SHIFT) & SWAP_FLAG_PRIO_MASK) | SWAP_FLAG_PREFER);
+ // swapon ("foobar_swap", 32769) =
+
+ swapon("foobar_swap", ((7 << SWAP_FLAG_PRIO_SHIFT) & SWAP_FLAG_PRIO_MASK) | SWAP_FLAG_PREFER);
+ // swapon ("foobar_swap", 32775) =
+
+ swapon(0, 0);
+ // swapon (NULL, 0) =
+
+ swapoff("foobar_swap");
+ // swapoff ("foobar_swap") =
+
+ swapoff(0);
+ // swapoff (NULL) =
+
+ return 0;
+}
+