]> granicus.if.org Git - strace/blobdiff - swapon.c
tests: fix build with recent kernel headers
[strace] / swapon.c
index 4006d9629b5132a471b4faae0d4cb7185e4d1f6c..e5ebd0fa77a9472c3342b78b524f93cb0489c0a5 100644 (file)
--- a/swapon.c
+++ b/swapon.c
@@ -2,31 +2,22 @@
 
 #include <sys/swap.h>
 
-#ifndef SWAP_FLAG_PREFER
-# define SWAP_FLAG_PREFER 0x8000
-#endif
-#ifndef SWAP_FLAG_DISCARD
-# define SWAP_FLAG_DISCARD 0x10000
-#endif
-#ifndef SWAP_FLAG_DISCARD_ONCE
-# define SWAP_FLAG_DISCARD_ONCE 0x20000
-#endif
-#ifndef SWAP_FLAG_DISCARD_PAGES
-# define SWAP_FLAG_DISCARD_PAGES 0x40000
-#endif
-
 #include "xlat/swap_flags.h"
 
 SYS_FUNC(swapon)
 {
-       if (entering(tcp)) {
-               int flags = tcp->u_arg[1];
-               printpath(tcp, tcp->u_arg[0]);
-               tprints(", ");
-               printflags(swap_flags, flags & ~SWAP_FLAG_PRIO_MASK,
-                       "SWAP_FLAG_???");
-               if (flags & SWAP_FLAG_PREFER)
-                       tprintf("|%d", flags & SWAP_FLAG_PRIO_MASK);
+       unsigned int flags = tcp->u_arg[1];
+       unsigned int prio = flags & SWAP_FLAG_PRIO_MASK;
+       flags &= ~SWAP_FLAG_PRIO_MASK;
+
+       printpath(tcp, tcp->u_arg[0]);
+       tprints(", ");
+       if (flags) {
+               printflags(swap_flags, flags, "SWAP_FLAG_???");
+               tprintf("|%u", prio);
+       } else {
+               tprintf("%u", prio);
        }
-       return 0;
+
+       return RVAL_DECODED;
 }