Expand PMF_FN_* macros.
[netbsd-mini2440.git] / dist / ntp / include / ntp_syscall.h
blob4f32249c9d09987da55e6ea3d30faa25dc1abe02
1 /* $NetBSD$ */
3 /*
4 * ntp_syscall.h - various ways to perform the ntp_adjtime() and ntp_gettime()
5 * system calls.
6 */
8 #ifndef NTP_SYSCALL_H
9 #define NTP_SYSCALL_H
11 #ifdef HAVE_CONFIG_H
12 #include <config.h>
13 #endif
15 #ifdef HAVE_SYS_TIMEX_H
16 # include <sys/timex.h>
17 #endif
19 #ifndef NTP_SYSCALLS_LIBC
20 #ifdef NTP_SYSCALLS_STD
21 # define ntp_adjtime(t) syscall(SYS_ntp_adjtime, (t))
22 # define ntp_gettime(t) syscall(SYS_ntp_gettime, (t))
23 #else /* !NTP_SYSCALLS_STD */
24 # ifdef HAVE___ADJTIMEX
25 extern int __adjtimex P((struct timex *));
27 # define ntp_adjtime(t) __adjtimex((t))
29 static inline int
30 ntp_gettime(
31 struct ntptimeval *ntv
34 struct timex tntx;
35 int result;
37 tntx.modes = 0;
38 result = __adjtimex (&tntx);
39 ntv->time = tntx.time;
40 ntv->maxerror = tntx.maxerror;
41 ntv->esterror = tntx.esterror;
42 #ifdef NTP_API
43 # if NTP_API > 3
44 ntv->tai = tntx.tai;
45 # endif
46 #endif
47 return(result);
49 # else /* !HAVE__ADJTIMEX */
50 # ifdef HAVE___NTP_GETTIME
51 # define ntp_gettime(t) __ntp_gettime((t))
52 # endif
53 # endif /* !HAVE_ADJTIMEX */
54 #endif /* !NTP_SYSCALLS_STD */
55 #endif /* !NTP_SYSCALLS_LIBC */
57 #endif /* NTP_SYSCALL_H */