]> granicus.if.org Git - strace/commitdiff
Handle CLONE_PARENT flag
authorWang Chao <wang.chao@cn.fujitsu.com>
Thu, 5 Aug 2010 06:58:37 +0000 (14:58 +0800)
committerDmitry V. Levin <ldv@altlinux.org>
Mon, 9 Aug 2010 21:29:00 +0000 (21:29 +0000)
* process.c (internal_fork): The parent of new cloned process is the
same of the calling process when CLONE_PARENT is set.

process.c

index f503ec5c27510b7dcbe5169af3952e4678102e65..59d7ba0401cd3a3f562ab1ef6ecb98d0468c94df 100644 (file)
--- a/process.c
+++ b/process.c
@@ -915,6 +915,16 @@ Process %u resumed (parent %d ready)\n",
                                tcpchild->flags |= TCB_CLONE_DETACHED;
                                ++tcp->nclone_detached;
                        }
+                       if ((call_flags & CLONE_PARENT) &&
+                           !(call_flags & CLONE_THREAD)) {
+                               --tcp->nchildren;
+                               tcpchild->parent = NULL;
+                               if (tcp->parent != NULL) {
+                                       tcp = tcp->parent;
+                                       tcpchild->parent = tcp;
+                                       ++tcp->nchildren;
+                               }
+                       }
                }
 #endif /* TCB_CLONE_THREAD */
        }