struct timeval etime; /* Syscall entry time */
/* Support for tracing forked processes */
struct tcb *parent; /* Parent of this process */
- int nchildren; /* # of traced children */
#ifdef LINUX
- int nclone_threads; /* # of nchildren with CLONE_THREAD */
+ int nclone_threads; /* # of children with CLONE_THREAD */
#endif
/* (1st arg of wait4()) */
long baddr; /* `Breakpoint' address */
sizeof tcpchild->inst);
}
tcpchild->parent = tcp;
- tcp->nchildren++;
if (tcpchild->flags & TCB_SUSPENDED) {
/* The child was born suspended, due to our having
forced CLONE_PTRACE. */
new thread, there will never be a
TCB_CLONE_THREAD process that has
children. */
- --tcp->nchildren;
tcp = tcp->parent;
tcpchild->parent = tcp;
- ++tcp->nchildren;
}
if (call_flags & CLONE_THREAD) {
tcpchild->flags |= TCB_CLONE_THREAD;
}
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;
}
}
}
sizeof tcpchild->inst);
}
tcpchild->parent = tcp;
- tcp->nchildren++;
if (!qflag)
fprintf(stderr, "Process %d attached\n", pid);
}
else if (tid != tcbtab[tcbi]->pid) {
tcp = alloctcb(tid);
tcp->flags |= TCB_ATTACHED|TCB_CLONE_THREAD|TCB_FOLLOWFORK;
- tcbtab[tcbi]->nchildren++;
tcbtab[tcbi]->nclone_threads++;
tcp->parent = tcbtab[tcbi];
}
if ((tcp->flags & TCB_INUSE) == 0) {
tcp->pid = pid;
tcp->parent = NULL;
- tcp->nchildren = 0;
#ifdef TCB_CLONE_THREAD
tcp->nclone_threads = 0;
#endif
tcp->pid = 0;
if (tcp->parent != NULL) {
- tcp->parent->nchildren--;
#ifdef TCB_CLONE_THREAD
if (tcp->flags & TCB_CLONE_THREAD)
tcp->parent->nclone_threads--;
#endif
#ifdef LINUX
- /* Update `tcp->parent->parent->nchildren' and the other fields
- like NCLONE_DETACHED, only for zombie group leader that has
- already reported and been short-circuited at the top of this
+ /* Update fields like NCLONE_DETACHED, only
+ for zombie group leader that has already reported
+ and been short-circuited at the top of this
function. The same condition as at the top of DETACH. */
if ((tcp->flags & TCB_CLONE_THREAD) &&
tcp->parent->nclone_threads == 0 &&