2007-07-23 Ulrich Drepper <drepper@redhat.com>

* mem.c (move_pages_flags): New variable.
	(sys_move_pages): New function.
	* linux/syscall.h: Declare sys_move_pages.
	* linux/syscallent.h: Add entry for sys_move_pages.
	* linux/x86_64/syscallent.h: Likewise.
This commit is contained in:
Roland McGrath 2007-07-24 01:52:58 +00:00
parent 7c7c00b193
commit 2c00a4a3cb
2 changed files with 83 additions and 1 deletions

View File

@ -99,7 +99,7 @@ int sys_mq_open(), sys_mq_timedsend(), sys_mq_timedreceive();
int sys_mq_notify(), sys_mq_getsetattr();
int sys_epoll_create(), sys_epoll_ctl(), sys_epoll_wait();
int sys_waitid(), sys_fadvise64(), sys_fadvise64_64();
int sys_mbind(), sys_get_mempolicy(), sys_set_mempolicy();
int sys_mbind(), sys_get_mempolicy(), sys_set_mempolicy(), sys_move_pages();
int sys_arch_prctl();
int sys_io_setup(), sys_io_submit(), sys_io_cancel(), sys_io_getevents(), sys_io_destroy();

82
mem.c
View File

@ -682,6 +682,8 @@ struct tcb *tcp;
#define MPOL_F_ADDR (1<<1)
#define MPOL_MF_STRICT (1<<0)
#define MPOL_MF_MOVE (1<<1)
#define MPOL_MF_MOVE_ALL (1<<2)
static const struct xlat policies[] = {
@ -694,6 +696,8 @@ static const struct xlat policies[] = {
static const struct xlat mbindflags[] = {
{ MPOL_MF_STRICT, "MPOL_MF_STRICT" },
{ MPOL_MF_MOVE, "MPOL_MF_MOVE" },
{ MPOL_MF_MOVE_ALL, "MPOL_MF_MOVE_ALL" },
{ 0, NULL }
};
@ -703,6 +707,12 @@ static const struct xlat mempolicyflags[] = {
{ 0, NULL }
};
static const struct xlat move_pages_flags[] = {
{ MPOL_MF_MOVE, "MPOL_MF_MOVE" },
{ MPOL_MF_MOVE_ALL, "MPOL_MF_MOVE_ALL" },
{ 0, NULL }
};
static void
get_nodes(tcp, ptr, maxnodes, err)
@ -794,4 +804,76 @@ struct tcb *tcp;
}
return 0;
}
int
sys_move_pages(tcp)
struct tcb *tcp;
{
if (entering(tcp)) {
unsigned long npages = tcp->u_arg[1];
tprintf("%ld, %lu, ", tcp->u_arg[0], npages);
if (tcp->u_arg[2] == 0)
tprintf("NULL, ");
else {
int i;
long puser = tcp->u_arg[2];
tprintf("{");
for (i = 0; i < npages; ++i) {
void *p;
if (i > 0)
tprintf(", ");
if (umove(tcp, puser, &p) < 0) {
tprintf("???");
break;
}
tprintf("%p", p);
puser += sizeof (void *);
}
tprintf("}, ");
}
if (tcp->u_arg[3] == 0)
tprintf("NULL, ");
else {
int i;
long nodeuser = tcp->u_arg[3];
tprintf("{");
for (i = 0; i < npages; ++i) {
int node;
if (i > 0)
tprintf(", ");
if (umove(tcp, nodeuser, &node) < 0) {
tprintf("???");
break;
}
tprintf("%#x", node);
nodeuser += sizeof (int);
}
tprintf("}, ");
}
}
if (exiting(tcp)) {
unsigned long npages = tcp->u_arg[1];
if (tcp->u_arg[4] == 0)
tprintf("NULL, ");
else {
int i;
long statususer = tcp->u_arg[4];
tprintf("{");
for (i = 0; i < npages; ++i) {
int status;
if (i > 0)
tprintf(", ");
if (umove(tcp, statususer, &status) < 0) {
tprintf("???");
break;
}
tprintf("%#x", status);
statususer += sizeof (int);
}
tprintf("}, ");
}
printflags(move_pages_flags, tcp->u_arg[5], "MPOL_???");
}
return 0;
}
#endif