summaryrefslogtreecommitdiffstats
path: root/sys/kern/kern_time.c
diff options
context:
space:
mode:
authorphk <phk@FreeBSD.org>2002-02-18 08:40:28 +0000
committerphk <phk@FreeBSD.org>2002-02-18 08:40:28 +0000
commite340a5652fafc42f89a43dcc2779106cf6ba7f67 (patch)
treec26e2cb774e2bdb4221a328a4681f76868fcdb7d /sys/kern/kern_time.c
parent68320d04d1ce77058a870d6070d61892172ef0ea (diff)
downloadFreeBSD-src-e340a5652fafc42f89a43dcc2779106cf6ba7f67.zip
FreeBSD-src-e340a5652fafc42f89a43dcc2779106cf6ba7f67.tar.gz
Take the common case of gettimeofday(&tv, NULL) out from under Giant.
Diffstat (limited to 'sys/kern/kern_time.c')
-rw-r--r--sys/kern/kern_time.c12
1 files changed, 4 insertions, 8 deletions
diff --git a/sys/kern/kern_time.c b/sys/kern/kern_time.c
index bca540f..f8c6aff 100644
--- a/sys/kern/kern_time.c
+++ b/sys/kern/kern_time.c
@@ -336,20 +336,16 @@ gettimeofday(td, uap)
struct timeval atv;
int error = 0;
- mtx_lock(&Giant);
if (uap->tp) {
microtime(&atv);
- if ((error = copyout((caddr_t)&atv, (caddr_t)uap->tp,
- sizeof (atv)))) {
- goto done2;
- }
+ error = copyout((caddr_t)&atv, (caddr_t)uap->tp, sizeof (atv));
}
- if (uap->tzp) {
+ if (error == 0 && uap->tzp != NULL) {
+ mtx_lock(&Giant);
error = copyout((caddr_t)&tz, (caddr_t)uap->tzp,
sizeof (tz));
+ mtx_unlock(&Giant);
}
-done2:
- mtx_unlock(&Giant);
return (error);
}
OpenPOWER on IntegriCloud