diff mbox

ptp: In the testptp utility, use clock_adjtime from glibc when available

Message ID 1402922805-3664-1-git-send-email-christian.riesch@omicron.at
State Accepted, archived
Delegated to: David Miller
Headers show

Commit Message

Christian Riesch June 16, 2014, 12:46 p.m. UTC
clock_adjtime was included in glibc 2.14. _GNU_SOURCE must be defined
to make it available.

Signed-off-by: Christian Riesch <christian.riesch@omicron.at>
Cc: Richard Cochran <richardcochran@gmail.com>
---
 Documentation/ptp/testptp.c |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

Comments

Richard Cochran June 16, 2014, 4:26 p.m. UTC | #1
On Mon, Jun 16, 2014 at 02:46:45PM +0200, Christian Riesch wrote:
> clock_adjtime was included in glibc 2.14. _GNU_SOURCE must be defined
> to make it available.

Acked-by: Richard Cochran <richardcochran@gmail.com>
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
David Miller June 17, 2014, 4:32 a.m. UTC | #2
From: Christian Riesch <christian.riesch@omicron.at>
Date: Mon, 16 Jun 2014 14:46:45 +0200

> clock_adjtime was included in glibc 2.14. _GNU_SOURCE must be defined
> to make it available.
> 
> Signed-off-by: Christian Riesch <christian.riesch@omicron.at>

Applied, thank you.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/Documentation/ptp/testptp.c b/Documentation/ptp/testptp.c
index f1ac2da..ba1d502 100644
--- a/Documentation/ptp/testptp.c
+++ b/Documentation/ptp/testptp.c
@@ -17,6 +17,7 @@ 
  *  along with this program; if not, write to the Free Software
  *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
+#define _GNU_SOURCE
 #include <errno.h>
 #include <fcntl.h>
 #include <inttypes.h>
@@ -46,12 +47,14 @@ 
 #define CLOCK_INVALID -1
 #endif
 
-/* When glibc offers the syscall, this will go away. */
+/* clock_adjtime is not available in GLIBC < 2.14 */
+#if !__GLIBC_PREREQ(2, 14)
 #include <sys/syscall.h>
 static int clock_adjtime(clockid_t id, struct timex *tx)
 {
 	return syscall(__NR_clock_adjtime, id, tx);
 }
+#endif
 
 static clockid_t get_clockid(int fd)
 {