From 21dcdb38e10ffcf66c6ad00ff8fc811a24ed5dac Mon Sep 17 00:00:00 2001 From: Poul-Henning Kamp Date: Mon, 18 Feb 2002 08:40:28 +0000 Subject: [PATCH] Take the common case of gettimeofday(&tv, NULL) out from under Giant. --- sys/kern/kern_time.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/sys/kern/kern_time.c b/sys/kern/kern_time.c index bca540fbf4d5..f8c6affc2f05 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); }