All PHC have a negative clkid, while the variations of the system clock use positive values. The do_caps() function hard codes a check against CLOCK_REALTIME to avoid executing the PTP_CLOCK_GETCAPS ioctl on a non-PHC clock.
Extend this to avoid operating on any system clock, allowing for the potential future use of other variations of the system clock. Reported-by: Erez <erezge...@gmail.com> Signed-off-by: Jacob Keller <jacob.e.kel...@intel.com> --- phc_ctl.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/phc_ctl.c b/phc_ctl.c index 4344184c364b..d61d27d8f632 100644 --- a/phc_ctl.c +++ b/phc_ctl.c @@ -282,8 +282,8 @@ static int do_caps(clockid_t clkid, int cmdc, char *cmdv[]) { struct ptp_clock_caps caps; - if (clkid == CLOCK_REALTIME) { - pr_warning("CLOCK_REALTIME is not a PHC device."); + if (clkid >= 0) { + pr_warning("The provided clock is not a PHC device."); return 0; } -- 2.41.0.1.g9857a21e0017.dirty _______________________________________________ Linuxptp-devel mailing list Linuxptp-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linuxptp-devel