diff options
author | peter <peter@FreeBSD.org> | 2003-12-11 02:34:49 +0000 |
---|---|---|
committer | peter <peter@FreeBSD.org> | 2003-12-11 02:34:49 +0000 |
commit | 0cde709881be2f636233fbf868c7f3a28e0a53db (patch) | |
tree | 804444deba7af65899010a073d53be509d03004a | |
parent | 0a45ae1ddc135b6fecccbb0b94ae1a612a05d7e4 (diff) | |
download | FreeBSD-src-0cde709881be2f636233fbf868c7f3a28e0a53db.zip FreeBSD-src-0cde709881be2f636233fbf868c7f3a28e0a53db.tar.gz |
Just implementing a 32 bit version of gettimeofday() was smaller than
the wrapper code. And it doesn't use the stackgap as a bonus.
-rw-r--r-- | sys/compat/freebsd32/freebsd32_misc.c | 36 |
1 files changed, 14 insertions, 22 deletions
diff --git a/sys/compat/freebsd32/freebsd32_misc.c b/sys/compat/freebsd32/freebsd32_misc.c index c753283..78ec550 100644 --- a/sys/compat/freebsd32/freebsd32_misc.c +++ b/sys/compat/freebsd32/freebsd32_misc.c @@ -761,29 +761,21 @@ int freebsd32_gettimeofday(struct thread *td, struct freebsd32_gettimeofday_args *uap) { - int error; - caddr_t sg; - struct timeval32 *p32, s32; - struct timeval *p = NULL, s; - - p32 = uap->tp; - if (p32) { - sg = stackgap_init(); - p = stackgap_alloc(&sg, sizeof(struct timeval)); - uap->tp = (struct timeval32 *)p; + struct timeval atv; + struct timeval32 atv32; + struct timezone rtz; + int error = 0; + + if (uap->tp) { + microtime(&atv); + CP(atv, atv32, tv_sec); + CP(atv, atv32, tv_usec); + error = copyout(&atv32, uap->tp, sizeof (atv32)); } - error = gettimeofday(td, (struct gettimeofday_args *) uap); - if (error) - return (error); - if (p32) { - error = copyin(p, &s, sizeof(s)); - if (error) - return (error); - CP(s, s32, tv_sec); - CP(s, s32, tv_usec); - error = copyout(&s32, p32, sizeof(s32)); - if (error) - return (error); + if (error == 0 && uap->tzp != NULL) { + rtz.tz_minuteswest = tz_minuteswest; + rtz.tz_dsttime = tz_dsttime; + error = copyout(&rtz, uap->tzp, sizeof (rtz)); } return (error); } |