exit_process on PID reuse
authorcompudj <compudj@04897980-b3bd-0310-b5e0-8ef037075253>
Wed, 11 Aug 2004 18:33:59 +0000 (18:33 +0000)
committercompudj <compudj@04897980-b3bd-0310-b5e0-8ef037075253>
Wed, 11 Aug 2004 18:33:59 +0000 (18:33 +0000)
git-svn-id: http://ltt.polymtl.ca/svn@699 04897980-b3bd-0310-b5e0-8ef037075253

ltt/branches/poly/lttv/lttv/state.c

index ec5298482d420522dca7e3359730c02714882692..fbe725420ab6797071c8d1694967c9f46f44fdf7 100644 (file)
@@ -843,9 +843,6 @@ lttv_state_find_process_or_create(LttvTracefileState *tfs, guint pid)
  * cases in the child's exit : when the parent ignores its children SIGCCHLD or
  * has the flag SA_NOCLDWAIT. It can also happen when the child is part
  * of a killed thread ground, but isn't the leader.
- *
- * This function is important : it removes the dead PID entry in the hash
- * table so there is no collision when the OS reuses PID.
  */
 static void exit_process(LttvTracefileState *tfs, LttvProcessState *process) 
 {
@@ -998,25 +995,23 @@ static gboolean process_fork(LttvTraceHook *trace_hook, LttvTracefileState *s)
 {
   LttField *f;
   guint child_pid;
+  LttvProcessState *zombie_process;
 
   /* Child PID */
   f = trace_hook->f2;
   child_pid = ltt_event_get_unsigned(s->parent.e, f);
 
-  lttv_state_create_process(s, s->process, child_pid);
-
-  return FALSE;
-#if 0
-  LttField *f = ((LttvTraceHook *)hook_data)->f1;
+  zombie_process = lttv_state_find_process(s, child_pid);
 
-  LttvTracefileState *s = (LttvTracefileState *)call_data;
-
-  guint child_pid;
-
-  child_pid = ltt_event_get_unsigned(s->parent.e, f);
+  if(zombie_process != NULL) {
+    /* Reutilisation of PID. Only now we are sure that the old PID
+     * has been released. FIXME : sould know when release_task happens instead.
+     */
+    exit_process(s, zombie_process);
+  }
   lttv_state_create_process(s, s->process, child_pid);
+
   return FALSE;
-#endif //0
 }
 
 
@@ -1026,15 +1021,6 @@ static gboolean process_exit(LttvTraceHook *trace_hook, LttvTracefileState *s)
     s->process->state->s = LTTV_STATE_EXIT;
   }
   return FALSE;
-#if 0
-  LttvTracefileState *s = (LttvTracefileState *)call_data;
-
-  if(s->process != NULL) {
-    s->process->state->s = LTTV_STATE_EXIT;
-  }
-  return FALSE;
-#endif //0
 }
 
 gboolean process(void *hook_data, void *call_data)
This page took 0.025659 seconds and 4 git commands to generate.