From: Chris Hanson <org/chris-hanson/cph>
Date: Wed, 24 Jul 1991 01:29:29 +0000 (+0000)
Subject: Work around bug in Ultrix: the `times' system call sometimes returns
X-Git-Tag: 20090517-FFI~10433
X-Git-Url: https://birchwood-abbey.net/git?a=commitdiff_plain;h=da5b1681d7c9362f5e44964397bc01904493978c;p=mit-scheme.git

Work around bug in Ultrix: the `times' system call sometimes returns
negative numbers (other than -1) when there are no errors.  The
STD_VOID_SYSTEM_CALL macro checks for result <0, so perform explicit
check for result =-1.
---

diff --git a/v7/src/microcode/uxenv.c b/v7/src/microcode/uxenv.c
index 8d5693c92..e5f7188c4 100644
--- a/v7/src/microcode/uxenv.c
+++ b/v7/src/microcode/uxenv.c
@@ -1,8 +1,8 @@
 /* -*-C-*-
 
-$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/microcode/uxenv.c,v 1.3 1991/01/24 11:25:41 cph Exp $
+$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/microcode/uxenv.c,v 1.4 1991/07/24 01:29:29 cph Exp $
 
-Copyright (c) 1990-1 Massachusetts Institute of Technology
+Copyright (c) 1990-91 Massachusetts Institute of Technology
 
 This material was developed by the Scheme project at the Massachusetts
 Institute of Technology, Department of Electrical Engineering and
@@ -72,7 +72,11 @@ DEFUN_VOID (OS_process_clock)
 {
   clock_t ct = (UX_SC_CLK_TCK ());
   struct tms buffer;
-  STD_VOID_SYSTEM_CALL (syscall_times, (UX_times (&buffer)));
+  /* Was STD_VOID_SYSTEM_CALL, but at least one version of Ultrix
+     returns negative numbers other than -1 when there are no errors.  */
+  while ((UX_times (&buffer)) == (-1))
+    if (errno != EINTR)
+      error_system_call (errno, syscall_times);
   return
     (((((buffer . tms_utime) - initial_process_clock) * 2000) + ct) /
      (2 * ct));