swapon: decode swap flags

* file.c: Include <sys/swap.h>.
(swap_flags): New xlat structure.
(sys_swapon): New function.
* linux/dummy.h (sys_swapon): Remove.
* linux/syscall.h (sys_swapon): New declaration.
This commit is contained in:
Дмитрий Левин 2012-03-09 21:02:19 +00:00
parent 37ab4b79de
commit 8829365654
3 changed files with 23 additions and 1 deletions

22
file.c
View File

@ -33,6 +33,7 @@
#include "defs.h"
#include <dirent.h>
#include <sys/swap.h>
struct kernel_dirent {
unsigned long d_ino;
@ -2694,3 +2695,24 @@ sys_fallocate(struct tcb *tcp)
}
return 0;
}
static const struct xlat swap_flags[] = {
{ SWAP_FLAG_PREFER, "SWAP_FLAG_PREFER" },
{ SWAP_FLAG_DISCARD, "SWAP_FLAG_DISCARD" },
{ 0, NULL }
};
int
sys_swapon(struct tcb *tcp)
{
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);
}
return 0;
}

View File

@ -91,7 +91,6 @@
#define sys_rmdir sys_chdir
#define sys_sched_get_priority_max sys_sched_get_priority_min
#define sys_swapoff sys_chdir
#define sys_swapon sys_chdir
#define sys_symlink sys_link
#define sys_syncfs sys_close
#define sys_umount sys_chdir

View File

@ -259,6 +259,7 @@ int sys_stat64();
int sys_statfs();
int sys_statfs64();
int sys_stime();
int sys_swapon();
int sys_symlinkat();
int sys_sysctl();
int sys_sysinfo();