소스 검색

refactor adjtimex in terms of clock_adjtime

this sets the stage for having the conversion logic for 64-bit time_t
all in one file, and as a bonus makes clock_adjtime for CLOCK_REALTIME
work even on kernels too old to have the clock_adjtime syscall.
Rich Felker 5 년 전
부모
커밋
107d68ad17
2개의 변경된 파일4개의 추가작업 그리고 2개의 파일을 삭제
  1. 2 2
      src/linux/adjtimex.c
  2. 2 0
      src/linux/clock_adjtime.c

+ 2 - 2
src/linux/adjtimex.c

@@ -1,7 +1,7 @@
 #include <sys/timex.h>
-#include "syscall.h"
+#include <time.h>
 
 int adjtimex(struct timex *tx)
 {
-	return syscall(SYS_adjtimex, tx);
+	return clock_adjtime(CLOCK_REALTIME, tx);
 }

+ 2 - 0
src/linux/clock_adjtime.c

@@ -1,7 +1,9 @@
 #include <sys/timex.h>
+#include <time.h>
 #include "syscall.h"
 
 int clock_adjtime (clockid_t clock_id, struct timex *utx)
 {
+	if (clock_id==CLOCK_REALTIME) return syscall(SYS_adjtimex, utx);
 	return syscall(SYS_clock_adjtime, clock_id, utx);
 }