pthread_cond_timedwait takes an absolute time as an argument, which
the function directly passes on to the kernel via the futex
syscall. In an application this absolute time argument is calculated
via the fake times provided by libfaketime. Since the kernel has no
knowledge of the fake time, pthread_cond_timedwait must be redefined
such that it converts the fake time back to real time before passing
it on.
Since SmartOS is close to SunOS, it's possible that these changes make
libfaketime build and run on other SunOS-like platforms.
These changes were tested on MacOS X and Ubuntu 12.04, and no regression
appeared during testing.
--exclude-monotonic prevents faketime from overriding
the clock with id CLOCK_MONOTONIC when using clock_gettime.
Add DONT_FAKE_MONOTONIC env variable to libfaketime that
has the same effect.
Add functional test for DONT_FAKE_MONOTONIC support.
Used (emacs) M-x untabify for whole faketime.c as the prevailing
style in that file used spaces for indentation.
Used M-x delete-trailing-whitespace to all files that had either
trailing whitespace or empty lines at the end of file to remove
those.
* Use variables for compiler and linker flags.
* Use variables for source/object files and binaries.
* Use proper targets instead of phony targets to build the timetest
program.
Signed-off-by: Lukas Fleischer <info@cryptocrack.de>
* Move test suite related stuff from "src/" to "test/".
* Fix "test.sh" to search for libfaketime libraries in the right place.
* Split up Makefile into two separate Makefiles (one for the main
program and one for the test suite).
Test cases should go in another directory for the sake of clean code
separation. This will also facilitate the creation of proper Makefiles.
Signed-off-by: Lukas Fleischer <info@cryptocrack.de>