From: Roland McGrath Date: Tue, 24 Jul 2007 01:52:58 +0000 (+0000) Subject: 2007-07-23 Ulrich Drepper X-Git-Tag: v4.5.18~181 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=2c00a4a3cb2d949ecec228395b4912a4727e89d6;p=strace 2007-07-23 Ulrich Drepper * 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. --- diff --git a/linux/syscall.h b/linux/syscall.h index 18984b22..dbb7a847 100644 --- a/linux/syscall.h +++ b/linux/syscall.h @@ -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(); diff --git a/mem.c b/mem.c index b1447e54..3a803fcf 100644 --- a/mem.c +++ b/mem.c @@ -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