Use clock_adjtime from glibc if available.

Signed-off-by: Miroslav Lichvar <mlichvar@redhat.com>
master
Miroslav Lichvar 2012-09-05 17:00:30 +02:00 committed by Richard Cochran
parent 7a50ead1d0
commit 9edd319f11
2 changed files with 8 additions and 1 deletions

View File

@ -17,10 +17,15 @@
KBUILD_OUTPUT ?= /lib/modules/$(shell uname -r)/build KBUILD_OUTPUT ?= /lib/modules/$(shell uname -r)/build
FEAT_CFLAGS :=
ifneq ($(shell grep clock_adjtime /usr/include/bits/time.h),)
FEAT_CFLAGS += -D_GNU_SOURCE -DHAVE_CLOCK_ADJTIME
endif
DEBUG = DEBUG =
CC = $(CROSS_COMPILE)gcc CC = $(CROSS_COMPILE)gcc
INC = -I$(KBUILD_OUTPUT)/usr/include INC = -I$(KBUILD_OUTPUT)/usr/include
CFLAGS = -Wall $(INC) $(DEBUG) $(EXTRA_CFLAGS) CFLAGS = -Wall $(INC) $(DEBUG) $(FEAT_CFLAGS) $(EXTRA_CFLAGS)
LDLIBS = -lm -lrt $(EXTRA_LDFLAGS) LDLIBS = -lm -lrt $(EXTRA_LDFLAGS)
PRG = ptp4l pmc phc2sys hwstamp_ctl PRG = ptp4l pmc phc2sys hwstamp_ctl
OBJ = bmc.o clock.o config.o fsm.o ptp4l.o mave.o msg.o phc.o pi.o port.o \ OBJ = bmc.o clock.o config.o fsm.o ptp4l.o mave.o msg.o phc.o pi.o port.o \

View File

@ -44,10 +44,12 @@
#define FD_TO_CLOCKID(fd) ((~(clockid_t) (fd) << 3) | CLOCKFD) #define FD_TO_CLOCKID(fd) ((~(clockid_t) (fd) << 3) | CLOCKFD)
#define CLOCKID_TO_FD(clk) ((unsigned int) ~((clk) >> 3)) #define CLOCKID_TO_FD(clk) ((unsigned int) ~((clk) >> 3))
#ifndef HAVE_CLOCK_ADJTIME
static inline int clock_adjtime(clockid_t id, struct timex *tx) static inline int clock_adjtime(clockid_t id, struct timex *tx)
{ {
return syscall(__NR_clock_adjtime, id, tx); return syscall(__NR_clock_adjtime, id, tx);
} }
#endif
#ifndef __uClinux__ #ifndef __uClinux__