ae126d1009
Quite a few of the changes against the MalcolmRobb/dump1090 fork are incompatible with OSX. This patch adds back that cross platform support back.
31 lines
972 B
Plaintext
31 lines
972 B
Plaintext
/*
|
|
* clock_gettime_stub.c
|
|
* gcc -Wall -c clock_gettime_stub.c
|
|
* posix realtime functions; MacOS user space glue
|
|
*/
|
|
|
|
/* @comment
|
|
* other possible implementation using intel builtin rdtsc
|
|
* rdtsc-workaround: http://www.mcs.anl.gov/~kazutomo/rdtsc.html
|
|
*
|
|
* we could get the ticks by doing this
|
|
*
|
|
* __asm __volatile("mov %%ebx, %%esi\n\t"
|
|
* "cpuid\n\t"
|
|
* "xchg %%esi, %%ebx\n\t"
|
|
* "rdtsc"
|
|
* : "=a" (a),
|
|
* "=d" (d)
|
|
* );
|
|
|
|
* we could even replace our tricky sched_yield call by assembly code to get a better accurency,
|
|
* anyway the following C stub will satisfy 99% of apps using posix clock_gettime call,
|
|
* moreover, the setter version (clock_settime) could be easly written using mach primitives:
|
|
* http://www.opensource.apple.com/source/xnu/xnu-${VERSION}/osfmk/man/ (clock_[set|get]_time)
|
|
*
|
|
* hackers don't be crackers, don't you use a flush toilet?
|
|
*
|
|
*
|
|
* @see draft: ./posix-realtime-stub/posix-realtime-stub.c
|
|
*
|
|
*/ |