diff options
author | kib <kib@FreeBSD.org> | 2016-08-26 10:04:10 +0000 |
---|---|---|
committer | kib <kib@FreeBSD.org> | 2016-08-26 10:04:10 +0000 |
commit | 5eaf5813abcaf71c35e1006aab0a861cd104f3aa (patch) | |
tree | bca93d9d17af3deb43eea20809b800e90e4e9643 /sys/net | |
parent | e78ab6e5643ca053c8b55a26b13329fb1d4afd3e (diff) | |
download | FreeBSD-src-5eaf5813abcaf71c35e1006aab0a861cd104f3aa.zip FreeBSD-src-5eaf5813abcaf71c35e1006aab0a861cd104f3aa.tar.gz |
MFC r303382:
Provide the getboottime(9) and getboottimebin(9) KPI.
MFC r303387:
Prevent parallel tc_windup() calls. Keep boottime in timehands,
and adjust it from tc_windup().
MFC notes:
The boottime and boottimebin globals are still exported from
the kernel dyn symbol table in stable/11, but their declarations are
removed from sys/time.h. This preserves KBI but not KPI, while all
in-tree consumers are converted to getboottime().
The variables are updated after tc_setclock_mtx is dropped, which gives
approximately same unlocked bugs as before.
The boottime and boottimebin locals in several sys/kern_tc.c functions
were renamed by adding the '_x' suffix to avoid name conficts.
Diffstat (limited to 'sys/net')
-rw-r--r-- | sys/net/altq/altq_subr.c | 3 | ||||
-rw-r--r-- | sys/net/bpf.c | 3 |
2 files changed, 4 insertions, 2 deletions
diff --git a/sys/net/altq/altq_subr.c b/sys/net/altq/altq_subr.c index 873d7bd..c5093d8 100644 --- a/sys/net/altq/altq_subr.c +++ b/sys/net/altq/altq_subr.c @@ -1027,9 +1027,10 @@ read_machclk(void) panic("read_machclk"); #endif } else { - struct timeval tv; + struct timeval tv, boottime; microtime(&tv); + getboottime(&boottime); val = (((u_int64_t)(tv.tv_sec - boottime.tv_sec) * 1000000 + tv.tv_usec) << MACHCLK_SHIFT); } diff --git a/sys/net/bpf.c b/sys/net/bpf.c index 3b12cf4..4251f71 100644 --- a/sys/net/bpf.c +++ b/sys/net/bpf.c @@ -2328,12 +2328,13 @@ bpf_hdrlen(struct bpf_d *d) static void bpf_bintime2ts(struct bintime *bt, struct bpf_ts *ts, int tstype) { - struct bintime bt2; + struct bintime bt2, boottimebin; struct timeval tsm; struct timespec tsn; if ((tstype & BPF_T_MONOTONIC) == 0) { bt2 = *bt; + getboottimebin(&boottimebin); bintime_add(&bt2, &boottimebin); bt = &bt2; } |