mirror of
https://git.FreeBSD.org/src.git
synced 2024-12-04 09:09:56 +00:00
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.
This commit is contained in:
parent
f90e4276f2
commit
3c81694426
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=24101
@ -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;
|
||||
|
@ -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
|
||||
|
||||
/*
|
||||
|
@ -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
|
||||
|
@ -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);
|
||||
|
@ -333,10 +333,6 @@ ext2_fsync(ap)
|
||||
#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));
|
||||
}
|
||||
|
@ -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;
|
||||
|
@ -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
|
||||
|
||||
/*
|
||||
|
@ -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
|
||||
|
@ -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);
|
||||
|
@ -333,10 +333,6 @@ ext2_fsync(ap)
|
||||
#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));
|
||||
}
|
||||
|
@ -1553,7 +1553,7 @@ sgetc(int noblock)
|
||||
* 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
|
||||
|
@ -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;
|
||||
|
||||
/*
|
||||
|
@ -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.
|
||||
|
@ -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.
|
||||
|
@ -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.
|
||||
|
@ -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.
|
||||
|
@ -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 @@ ttread(tp, uio, flag)
|
||||
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 @@ ttread(tp, uio, flag)
|
||||
} 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;
|
||||
|
@ -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 @@ nfs_reply(myrep)
|
||||
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
|
||||
|
@ -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 */
|
||||
|
@ -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 &&
|
||||
|
@ -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 */
|
||||
|
@ -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 @@ nfs_reply(myrep)
|
||||
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
|
||||
|
@ -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 &&
|
||||
|
@ -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 @@ nfs_reply(myrep)
|
||||
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
|
||||
|
@ -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 */
|
||||
|
@ -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 */
|
||||
|
@ -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));
|
||||
|
@ -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));
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
@ -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
|
||||
|
@ -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 @@ ffs_sync(mp, waitfor, cred, p)
|
||||
} 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);
|
||||
|
@ -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 @@ ffs_fsync(ap)
|
||||
#endif
|
||||
}
|
||||
|
||||
tv = time;
|
||||
gettime(&tv);
|
||||
return (VOP_UPDATE(ap->a_vp, &tv, &tv, ap->a_waitfor == MNT_WAIT));
|
||||
}
|
||||
|
||||
|
@ -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)
|
||||
|
@ -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)
|
||||
|
@ -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:
|
||||
|
@ -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);
|
||||
|
@ -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 @@ ufs_rename(ap)
|
||||
*/
|
||||
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;
|
||||
|
Loading…
Reference in New Issue
Block a user