diff options
author | bde <bde@FreeBSD.org> | 1997-03-22 06:53:45 +0000 |
---|---|---|
committer | bde <bde@FreeBSD.org> | 1997-03-22 06:53:45 +0000 |
commit | 0bc178170104cff1e818e849d08a50c6a4ee0851 (patch) | |
tree | 1a4787be89dc6587f785bb211bf92dd0ce277648 | |
parent | 5610d80b6231f85421e587a175ddd4d4b0c735c5 (diff) | |
download | FreeBSD-src-0bc178170104cff1e818e849d08a50c6a4ee0851.zip FreeBSD-src-0bc178170104cff1e818e849d08a50c6a4ee0851.tar.gz |
Fixed some invalid (non-atomic) accesses to `time', mostly ones of the
form `tv = time'. Use a new function gettime(). The current version
just forces atomicicity without fixing precision or efficiency bugs.
Simplified some related valid accesses by using the central function.
37 files changed, 168 insertions, 147 deletions
diff --git a/sys/gnu/ext2fs/ext2_alloc.c b/sys/gnu/ext2fs/ext2_alloc.c index 8d46733..eef5393 100644 --- a/sys/gnu/ext2fs/ext2_alloc.c +++ b/sys/gnu/ext2fs/ext2_alloc.c @@ -241,6 +241,7 @@ return ENOSPC; daddr_t start_lbn, end_lbn, soff, eoff, newblk, blkno; struct indir start_ap[NIADDR + 1], end_ap[NIADDR + 1], *idp; int i, len, start_lvl, end_lvl, pref, ssize; + struct timeval tv; vp = ap->a_vp; ip = VTOI(vp); @@ -346,13 +347,11 @@ return ENOSPC; else bwrite(sbp); } else { -#if !defined(__FreeBSD__) - struct timeval time; - get_time(&time); -#endif ip->i_flag |= IN_CHANGE | IN_UPDATE; - if (!doasyncfree) - VOP_UPDATE(vp, &time, &time, MNT_WAIT); + if (!doasyncfree) { + gettime(&tv); + VOP_UPDATE(vp, &tv, &tv, MNT_WAIT); + } } if (ssize < len) if (doasyncfree) @@ -441,7 +440,7 @@ ext2_valloc(ap) * XXX check if this makes sense in ext2 */ #if !defined(__FreeBSD__) - get_time(&time); + gettime(&time); #endif if (++nextgennumber < (u_long)time.tv_sec) nextgennumber = time.tv_sec; diff --git a/sys/gnu/ext2fs/ext2_extern.h b/sys/gnu/ext2fs/ext2_extern.h index 3f97cba..f287819 100644 --- a/sys/gnu/ext2fs/ext2_extern.h +++ b/sys/gnu/ext2fs/ext2_extern.h @@ -95,6 +95,7 @@ void mark_buffer_dirty __P((struct buf *bh)); #if !defined(__FreeBSD__) int bwrite(); /* FFS needs a bwrite routine. XXX */ +#define gettime get_time #endif /* diff --git a/sys/gnu/ext2fs/ext2_inode.c b/sys/gnu/ext2fs/ext2_inode.c index 788f5eb..9b94bc2 100644 --- a/sys/gnu/ext2fs/ext2_inode.c +++ b/sys/gnu/ext2fs/ext2_inode.c @@ -125,7 +125,7 @@ ext2_update(ap) } if (ip->i_flag & IN_CHANGE) { #if !defined(__FreeBSD__) - get_time(&time); + gettime(&time); #endif ip->i_ctime = time.tv_sec; } @@ -192,11 +192,7 @@ printf("ext2_truncate called %d to %d\n", VTOI(ovp)->i_number, ap->a_length); return EFBIG; oip = VTOI(ovp); -#if defined(__FreeBSD__) - tv = time; -#else - get_time(&tv); -#endif + gettime(&tv); if (ovp->v_type == VLNK && oip->i_size < ovp->v_mount->mnt_maxsymlinklen) { #if DIAGNOSTIC diff --git a/sys/gnu/ext2fs/ext2_readwrite.c b/sys/gnu/ext2fs/ext2_readwrite.c index 806c630..ae87153 100644 --- a/sys/gnu/ext2fs/ext2_readwrite.c +++ b/sys/gnu/ext2fs/ext2_readwrite.c @@ -313,11 +313,7 @@ WRITE(ap) uio->uio_resid = resid; } } else if (resid > uio->uio_resid && (ioflag & IO_SYNC)) { -#if !defined(__FreeBSD__) - get_time(&tv); -#else - tv = time; -#endif + gettime(&tv); error = VOP_UPDATE(vp, &tv, &tv, 1); } return (error); diff --git a/sys/gnu/ext2fs/ext2_vnops.c b/sys/gnu/ext2fs/ext2_vnops.c index 7bc803a..2075e07 100644 --- a/sys/gnu/ext2fs/ext2_vnops.c +++ b/sys/gnu/ext2fs/ext2_vnops.c @@ -333,10 +333,6 @@ loop: #endif } splx(s); -#if defined(__FreeBSD__) - tv = time; -#else - get_time(&tv); -#endif + gettime(&tv); return (VOP_UPDATE(ap->a_vp, &tv, &tv, ap->a_waitfor == MNT_WAIT)); } diff --git a/sys/gnu/fs/ext2fs/ext2_alloc.c b/sys/gnu/fs/ext2fs/ext2_alloc.c index 8d46733..eef5393 100644 --- a/sys/gnu/fs/ext2fs/ext2_alloc.c +++ b/sys/gnu/fs/ext2fs/ext2_alloc.c @@ -241,6 +241,7 @@ return ENOSPC; daddr_t start_lbn, end_lbn, soff, eoff, newblk, blkno; struct indir start_ap[NIADDR + 1], end_ap[NIADDR + 1], *idp; int i, len, start_lvl, end_lvl, pref, ssize; + struct timeval tv; vp = ap->a_vp; ip = VTOI(vp); @@ -346,13 +347,11 @@ return ENOSPC; else bwrite(sbp); } else { -#if !defined(__FreeBSD__) - struct timeval time; - get_time(&time); -#endif ip->i_flag |= IN_CHANGE | IN_UPDATE; - if (!doasyncfree) - VOP_UPDATE(vp, &time, &time, MNT_WAIT); + if (!doasyncfree) { + gettime(&tv); + VOP_UPDATE(vp, &tv, &tv, MNT_WAIT); + } } if (ssize < len) if (doasyncfree) @@ -441,7 +440,7 @@ ext2_valloc(ap) * XXX check if this makes sense in ext2 */ #if !defined(__FreeBSD__) - get_time(&time); + gettime(&time); #endif if (++nextgennumber < (u_long)time.tv_sec) nextgennumber = time.tv_sec; diff --git a/sys/gnu/fs/ext2fs/ext2_extern.h b/sys/gnu/fs/ext2fs/ext2_extern.h index 3f97cba..f287819 100644 --- a/sys/gnu/fs/ext2fs/ext2_extern.h +++ b/sys/gnu/fs/ext2fs/ext2_extern.h @@ -95,6 +95,7 @@ void mark_buffer_dirty __P((struct buf *bh)); #if !defined(__FreeBSD__) int bwrite(); /* FFS needs a bwrite routine. XXX */ +#define gettime get_time #endif /* diff --git a/sys/gnu/fs/ext2fs/ext2_inode.c b/sys/gnu/fs/ext2fs/ext2_inode.c index 788f5eb..9b94bc2 100644 --- a/sys/gnu/fs/ext2fs/ext2_inode.c +++ b/sys/gnu/fs/ext2fs/ext2_inode.c @@ -125,7 +125,7 @@ ext2_update(ap) } if (ip->i_flag & IN_CHANGE) { #if !defined(__FreeBSD__) - get_time(&time); + gettime(&time); #endif ip->i_ctime = time.tv_sec; } @@ -192,11 +192,7 @@ printf("ext2_truncate called %d to %d\n", VTOI(ovp)->i_number, ap->a_length); return EFBIG; oip = VTOI(ovp); -#if defined(__FreeBSD__) - tv = time; -#else - get_time(&tv); -#endif + gettime(&tv); if (ovp->v_type == VLNK && oip->i_size < ovp->v_mount->mnt_maxsymlinklen) { #if DIAGNOSTIC diff --git a/sys/gnu/fs/ext2fs/ext2_readwrite.c b/sys/gnu/fs/ext2fs/ext2_readwrite.c index 806c630..ae87153 100644 --- a/sys/gnu/fs/ext2fs/ext2_readwrite.c +++ b/sys/gnu/fs/ext2fs/ext2_readwrite.c @@ -313,11 +313,7 @@ WRITE(ap) uio->uio_resid = resid; } } else if (resid > uio->uio_resid && (ioflag & IO_SYNC)) { -#if !defined(__FreeBSD__) - get_time(&tv); -#else - tv = time; -#endif + gettime(&tv); error = VOP_UPDATE(vp, &tv, &tv, 1); } return (error); diff --git a/sys/gnu/fs/ext2fs/ext2_vnops.c b/sys/gnu/fs/ext2fs/ext2_vnops.c index 7bc803a..2075e07 100644 --- a/sys/gnu/fs/ext2fs/ext2_vnops.c +++ b/sys/gnu/fs/ext2fs/ext2_vnops.c @@ -333,10 +333,6 @@ loop: #endif } splx(s); -#if defined(__FreeBSD__) - tv = time; -#else - get_time(&tv); -#endif + gettime(&tv); return (VOP_UPDATE(ap->a_vp, &tv, &tv, ap->a_waitfor == MNT_WAIT)); } diff --git a/sys/i386/isa/pcvt/pcvt_kbd.c b/sys/i386/isa/pcvt/pcvt_kbd.c index 17bdea8..dbfab45 100644 --- a/sys/i386/isa/pcvt/pcvt_kbd.c +++ b/sys/i386/isa/pcvt/pcvt_kbd.c @@ -1553,7 +1553,7 @@ loop: * happen "recently", i.e. before * less than half a second */ - now = time; + gettime(&now); timevalsub(&now, &mouse.lastmove); mouse.lastmove = time; accel = (now.tv_sec == 0 diff --git a/sys/kern/init_main.c b/sys/kern/init_main.c index 57fa5dd..f108547 100644 --- a/sys/kern/init_main.c +++ b/sys/kern/init_main.c @@ -39,7 +39,7 @@ * SUCH DAMAGE. * * @(#)init_main.c 8.9 (Berkeley) 1/21/94 - * $Id: init_main.c,v 1.57 1997/02/22 09:38:59 peter Exp $ + * $Id: init_main.c,v 1.58 1997/03/01 17:49:09 wosch Exp $ */ #include "opt_rlimit.h" @@ -413,7 +413,8 @@ proc0_post(dummy) * from the file system. Reset p->p_rtime as it may have been * munched in mi_switch() after the time got set. */ - proc0.p_stats->p_start = runtime = mono_time = boottime = time; + gettime(&boottime); + proc0.p_stats->p_start = runtime = mono_time = boottime; proc0.p_rtime.tv_sec = proc0.p_rtime.tv_usec = 0; /* diff --git a/sys/kern/kern_clock.c b/sys/kern/kern_clock.c index 341c00e..e5fa539 100644 --- a/sys/kern/kern_clock.c +++ b/sys/kern/kern_clock.c @@ -36,7 +36,7 @@ * SUCH DAMAGE. * * @(#)kern_clock.c 8.5 (Berkeley) 1/21/94 - * $Id$ + * $Id: kern_clock.c,v 1.32 1997/02/22 09:39:02 peter Exp $ */ /* Portions of this software are covered by the following: */ @@ -799,6 +799,17 @@ untimeout(ftn, arg) splx(s); } +void +gettime(struct timeval *tvp) +{ + int s; + + s = splclock(); + /* XXX should use microtime() iff tv_usec is used. */ + *tvp = time; + splx(s); +} + /* * Compute number of hz until specified time. Used to * compute third argument to timeout() from an absolute time. diff --git a/sys/kern/kern_tc.c b/sys/kern/kern_tc.c index 341c00e..e5fa539 100644 --- a/sys/kern/kern_tc.c +++ b/sys/kern/kern_tc.c @@ -36,7 +36,7 @@ * SUCH DAMAGE. * * @(#)kern_clock.c 8.5 (Berkeley) 1/21/94 - * $Id$ + * $Id: kern_clock.c,v 1.32 1997/02/22 09:39:02 peter Exp $ */ /* Portions of this software are covered by the following: */ @@ -799,6 +799,17 @@ untimeout(ftn, arg) splx(s); } +void +gettime(struct timeval *tvp) +{ + int s; + + s = splclock(); + /* XXX should use microtime() iff tv_usec is used. */ + *tvp = time; + splx(s); +} + /* * Compute number of hz until specified time. Used to * compute third argument to timeout() from an absolute time. diff --git a/sys/kern/kern_timeout.c b/sys/kern/kern_timeout.c index 341c00e..e5fa539 100644 --- a/sys/kern/kern_timeout.c +++ b/sys/kern/kern_timeout.c @@ -36,7 +36,7 @@ * SUCH DAMAGE. * * @(#)kern_clock.c 8.5 (Berkeley) 1/21/94 - * $Id$ + * $Id: kern_clock.c,v 1.32 1997/02/22 09:39:02 peter Exp $ */ /* Portions of this software are covered by the following: */ @@ -799,6 +799,17 @@ untimeout(ftn, arg) splx(s); } +void +gettime(struct timeval *tvp) +{ + int s; + + s = splclock(); + /* XXX should use microtime() iff tv_usec is used. */ + *tvp = time; + splx(s); +} + /* * Compute number of hz until specified time. Used to * compute third argument to timeout() from an absolute time. diff --git a/sys/kern/sys_pipe.c b/sys/kern/sys_pipe.c index 8be483b..66b0ac7 100644 --- a/sys/kern/sys_pipe.c +++ b/sys/kern/sys_pipe.c @@ -16,7 +16,7 @@ * 4. Modifications may be freely made to this file if the above conditions * are met. * - * $Id$ + * $Id: sys_pipe.c,v 1.24 1997/02/22 09:39:19 peter Exp $ */ #ifndef OLD_PIPE @@ -253,11 +253,9 @@ pipeinit(cpipe) cpipe->pipe_state = 0; cpipe->pipe_peer = NULL; cpipe->pipe_busy = 0; - s = splhigh(); - cpipe->pipe_ctime = time; - cpipe->pipe_atime = time; - cpipe->pipe_mtime = time; - splx(s); + gettime(&cpipe->pipe_ctime); + cpipe->pipe_atime = cpipe->pipe_ctime; + cpipe->pipe_mtime = cpipe->pipe_ctime; bzero(&cpipe->pipe_sel, sizeof cpipe->pipe_sel); cpipe->pipe_pgid = NO_PID; @@ -439,11 +437,8 @@ pipe_read(fp, uio, cred) } } - if (error == 0) { - int s = splhigh(); - rpipe->pipe_atime = time; - splx(s); - } + if (error == 0) + gettime(&rpipe->pipe_atime); --rpipe->pipe_busy; if ((rpipe->pipe_busy == 0) && (rpipe->pipe_state & PIPE_WANT)) { @@ -914,11 +909,9 @@ pipe_write(fp, uio, cred) (error == EPIPE)) error = 0; - if (error == 0) { - int s = splhigh(); - wpipe->pipe_mtime = time; - splx(s); - } + if (error == 0) + gettime(&wpipe->pipe_mtime); + /* * We have something to offer, * wake up select. diff --git a/sys/kern/tty.c b/sys/kern/tty.c index 8d91223..a1e516d 100644 --- a/sys/kern/tty.c +++ b/sys/kern/tty.c @@ -36,7 +36,7 @@ * SUCH DAMAGE. * * @(#)tty.c 8.8 (Berkeley) 1/21/94 - * $Id$ + * $Id: tty.c,v 1.91 1997/02/22 09:39:23 peter Exp $ */ /*- @@ -1513,9 +1513,7 @@ loop: goto sleep; if (qp->c_cc >= m) goto read; - x = splclock(); - timecopy = time; - splx(x); + gettime(&timecopy); if (!has_stime) { /* first character, start timer */ has_stime = 1; @@ -1535,9 +1533,7 @@ loop: } else { /* m == 0 */ if (qp->c_cc > 0) goto read; - x = splclock(); - timecopy = time; - splx(x); + gettime(&timecopy); if (!has_stime) { has_stime = 1; stime = timecopy; diff --git a/sys/nfs/nfs_socket.c b/sys/nfs/nfs_socket.c index 2dbe371..a584d97 100644 --- a/sys/nfs/nfs_socket.c +++ b/sys/nfs/nfs_socket.c @@ -34,7 +34,7 @@ * SUCH DAMAGE. * * @(#)nfs_socket.c 8.5 (Berkeley) 3/30/95 - * $Id$ + * $Id: nfs_socket.c,v 1.21 1997/02/22 09:42:39 peter Exp $ */ /* @@ -761,7 +761,7 @@ nfsmout: rt->srtt = nmp->nm_srtt[proct[rep->r_procnum] - 1]; rt->sdrtt = nmp->nm_sdrtt[proct[rep->r_procnum] - 1]; rt->fsid = nmp->nm_mountp->mnt_stat.f_fsid; - rt->tstamp = time; + gettime(&rt->tstamp); if (rep->r_flags & R_TIMING) rt->rtt = rep->r_rtt; else diff --git a/sys/nfs/nfs_syscalls.c b/sys/nfs/nfs_syscalls.c index cbcd695..83cd64d 100644 --- a/sys/nfs/nfs_syscalls.c +++ b/sys/nfs/nfs_syscalls.c @@ -34,7 +34,7 @@ * SUCH DAMAGE. * * @(#)nfs_syscalls.c 8.5 (Berkeley) 3/30/95 - * $Id$ + * $Id: nfs_syscalls.c,v 1.18 1997/02/22 09:42:42 peter Exp $ */ #include <sys/param.h> @@ -542,7 +542,7 @@ nfssvc_nfsd(nsd, argp, p) else solockp = (int *)0; if (nd) { - nd->nd_starttime = time; + gettime(&nd->nd_starttime); if (nd->nd_nam2) nd->nd_nam = nd->nd_nam2; else @@ -956,7 +956,7 @@ nfs_getnickauth(nmp, cred, auth_str, auth_len, verf_str, verf_len) if (time.tv_sec > nuidp->nu_timestamp.tv_sec || (time.tv_sec == nuidp->nu_timestamp.tv_sec && time.tv_usec > nuidp->nu_timestamp.tv_usec)) - nuidp->nu_timestamp = time; + gettime(&nuidp->nu_timestamp); else nuidp->nu_timestamp.tv_usec++; ktvin.tv_sec = txdr_unsigned(nuidp->nu_timestamp.tv_sec); @@ -1144,7 +1144,7 @@ nfsd_rt(sotype, nd, cacherep) rt->ipadr = INADDR_ANY; rt->resptime = ((time.tv_sec - nd->nd_starttime.tv_sec) * 1000000) + (time.tv_usec - nd->nd_starttime.tv_usec); - rt->tstamp = time; + gettime(&rt->tstamp); nfsdrt.pos = (nfsdrt.pos + 1) % NFSRTTLOGSIZ; } #endif /* NFS_NOSERVER */ diff --git a/sys/nfs/nfs_vnops.c b/sys/nfs/nfs_vnops.c index ae6238b..342497f 100644 --- a/sys/nfs/nfs_vnops.c +++ b/sys/nfs/nfs_vnops.c @@ -34,7 +34,7 @@ * SUCH DAMAGE. * * @(#)nfs_vnops.c 8.16 (Berkeley) 5/27/95 - * $Id: nfs_vnops.c,v 1.42 1997/02/22 09:42:46 peter Exp $ + * $Id: nfs_vnops.c,v 1.43 1997/02/28 17:56:27 bde Exp $ */ @@ -3234,13 +3234,15 @@ nfsspec_read(ap) } */ *ap; { register struct nfsnode *np = VTONFS(ap->a_vp); + struct timeval tv; /* * Set access flag. */ np->n_flag |= NACC; - np->n_atim.tv_sec = time.tv_sec; - np->n_atim.tv_nsec = time.tv_usec * 1000; + gettime(&tv); + np->n_atim.tv_sec = tv.tv_sec; + np->n_atim.tv_nsec = tv.tv_usec * 1000; return (VOCALL(spec_vnodeop_p, VOFFSET(vop_read), ap)); } @@ -3257,13 +3259,15 @@ nfsspec_write(ap) } */ *ap; { register struct nfsnode *np = VTONFS(ap->a_vp); + struct timeval tv; /* * Set update flag. */ np->n_flag |= NUPD; - np->n_mtim.tv_sec = time.tv_sec; - np->n_mtim.tv_nsec = time.tv_usec * 1000; + gettime(&tv); + np->n_mtim.tv_sec = tv.tv_sec; + np->n_mtim.tv_nsec = tv.tv_usec * 1000; return (VOCALL(spec_vnodeop_p, VOFFSET(vop_write), ap)); } @@ -3313,13 +3317,15 @@ nfsfifo_read(ap) } */ *ap; { register struct nfsnode *np = VTONFS(ap->a_vp); + struct timeval tv; /* * Set access flag. */ np->n_flag |= NACC; - np->n_atim.tv_sec = time.tv_sec; - np->n_atim.tv_nsec = time.tv_usec * 1000; + gettime(&tv); + np->n_atim.tv_sec = tv.tv_sec; + np->n_atim.tv_nsec = tv.tv_usec * 1000; return (VOCALL(fifo_vnodeop_p, VOFFSET(vop_read), ap)); } @@ -3336,13 +3342,15 @@ nfsfifo_write(ap) } */ *ap; { register struct nfsnode *np = VTONFS(ap->a_vp); + struct timeval tv; /* * Set update flag. */ np->n_flag |= NUPD; - np->n_mtim.tv_sec = time.tv_sec; - np->n_mtim.tv_nsec = time.tv_usec * 1000; + gettime(&tv); + np->n_mtim.tv_sec = tv.tv_sec; + np->n_mtim.tv_nsec = tv.tv_usec * 1000; return (VOCALL(fifo_vnodeop_p, VOFFSET(vop_write), ap)); } @@ -3362,16 +3370,18 @@ nfsfifo_close(ap) { register struct vnode *vp = ap->a_vp; register struct nfsnode *np = VTONFS(vp); + struct timeval tv; struct vattr vattr; if (np->n_flag & (NACC | NUPD)) { + gettime(&tv); if (np->n_flag & NACC) { - np->n_atim.tv_sec = time.tv_sec; - np->n_atim.tv_nsec = time.tv_usec * 1000; + np->n_atim.tv_sec = tv.tv_sec; + np->n_atim.tv_nsec = tv.tv_usec * 1000; } if (np->n_flag & NUPD) { - np->n_mtim.tv_sec = time.tv_sec; - np->n_mtim.tv_nsec = time.tv_usec * 1000; + np->n_mtim.tv_sec = tv.tv_sec; + np->n_mtim.tv_nsec = tv.tv_usec * 1000; } np->n_flag |= NCHG; if (vp->v_usecount == 1 && diff --git a/sys/nfsclient/nfs_nfsiod.c b/sys/nfsclient/nfs_nfsiod.c index cbcd695..83cd64d 100644 --- a/sys/nfsclient/nfs_nfsiod.c +++ b/sys/nfsclient/nfs_nfsiod.c @@ -34,7 +34,7 @@ * SUCH DAMAGE. * * @(#)nfs_syscalls.c 8.5 (Berkeley) 3/30/95 - * $Id$ + * $Id: nfs_syscalls.c,v 1.18 1997/02/22 09:42:42 peter Exp $ */ #include <sys/param.h> @@ -542,7 +542,7 @@ nfssvc_nfsd(nsd, argp, p) else solockp = (int *)0; if (nd) { - nd->nd_starttime = time; + gettime(&nd->nd_starttime); if (nd->nd_nam2) nd->nd_nam = nd->nd_nam2; else @@ -956,7 +956,7 @@ nfs_getnickauth(nmp, cred, auth_str, auth_len, verf_str, verf_len) if (time.tv_sec > nuidp->nu_timestamp.tv_sec || (time.tv_sec == nuidp->nu_timestamp.tv_sec && time.tv_usec > nuidp->nu_timestamp.tv_usec)) - nuidp->nu_timestamp = time; + gettime(&nuidp->nu_timestamp); else nuidp->nu_timestamp.tv_usec++; ktvin.tv_sec = txdr_unsigned(nuidp->nu_timestamp.tv_sec); @@ -1144,7 +1144,7 @@ nfsd_rt(sotype, nd, cacherep) rt->ipadr = INADDR_ANY; rt->resptime = ((time.tv_sec - nd->nd_starttime.tv_sec) * 1000000) + (time.tv_usec - nd->nd_starttime.tv_usec); - rt->tstamp = time; + gettime(&rt->tstamp); nfsdrt.pos = (nfsdrt.pos + 1) % NFSRTTLOGSIZ; } #endif /* NFS_NOSERVER */ diff --git a/sys/nfsclient/nfs_socket.c b/sys/nfsclient/nfs_socket.c index 2dbe371..a584d97 100644 --- a/sys/nfsclient/nfs_socket.c +++ b/sys/nfsclient/nfs_socket.c @@ -34,7 +34,7 @@ * SUCH DAMAGE. * * @(#)nfs_socket.c 8.5 (Berkeley) 3/30/95 - * $Id$ + * $Id: nfs_socket.c,v 1.21 1997/02/22 09:42:39 peter Exp $ */ /* @@ -761,7 +761,7 @@ nfsmout: rt->srtt = nmp->nm_srtt[proct[rep->r_procnum] - 1]; rt->sdrtt = nmp->nm_sdrtt[proct[rep->r_procnum] - 1]; rt->fsid = nmp->nm_mountp->mnt_stat.f_fsid; - rt->tstamp = time; + gettime(&rt->tstamp); if (rep->r_flags & R_TIMING) rt->rtt = rep->r_rtt; else diff --git a/sys/nfsclient/nfs_vnops.c b/sys/nfsclient/nfs_vnops.c index ae6238b..342497f 100644 --- a/sys/nfsclient/nfs_vnops.c +++ b/sys/nfsclient/nfs_vnops.c @@ -34,7 +34,7 @@ * SUCH DAMAGE. * * @(#)nfs_vnops.c 8.16 (Berkeley) 5/27/95 - * $Id: nfs_vnops.c,v 1.42 1997/02/22 09:42:46 peter Exp $ + * $Id: nfs_vnops.c,v 1.43 1997/02/28 17:56:27 bde Exp $ */ @@ -3234,13 +3234,15 @@ nfsspec_read(ap) } */ *ap; { register struct nfsnode *np = VTONFS(ap->a_vp); + struct timeval tv; /* * Set access flag. */ np->n_flag |= NACC; - np->n_atim.tv_sec = time.tv_sec; - np->n_atim.tv_nsec = time.tv_usec * 1000; + gettime(&tv); + np->n_atim.tv_sec = tv.tv_sec; + np->n_atim.tv_nsec = tv.tv_usec * 1000; return (VOCALL(spec_vnodeop_p, VOFFSET(vop_read), ap)); } @@ -3257,13 +3259,15 @@ nfsspec_write(ap) } */ *ap; { register struct nfsnode *np = VTONFS(ap->a_vp); + struct timeval tv; /* * Set update flag. */ np->n_flag |= NUPD; - np->n_mtim.tv_sec = time.tv_sec; - np->n_mtim.tv_nsec = time.tv_usec * 1000; + gettime(&tv); + np->n_mtim.tv_sec = tv.tv_sec; + np->n_mtim.tv_nsec = tv.tv_usec * 1000; return (VOCALL(spec_vnodeop_p, VOFFSET(vop_write), ap)); } @@ -3313,13 +3317,15 @@ nfsfifo_read(ap) } */ *ap; { register struct nfsnode *np = VTONFS(ap->a_vp); + struct timeval tv; /* * Set access flag. */ np->n_flag |= NACC; - np->n_atim.tv_sec = time.tv_sec; - np->n_atim.tv_nsec = time.tv_usec * 1000; + gettime(&tv); + np->n_atim.tv_sec = tv.tv_sec; + np->n_atim.tv_nsec = tv.tv_usec * 1000; return (VOCALL(fifo_vnodeop_p, VOFFSET(vop_read), ap)); } @@ -3336,13 +3342,15 @@ nfsfifo_write(ap) } */ *ap; { register struct nfsnode *np = VTONFS(ap->a_vp); + struct timeval tv; /* * Set update flag. */ np->n_flag |= NUPD; - np->n_mtim.tv_sec = time.tv_sec; - np->n_mtim.tv_nsec = time.tv_usec * 1000; + gettime(&tv); + np->n_mtim.tv_sec = tv.tv_sec; + np->n_mtim.tv_nsec = tv.tv_usec * 1000; return (VOCALL(fifo_vnodeop_p, VOFFSET(vop_write), ap)); } @@ -3362,16 +3370,18 @@ nfsfifo_close(ap) { register struct vnode *vp = ap->a_vp; register struct nfsnode *np = VTONFS(vp); + struct timeval tv; struct vattr vattr; if (np->n_flag & (NACC | NUPD)) { + gettime(&tv); if (np->n_flag & NACC) { - np->n_atim.tv_sec = time.tv_sec; - np->n_atim.tv_nsec = time.tv_usec * 1000; + np->n_atim.tv_sec = tv.tv_sec; + np->n_atim.tv_nsec = tv.tv_usec * 1000; } if (np->n_flag & NUPD) { - np->n_mtim.tv_sec = time.tv_sec; - np->n_mtim.tv_nsec = time.tv_usec * 1000; + np->n_mtim.tv_sec = tv.tv_sec; + np->n_mtim.tv_nsec = tv.tv_usec * 1000; } np->n_flag |= NCHG; if (vp->v_usecount == 1 && diff --git a/sys/nfsserver/nfs_srvsock.c b/sys/nfsserver/nfs_srvsock.c index 2dbe371..a584d97 100644 --- a/sys/nfsserver/nfs_srvsock.c +++ b/sys/nfsserver/nfs_srvsock.c @@ -34,7 +34,7 @@ * SUCH DAMAGE. * * @(#)nfs_socket.c 8.5 (Berkeley) 3/30/95 - * $Id$ + * $Id: nfs_socket.c,v 1.21 1997/02/22 09:42:39 peter Exp $ */ /* @@ -761,7 +761,7 @@ nfsmout: rt->srtt = nmp->nm_srtt[proct[rep->r_procnum] - 1]; rt->sdrtt = nmp->nm_sdrtt[proct[rep->r_procnum] - 1]; rt->fsid = nmp->nm_mountp->mnt_stat.f_fsid; - rt->tstamp = time; + gettime(&rt->tstamp); if (rep->r_flags & R_TIMING) rt->rtt = rep->r_rtt; else diff --git a/sys/nfsserver/nfs_syscalls.c b/sys/nfsserver/nfs_syscalls.c index cbcd695..83cd64d 100644 --- a/sys/nfsserver/nfs_syscalls.c +++ b/sys/nfsserver/nfs_syscalls.c @@ -34,7 +34,7 @@ * SUCH DAMAGE. * * @(#)nfs_syscalls.c 8.5 (Berkeley) 3/30/95 - * $Id$ + * $Id: nfs_syscalls.c,v 1.18 1997/02/22 09:42:42 peter Exp $ */ #include <sys/param.h> @@ -542,7 +542,7 @@ nfssvc_nfsd(nsd, argp, p) else solockp = (int *)0; if (nd) { - nd->nd_starttime = time; + gettime(&nd->nd_starttime); if (nd->nd_nam2) nd->nd_nam = nd->nd_nam2; else @@ -956,7 +956,7 @@ nfs_getnickauth(nmp, cred, auth_str, auth_len, verf_str, verf_len) if (time.tv_sec > nuidp->nu_timestamp.tv_sec || (time.tv_sec == nuidp->nu_timestamp.tv_sec && time.tv_usec > nuidp->nu_timestamp.tv_usec)) - nuidp->nu_timestamp = time; + gettime(&nuidp->nu_timestamp); else nuidp->nu_timestamp.tv_usec++; ktvin.tv_sec = txdr_unsigned(nuidp->nu_timestamp.tv_sec); @@ -1144,7 +1144,7 @@ nfsd_rt(sotype, nd, cacherep) rt->ipadr = INADDR_ANY; rt->resptime = ((time.tv_sec - nd->nd_starttime.tv_sec) * 1000000) + (time.tv_usec - nd->nd_starttime.tv_usec); - rt->tstamp = time; + gettime(&rt->tstamp); nfsdrt.pos = (nfsdrt.pos + 1) % NFSRTTLOGSIZ; } #endif /* NFS_NOSERVER */ diff --git a/sys/pci/ncr.c b/sys/pci/ncr.c index ef96293..74726ff 100644 --- a/sys/pci/ncr.c +++ b/sys/pci/ncr.c @@ -1,6 +1,6 @@ /************************************************************************** ** -** $Id$ +** $Id: ncr.c,v 1.95 1997/02/22 09:44:08 peter Exp $ ** ** Device driver for the NCR 53C810 PCI-SCSI-Controller. ** @@ -1263,7 +1263,7 @@ static void ncr_attach (pcici_t tag, int unit); static char ident[] = - "\n$Id$\n"; + "\n$Id: ncr.c,v 1.95 1997/02/22 09:44:08 peter Exp $\n"; static const u_long ncr_version = NCR_VERSION * 11 + (u_long) sizeof (struct ncb) * 7 @@ -3708,7 +3708,7 @@ static int32_t ncr_start (struct scsi_xfer * xp) */ bzero (&cp->phys.header.stamp, sizeof (struct tstamp)); - cp->phys.header.stamp.start = time; + gettime(&cp->phys.header.stamp.start); /*---------------------------------------------------- ** @@ -5078,7 +5078,7 @@ void ncr_exception (ncb_p np) if (time.tv_sec - np->regtime.tv_sec>10) { int i; - np->regtime = time; + gettime(&np->regtime); for (i=0; i<sizeof(np->regdump); i++) ((char*)&np->regdump)[i] = ((volatile char*)np->reg)[i]; np->regdump.nc_dstat = dstat; @@ -6685,7 +6685,7 @@ static void ncb_profile (ncb_p np, ccb_p cp) int co, da, st, en, di, se, post,work,disc; u_long diff; - PROFILE.end = time; + gettime(&PROFILE.end); st = ncr_delta (&PROFILE.start,&PROFILE.status); if (st<0) return; /* status not reached */ diff --git a/sys/sys/time.h b/sys/sys/time.h index 98af29c..a17a035 100644 --- a/sys/sys/time.h +++ b/sys/sys/time.h @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * @(#)time.h 8.5 (Berkeley) 5/4/95 - * $Id$ + * $Id: time.h,v 1.11 1997/02/22 09:46:08 peter Exp $ */ #ifndef _SYS_TIME_H_ @@ -130,6 +130,7 @@ struct clockinfo { }; #ifdef KERNEL +void gettime __P((struct timeval *tv)); int itimerfix __P((struct timeval *tv)); int itimerdecr __P((struct itimerval *itp, int usec)); void microtime __P((struct timeval *tv)); diff --git a/sys/sys/timetc.h b/sys/sys/timetc.h index 98af29c..a17a035 100644 --- a/sys/sys/timetc.h +++ b/sys/sys/timetc.h @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * @(#)time.h 8.5 (Berkeley) 5/4/95 - * $Id$ + * $Id: time.h,v 1.11 1997/02/22 09:46:08 peter Exp $ */ #ifndef _SYS_TIME_H_ @@ -130,6 +130,7 @@ struct clockinfo { }; #ifdef KERNEL +void gettime __P((struct timeval *tv)); int itimerfix __P((struct timeval *tv)); int itimerdecr __P((struct itimerval *itp, int usec)); void microtime __P((struct timeval *tv)); diff --git a/sys/ufs/ffs/ffs_alloc.c b/sys/ufs/ffs/ffs_alloc.c index ea4f23f..3be3f2f 100644 --- a/sys/ufs/ffs/ffs_alloc.c +++ b/sys/ufs/ffs/ffs_alloc.c @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * @(#)ffs_alloc.c 8.18 (Berkeley) 5/26/95 - * $Id: ffs_alloc.c,v 1.30 1997/02/22 09:47:00 peter Exp $ + * $Id: ffs_alloc.c,v 1.31 1997/03/09 06:00:40 mpp Exp $ */ #include "opt_quota.h" @@ -487,7 +487,7 @@ ffs_reallocblks(ap) } else { ip->i_flag |= IN_CHANGE | IN_UPDATE; if (!doasyncfree) { - tv = time; + gettime(&tv); VOP_UPDATE(vp, &tv, &tv, 1); } } diff --git a/sys/ufs/ffs/ffs_inode.c b/sys/ufs/ffs/ffs_inode.c index 9d5992a..020b08d 100644 --- a/sys/ufs/ffs/ffs_inode.c +++ b/sys/ufs/ffs/ffs_inode.c @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * @(#)ffs_inode.c 8.13 (Berkeley) 4/21/95 - * $Id$ + * $Id: ffs_inode.c,v 1.25 1997/02/22 09:47:03 peter Exp $ */ #include "opt_quota.h" @@ -183,7 +183,7 @@ ffs_truncate(ap) return (EINVAL); if (length > fs->fs_maxfilesize) return (EFBIG); - tv = time; + gettime(&tv); if (ovp->v_type == VLNK && (oip->i_size < ovp->v_mount->mnt_maxsymlinklen || oip->i_din.di_blocks == 0)) { #ifdef DIAGNOSTIC diff --git a/sys/ufs/ffs/ffs_vfsops.c b/sys/ufs/ffs/ffs_vfsops.c index 7e5c2f3..c63e5b7 100644 --- a/sys/ufs/ffs/ffs_vfsops.c +++ b/sys/ufs/ffs/ffs_vfsops.c @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * @(#)ffs_vfsops.c 8.31 (Berkeley) 5/20/95 - * $Id: ffs_vfsops.c,v 1.47 1997/03/15 18:58:10 sos Exp $ + * $Id: ffs_vfsops.c,v 1.48 1997/03/18 19:50:12 peter Exp $ */ #include "opt_quota.h" @@ -861,7 +861,7 @@ loop: } else { simple_unlock(&mntvnode_slock); simple_unlock(&vp->v_interlock); - tv = time; + gettime(&tv); /* VOP_UPDATE(vp, &tv, &tv, waitfor == MNT_WAIT); */ VOP_UPDATE(vp, &tv, &tv, 0); simple_lock(&mntvnode_slock); diff --git a/sys/ufs/ffs/ffs_vnops.c b/sys/ufs/ffs/ffs_vnops.c index 85369f6..c7ecb37 100644 --- a/sys/ufs/ffs/ffs_vnops.c +++ b/sys/ufs/ffs/ffs_vnops.c @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * @(#)ffs_vnops.c 8.15 (Berkeley) 5/14/95 - * $Id: ffs_vnops.c,v 1.23 1997/02/22 09:47:09 peter Exp $ + * $Id: ffs_vnops.c,v 1.24 1997/03/04 18:35:15 bde Exp $ */ #include <sys/param.h> @@ -321,7 +321,7 @@ loop: #endif } - tv = time; + gettime(&tv); return (VOP_UPDATE(ap->a_vp, &tv, &tv, ap->a_waitfor == MNT_WAIT)); } diff --git a/sys/ufs/lfs/lfs_inode.c b/sys/ufs/lfs/lfs_inode.c index 8fc49bc..8948a5e 100644 --- a/sys/ufs/lfs/lfs_inode.c +++ b/sys/ufs/lfs/lfs_inode.c @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * @(#)lfs_inode.c 8.5 (Berkeley) 12/30/93 - * $Id$ + * $Id: lfs_inode.c,v 1.15 1997/02/22 09:47:21 peter Exp $ */ #include "opt_quota.h" @@ -190,7 +190,7 @@ lfs_truncate(ap) int e1, e2, depth, lastseg, num, offset, seg, size; ip = VTOI(vp); - tv = time; + gettime(&tv); if (vp->v_type == VLNK && vp->v_mount->mnt_maxsymlinklen > 0) { #ifdef DIAGNOSTIC if (length != 0) diff --git a/sys/ufs/lfs/lfs_vnops.c b/sys/ufs/lfs/lfs_vnops.c index 9403792..bff2bcc 100644 --- a/sys/ufs/lfs/lfs_vnops.c +++ b/sys/ufs/lfs/lfs_vnops.c @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * @(#)lfs_vnops.c 8.5 (Berkeley) 12/30/93 - * $Id$ + * $Id: lfs_vnops.c,v 1.19 1997/02/22 09:47:26 peter Exp $ */ #include <sys/param.h> @@ -244,8 +244,8 @@ lfs_fsync(ap) { struct timeval tv; int error; - tv = time; + gettime(&tv); error = (VOP_UPDATE(ap->a_vp, &tv, &tv, ap->a_waitfor == MNT_WAIT ? LFS_SYNC : 0)); if(ap->a_waitfor == MNT_WAIT && ap->a_vp->v_dirtyblkhd.lh_first != NULL) diff --git a/sys/ufs/ufs/ufs_inode.c b/sys/ufs/ufs/ufs_inode.c index 5b60ad1..25df2a5 100644 --- a/sys/ufs/ufs/ufs_inode.c +++ b/sys/ufs/ufs/ufs_inode.c @@ -36,7 +36,7 @@ * SUCH DAMAGE. * * @(#)ufs_inode.c 8.9 (Berkeley) 5/14/95 - * $Id$ + * $Id: ufs_inode.c,v 1.11 1997/02/22 09:47:48 peter Exp $ */ #include "opt_quota.h" @@ -94,7 +94,7 @@ ufs_inactive(ap) VOP_VFREE(vp, ip->i_number, mode); } if (ip->i_flag & (IN_ACCESS | IN_CHANGE | IN_MODIFIED | IN_UPDATE)) { - tv = time; + gettime(&tv); VOP_UPDATE(vp, &tv, &tv, 0); } out: diff --git a/sys/ufs/ufs/ufs_readwrite.c b/sys/ufs/ufs/ufs_readwrite.c index eb980b8..91597a1 100644 --- a/sys/ufs/ufs/ufs_readwrite.c +++ b/sys/ufs/ufs/ufs_readwrite.c @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * @(#)ufs_readwrite.c 8.11 (Berkeley) 5/8/95 - * $Id: ufs_readwrite.c,v 1.27 1997/02/22 09:47:51 peter Exp $ + * $Id: ufs_readwrite.c,v 1.28 1997/03/03 16:23:02 bde Exp $ */ #ifdef LFS_READWRITE @@ -311,7 +311,7 @@ WRITE(ap) uio->uio_resid = resid; } } else if (resid > uio->uio_resid && (ioflag & IO_SYNC)) { - tv = time; + gettime(&tv); error = VOP_UPDATE(vp, &tv, &tv, 1); } return (error); diff --git a/sys/ufs/ufs/ufs_vnops.c b/sys/ufs/ufs/ufs_vnops.c index f24e773..70bb3cc 100644 --- a/sys/ufs/ufs/ufs_vnops.c +++ b/sys/ufs/ufs/ufs_vnops.c @@ -36,7 +36,7 @@ * SUCH DAMAGE. * * @(#)ufs_vnops.c 8.27 (Berkeley) 5/27/95 - * $Id: ufs_vnops.c,v 1.46 1997/02/22 09:47:53 peter Exp $ + * $Id: ufs_vnops.c,v 1.47 1997/03/09 06:10:36 mpp Exp $ */ #include "opt_quota.h" @@ -746,7 +746,7 @@ ufs_link(ap) } ip->i_nlink++; ip->i_flag |= IN_CHANGE; - tv = time; + gettime(&tv); error = VOP_UPDATE(vp, &tv, &tv, 1); if (!error) { #ifdef EXT2FS @@ -1004,7 +1004,7 @@ abortit: */ ip->i_nlink++; ip->i_flag |= IN_CHANGE; - tv = time; + gettime(&tv); if (error = VOP_UPDATE(fvp, &tv, &tv, 1)) { VOP_UNLOCK(fvp, 0, p); goto bad; @@ -1378,7 +1378,7 @@ ufs_mkdir(ap) ip->i_nlink = 2; if (cnp->cn_flags & ISWHITEOUT) ip->i_flags |= UF_OPAQUE; - tv = time; + gettime(&tv); error = VOP_UPDATE(tvp, &tv, &tv, 1); /* @@ -2156,7 +2156,7 @@ ufs_makeinode(mode, dvp, vpp, cnp) /* * Make sure inode goes to disk before directory entry. */ - tv = time; + gettime(&tv); error = VOP_UPDATE(tvp, &tv, &tv, 1); if (error) goto bad; |