- jiffies_to_timeval(p->utime, &prstatus->pr_utime);
- jiffies_to_timeval(p->stime, &prstatus->pr_stime);
- jiffies_to_timeval(p->cutime, &prstatus->pr_cutime);
- jiffies_to_timeval(p->cstime, &prstatus->pr_cstime);
+ if (p->pid == p->tgid) {
+ /*
+ * This is the record for the group leader. Add in the
+ * cumulative times of previous dead threads. This total
+ * won't include the time of each live thread whose state
+ * is included in the core dump. The final total reported
+ * to our parent process when it calls wait4 will include
+ * those sums as well as the little bit more time it takes
+ * this and each other thread to finish dying after the
+ * core dump synchronization phase.
+ */
+ jiffies_to_timeval(p->utime + p->signal->utime,
+ &prstatus->pr_utime);
+ jiffies_to_timeval(p->stime + p->signal->stime,
+ &prstatus->pr_stime);
+ } else {
+ jiffies_to_timeval(p->utime, &prstatus->pr_utime);
+ jiffies_to_timeval(p->stime, &prstatus->pr_stime);
+ }
+ jiffies_to_timeval(p->signal->cutime, &prstatus->pr_cutime);
+ jiffies_to_timeval(p->signal->cstime, &prstatus->pr_cstime);