]> granicus.if.org Git - strace/commitdiff
2002-12-21 Roland McGrath <roland@redhat.com>
authorRoland McGrath <roland@redhat.com>
Sun, 22 Dec 2002 03:34:36 +0000 (03:34 +0000)
committerRoland McGrath <roland@redhat.com>
Sun, 22 Dec 2002 03:34:36 +0000 (03:34 +0000)
* linux/syscallent.h: Add some new 2.5 syscall names.
Now clone takes 5 args.
* process.c [LINUX] (clone_flags): Update with 2.5 flag bits.
[LINUX] (sys_clone): Print new args.
* mem.c (print_ldt_entry): Make global.

mem.c
process.c

diff --git a/mem.c b/mem.c
index 295238dbfca513e7a5f5ba1d6c34311767d07518..6d2e6534473b284a6841cb5f1610a9cfc9d895c6 100644 (file)
--- a/mem.c
+++ b/mem.c
@@ -37,7 +37,7 @@
 #endif
 #include <sys/mman.h>
 
-#if defined(LINUX) && defined(__i386__)
+#if defined(LINUX) && defined(I386)
 #include <asm/ldt.h>
 #endif
 
@@ -221,7 +221,7 @@ struct tcb *tcp;
            return 0;
 #endif // defined(IA64)
     return print_mmap(tcp, u_arg);
-   
+
 }
 #endif
 
@@ -281,7 +281,7 @@ struct tcb *tcp;
 }
 #endif
 
+
 int
 sys_munmap(tcp)
 struct tcb *tcp;
@@ -505,7 +505,7 @@ struct tcb *tcp;
 }
 
 #if defined(LINUX) && defined(__i386__)
-static void
+void
 print_ldt_entry (ldt_entry)
 struct modify_ldt_ldt_s *ldt_entry;
 {
@@ -577,7 +577,7 @@ struct tcb *tcp;
                }
        }
        return 0;
-                       
+
 }
 
 int
@@ -598,7 +598,6 @@ struct tcb *tcp;
                }
        }
        return 0;
-                       
+
 }
 #endif /* LINUX && __i386__ */
-
index 9705ba62bd9a0e3c5053995277f27f2fcd8495b6..14f3273b68e27eec305ee680f3d2265f834841a5 100644 (file)
--- a/process.c
+++ b/process.c
@@ -474,23 +474,46 @@ struct tcb *tcp;
 #define CLONE_FS        0x00000200      /* set if fs info shared between processes */
 #define CLONE_FILES     0x00000400      /* set if open files shared between processes */
 #define CLONE_SIGHAND   0x00000800      /* set if signal handlers shared */
-#define CLONE_PID       0x00001000      /* set if pid shared */
+#define CLONE_IDLETASK  0x00001000      /* kernel-only flag */
 #define CLONE_PTRACE    0x00002000      /* set if we want to let tracing continue on the child too */
 #define CLONE_VFORK     0x00004000      /* set if the parent wants the child to wake it up on mm_release */
 #define CLONE_PARENT    0x00008000      /* set if we want to have the same parent as the cloner */
+#define CLONE_THREAD   0x00010000      /* Same thread group? */
+#define CLONE_NEWNS    0x00020000      /* New namespace group? */
+#define CLONE_SYSVSEM  0x00040000      /* share system V SEM_UNDO semantics */
+#define CLONE_SETTLS   0x00080000      /* create a new TLS for the child */
+#define CLONE_PARENT_SETTID    0x00100000      /* set the TID in the parent */
+#define CLONE_CHILD_CLEARTID   0x00200000      /* clear the TID in the child */
+#define CLONE_DETACHED         0x00400000      /* parent wants no child-exit signal */
+#define CLONE_UNTRACED         0x00800000      /* set if the tracing process can't force CLONE_PTRACE on this clone */
+#define CLONE_CHILD_SETTID     0x01000000      /* set the TID in the child */
 
 static struct xlat clone_flags[] = {
     { CLONE_VM,                "CLONE_VM"      },
     { CLONE_FS,                "CLONE_FS"      },
     { CLONE_FILES,     "CLONE_FILES"   },
     { CLONE_SIGHAND,   "CLONE_SIGHAND" },
-    { CLONE_PID,       "CLONE_PID"     },
+    { CLONE_IDLETASK,  "CLONE_IDLETASK"},
     { CLONE_PTRACE,    "CLONE_PTRACE"  },
     { CLONE_VFORK,     "CLONE_VFORK"   },
     { CLONE_PARENT,    "CLONE_PARENT"  },
+    { CLONE_THREAD,    "CLONE_THREAD" },
+    { CLONE_NEWNS,     "CLONE_NEWNS" },
+    { CLONE_SYSVSEM,   "CLONE_SYSVSEM" },
+    { CLONE_SETTLS,    "CLONE_SETTLS" },
+    { CLONE_PARENT_SETTID,"CLONE_PARENT_SETTID" },
+    { CLONE_CHILD_CLEARTID,"CLONE_CHILD_CLEARTID" },
+    { CLONE_DETACHED,  "CLONE_DETACHED" },
+    { CLONE_UNTRACED,  "CLONE_UNTRACED" },
+    { CLONE_CHILD_SETTID,"CLONE_CHILD_SETTID" },
     { 0,               NULL            },
 };
 
+# ifdef I386
+#  include <asm/ldt.h>
+extern void print_ldt_entry();
+# endif
+
 int
 sys_clone(tcp)
 struct tcb *tcp;
@@ -499,6 +522,41 @@ struct tcb *tcp;
                tprintf("child_stack=%#lx, flags=", tcp->u_arg[1]);
                if (printflags(clone_flags, tcp->u_arg[0]) == 0)
                        tprintf("0");
+               if ((tcp->u_arg[0] & (CLONE_PARENT_SETTID|CLONE_CHILD_SETTID
+                                     |CLONE_SETTLS)) == 0)
+                       return 0;
+               if (tcp->u_arg[0] & CLONE_PARENT_SETTID) {
+                       int pid;
+                       if (umove(tcp, tcp->u_arg[2], &pid) == 0)
+                               tprintf(", [%d]", pid);
+                       else
+                               tprintf(", %#lx", tcp->u_arg[2]);
+               }
+               else
+                       tprintf(", <ignored>");
+#ifdef I386
+               if (tcp->u_arg[0] & CLONE_SETTLS) {
+                       struct modify_ldt_ldt_s copy;
+                       if (umove(tcp, tcp->u_arg[3], &copy) != -1) {
+                               tprintf(", {entry_number:%d, ",
+                                       copy.entry_number);
+                               if (!verbose(tcp))
+                                       tprintf("...}");
+                               else
+                                       print_ldt_entry(&copy);
+                       }
+                       else
+                               tprintf(", %#lx", tcp->u_arg[3]);
+               }
+               else
+                       tprintf(", <ignored>");
+# define TIDARG 4
+#else
+# define TIDARG 3
+#endif
+               if (tcp->u_arg[0] & CLONE_CHILD_SETTID)
+                       tprintf(", %#lx", tcp->u_arg[TIDARG]);
+#undef TIDARG
        }
        return 0;
 }