-
Notifications
You must be signed in to change notification settings - Fork 98
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
configure: fix CLOCK_MONOTONIC check for cross-compilation #269
Conversation
In cross-compilation, we can't run test programs, so configure just bails out. Since there is no cache variable (e.g. ac_cv_blabla, we can't even provide the correct result. But in thise case, we don't really need to run to start with; we just need to check if the toolchain headers know about CLOCK_MONOTONIC. Signed-off-by: "Yann E. MORIN" <[email protected]>
Patch resent, to fix a typo in the commit title. Sorry for the noise... :-/ |
New patch looks good, Merged, thanks! |
Actually, Hurd has a bug here: it defines _POSIX_MONOTONIC_CLOCK to 200809L, returns the same value for a |
N.B. |
And re I admittedly don't have enough experience with cross-compiles, but merely
Hence it looks to me that it would be highly preferable if |
The problem here is that a working CLOCK_MONOTONIC isn't a property of the platform. Under Linux, it depends on the currently running kernel. So the same binary on the same system may find it working one time, then, after a reboot to another kernel, may find it non-working. That's why it needs run-time handling. |
@wferi when the monotonic code (in Corosync) was written ~10 years ago, it was a property of all Linux kernels. Hi-Res timers had just went into the kernel and thank god we were able to use it, as a cluster reset every 6 months (DST change) causes alot of anger among the 20-30k sites using corosync :) Personally I feel the best solution is to complain furiously when monotonic clocks are not available in the system, but still work correctly at runtime. Correct operation can be achieved at runtime without monotonic clocks, by watching for dst boundaries and adjusting the internal corosync clock. I'm not sure how applicable this approach would be to libqb, but trust me when I say you don't want to run without monotonic without some workaround for DST. I could not reproduce this field bug (it was poorly reported) and I am in AZ (no DST) so it was never identified until after we added monotonic clocks and operators started reporting Corosync was more reliable on a yearly basis :) Regarding @jnpkrn's commentary, I did embedded dev for 5 years, and cross compilers (if done right) are truly cross-compiled - they have no dependency on any part of the toolchain in the host os. Only a few LInux vendors managed to get this right. Cheers |
@sdake I agree that CLOCK_MONOTONIC really should be available and working on every x86 Linux kernel in use nowadays. Still, libc does not guarantee it, so a runtime check is required. |
@wferi when timers were implemented in Corosync originally, there was no realtime clock. In other words, libc didn't have clock_gettime(). Instead we were using gettimeofday() and doing math on the clocks. Ya, I know, wrong answer which is why we switched to MONOTONIC. I don't see how a runtime config check can be set on something that sometimes links with the rt shared object, and other times doesn't without dlopen() in the mix. In any regard, eel free to fix as you see fit, but I'd avoid taking out CLOCK_MONOTONIC support as that change drastically improved the stability of Corosync. Cheers |
@sdake |
Just FYI, eventually managed to get rid of |
In cross-compilation, we can't run test programs, so configure just
bails out. Since there is no cache variable (e.g. ac_cv_blabla, we can't
even provide the correct result.
But in thise case, we don't really need to run to start with; we just
need to check if the toolchain headers know about CLOCK_MONOTONIC.
Signed-off-by: "Yann E. MORIN" [email protected]