Unfortunately uClinux is rather inconsistent with respect to
clock_nanosleep(). Older versions of uclibc lack that function, while
newer versions may include the declaration but still lack the
definition, depending on whether pthreads are selected in the
configuration.
This patch works around uClinux shortcomings by using the library call
when available at compile time, otherwise falling back to syscall().
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
The current implementation fetches a transmit time stamp by polling on the
socket with pollfd.events set to zero, and then checking if POLLERR has
been returned by the kernel in pollfd.revents. This has the unfortunate
side effect of sleeping in poll() for the entire time out duration,
regardless of when the error queue becomes readable.
Linux kernel version 3.10 introduced a new socket option that allows
polling for transmit time stamps explicitly, waking the process as soon as
a time stamp becomes available. This patch enables the socket option,
falling back to the old behavior if necessary.
Suggested-by: Joe Schaack <jschaack@xes-inc.com>
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
In order to allow hwtstamp_ctl to use the non-destructive SIOCGHWTSTAMP
ioctl, we need to add it to missing.h, in order to prevent build failure
on older kernels which don't have this support.
Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
This patch adds a semicolon forgotten in commit
5bf265e "missing: add onestep sync to missing.h"
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
this patch uses grep to test whether the net_tstamp.h header has
HWTSTAMP_TX_ONESTEP_SYNC flag defined. If it doesn't then we can simply define
it with the correct value. This works because proper drivers should just report
that the value is not allowed if they don't support onestep mode. This is the
cleanest way to ensure that linuxptp will still work on kernels which have not
defined the one step flag, and also works for any distributions which backport
the feature.
Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
The timerfd calls are missing from Sourcery CodeBench Lite 2011.09-23.
We can remove this code once these calls are properly integrated into a
current tool chain.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
This commit gets the project off to a good start. The header files provide
some basic data types and definitions.
The README file will most probably grow over time.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>