[GHC] #8938: Should fallback instead of EXIT_FAILURE on clock_gettime failure

GHC ghc-devs at haskell.org
Fri Mar 28 21:18:43 UTC 2014


#8938: Should fallback instead of EXIT_FAILURE on clock_gettime failure
-------------------------------------------+-------------------------------
       Reporter:  uznx                     |             Owner:  simonmar
           Type:  bug                      |            Status:  new
       Priority:  normal                   |         Milestone:
      Component:  Runtime System           |           Version:  7.6.3
       Keywords:                           |  Operating System:
   Architecture:  Unknown/Multiple         |  Unknown/Multiple
     Difficulty:  Easy (less than 1 hour)  |   Type of failure:
     Blocked By:                           |  None/Unknown
Related Tickets:                           |         Test Case:
                                           |          Blocking:
-------------------------------------------+-------------------------------
 In GHC 7.6, `rts/posix/GetTime.c, Time getProcessCPUTime(void)`:

 if the result of `clock_gettime` is not zero (success), then the function
 should fall back to getrusage below instead of aborting with
 {{{
             sysErrorBelch("clock_gettime");
             stg_exit(EXIT_FAILURE);
 }}}

 The following patch demonstrates a possible fix:
 {{{
 --- pre/rts/posix/GetTime.c     2013-04-18 17:22:47.000000000 -0400
 +++ ghc-7.6.3/rts/posix/GetTime.c       2014-03-28 09:52:08.537125998
 -0400
 @@ -64,10 +64,8 @@
          res = clock_gettime(CLOCK_PROCESS_CPUTIME_ID, &ts);
          if (res == 0) {
              return SecondsToTime(ts.tv_sec) + NSToTime(ts.tv_nsec);
 -        } else {
 -            sysErrorBelch("clock_gettime");
 -            stg_exit(EXIT_FAILURE);
          }
 +        // else fallback
      }
  #endif

 }}}

--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/8938>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list