]> granicus.if.org Git - strace/commitdiff
Drop nclone_detached and related flags
authorWang Chao <wang.chao@cn.fujitsu.com>
Fri, 27 Aug 2010 09:43:16 +0000 (17:43 +0800)
committerDmitry V. Levin <ldv@altlinux.org>
Sat, 28 Aug 2010 22:36:54 +0000 (22:36 +0000)
Remove nclone_detached since CLONE_DETACHED flag was no-op for a very
long time in kernel.

* defs.h (struct tcb): Remove nclone_detached field.
Remove TCB_CLONE_DETACHED flag.
* process.c: Remove CLONE_DETACHED flag.
(clone_flags): Remove CLONE_DETACHED entry.
(internal_fork, internal_wait): Remove code dealing with CLONE_DETACHED
flag and nclone_detached.
* strace.c (startup_attach, alloc_tcb, droptcb, handle_group_exit):
Likewise.

Signed-off-by: Wang Chao <wang.chao@cn.fujitsu.com>
defs.h
process.c
strace.c

diff --git a/defs.h b/defs.h
index 419b12e58a50d4c8547e43cd6bafe7c3fc1ba857..4b9c29e4322db605784823e3f6ef845cf45b9d55 100644 (file)
--- a/defs.h
+++ b/defs.h
@@ -336,7 +336,6 @@ struct tcb {
        int nzombies;           /* # of formerly traced children now dead */
 #ifdef LINUX
        int nclone_threads;     /* # of nchildren with CLONE_THREAD */
-       int nclone_detached;    /* # of nchildren with CLONE_DETACHED */
        int nclone_waiting;     /* clone threads in wait4 (TCB_SUSPENDED) */
 #endif
                                /* (1st arg of wait4()) */
@@ -382,7 +381,6 @@ struct tcb {
   || defined(ARM) || defined(MIPS) || defined(BFIN) || defined(TILE)
 #  define TCB_WAITEXECVE 02000 /* ignore SIGTRAP after exceve */
 # endif
-# define TCB_CLONE_DETACHED 04000 /* CLONE_DETACHED set in creating syscall */
 # define TCB_CLONE_THREAD  010000 /* CLONE_THREAD set in creating syscall */
 # define TCB_GROUP_EXITING 020000 /* TCB_EXITING was exit_group, not _exit */
 # include <sys/syscall.h>
index 59d7ba0401cd3a3f562ab1ef6ecb98d0468c94df..f7af19681bca514bea6cc7f82f5a6f71cd34e99b 100644 (file)
--- a/process.c
+++ b/process.c
@@ -555,7 +555,6 @@ struct tcb *tcp;
 #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 */
 
@@ -574,7 +573,6 @@ static const struct xlat clone_flags[] = {
     { 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            },
@@ -911,10 +909,6 @@ Process %u resumed (parent %d ready)\n",
                                tcpchild->flags |= TCB_CLONE_THREAD;
                                ++tcp->nclone_threads;
                        }
-                       if (call_flags & CLONE_DETACHED) {
-                               tcpchild->flags |= TCB_CLONE_DETACHED;
-                               ++tcp->nclone_detached;
-                       }
                        if ((call_flags & CLONE_PARENT) &&
                            !(call_flags & CLONE_THREAD)) {
                                --tcp->nchildren;
@@ -1932,9 +1926,9 @@ int flagarg;
        if (tcp->flags & TCB_CLONE_THREAD)
                /* The children we wait for are our parent's children.  */
                got_kids = (tcp->parent->nchildren
-                           > (tcp->parent->nclone_detached + tcp->parent->nclone_threads));
+                           > tcp->parent->nclone_threads);
        else
-               got_kids = (tcp->nchildren > (tcp->nclone_detached + tcp->nclone_threads));
+               got_kids = (tcp->nchildren > tcp->nclone_threads);
 #else
        got_kids = tcp->nchildren > 0;
 #endif
index 35059483e0f71aa31930cc1b0fe6bb83f8e06556..c1d65398498a15741cd91f088e60ee8a0677170f 100644 (file)
--- a/strace.c
+++ b/strace.c
@@ -443,10 +443,9 @@ startup_attach(void)
                                                ++nerr;
                                        else if (tid != tcbtab[tcbi]->pid) {
                                                tcp = alloctcb(tid);
-                                               tcp->flags |= TCB_ATTACHED|TCB_CLONE_THREAD|TCB_CLONE_DETACHED|TCB_FOLLOWFORK;
+                                               tcp->flags |= TCB_ATTACHED|TCB_CLONE_THREAD|TCB_FOLLOWFORK;
                                                tcbtab[tcbi]->nchildren++;
                                                tcbtab[tcbi]->nclone_threads++;
-                                               tcbtab[tcbi]->nclone_detached++;
                                                tcp->parent = tcbtab[tcbi];
                                        }
                                        if (interactive) {
@@ -1028,7 +1027,7 @@ alloc_tcb(int pid, int command_options_parsed)
                        tcp->nchildren = 0;
                        tcp->nzombies = 0;
 #ifdef TCB_CLONE_THREAD
-                       tcp->nclone_threads = tcp->nclone_detached = 0;
+                       tcp->nclone_threads = 0;
                        tcp->nclone_waiting = 0;
 #endif
                        tcp->flags = TCB_INUSE | TCB_STARTUP;
@@ -1396,15 +1395,10 @@ struct tcb *tcp;
        if (tcp->parent != NULL) {
                tcp->parent->nchildren--;
 #ifdef TCB_CLONE_THREAD
-               if (tcp->flags & TCB_CLONE_DETACHED)
-                       tcp->parent->nclone_detached--;
                if (tcp->flags & TCB_CLONE_THREAD)
                        tcp->parent->nclone_threads--;
 #endif
-#ifdef TCB_CLONE_DETACHED
-               if (!(tcp->flags & TCB_CLONE_DETACHED))
-#endif
-                       tcp->parent->nzombies++;
+               tcp->parent->nzombies++;
 #ifdef LINUX
                /* Update `tcp->parent->parent->nchildren' and the other fields
                   like NCLONE_DETACHED, only for zombie group leader that has
@@ -2232,8 +2226,6 @@ handle_group_exit(struct tcb *tcp, int sig)
 
        if (tcp->flags & TCB_CLONE_THREAD)
                leader = tcp->parent;
-       else if (tcp->nclone_detached > 0)
-               leader = tcp;
 
        if (sig < 0) {
                if (leader != NULL && leader != tcp