Fix autoconf's check for create_timer()
ClosedPublic

Authored by arrowdodger on Apr 9 2015, 1:12 PM.

Details

Summary

GHC build system have custom autoconf check for create_timer() function from librt. Check description says that it checks for CLOCK_REALTIME timer, but checking code also checks for CLOCK_PROCESS_CPUTIME_ID timer, which is not commonly present (for example, FreeBSD doesn't have it). This makes whole check fail despite the fact that FreeBSD have create_timer() call and supports CLOCK_REALTIME. As a consequence, GHC RTS falls back to using SIGALRM for its timing machinery. Not only it's very ancient codepath, it also break some FFI bindings to C code that isn't prepared for syscall interruption caused by SIGALRM delivery.

Grepping through ghc source code reveals that USE_TIMER_CREATE defininition in the config.h doesn't imply having CLOCK_PROCESS_CPUTIME_ID. The only place where CLOCK_PROCESS_CPUTIME_ID is used is rts/posix/GetTime.c and this code handles the absence of CLOCK_PROCESS_CPUTIME_ID gracefully.

This patch makes autoconf checking code to check only for timer_create(CLOCK_REALTIME, ...) and fixes check description.

Diff Detail

Repository
rGHC Glasgow Haskell Compiler
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
arrowdodger updated this revision to Diff 2712.Apr 9 2015, 1:12 PM
arrowdodger retitled this revision from to Fix autoconf's check for create_timer().
arrowdodger updated this object.
arrowdodger edited the test plan for this revision. (Show Details)
arrowdodger added a reviewer: GHC.
arrowdodger set the repository for this revision to rGHC Glasgow Haskell Compiler.
arrowdodger added a project: GHC.
austin accepted this revision.Apr 14 2015, 12:51 AM
austin edited edge metadata.

lgtm

This revision is now accepted and ready to land.Apr 14 2015, 12:51 AM
This revision was automatically updated to reflect the committed changes.