]> granicus.if.org Git - strace/commitdiff
2007-07-23 Ulrich Drepper <drepper@redhat.com>
authorRoland McGrath <roland@redhat.com>
Tue, 24 Jul 2007 01:52:58 +0000 (01:52 +0000)
committerRoland McGrath <roland@redhat.com>
Tue, 24 Jul 2007 01:52:58 +0000 (01:52 +0000)
* 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.

linux/syscall.h
mem.c

index 18984b222375e4b5d4a306d0be6ee6f9a673330d..dbb7a847c56035f78f245e35d49337be801b379f 100644 (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();
 
diff --git a/mem.c b/mem.c
index b1447e547754ff36d13f3f80222057e5c538e201..3a803fcf65006ff48614d5badaf1f83e30ae4d9e 100644 (file)
--- 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