reparent the process if unordered schedule + fork
authorcompudj <compudj@04897980-b3bd-0310-b5e0-8ef037075253>
Wed, 31 Aug 2005 16:44:33 +0000 (16:44 +0000)
committercompudj <compudj@04897980-b3bd-0310-b5e0-8ef037075253>
Wed, 31 Aug 2005 16:44:33 +0000 (16:44 +0000)
git-svn-id: http://ltt.polymtl.ca/svn@1097 04897980-b3bd-0310-b5e0-8ef037075253

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

index cb6b70da2bc2743bb2496534432973828ebc28f7..c06ba340e25fa77d7bfc97002f3e2de001f8c070 100644 (file)
@@ -1238,6 +1238,7 @@ static gboolean process_fork(void *hook_data, void *call_data)
   guint cpu = ltt_tracefile_num(s->parent.tf);
   LttvTraceState *ts = (LttvTraceState*)s->parent.t_context;
   LttvProcessState *process = ts->running_process[cpu];
+  LttvProcessState *child_process;
 
   /* Parent PID */
   f = thf->f1;
@@ -1269,7 +1270,18 @@ static gboolean process_fork(void *hook_data, void *call_data)
   g_assert(process->pid != child_pid);
   // FIXME : Add this test in the "known state" section
   // g_assert(process->pid == parent_pid);
-  lttv_state_create_process(ts, process, cpu, child_pid, &s->parent.timestamp);
+  child_process = lttv_state_find_process(ts, ANY_CPU, child_pid);
+  if(child_process == NULL) {
+    lttv_state_create_process(ts, process, cpu,
+                              child_pid, &s->parent.timestamp);
+  } else {
+    /* The process has already been created :  due to time imprecision between
+     * multiple CPUs : it has been scheduled in before creation.
+     *
+     * Simply put a correct parent.
+     */
+    child_process->ppid = process->pid;
+  }
 
   return FALSE;
 }
This page took 0.039328 seconds and 4 git commands to generate.