[PATCH 3/3] remove unused fields #2

Denys Vlasenko dvlasenk at redhat.com
Mon Feb 9 19:26:03 UTC 2009


On Mon, 2009-02-09 at 20:23 +0100, Denys Vlasenko wrote:
> On Mon, 2009-02-09 at 20:17 +0100, Denys Vlasenko wrote:
> > These patches are not intended for inclusion, at least not
> > right now. I seek your comments and patch review, and also
> > am interested in hearing whether this is a viable idea at all.
> > 
> > This is the first patch. It removes special handling of waitXXX
> > syscalls.
> 
> Second patch: get rid of some tcp->xxx members which were
> used for parent/child accounting, but which are useless
> since internal_wait() function is removed. "Useless" in a sense
> that they are either only assigned to now, or stay zero always,
> and thus conditionals on them can be eliminated:

Third patch: remove tcp->watpid as it is always zero now.
--
vda


diff -d -urpN strace.7/defs.h strace.8/defs.h
--- strace.7/defs.h	2009-02-09 18:04:29.000000000 +0100
+++ strace.8/defs.h	2009-02-09 18:04:34.000000000 +0100
@@ -319,7 +319,6 @@ struct tcb {
 				/* Support for tracing forked processes */
 //TODO: try to get rid of:
 	struct tcb *parent;	/* Parent of this process */
-	int waitpid;		/* pid(s) this process is waiting for */ // used only by resume_from_tcp()
 #ifdef LINUX
 	int nclone_threads;	/* # of children with CLONE_THREAD */
 	int nclone_detached;	/* # of children with CLONE_DETACHED */ // used only in handle_group_exit()
diff -d -urpN strace.7/strace.c strace.8/strace.c
--- strace.7/strace.c	2009-02-09 17:09:46.000000000 +0100
+++ strace.8/strace.c	2009-02-09 17:09:02.000000000 +0100
@@ -1444,14 +1444,10 @@ resume_from_tcp (struct tcb *tcp)
 	   it ought to wake up and get ECHILD.  We would have to
 	   search the system for all pid's in the pgrp to be sure.
 
-	     && (t->waitpid == -1 ||
-		 (t->waitpid == 0 && getpgid (tcp->pid) == getpgid (t->pid))
-		 || (t->waitpid < 0 && t->waitpid == -getpid (t->pid)))
+	     && (getpgid (tcp->pid) == getpgid (t->pid))
 	*/
 
-	if (tcp->parent &&
-	    (tcp->parent->flags & TCB_SUSPENDED) &&
-	    (tcp->parent->waitpid <= 0 || tcp->parent->waitpid == tcp->pid)) {
+	if (tcp->parent && (tcp->parent->flags & TCB_SUSPENDED)) {
  		error = resume(tcp->parent);
 	}
 






More information about the Strace-devel mailing list