phc_open() can open any device and return clkid even if the device is not phc
for example /dev/kvm and so on.
As a result, phc2sys keeps running with reading bogus clock as below:
# phc2sys -s /dev/kvm -O 0 -q -m
phc2sys[687019.699]: failed to read clock: Invalid argument
phc2sys[687020.699]: failed to read clock: Invalid argument
phc2sys[687021.699]: failed to read clock: Invalid argument
phc2sys[687022.699]: failed to read clock: Invalid argument
...
This patch fixes that problem.
Signed-off-by: Ken ICHIKAWA <ichikawa.ken@jp.fujitsu.com>
PPS output from a PHC has to be enabled by PTP_ENABLE_PPS ioctl. Call
the ioctl when both PHC device and PPS device are specified and PPS is
supported by the PHC.
Signed-off-by: Jiri Benc <jbenc@redhat.com>
On 32 bit platforms, a PHC driver might allow a larger adjustment than
can fit into the 'long' type used in the clock_adjtime interface. This
patch fixes the issue by using the smaller of the two maxima.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>