From: Miroslav Lichvar Date: Tue, 15 Aug 2017 11:39:39 +0000 (+0200) Subject: sys_linux: fix building with older kernel headers X-Git-Tag: 3.2-pre2~23 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3d08815efb6fb8c98da4f68b333008a4026d0ace;p=thirdparty%2Fchrony.git sys_linux: fix building with older kernel headers Programming pins for external PHC timestamping was added in Linux 3.15, but the PHC subsystem is older than that. Compile the programming code only when the ioctl is defined. --- diff --git a/sys_linux.c b/sys_linux.c index 2f84246e..f2f65aa4 100644 --- a/sys_linux.c +++ b/sys_linux.c @@ -517,7 +517,10 @@ SYS_Linux_EnableSystemCallFilter(int level) const static unsigned long ioctls[] = { FIONREAD, TCGETS, #if defined(FEAT_PHC) || defined(HAVE_LINUX_TIMESTAMPING) - PTP_EXTTS_REQUEST, PTP_PIN_SETFUNC, PTP_SYS_OFFSET, + PTP_EXTTS_REQUEST, PTP_SYS_OFFSET, +#ifdef PTP_PIN_SETFUNC + PTP_PIN_SETFUNC, +#endif #ifdef PTP_SYS_OFFSET_PRECISE PTP_SYS_OFFSET_PRECISE, #endif @@ -822,8 +825,9 @@ int SYS_Linux_SetPHCExtTimestamping(int fd, int pin, int channel, int rising, int falling, int enable) { - struct ptp_pin_desc pin_desc; struct ptp_extts_request extts_req; +#ifdef PTP_PIN_SETFUNC + struct ptp_pin_desc pin_desc; memset(&pin_desc, 0, sizeof (pin_desc)); pin_desc.index = pin; @@ -834,6 +838,10 @@ SYS_Linux_SetPHCExtTimestamping(int fd, int pin, int channel, DEBUG_LOG("ioctl(%s) failed : %s", "PTP_PIN_SETFUNC", strerror(errno)); return 0; } +#else + DEBUG_LOG("Missing PTP_PIN_SETFUNC"); + return 0; +#endif memset(&extts_req, 0, sizeof (extts_req)); extts_req.index = channel;