]> granicus.if.org Git - strace/blobdiff - mem.c
Decode mtd ioctls
[strace] / mem.c
diff --git a/mem.c b/mem.c
index 1fc8595f3a8f59b20ef46c581be543b78acef569..72b30decc2380ffa8dcc54de71af8753e8fbc8be 100644 (file)
--- a/mem.c
+++ b/mem.c
  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- *     $Id$
  */
 
 #include "defs.h"
-
 #include <asm/mman.h>
 #include <sys/mman.h>
-
 #if defined(I386)
 # include <asm/ldt.h>
 # ifdef HAVE_STRUCT_USER_DESC
@@ -51,7 +47,7 @@
 /*
  * Ugly hacks for systems that have a long long off_t
  */
-#define sys_mmap64     sys_mmap
+# define sys_mmap64    sys_mmap
 #endif
 
 int
@@ -63,7 +59,6 @@ sys_brk(struct tcb *tcp)
        return RVAL_HEX;
 }
 
-
 static const struct xlat mmap_prot[] = {
        { PROT_NONE,    "PROT_NONE",    },
        { PROT_READ,    "PROT_READ"     },
@@ -146,29 +141,29 @@ static const struct xlat mmap_flags[] = {
        { MAP_EXECUTABLE,"MAP_EXECUTABLE"},
 #endif
 #ifdef MAP_INHERIT
-       { MAP_INHERIT,"MAP_INHERIT"     },
+       { MAP_INHERIT,  "MAP_INHERIT"   },
 #endif
 #ifdef MAP_FILE
-       { MAP_FILE,"MAP_FILE"},
+       { MAP_FILE,     "MAP_FILE"      },
 #endif
 #ifdef MAP_LOCKED
-       { MAP_LOCKED,"MAP_LOCKED"},
+       { MAP_LOCKED,   "MAP_LOCKED"    },
 #endif
        /* FreeBSD ones */
-#ifdef MAP_ANON
-       { MAP_ANON,             "MAP_ANON"      },
+#if defined(MAP_ANON) && (!defined(MAP_ANONYMOUS) || MAP_ANON != MAP_ANONYMOUS)
+       { MAP_ANON,     "MAP_ANON"      },
 #endif
 #ifdef MAP_HASSEMAPHORE
-       { MAP_HASSEMAPHORE,     "MAP_HASSEMAPHORE"      },
+       { MAP_HASSEMAPHORE,"MAP_HASSEMAPHORE"},
 #endif
 #ifdef MAP_STACK
-       { MAP_STACK,            "MAP_STACK"     },
+       { MAP_STACK,    "MAP_STACK"     },
 #endif
 #ifdef MAP_NOSYNC
-       { MAP_NOSYNC,           "MAP_NOSYNC"    },
+       { MAP_NOSYNC,   "MAP_NOSYNC"    },
 #endif
 #ifdef MAP_NOCORE
-       { MAP_NOCORE,           "MAP_NOCORE"    },
+       { MAP_NOCORE,   "MAP_NOCORE"    },
 #endif
 #ifdef TILE
        { MAP_CACHE_NO_LOCAL, "MAP_CACHE_NO_LOCAL" },
@@ -368,7 +363,6 @@ sys_mmap64(struct tcb *tcp)
 }
 #endif /* _LFS64_LARGEFILE || HAVE_LONG_LONG_OFF_T */
 
-
 int
 sys_munmap(struct tcb *tcp)
 {
@@ -390,7 +384,6 @@ sys_mprotect(struct tcb *tcp)
        return 0;
 }
 
-
 static const struct xlat mremap_flags[] = {
        { MREMAP_MAYMOVE,       "MREMAP_MAYMOVE"        },
 #ifdef MREMAP_FIXED
@@ -434,7 +427,6 @@ static const struct xlat madvise_cmds[] = {
        { 0,                    NULL },
 };
 
-
 int
 sys_madvise(struct tcb *tcp)
 {
@@ -445,7 +437,6 @@ sys_madvise(struct tcb *tcp)
        return 0;
 }
 
-
 static const struct xlat mlockall_flags[] = {
 #ifdef MCL_CURRENT
        { MCL_CURRENT,  "MCL_CURRENT" },
@@ -465,8 +456,6 @@ sys_mlockall(struct tcb *tcp)
        return 0;
 }
 
-
-
 #ifdef MS_ASYNC
 
 static const struct xlat mctl_sync[] = {
@@ -712,7 +701,6 @@ sys_remap_file_pages(struct tcb *tcp)
        return 0;
 }
 
-
 #define MPOL_DEFAULT    0
 #define MPOL_PREFERRED  1
 #define MPOL_BIND       2
@@ -725,7 +713,6 @@ sys_remap_file_pages(struct tcb *tcp)
 #define MPOL_MF_MOVE   (1<<1)
 #define MPOL_MF_MOVE_ALL (1<<2)
 
-
 static const struct xlat policies[] = {
        { MPOL_DEFAULT,         "MPOL_DEFAULT"          },
        { MPOL_PREFERRED,       "MPOL_PREFERRED"        },
@@ -753,7 +740,6 @@ static const struct xlat move_pages_flags[] = {
        { 0,                    NULL                    }
 };
 
-
 static void
 get_nodes(struct tcb *tcp, unsigned long ptr, unsigned long maxnodes, int err)
 {
@@ -838,6 +824,18 @@ sys_get_mempolicy(struct tcb *tcp)
        return 0;
 }
 
+int
+sys_migrate_pages(struct tcb *tcp)
+{
+       if (entering(tcp)) {
+               tprintf("%ld, ", (long) (pid_t) tcp->u_arg[0]);
+               get_nodes(tcp, tcp->u_arg[2], tcp->u_arg[1], 0);
+               tprints(", ");
+               get_nodes(tcp, tcp->u_arg[3], tcp->u_arg[1], 0);
+       }
+       return 0;
+}
+
 int
 sys_move_pages(struct tcb *tcp)
 {