about summary refs log tree commit diff
path: root/Src/jobs.c
diff options
context:
space:
mode:
authorPaul Ackersviller <packersv@users.sourceforge.net>2007-09-18 02:38:15 +0000
committerPaul Ackersviller <packersv@users.sourceforge.net>2007-09-18 02:38:15 +0000
commitd77e5bfd6c286dfeaca6e9807281f7001ff6bc7b (patch)
tree611e49806534227d01717e00022f987dead5993c /Src/jobs.c
parent0cdd7c451a86fd444767c6a2eb9e5ccbd4ebe8e9 (diff)
downloadzsh-d77e5bfd6c286dfeaca6e9807281f7001ff6bc7b.tar.gz
zsh-d77e5bfd6c286dfeaca6e9807281f7001ff6bc7b.tar.xz
zsh-d77e5bfd6c286dfeaca6e9807281f7001ff6bc7b.zip
Merge of SF bug #1262954: compilation problem.
Diffstat (limited to 'Src/jobs.c')
-rw-r--r--Src/jobs.c17
1 files changed, 13 insertions, 4 deletions
diff --git a/Src/jobs.c b/Src/jobs.c
index 55369ce85..94033cb31 100644
--- a/Src/jobs.c
+++ b/Src/jobs.c
@@ -271,7 +271,7 @@ get_usage(void)
 }
 
 
-#ifndef HAVE_GETRUSAGE
+#if !defined HAVE_WAIT3 || !defined HAVE_GETRUSAGE
 /* Update status of process that we have just WAIT'ed for */
 
 /**/
@@ -279,17 +279,26 @@ void
 update_process(Process pn, int status)
 {
     struct timezone dummy_tz;
-    long childs, childu;
+#ifdef HAVE_GETRUSAGE
+    struct timeval childs = child_usage.ru_stime;
+    struct timeval childu = child_usage.ru_utime;
+#else
+    long childs = shtms.tms_cstime;
+    long childu = shtms.tms_cutime;
+#endif
 
-    childs = shtms.tms_cstime;
-    childu = shtms.tms_cutime;
     /* get time-accounting info          */
     get_usage();
     gettimeofday(&pn->endtime, &dummy_tz);  /* record time process exited        */
 
     pn->status = status;                    /* save the status returned by WAIT  */
+#ifdef HAVE_GETRUSAGE
+    dtime(&pn->ti.ru_stime, &childs, &child_usage.ru_stime);
+    dtime(&pn->ti.ru_utime, &childu, &child_usage.ru_utime);
+#else
     pn->ti.st  = shtms.tms_cstime - childs; /* compute process system space time */
     pn->ti.ut  = shtms.tms_cutime - childu; /* compute process user space time   */
+#endif
 }
 #endif