Should fallback instead of EXIT_FAILURE on clock_gettime failure
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
Trac metadata
| Trac field | Value |
|---|---|
| Version | 7.6.3 |
| Type | Bug |
| TypeOfFailure | OtherFailure |
| Priority | normal |
| Resolution | Unresolved |
| Component | Runtime System |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | simonmar |
| Operating system | |
| Architecture |