diff --git a/lib/libc/sys/Makefile.inc b/lib/libc/sys/Makefile.inc --- a/lib/libc/sys/Makefile.inc +++ b/lib/libc/sys/Makefile.inc @@ -402,8 +402,8 @@ extattr_get_file.2 extattr_set_file.2 \ extattr_get_file.2 extattr_set_link.2 MLINKS+=ffclock.2 ffclock_getcounter.2 \ - ffclock.2 ffclock_getestimate.2 \ - ffclock.2 ffclock_setestimate.2 + ffclock.2 ffclock_getdata.2 \ + ffclock.2 ffclock_setdata.2 MLINKS+=fhlink.2 fhlinkat.2 MLINKS+=fhopen.2 fhstat.2 fhopen.2 fhstatfs.2 MLINKS+=fork.2 _Fork.2 diff --git a/lib/libc/sys/Symbol.map b/lib/libc/sys/Symbol.map --- a/lib/libc/sys/Symbol.map +++ b/lib/libc/sys/Symbol.map @@ -425,6 +425,11 @@ timerfd_settime; }; +FBSD_1.8 { + ffclock_getdata; + ffclock_setdata; +}; + FBSDprivate_1.0 { ___acl_aclcheck_fd; __sys___acl_aclcheck_fd; diff --git a/lib/libc/sys/ffclock.2 b/lib/libc/sys/ffclock.2 --- a/lib/libc/sys/ffclock.2 +++ b/lib/libc/sys/ffclock.2 @@ -30,8 +30,8 @@ .Os .Sh NAME .Nm ffclock_getcounter , -.Nm ffclock_getestimate , -.Nm ffclock_setestimate +.Nm ffclock_getdata , +.Nm ffclock_setdata .Nd Retrieve feedforward counter, get and set the parameters defining the native feedforward clock. .Sh LIBRARY @@ -41,9 +41,9 @@ .Ft int .Fn ffclock_getcounter "ffcounter *ffcount" .Ft int -.Fn ffclock_getestimate "struct ffclock_estimate *cest" +.Fn ffclock_getdata "struct ffclock_data *cdat" .Ft int -.Fn ffclock_setestimate "struct ffclock_estimate *cest" +.Fn ffclock_setdata "struct ffclock_data *cdat" .Sh DESCRIPTION The FFclock is an alternative method to synchronize the system clock. It implements a feedforward paradigm that decouples low level timestamping @@ -69,17 +69,17 @@ feedforward counter maintained by the kernel. .Pp The -.Fn ffclock_getestimate +.Fn ffclock_getdata and -.Fn ffclock_setestimate +.Fn ffclock_setdata system calls allow the caller to respectively get and set the kernel's native feedforward clock parameters. The -.Fn ffclock_setestimate +.Fn ffclock_setdata system call should be invoked by a single instance of a feedforward synchronization daemon. The -.Fn ffclock_getestimate +.Fn ffclock_getdata system call can be called by any process to retrieve the current value of the parameters. .Pp @@ -89,12 +89,12 @@ reading of the ffcounter itself. .Pp The native clock parameter data structure pointed to by -.Fa cest +.Fa cdat is defined in .In sys/timeffc.h as: .Bd -literal -struct ffclock_estimate { +struct ffclock_data { struct bintime update_time; /* FFclock time of last update */ ffcounter update_ffcount; /* Counter value at last update */ ffcounter leapsec_expected; /* Estimated counter value of next leap. */ @@ -119,7 +119,7 @@ The .Fa ffcount or -.Fa cest +.Fa cdat pointer referenced invalid memory. .It Bq Er EPERM A user other than the super-user attempted to set the FFclock data. @@ -172,7 +172,7 @@ .Nm ffclock_getcounter , or directly in bypass mode. The clock parameters could be obtained via -.Fn ffclock_getestimate , +.Fn ffclock_getdata , or .Po preferred diff --git a/sys/compat/freebsd32/freebsd32.h b/sys/compat/freebsd32/freebsd32.h --- a/sys/compat/freebsd32/freebsd32.h +++ b/sys/compat/freebsd32/freebsd32.h @@ -64,7 +64,7 @@ uint32_t frac[2]; }; -struct ffclock_estimate32 { +struct ffclock_data32 { struct bintime32 update_time; ffcounter update_ffcount; ffcounter leapsec_expected; @@ -81,9 +81,9 @@ #endif ; #if defined(__amd64__) -_Static_assert(sizeof(struct ffclock_estimate32) == 52, "ffclock_estimate32 size"); +_Static_assert(sizeof(struct ffclock_data32) == 52, "ffclock_data32 size"); #else -_Static_assert(sizeof(struct ffclock_estimate32) == 56, "ffclock_estimate32 size"); +_Static_assert(sizeof(struct ffclock_data32) == 56, "ffclock_data32 size"); #endif struct rusage32 { diff --git a/sys/compat/freebsd32/freebsd32_misc.c b/sys/compat/freebsd32/freebsd32_misc.c --- a/sys/compat/freebsd32/freebsd32_misc.c +++ b/sys/compat/freebsd32/freebsd32_misc.c @@ -4084,82 +4084,82 @@ #ifdef FFCLOCK extern struct mtx ffclock_mtx; -extern struct ffclock_estimate ffclock_estimate; +extern struct ffclock_data ffclock_data; extern int8_t ffclock_updated; int -freebsd32_ffclock_setestimate(struct thread *td, - struct freebsd32_ffclock_setestimate_args *uap) +freebsd32_ffclock_setdata(struct thread *td, + struct freebsd32_ffclock_setdata_args *uap) { - struct ffclock_estimate cest; - struct ffclock_estimate32 cest32; + struct ffclock_data cdat; + struct ffclock_data32 cdat32; int error; /* Reuse of PRIV_CLOCK_SETTIME. */ if ((error = priv_check(td, PRIV_CLOCK_SETTIME)) != 0) return (error); - if ((error = copyin(uap->cest, &cest32, - sizeof(struct ffclock_estimate32))) != 0) + if ((error = copyin(uap->cdat, &cdat32, + sizeof(struct ffclock_data32))) != 0) return (error); - CP(cest32.update_time, cest.update_time, sec); - memcpy(&cest.update_time.frac, &cest32.update_time.frac, sizeof(uint64_t)); - CP(cest32, cest, update_ffcount); - CP(cest32, cest, leapsec_expected); - CP(cest32, cest, period); - CP(cest32, cest, errb_abs); - CP(cest32, cest, errb_rate); - CP(cest32, cest, status); - CP(cest32, cest, secs_to_nextupdate); - CP(cest32, cest, leapsec_total); - CP(cest32, cest, leapsec_next); + CP(cdat32.update_time, cdat.update_time, sec); + memcpy(&cdat.update_time.frac, &cdat32.update_time.frac, sizeof(uint64_t)); + CP(cdat32, cdat, update_ffcount); + CP(cdat32, cdat, leapsec_expected); + CP(cdat32, cdat, period); + CP(cdat32, cdat, errb_abs); + CP(cdat32, cdat, errb_rate); + CP(cdat32, cdat, status); + CP(cdat32, cdat, secs_to_nextupdate); + CP(cdat32, cdat, leapsec_total); + CP(cdat32, cdat, leapsec_next); mtx_lock_spin(&ffclock_mtx); - memcpy(&ffclock_estimate, &cest, sizeof(struct ffclock_estimate)); + memcpy(&ffclock_data, &cdat, sizeof(struct ffclock_data)); ffclock_updated++; mtx_unlock_spin(&ffclock_mtx); return (error); } int -freebsd32_ffclock_getestimate(struct thread *td, - struct freebsd32_ffclock_getestimate_args *uap) +freebsd32_ffclock_getdata(struct thread *td, + struct freebsd32_ffclock_getdata_args *uap) { - struct ffclock_estimate cest; - struct ffclock_estimate32 cest32; + struct ffclock_data cdat; + struct ffclock_data32 cdat32; int error; mtx_lock_spin(&ffclock_mtx); - memcpy(&cest, &ffclock_estimate, sizeof(struct ffclock_estimate)); + memcpy(&cdat, &ffclock_data, sizeof(struct ffclock_data)); mtx_unlock_spin(&ffclock_mtx); - CP(cest.update_time, cest32.update_time, sec); - memcpy(&cest32.update_time.frac, &cest.update_time.frac, sizeof(uint64_t)); - CP(cest, cest32, update_ffcount); - CP(cest, cest32, leapsec_expected); - CP(cest, cest32, period); - CP(cest, cest32, errb_abs); - CP(cest, cest32, errb_rate); - CP(cest, cest32, status); - CP(cest, cest32, secs_to_nextupdate); - CP(cest, cest32, leapsec_total); - CP(cest, cest32, leapsec_next); - - error = copyout(&cest32, uap->cest, sizeof(struct ffclock_estimate32)); + CP(cdat.update_time, cdat32.update_time, sec); + memcpy(&cdat32.update_time.frac, &cdat.update_time.frac, sizeof(uint64_t)); + CP(cdat, cdat32, update_ffcount); + CP(cdat, cdat32, leapsec_expected); + CP(cdat, cdat32, period); + CP(cdat, cdat32, errb_abs); + CP(cdat, cdat32, errb_rate); + CP(cdat, cdat32, status); + CP(cdat, cdat32, secs_to_nextupdate); + CP(cdat, cdat32, leapsec_total); + CP(cdat, cdat32, leapsec_next); + + error = copyout(&cdat32, uap->cdat, sizeof(struct ffclock_data32)); return (error); } #else /* !FFCLOCK */ int -freebsd32_ffclock_setestimate(struct thread *td, - struct freebsd32_ffclock_setestimate_args *uap) +freebsd32_ffclock_setdata(struct thread *td, + struct freebsd32_ffclock_setdata_args *uap) { return (ENOSYS); } int -freebsd32_ffclock_getestimate(struct thread *td, - struct freebsd32_ffclock_getestimate_args *uap) +freebsd32_ffclock_getdata(struct thread *td, + struct freebsd32_ffclock_getdata_args *uap) { return (ENOSYS); } diff --git a/sys/compat/freebsd32/freebsd32_proto.h b/sys/compat/freebsd32/freebsd32_proto.h --- a/sys/compat/freebsd32/freebsd32_proto.h +++ b/sys/compat/freebsd32/freebsd32_proto.h @@ -212,12 +212,6 @@ char rqtp_l_[PADL_(const struct timespec32 *)]; const struct timespec32 * rqtp; char rqtp_r_[PADR_(const struct timespec32 *)]; char rmtp_l_[PADL_(struct timespec32 *)]; struct timespec32 * rmtp; char rmtp_r_[PADR_(struct timespec32 *)]; }; -struct freebsd32_ffclock_setestimate_args { - char cest_l_[PADL_(struct ffclock_estimate32 *)]; struct ffclock_estimate32 * cest; char cest_r_[PADR_(struct ffclock_estimate32 *)]; -}; -struct freebsd32_ffclock_getestimate_args { - char cest_l_[PADL_(struct ffclock_estimate32 *)]; struct ffclock_estimate32 * cest; char cest_r_[PADR_(struct ffclock_estimate32 *)]; -}; struct freebsd32_clock_nanosleep_args { char clock_id_l_[PADL_(clockid_t)]; clockid_t clock_id; char clock_id_r_[PADR_(clockid_t)]; char flags_l_[PADL_(int)]; int flags; char flags_r_[PADR_(int)]; @@ -694,6 +688,12 @@ char new_value_l_[PADL_(const struct itimerspec32 *)]; const struct itimerspec32 * new_value; char new_value_r_[PADR_(const struct itimerspec32 *)]; char old_value_l_[PADL_(struct itimerspec32 *)]; struct itimerspec32 * old_value; char old_value_r_[PADR_(struct itimerspec32 *)]; }; +struct freebsd32_ffclock_setdata_args { + char cdat_l_[PADL_(struct ffclock_data32 *)]; struct ffclock_data32 * cdat; char cdat_r_[PADR_(struct ffclock_data32 *)]; +}; +struct freebsd32_ffclock_getdata_args { + char cdat_l_[PADL_(struct ffclock_data32 *)]; struct ffclock_data32 * cdat; char cdat_r_[PADR_(struct ffclock_data32 *)]; +}; int freebsd32_wait4(struct thread *, struct freebsd32_wait4_args *); int freebsd32_ptrace(struct thread *, struct freebsd32_ptrace_args *); int freebsd32_recvmsg(struct thread *, struct freebsd32_recvmsg_args *); @@ -729,8 +729,6 @@ int freebsd32_ktimer_settime(struct thread *, struct freebsd32_ktimer_settime_args *); int freebsd32_ktimer_gettime(struct thread *, struct freebsd32_ktimer_gettime_args *); int freebsd32_nanosleep(struct thread *, struct freebsd32_nanosleep_args *); -int freebsd32_ffclock_setestimate(struct thread *, struct freebsd32_ffclock_setestimate_args *); -int freebsd32_ffclock_getestimate(struct thread *, struct freebsd32_ffclock_getestimate_args *); int freebsd32_clock_nanosleep(struct thread *, struct freebsd32_clock_nanosleep_args *); int freebsd32_clock_getcpuclockid2(struct thread *, struct freebsd32_clock_getcpuclockid2_args *); int freebsd32_aio_read(struct thread *, struct freebsd32_aio_read_args *); @@ -811,6 +809,8 @@ int freebsd32_aio_readv(struct thread *, struct freebsd32_aio_readv_args *); int freebsd32_timerfd_gettime(struct thread *, struct freebsd32_timerfd_gettime_args *); int freebsd32_timerfd_settime(struct thread *, struct freebsd32_timerfd_settime_args *); +int freebsd32_ffclock_setdata(struct thread *, struct freebsd32_ffclock_setdata_args *); +int freebsd32_ffclock_getdata(struct thread *, struct freebsd32_ffclock_getdata_args *); #ifdef COMPAT_43 @@ -1208,8 +1208,6 @@ #define FREEBSD32_SYS_AUE_freebsd32_ktimer_settime AUE_NULL #define FREEBSD32_SYS_AUE_freebsd32_ktimer_gettime AUE_NULL #define FREEBSD32_SYS_AUE_freebsd32_nanosleep AUE_NULL -#define FREEBSD32_SYS_AUE_freebsd32_ffclock_setestimate AUE_NULL -#define FREEBSD32_SYS_AUE_freebsd32_ffclock_getestimate AUE_NULL #define FREEBSD32_SYS_AUE_freebsd32_clock_nanosleep AUE_NULL #define FREEBSD32_SYS_AUE_freebsd32_clock_getcpuclockid2 AUE_NULL #define FREEBSD32_SYS_AUE_freebsd32_aio_read AUE_AIO_READ @@ -1306,6 +1304,8 @@ #define FREEBSD32_SYS_AUE_freebsd32_aio_readv AUE_AIO_READV #define FREEBSD32_SYS_AUE_freebsd32_timerfd_gettime AUE_TIMERFD #define FREEBSD32_SYS_AUE_freebsd32_timerfd_settime AUE_TIMERFD +#define FREEBSD32_SYS_AUE_freebsd32_ffclock_setdata AUE_NULL +#define FREEBSD32_SYS_AUE_freebsd32_ffclock_getdata AUE_NULL #undef PAD_ #undef PADL_ diff --git a/sys/compat/freebsd32/freebsd32_syscall.h b/sys/compat/freebsd32/freebsd32_syscall.h --- a/sys/compat/freebsd32/freebsd32_syscall.h +++ b/sys/compat/freebsd32/freebsd32_syscall.h @@ -217,8 +217,8 @@ #define FREEBSD32_SYS_ktimer_getoverrun 239 #define FREEBSD32_SYS_freebsd32_nanosleep 240 #define FREEBSD32_SYS_ffclock_getcounter 241 -#define FREEBSD32_SYS_freebsd32_ffclock_setestimate 242 -#define FREEBSD32_SYS_freebsd32_ffclock_getestimate 243 + /* 242 is obsolete ffclock_setestimate */ + /* 243 is obsolete ffclock_getestimate */ #define FREEBSD32_SYS_freebsd32_clock_nanosleep 244 #define FREEBSD32_SYS_freebsd32_clock_getcpuclockid2 247 #define FREEBSD32_SYS_minherit 250 @@ -506,4 +506,6 @@ #define FREEBSD32_SYS_timerfd_create 585 #define FREEBSD32_SYS_freebsd32_timerfd_gettime 586 #define FREEBSD32_SYS_freebsd32_timerfd_settime 587 -#define FREEBSD32_SYS_MAXSYSCALL 588 +#define FREEBSD32_SYS_freebsd32_ffclock_setdata 588 +#define FREEBSD32_SYS_freebsd32_ffclock_getdata 589 +#define FREEBSD32_SYS_MAXSYSCALL 590 diff --git a/sys/compat/freebsd32/freebsd32_syscalls.c b/sys/compat/freebsd32/freebsd32_syscalls.c --- a/sys/compat/freebsd32/freebsd32_syscalls.c +++ b/sys/compat/freebsd32/freebsd32_syscalls.c @@ -247,8 +247,8 @@ "ktimer_getoverrun", /* 239 = ktimer_getoverrun */ "freebsd32_nanosleep", /* 240 = freebsd32_nanosleep */ "ffclock_getcounter", /* 241 = ffclock_getcounter */ - "freebsd32_ffclock_setestimate", /* 242 = freebsd32_ffclock_setestimate */ - "freebsd32_ffclock_getestimate", /* 243 = freebsd32_ffclock_getestimate */ + "obs_ffclock_setestimate", /* 242 = obsolete ffclock_setestimate */ + "obs_ffclock_getestimate", /* 243 = obsolete ffclock_getestimate */ "freebsd32_clock_nanosleep", /* 244 = freebsd32_clock_nanosleep */ "#245", /* 245 = reserved for local use */ "#246", /* 246 = reserved for local use */ @@ -593,4 +593,6 @@ "timerfd_create", /* 585 = timerfd_create */ "freebsd32_timerfd_gettime", /* 586 = freebsd32_timerfd_gettime */ "freebsd32_timerfd_settime", /* 587 = freebsd32_timerfd_settime */ + "freebsd32_ffclock_setdata", /* 588 = freebsd32_ffclock_setdata */ + "freebsd32_ffclock_getdata", /* 589 = freebsd32_ffclock_getdata */ }; diff --git a/sys/compat/freebsd32/freebsd32_sysent.c b/sys/compat/freebsd32/freebsd32_sysent.c --- a/sys/compat/freebsd32/freebsd32_sysent.c +++ b/sys/compat/freebsd32/freebsd32_sysent.c @@ -303,8 +303,8 @@ { .sy_narg = AS(ktimer_getoverrun_args), .sy_call = (sy_call_t *)sys_ktimer_getoverrun, .sy_auevent = AUE_NULL, .sy_flags = SYF_CAPENABLED, .sy_thrcnt = SY_THR_STATIC }, /* 239 = ktimer_getoverrun */ { .sy_narg = AS(freebsd32_nanosleep_args), .sy_call = (sy_call_t *)freebsd32_nanosleep, .sy_auevent = AUE_NULL, .sy_flags = SYF_CAPENABLED, .sy_thrcnt = SY_THR_STATIC }, /* 240 = freebsd32_nanosleep */ { .sy_narg = AS(ffclock_getcounter_args), .sy_call = (sy_call_t *)sys_ffclock_getcounter, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 241 = ffclock_getcounter */ - { .sy_narg = AS(freebsd32_ffclock_setestimate_args), .sy_call = (sy_call_t *)freebsd32_ffclock_setestimate, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 242 = freebsd32_ffclock_setestimate */ - { .sy_narg = AS(freebsd32_ffclock_getestimate_args), .sy_call = (sy_call_t *)freebsd32_ffclock_getestimate, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 243 = freebsd32_ffclock_getestimate */ + { .sy_narg = 0, .sy_call = (sy_call_t *)nosys, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_ABSENT }, /* 242 = obsolete ffclock_setestimate */ + { .sy_narg = 0, .sy_call = (sy_call_t *)nosys, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_ABSENT }, /* 243 = obsolete ffclock_getestimate */ { .sy_narg = AS(freebsd32_clock_nanosleep_args), .sy_call = (sy_call_t *)freebsd32_clock_nanosleep, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 244 = freebsd32_clock_nanosleep */ { .sy_narg = 0, .sy_call = (sy_call_t *)nosys, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_ABSENT }, /* 245 = reserved for local use */ { .sy_narg = 0, .sy_call = (sy_call_t *)nosys, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_ABSENT }, /* 246 = reserved for local use */ @@ -649,4 +649,6 @@ { .sy_narg = AS(timerfd_create_args), .sy_call = (sy_call_t *)sys_timerfd_create, .sy_auevent = AUE_TIMERFD, .sy_flags = SYF_CAPENABLED, .sy_thrcnt = SY_THR_STATIC }, /* 585 = timerfd_create */ { .sy_narg = AS(freebsd32_timerfd_gettime_args), .sy_call = (sy_call_t *)freebsd32_timerfd_gettime, .sy_auevent = AUE_TIMERFD, .sy_flags = SYF_CAPENABLED, .sy_thrcnt = SY_THR_STATIC }, /* 586 = freebsd32_timerfd_gettime */ { .sy_narg = AS(freebsd32_timerfd_settime_args), .sy_call = (sy_call_t *)freebsd32_timerfd_settime, .sy_auevent = AUE_TIMERFD, .sy_flags = SYF_CAPENABLED, .sy_thrcnt = SY_THR_STATIC }, /* 587 = freebsd32_timerfd_settime */ + { .sy_narg = AS(freebsd32_ffclock_setdata_args), .sy_call = (sy_call_t *)freebsd32_ffclock_setdata, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 588 = freebsd32_ffclock_setdata */ + { .sy_narg = AS(freebsd32_ffclock_getdata_args), .sy_call = (sy_call_t *)freebsd32_ffclock_getdata, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 589 = freebsd32_ffclock_getdata */ }; diff --git a/sys/compat/freebsd32/freebsd32_systrace_args.c b/sys/compat/freebsd32/freebsd32_systrace_args.c --- a/sys/compat/freebsd32/freebsd32_systrace_args.c +++ b/sys/compat/freebsd32/freebsd32_systrace_args.c @@ -1203,20 +1203,6 @@ *n_args = 1; break; } - /* freebsd32_ffclock_setestimate */ - case 242: { - struct freebsd32_ffclock_setestimate_args *p = params; - uarg[a++] = (intptr_t)p->cest; /* struct ffclock_estimate32 * */ - *n_args = 1; - break; - } - /* freebsd32_ffclock_getestimate */ - case 243: { - struct freebsd32_ffclock_getestimate_args *p = params; - uarg[a++] = (intptr_t)p->cest; /* struct ffclock_estimate32 * */ - *n_args = 1; - break; - } /* freebsd32_clock_nanosleep */ case 244: { struct freebsd32_clock_nanosleep_args *p = params; @@ -3371,6 +3357,20 @@ *n_args = 4; break; } + /* freebsd32_ffclock_setdata */ + case 588: { + struct freebsd32_ffclock_setdata_args *p = params; + uarg[a++] = (intptr_t)p->cdat; /* struct ffclock_data32 * */ + *n_args = 1; + break; + } + /* freebsd32_ffclock_getdata */ + case 589: { + struct freebsd32_ffclock_getdata_args *p = params; + uarg[a++] = (intptr_t)p->cdat; /* struct ffclock_data32 * */ + *n_args = 1; + break; + } default: *n_args = 0; break; @@ -5263,26 +5263,6 @@ break; }; break; - /* freebsd32_ffclock_setestimate */ - case 242: - switch (ndx) { - case 0: - p = "userland struct ffclock_estimate32 *"; - break; - default: - break; - }; - break; - /* freebsd32_ffclock_getestimate */ - case 243: - switch (ndx) { - case 0: - p = "userland struct ffclock_estimate32 *"; - break; - default: - break; - }; - break; /* freebsd32_clock_nanosleep */ case 244: switch (ndx) { @@ -9101,6 +9081,26 @@ break; }; break; + /* freebsd32_ffclock_setdata */ + case 588: + switch (ndx) { + case 0: + p = "userland struct ffclock_data32 *"; + break; + default: + break; + }; + break; + /* freebsd32_ffclock_getdata */ + case 589: + switch (ndx) { + case 0: + p = "userland struct ffclock_data32 *"; + break; + default: + break; + }; + break; default: break; }; @@ -9795,16 +9795,6 @@ if (ndx == 0 || ndx == 1) p = "int"; break; - /* freebsd32_ffclock_setestimate */ - case 242: - if (ndx == 0 || ndx == 1) - p = "int"; - break; - /* freebsd32_ffclock_getestimate */ - case 243: - if (ndx == 0 || ndx == 1) - p = "int"; - break; /* freebsd32_clock_nanosleep */ case 244: if (ndx == 0 || ndx == 1) @@ -10989,6 +10979,16 @@ if (ndx == 0 || ndx == 1) p = "int"; break; + /* freebsd32_ffclock_setdata */ + case 588: + if (ndx == 0 || ndx == 1) + p = "int"; + break; + /* freebsd32_ffclock_getdata */ + case 589: + if (ndx == 0 || ndx == 1) + p = "int"; + break; default: break; }; diff --git a/sys/kern/init_sysent.c b/sys/kern/init_sysent.c --- a/sys/kern/init_sysent.c +++ b/sys/kern/init_sysent.c @@ -302,8 +302,8 @@ { .sy_narg = AS(ktimer_getoverrun_args), .sy_call = (sy_call_t *)sys_ktimer_getoverrun, .sy_auevent = AUE_NULL, .sy_flags = SYF_CAPENABLED, .sy_thrcnt = SY_THR_STATIC }, /* 239 = ktimer_getoverrun */ { .sy_narg = AS(nanosleep_args), .sy_call = (sy_call_t *)sys_nanosleep, .sy_auevent = AUE_NULL, .sy_flags = SYF_CAPENABLED, .sy_thrcnt = SY_THR_STATIC }, /* 240 = nanosleep */ { .sy_narg = AS(ffclock_getcounter_args), .sy_call = (sy_call_t *)sys_ffclock_getcounter, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 241 = ffclock_getcounter */ - { .sy_narg = AS(ffclock_setestimate_args), .sy_call = (sy_call_t *)sys_ffclock_setestimate, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 242 = ffclock_setestimate */ - { .sy_narg = AS(ffclock_getestimate_args), .sy_call = (sy_call_t *)sys_ffclock_getestimate, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 243 = ffclock_getestimate */ + { .sy_narg = 0, .sy_call = (sy_call_t *)nosys, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_ABSENT }, /* 242 = obsolete ffclock_setestimate */ + { .sy_narg = 0, .sy_call = (sy_call_t *)nosys, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_ABSENT }, /* 243 = obsolete ffclock_getestimate */ { .sy_narg = AS(clock_nanosleep_args), .sy_call = (sy_call_t *)sys_clock_nanosleep, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 244 = clock_nanosleep */ { .sy_narg = 0, .sy_call = (sy_call_t *)nosys, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_ABSENT }, /* 245 = reserved for local use */ { .sy_narg = 0, .sy_call = (sy_call_t *)nosys, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_ABSENT }, /* 246 = reserved for local use */ @@ -648,4 +648,6 @@ { .sy_narg = AS(timerfd_create_args), .sy_call = (sy_call_t *)sys_timerfd_create, .sy_auevent = AUE_TIMERFD, .sy_flags = SYF_CAPENABLED, .sy_thrcnt = SY_THR_STATIC }, /* 585 = timerfd_create */ { .sy_narg = AS(timerfd_gettime_args), .sy_call = (sy_call_t *)sys_timerfd_gettime, .sy_auevent = AUE_TIMERFD, .sy_flags = SYF_CAPENABLED, .sy_thrcnt = SY_THR_STATIC }, /* 586 = timerfd_gettime */ { .sy_narg = AS(timerfd_settime_args), .sy_call = (sy_call_t *)sys_timerfd_settime, .sy_auevent = AUE_TIMERFD, .sy_flags = SYF_CAPENABLED, .sy_thrcnt = SY_THR_STATIC }, /* 587 = timerfd_settime */ + { .sy_narg = AS(ffclock_setdata_args), .sy_call = (sy_call_t *)sys_ffclock_setdata, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 588 = ffclock_setdata */ + { .sy_narg = AS(ffclock_getdata_args), .sy_call = (sy_call_t *)sys_ffclock_getdata, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 589 = ffclock_getdata */ }; diff --git a/sys/kern/kern_ffclock.c b/sys/kern/kern_ffclock.c --- a/sys/kern/kern_ffclock.c +++ b/sys/kern/kern_ffclock.c @@ -51,7 +51,7 @@ FEATURE(ffclock, "Feedforward clock support"); -extern struct ffclock_estimate ffclock_estimate; +extern struct ffclock_data ffclock_data; extern int8_t ffclock_updated; extern struct mtx ffclock_mtx; @@ -71,7 +71,7 @@ ffclock_abstime(ffcounter *ffcount, struct bintime *bt, struct bintime *error_bound, uint32_t flags) { - struct ffclock_estimate cest; + struct ffclock_data cdat; ffcounter ffc; ffcounter update_ffcount; ffcounter ffdelta_error; @@ -84,29 +84,29 @@ ffclock_convert_abs(ffc, bt, flags); } - /* Current ffclock estimate, use update_ffcount as generation number. */ + /* Current ffclock data, use update_ffcount as generation number. */ do { - update_ffcount = ffclock_estimate.update_ffcount; - memcpy(&cest, &ffclock_estimate,sizeof(struct ffclock_estimate)); - } while (update_ffcount != ffclock_estimate.update_ffcount); + update_ffcount = ffclock_data.update_ffcount; + memcpy(&cdat, &ffclock_data, sizeof(struct ffclock_data)); + } while (update_ffcount != ffclock_data.update_ffcount); /* * Leap second adjustment. Total as seen by the FFclock daemon since it - * started. cest.leapsec_expected is the ffcounter prediction of when + * started. cdat.leapsec_expected is the ffcounter prediction of when * the next leapsecond occurs. */ if ((flags & FFCLOCK_LEAPSEC) == FFCLOCK_LEAPSEC) { - bt->sec -= cest.leapsec_total; // subtracting = including leaps - if (cest.leapsec_expected != 0 && ffc > cest.leapsec_expected) - bt->sec -= cest.leapsec_next; + bt->sec -= cdat.leapsec_total; // subtracting = including leaps + if (cdat.leapsec_expected != 0 && ffc > cdat.leapsec_expected) + bt->sec -= cdat.leapsec_next; } /* Compute error bound if a valid pointer has been passed. */ if (error_bound) { - ffdelta_error = ffc - cest.update_ffcount; + ffdelta_error = ffc - cdat.update_ffcount; ffclock_convert_diff(ffdelta_error, error_bound); - bintime_mul(error_bound, cest.errb_rate * PS_AS_BINFRAC); - bintime_addx(error_bound, cest.errb_abs * NS_AS_BINFRAC); + bintime_mul(error_bound, cdat.errb_rate * PS_AS_BINFRAC); + bintime_addx(error_bound, cdat.errb_abs * NS_AS_BINFRAC); } if (ffcount) @@ -130,9 +130,9 @@ if (error_bound) { do { - update_ffcount = ffclock_estimate.update_ffcount; - err_rate = ffclock_estimate.errb_rate; - } while (update_ffcount != ffclock_estimate.update_ffcount); + update_ffcount = ffclock_data.update_ffcount; + err_rate = ffclock_data.errb_rate; + } while (update_ffcount != ffclock_data.update_ffcount); ffclock_convert_diff(ffdelta, error_bound); bintime_mul(error_bound, err_rate * PS_AS_BINFRAC); @@ -395,34 +395,33 @@ /* * System call allowing the synchronisation daemon to push new feedforward - * clock estimates to the kernel. Acquire ffclock_mtx to prevent concurrent + * clock data to the kernel. Acquire ffclock_mtx to prevent concurrent * updates and ensure data consistency. - * NOTE: ffclock_updated signals the fftimehands that new estimates are - * available. The updated estimates are picked up by the fftimehands on next - * tick, which could take as long as 1/hz seconds (if ticks are not missed). + * NOTE: ffclock_updated signals the fftimehands that new data is available. + * The updated data is picked up by the fftimehands on next tick, which could + * take as long as 1/hz seconds (if ticks are not missed). */ #ifndef _SYS_SYSPROTO_H_ -struct ffclock_setestimate_args { - struct ffclock_estimate *cest; +struct ffclock_setdata_args { + struct ffclock_data *cdat; }; #endif /* ARGSUSED */ int -sys_ffclock_setestimate(struct thread *td, struct ffclock_setestimate_args *uap) +sys_ffclock_setdata(struct thread *td, struct ffclock_setdata_args *uap) { - struct ffclock_estimate cest; + struct ffclock_data cdat; int error; /* Reuse of PRIV_CLOCK_SETTIME. */ if ((error = priv_check(td, PRIV_CLOCK_SETTIME)) != 0) return (error); - if ((error = copyin(uap->cest, &cest, sizeof(struct ffclock_estimate))) - != 0) + if ((error = copyin(uap->cdat, &cdat,sizeof(struct ffclock_data))) != 0) return (error); mtx_lock_spin(&ffclock_mtx); - memcpy(&ffclock_estimate, &cest, sizeof(struct ffclock_estimate)); + memcpy(&ffclock_data, &cdat, sizeof(struct ffclock_data)); ffclock_updated++; mtx_unlock_spin(&ffclock_mtx); @@ -430,26 +429,26 @@ } /* - * System call allowing userland applications to retrieve the clock estimates + * System call allowing userland applications to retrieve the clock data * stored within the kernel. It is useful to kickstart the synchronisation * daemon with the kernel's knowledge of hardware timecounter. */ #ifndef _SYS_SYSPROTO_H_ -struct ffclock_getestimate_args { - struct ffclock_estimate *cest; +struct ffclock_getdata_args { + struct ffclock_data *cdat; }; #endif /* ARGSUSED */ int -sys_ffclock_getestimate(struct thread *td, struct ffclock_getestimate_args *uap) +sys_ffclock_getdata(struct thread *td, struct ffclock_getdata_args *uap) { - struct ffclock_estimate cest; + struct ffclock_data cdat; int error; mtx_lock_spin(&ffclock_mtx); - memcpy(&cest, &ffclock_estimate, sizeof(struct ffclock_estimate)); + memcpy(&cdat, &ffclock_data, sizeof(struct ffclock_data)); mtx_unlock_spin(&ffclock_mtx); - error = copyout(&cest, uap->cest, sizeof(struct ffclock_estimate)); + error = copyout(&cdat, uap->cdat, sizeof(struct ffclock_data)); return (error); } @@ -463,14 +462,14 @@ } int -sys_ffclock_setestimate(struct thread *td, struct ffclock_setestimate_args *uap) +sys_ffclock_setdata(struct thread *td, struct ffclock_setdata_args *uap) { return (ENOSYS); } int -sys_ffclock_getestimate(struct thread *td, struct ffclock_getestimate_args *uap) +sys_ffclock_getdata(struct thread *td, struct ffclock_getdata_args *uap) { return (ENOSYS); diff --git a/sys/kern/kern_tc.c b/sys/kern/kern_tc.c --- a/sys/kern/kern_tc.c +++ b/sys/kern/kern_tc.c @@ -518,14 +518,14 @@ * separately. */ -/* Feedforward clock estimates kept updated by the synchronization daemon. */ -struct ffclock_estimate ffclock_estimate; +/* Feedforward clock data kept updated by the synchronization daemon. */ +struct ffclock_data ffclock_data; /* natFFC data from FFclock daemon. */ uint32_t ffclock_status; /* feedforward clock status. */ -int8_t ffclock_updated; /* New estimates are available. */ -struct mtx ffclock_mtx; /* Mutex on ffclock_estimate. */ +int8_t ffclock_updated; /* New data is available. */ +struct mtx ffclock_mtx; /* Mutex on ffclock_data. */ struct fftimehands { - struct ffclock_estimate cest; /* natFFC daemon data */ + struct ffclock_data cdat; /* natFFC daemon data */ struct bintime tick_time; /* natFFC */ struct bintime tick_time_mono; /* monoFFC */ struct bintime tick_time_diff; /* diffFFC */ @@ -611,7 +611,7 @@ ffclock_windup(unsigned int delta, struct bintime *reset_FBbootime, struct bintime *reset_UTC) { - struct ffclock_estimate *cest; + struct ffclock_data *cdat; struct fftimehands *ffth; struct bintime bt, gap, upt; ffcounter ffdelta; @@ -622,7 +622,7 @@ ffth = fftimehands->next; ogen = ffth->gen; ffth->gen = 0; - cest = &ffth->cest; + cdat = &ffth->cdat; /* Move FF counter forward to existing tick start. */ ffdelta = (ffcounter)delta; @@ -634,7 +634,7 @@ */ if (reset_FBbootime) { /* Acceptable to ignore a potentially pending update here. */ - memcpy(cest, &fftimehands->cest,sizeof(struct ffclock_estimate)); + memcpy(cdat, &fftimehands->cdat,sizeof(struct ffclock_data)); /* * Set value of ffclock_boottime to maximize Upclock continuity. @@ -669,21 +669,21 @@ ffth->tick_time_diff = *reset_UTC; /* Reset natFFC to reflect the reset, effected at tick-start. */ - cest->update_time = *reset_UTC; - cest->update_ffcount = ffth->tick_ffcount; - if (cest->period == 0) // if never set - cest->period = ((1ULL << 63)/ \ + cdat->update_time = *reset_UTC; + cdat->update_ffcount = ffth->tick_ffcount; + if (cdat->period == 0) // if never set + cdat->period = ((1ULL << 63)/ \ timehands->th_counter->tc_frequency) << 1; - cest->errb_abs = 0; - cest->errb_rate = 0; - cest->status = FFCLOCK_STA_UNSYNC; - cest->secs_to_nextupdate = 0; // no daemon update since reset - cest->leapsec_expected = 0; - cest->leapsec_total = 0; - cest->leapsec_next = 0; + cdat->errb_abs = 0; + cdat->errb_rate = 0; + cdat->status = FFCLOCK_STA_UNSYNC; + cdat->secs_to_nextupdate = 0; // no daemon update since reset + cdat->leapsec_expected = 0; + cdat->leapsec_total = 0; + cdat->leapsec_next = 0; mtx_lock_spin(&ffclock_mtx); - memcpy(&ffclock_estimate, cest,sizeof(struct ffclock_estimate)); + memcpy(&ffclock_data, cdat,sizeof(struct ffclock_data)); ffclock_updated = 0; // signal no daemon update to process mtx_unlock_spin(&ffclock_mtx); @@ -691,7 +691,7 @@ /* Reset remaining fftimehands members. */ ffth->tick_error.sec = ffth->tick_error.frac = 0; - ffth->period_mono = cest->period; + ffth->period_mono = cdat->period; upt = ffth->tick_time_mono; bintime_sub(&upt, &ffth->ffclock_boottime); @@ -710,9 +710,9 @@ /* * Signal to ignore a stale daemon update following a RTC reset. */ - if (ffclock_updated > 0 && fftimehands->cest.secs_to_nextupdate == 0 - && bintime_cmp(&fftimehands->cest.update_time, - &ffclock_estimate.update_time,>) ) { + if (ffclock_updated > 0 && fftimehands->cdat.secs_to_nextupdate == 0 + && bintime_cmp(&fftimehands->cdat.update_time, + &ffclock_data.update_time,>) ) { ffclock_updated = 0; printf("Ignoring stale natFFC update following RTC reset.\n"); } @@ -724,14 +724,14 @@ */ if (ffclock_updated <= 0 && reset_FBbootime == NULL) { - /* Update natFFC members {cest, tick_time{_diff}, tick_error} */ - memcpy(cest, &fftimehands->cest,sizeof(struct ffclock_estimate)); + /* Update natFFC members {cdat, tick_time{_diff}, tick_error} */ + memcpy(cdat, &fftimehands->cdat,sizeof(struct ffclock_data)); ffth->tick_time = fftimehands->tick_time; ffth->tick_time_diff = fftimehands->tick_time_diff; - ffclock_convert_delta(ffdelta, cest->period, &bt); + ffclock_convert_delta(ffdelta, cdat->period, &bt); bintime_add(&ffth->tick_time, &bt); bintime_add(&ffth->tick_time_diff, &bt); - bintime_mul(&bt, cest->errb_rate * PS_AS_BINFRAC); + bintime_mul(&bt, cdat->errb_rate * PS_AS_BINFRAC); bintime_add(&ffth->tick_error, &bt); /* Update monoFFC members {period_mono, tick_time_mono}. */ @@ -747,9 +747,9 @@ */ if (ffclock_updated == 0) { bt = ffth->tick_time; - bintime_sub(&bt, &cest->update_time); + bintime_sub(&bt, &cdat->update_time); if (bt.sec > 3 * FFCLOCK_SKM_SCALE && - bt.sec > 3 * cest->secs_to_nextupdate) + bt.sec > 3 * cdat->secs_to_nextupdate) ffclock_status |= FFCLOCK_STA_UNSYNC; } @@ -761,14 +761,14 @@ */ if (ffclock_updated > 0) { - /* Update natFFC members {cest, tick_time, tick_error}. */ - memcpy(cest, &ffclock_estimate,sizeof(struct ffclock_estimate)); - ffdelta = ffth->tick_ffcount - cest->update_ffcount; - ffth->tick_time = cest->update_time; - ffclock_convert_delta(ffdelta, cest->period, &bt); + /* Update natFFC members {cdat, tick_time, tick_error}. */ + memcpy(cdat, &ffclock_data,sizeof(struct ffclock_data)); + ffdelta = ffth->tick_ffcount - cdat->update_ffcount; + ffth->tick_time = cdat->update_time; + ffclock_convert_delta(ffdelta, cdat->period, &bt); bintime_add(&ffth->tick_time, &bt); - bintime_mul(&bt, cest->errb_rate * PS_AS_BINFRAC); - bintime_addx(&bt, cest->errb_abs * NS_AS_BINFRAC); + bintime_mul(&bt, cdat->errb_rate * PS_AS_BINFRAC); + bintime_addx(&bt, cdat->errb_abs * NS_AS_BINFRAC); ffth->tick_error = bt; /* @@ -776,7 +776,7 @@ * continuity over ticks. */ ffth->tick_time_diff = fftimehands->tick_time_diff; - ffclock_convert_delta((ffcounter)delta, cest->period, &bt); + ffclock_convert_delta((ffcounter)delta, cdat->period, &bt); bintime_add(&ffth->tick_time_diff, &bt); /* @@ -814,7 +814,7 @@ * If the jump is forward, then monoFFC remains monotonic. */ if (((ffclock_status & FFCLOCK_STA_UNSYNC) == FFCLOCK_STA_UNSYNC) - && ((cest->status & FFCLOCK_STA_UNSYNC) == 0) ) { + && ((cdat->status & FFCLOCK_STA_UNSYNC) == 0) ) { if (forward_jump) { printf("ffwindup: forward"); bintime_add(&ffth->ffclock_boottime, &gap); @@ -846,22 +846,22 @@ * is capped at 5000PPM (5ms/s). If there is no gap, the clocks * will agree throughout the new tick. */ - ffth->period_mono = cest->period; // re-initialize + ffth->period_mono = cdat->period; // re-initialize /* Keep default if no visible gap or no daemon updates yet. */ - if (bintime_isset(&gap) && cest->secs_to_nextupdate > 0) { + if (bintime_isset(&gap) && cdat->secs_to_nextupdate > 0) { /* Calculate cap */ bt.sec = 0; bt.frac = 5000000 * NS_AS_BINFRAC; - bintime_mul(&bt, cest->secs_to_nextupdate); + bintime_mul(&bt, cdat->secs_to_nextupdate); if (bintime_cmp(&gap, &bt, >)) gap = bt; // gap = min(gap, bt) /* Convert secs_to_nextupdate to counter units. */ frac = 0; frac -= 1; // approximate 2^64 with (2^64)-1 for ease - ffdelta = (frac/cest->period) * cest->secs_to_nextupdate; + ffdelta = (frac/cdat->period) * cdat->secs_to_nextupdate; /* Store the portion of gap per cycle in frac. */ frac = 0; @@ -877,7 +877,7 @@ ffth->period_mono -= frac; } - ffclock_status = cest->status; // unsets FFCLOCK_STA_UNSYNC + ffclock_status = cdat->status; // unsets FFCLOCK_STA_UNSYNC ffclock_updated = 0; // signal latest update done } @@ -902,7 +902,7 @@ ffclock_change_tc(struct timehands *th, unsigned int ncount) { struct fftimehands *ffth; - struct ffclock_estimate *cest; + struct ffclock_data *cdat; struct timecounter *tc; uint8_t ogen; ffcounter now; @@ -913,7 +913,7 @@ ffth = fftimehands->next; ogen = ffth->gen; ffth->gen = 0; - cest = &ffth->cest; + cdat = &ffth->cdat; /* * Origin setting: reset FFcounter to match start of the current tick. @@ -934,26 +934,26 @@ (ffcounter)((unsigned int)now - ncount); } - memcpy(cest, &(fftimehands->cest), sizeof(struct ffclock_estimate)); - cest->update_ffcount = ffth->tick_ffcount; - cest->secs_to_nextupdate = 0; - cest->period = ((1ULL << 63) / tc->tc_frequency ) << 1; - cest->errb_abs = 0; - cest->errb_rate = 0; - cest->status |= FFCLOCK_STA_UNSYNC; - cest->leapsec_expected = 0; - cest->leapsec_total = 0; - cest->leapsec_next = 0; + memcpy(cdat, &(fftimehands->cdat), sizeof(struct ffclock_data)); + cdat->update_ffcount = ffth->tick_ffcount; + cdat->secs_to_nextupdate = 0; + cdat->period = ((1ULL << 63) / tc->tc_frequency ) << 1; + cdat->errb_abs = 0; + cdat->errb_rate = 0; + cdat->status |= FFCLOCK_STA_UNSYNC; + cdat->leapsec_expected = 0; + cdat->leapsec_total = 0; + cdat->leapsec_next = 0; ffth->tick_time = fftimehands->tick_time; ffth->tick_error = fftimehands->tick_error; ffth->tick_time_diff = fftimehands->tick_time_diff; ffth->tick_time_mono = fftimehands->tick_time_mono; - ffth->period_mono = cest->period; + ffth->period_mono = cdat->period; /* Push the reset natFFC data to the global variable. */ mtx_lock_spin(&ffclock_mtx); - memcpy(&ffclock_estimate, cest, sizeof(struct ffclock_estimate)); + memcpy(&ffclock_data, cdat, sizeof(struct ffclock_data)); ffclock_updated--; // ensure next daemon update will be ignored mtx_unlock_spin(&ffclock_mtx); @@ -1028,7 +1028,7 @@ *bt = ffth->tick_time_diff; else *bt = ffth->tick_time; - ffclock_convert_delta(ffdelta, ffth->cest.period, &bt2); + ffclock_convert_delta(ffdelta, ffth->cdat.period, &bt2); } if (ffcount > ffth->tick_ffcount) @@ -1059,7 +1059,7 @@ do { ffth = fftimehands; gen = ffth->gen; - ffclock_convert_delta(ffdelta, ffth->cest.period, bt); + ffclock_convert_delta(ffdelta, ffth->cdat.period, bt); } while (gen == 0 || gen != ffth->gen); } @@ -1236,7 +1236,7 @@ #ifdef FFCLOCK struct ffclock_info *ffi; struct fftimehands *ffth; - struct ffclock_estimate cest; + struct ffclock_data cdat; #endif delta = 0; @@ -1261,10 +1261,10 @@ ffi->tick_time_diff = ffth->tick_time_diff; ffi->tick_time_mono = ffth->tick_time_mono; ffi->ffclock_boottime = ffth->ffclock_boottime; - ffi->period = ffth->cest.period; + ffi->period = ffth->cdat.period; ffi->period_mono = ffth->period_mono; clock_snap->ffcount = ffth->tick_ffcount; - cest = ffth->cest; + cdat = ffth->cdat; #endif atomic_thread_fence_acq(); } while (gen == 0 || gen != th->th_generation); @@ -1287,17 +1287,17 @@ * Pre-calculate total leap adjustment appropriate to this ffcount. That * is, total leaps so far and impending leap ffcount may have surpassed. */ - ffi->leapsec_adjustment = cest.leapsec_total; - if (cest.leapsec_expected != 0 && clock_snap->ffcount > - cest.leapsec_expected) - ffi->leapsec_adjustment += cest.leapsec_next; + ffi->leapsec_adjustment = cdat.leapsec_total; + if (cdat.leapsec_expected != 0 && clock_snap->ffcount > + cdat.leapsec_expected) + ffi->leapsec_adjustment += cdat.leapsec_next; /* Record feedforward clock status and error. */ - ffi->status = cest.status; + ffi->status = cdat.status; ffi->error = ffth->tick_error; if (!fast) { - ffclock_convert_delta((ffcounter)delta, cest.period, &bt); - bintime_mul(&bt, cest.errb_rate * PS_AS_BINFRAC); + ffclock_convert_delta((ffcounter)delta, cdat.period, &bt); + bintime_mul(&bt, cdat.errb_rate * PS_AS_BINFRAC); bintime_add(&ffi->error, &bt); } #endif @@ -2093,7 +2093,7 @@ #ifdef FFCLOCK *ffcount = pps->capffth->tick_ffcount + tcount; bt = pps->capffth->tick_time; - ffclock_convert_delta(tcount, pps->capffth->cest.period, &bt); + ffclock_convert_delta(tcount, pps->capffth->cdat.period, &bt); bintime_add(&bt, &pps->capffth->tick_time); (*pseq_ffc)++; bintime2timespec(&bt, tsp_ffc); diff --git a/sys/kern/syscalls.c b/sys/kern/syscalls.c --- a/sys/kern/syscalls.c +++ b/sys/kern/syscalls.c @@ -247,8 +247,8 @@ "ktimer_getoverrun", /* 239 = ktimer_getoverrun */ "nanosleep", /* 240 = nanosleep */ "ffclock_getcounter", /* 241 = ffclock_getcounter */ - "ffclock_setestimate", /* 242 = ffclock_setestimate */ - "ffclock_getestimate", /* 243 = ffclock_getestimate */ + "obs_ffclock_setestimate", /* 242 = obsolete ffclock_setestimate */ + "obs_ffclock_getestimate", /* 243 = obsolete ffclock_getestimate */ "clock_nanosleep", /* 244 = clock_nanosleep */ "#245", /* 245 = reserved for local use */ "#246", /* 246 = reserved for local use */ @@ -593,4 +593,6 @@ "timerfd_create", /* 585 = timerfd_create */ "timerfd_gettime", /* 586 = timerfd_gettime */ "timerfd_settime", /* 587 = timerfd_settime */ + "ffclock_setdata", /* 588 = ffclock_setdata */ + "ffclock_getdata", /* 589 = ffclock_getdata */ }; diff --git a/sys/kern/syscalls.master b/sys/kern/syscalls.master --- a/sys/kern/syscalls.master +++ b/sys/kern/syscalls.master @@ -1427,16 +1427,8 @@ _Out_ ffcounter *ffcount ); } -242 AUE_NULL STD { - int ffclock_setestimate( - _In_ _Contains_timet_ struct ffclock_estimate *cest - ); - } -243 AUE_NULL STD { - int ffclock_getestimate( - _Out_ _Contains_timet_ struct ffclock_estimate *cest - ); - } +242 AUE_NULL OBSOL ffclock_setestimate +243 AUE_NULL OBSOL ffclock_getestimate 244 AUE_NULL STD { int clock_nanosleep( clockid_t clock_id, @@ -3339,6 +3331,15 @@ _Out_opt_ _Contains_long_timet_ struct itimerspec *old_value ); } - +588 AUE_NULL STD { + int ffclock_setdata( + _In_ _Contains_timet_ struct ffclock_data *cdat + ); + } +589 AUE_NULL STD { + int ffclock_getdata( + _Out_ _Contains_timet_ struct ffclock_data *cdat + ); + } ; vim: syntax=off diff --git a/sys/kern/systrace_args.c b/sys/kern/systrace_args.c --- a/sys/kern/systrace_args.c +++ b/sys/kern/systrace_args.c @@ -1226,20 +1226,6 @@ *n_args = 1; break; } - /* ffclock_setestimate */ - case 242: { - struct ffclock_setestimate_args *p = params; - uarg[a++] = (intptr_t)p->cest; /* struct ffclock_estimate * */ - *n_args = 1; - break; - } - /* ffclock_getestimate */ - case 243: { - struct ffclock_getestimate_args *p = params; - uarg[a++] = (intptr_t)p->cest; /* struct ffclock_estimate * */ - *n_args = 1; - break; - } /* clock_nanosleep */ case 244: { struct clock_nanosleep_args *p = params; @@ -3458,6 +3444,20 @@ *n_args = 4; break; } + /* ffclock_setdata */ + case 588: { + struct ffclock_setdata_args *p = params; + uarg[a++] = (intptr_t)p->cdat; /* struct ffclock_data * */ + *n_args = 1; + break; + } + /* ffclock_getdata */ + case 589: { + struct ffclock_getdata_args *p = params; + uarg[a++] = (intptr_t)p->cdat; /* struct ffclock_data * */ + *n_args = 1; + break; + } default: *n_args = 0; break; @@ -5395,26 +5395,6 @@ break; }; break; - /* ffclock_setestimate */ - case 242: - switch (ndx) { - case 0: - p = "userland struct ffclock_estimate *"; - break; - default: - break; - }; - break; - /* ffclock_getestimate */ - case 243: - switch (ndx) { - case 0: - p = "userland struct ffclock_estimate *"; - break; - default: - break; - }; - break; /* clock_nanosleep */ case 244: switch (ndx) { @@ -9246,6 +9226,26 @@ break; }; break; + /* ffclock_setdata */ + case 588: + switch (ndx) { + case 0: + p = "userland struct ffclock_data *"; + break; + default: + break; + }; + break; + /* ffclock_getdata */ + case 589: + switch (ndx) { + case 0: + p = "userland struct ffclock_data *"; + break; + default: + break; + }; + break; default: break; }; @@ -9955,16 +9955,6 @@ if (ndx == 0 || ndx == 1) p = "int"; break; - /* ffclock_setestimate */ - case 242: - if (ndx == 0 || ndx == 1) - p = "int"; - break; - /* ffclock_getestimate */ - case 243: - if (ndx == 0 || ndx == 1) - p = "int"; - break; /* clock_nanosleep */ case 244: if (ndx == 0 || ndx == 1) @@ -11224,6 +11214,16 @@ if (ndx == 0 || ndx == 1) p = "int"; break; + /* ffclock_setdata */ + case 588: + if (ndx == 0 || ndx == 1) + p = "int"; + break; + /* ffclock_getdata */ + case 589: + if (ndx == 0 || ndx == 1) + p = "int"; + break; default: break; }; diff --git a/sys/sys/syscall.h b/sys/sys/syscall.h --- a/sys/sys/syscall.h +++ b/sys/sys/syscall.h @@ -220,8 +220,8 @@ #define SYS_ktimer_getoverrun 239 #define SYS_nanosleep 240 #define SYS_ffclock_getcounter 241 -#define SYS_ffclock_setestimate 242 -#define SYS_ffclock_getestimate 243 + /* 242 is obsolete ffclock_setestimate */ + /* 243 is obsolete ffclock_getestimate */ #define SYS_clock_nanosleep 244 #define SYS_clock_getcpuclockid2 247 #define SYS_ntp_gettime 248 @@ -524,4 +524,6 @@ #define SYS_timerfd_create 585 #define SYS_timerfd_gettime 586 #define SYS_timerfd_settime 587 -#define SYS_MAXSYSCALL 588 +#define SYS_ffclock_setdata 588 +#define SYS_ffclock_getdata 589 +#define SYS_MAXSYSCALL 590 diff --git a/sys/sys/syscall.mk b/sys/sys/syscall.mk --- a/sys/sys/syscall.mk +++ b/sys/sys/syscall.mk @@ -155,8 +155,6 @@ ktimer_getoverrun.o \ nanosleep.o \ ffclock_getcounter.o \ - ffclock_setestimate.o \ - ffclock_getestimate.o \ clock_nanosleep.o \ clock_getcpuclockid2.o \ ntp_gettime.o \ @@ -429,4 +427,6 @@ membarrier.o \ timerfd_create.o \ timerfd_gettime.o \ - timerfd_settime.o + timerfd_settime.o \ + ffclock_setdata.o \ + ffclock_getdata.o diff --git a/sys/sys/sysproto.h b/sys/sys/sysproto.h --- a/sys/sys/sysproto.h +++ b/sys/sys/sysproto.h @@ -662,12 +662,6 @@ struct ffclock_getcounter_args { char ffcount_l_[PADL_(ffcounter *)]; ffcounter * ffcount; char ffcount_r_[PADR_(ffcounter *)]; }; -struct ffclock_setestimate_args { - char cest_l_[PADL_(struct ffclock_estimate *)]; struct ffclock_estimate * cest; char cest_r_[PADR_(struct ffclock_estimate *)]; -}; -struct ffclock_getestimate_args { - char cest_l_[PADL_(struct ffclock_estimate *)]; struct ffclock_estimate * cest; char cest_r_[PADR_(struct ffclock_estimate *)]; -}; struct clock_nanosleep_args { char clock_id_l_[PADL_(clockid_t)]; clockid_t clock_id; char clock_id_r_[PADR_(clockid_t)]; char flags_l_[PADL_(int)]; int flags; char flags_r_[PADR_(int)]; @@ -1876,6 +1870,12 @@ char new_value_l_[PADL_(const struct itimerspec *)]; const struct itimerspec * new_value; char new_value_r_[PADR_(const struct itimerspec *)]; char old_value_l_[PADL_(struct itimerspec *)]; struct itimerspec * old_value; char old_value_r_[PADR_(struct itimerspec *)]; }; +struct ffclock_setdata_args { + char cdat_l_[PADL_(struct ffclock_data *)]; struct ffclock_data * cdat; char cdat_r_[PADR_(struct ffclock_data *)]; +}; +struct ffclock_getdata_args { + char cdat_l_[PADL_(struct ffclock_data *)]; struct ffclock_data * cdat; char cdat_r_[PADR_(struct ffclock_data *)]; +}; int sys_exit(struct thread *, struct exit_args *); int sys_fork(struct thread *, struct fork_args *); int sys_read(struct thread *, struct read_args *); @@ -2018,8 +2018,6 @@ int sys_ktimer_getoverrun(struct thread *, struct ktimer_getoverrun_args *); int sys_nanosleep(struct thread *, struct nanosleep_args *); int sys_ffclock_getcounter(struct thread *, struct ffclock_getcounter_args *); -int sys_ffclock_setestimate(struct thread *, struct ffclock_setestimate_args *); -int sys_ffclock_getestimate(struct thread *, struct ffclock_getestimate_args *); int sys_clock_nanosleep(struct thread *, struct clock_nanosleep_args *); int sys_clock_getcpuclockid2(struct thread *, struct clock_getcpuclockid2_args *); int sys_ntp_gettime(struct thread *, struct ntp_gettime_args *); @@ -2276,6 +2274,8 @@ int sys_timerfd_create(struct thread *, struct timerfd_create_args *); int sys_timerfd_gettime(struct thread *, struct timerfd_gettime_args *); int sys_timerfd_settime(struct thread *, struct timerfd_settime_args *); +int sys_ffclock_setdata(struct thread *, struct ffclock_setdata_args *); +int sys_ffclock_getdata(struct thread *, struct ffclock_getdata_args *); #ifdef COMPAT_43 @@ -2968,8 +2968,6 @@ #define SYS_AUE_ktimer_getoverrun AUE_NULL #define SYS_AUE_nanosleep AUE_NULL #define SYS_AUE_ffclock_getcounter AUE_NULL -#define SYS_AUE_ffclock_setestimate AUE_NULL -#define SYS_AUE_ffclock_getestimate AUE_NULL #define SYS_AUE_clock_nanosleep AUE_NULL #define SYS_AUE_clock_getcpuclockid2 AUE_NULL #define SYS_AUE_ntp_gettime AUE_NULL @@ -3250,6 +3248,8 @@ #define SYS_AUE_timerfd_create AUE_TIMERFD #define SYS_AUE_timerfd_gettime AUE_TIMERFD #define SYS_AUE_timerfd_settime AUE_TIMERFD +#define SYS_AUE_ffclock_setdata AUE_NULL +#define SYS_AUE_ffclock_getdata AUE_NULL #undef PAD_ #undef PADL_ diff --git a/sys/sys/timeffc.h b/sys/sys/timeffc.h --- a/sys/sys/timeffc.h +++ b/sys/sys/timeffc.h @@ -40,12 +40,12 @@ #ifdef _KERNEL /* - * Feedforward clock estimate + * Feedforward clock data. * Holds time mark as a ffcounter and conversion to bintime based on current * timecounter period and offset estimate passed by the synchronization daemon. * Provides time of last daemon update, clock status and bound on error. */ -struct ffclock_estimate { +struct ffclock_data { struct bintime update_time; /* FFclock time of last update. */ ffcounter update_ffcount; /* Counter value at last update. */ ffcounter leapsec_expected; /* Approx counter value of next leap. */ @@ -196,7 +196,7 @@ /* * Feedforward clock routines. * - * These functions rely on the timecounters and ffclock_estimates stored in + * These functions rely on the timecounters and ffclock_data stored in * fftimehands. Note that the error_bound parameter is not the error of the * clock but an upper bound on the error of the absolute time or time interval * returned. @@ -239,7 +239,7 @@ /* * Wrapper routines to convert a time interval specified in ffcounter units into - * seconds using the current feedforward clock estimates. + * seconds using the current feedforward clock data. */ void ffclock_bindifftime(ffcounter ffdelta, struct bintime *bt); void ffclock_nanodifftime(ffcounter ffdelta, struct timespec *tsp); @@ -398,8 +398,8 @@ /* Feedforward Clock system calls. */ __BEGIN_DECLS int ffclock_getcounter(ffcounter *ffcount); -int ffclock_getestimate(struct ffclock_estimate *cest); -int ffclock_setestimate(struct ffclock_estimate *cest); +int ffclock_getdata(struct ffclock_data *cdat); +int ffclock_setdata(struct ffclock_data *cdat); __END_DECLS #endif /* _KERNEL */