Eradicate the variable "time" from the kernel, using various measures.

"time" wasn't a atomic variable, so splfoo() protection were needed
around any access to it, unless you just wanted the seconds part.

Most uses of time.tv_sec now uses the new variable time_second instead.

gettime() changed to getmicrotime(0.

Remove a couple of unneeded splfoo() protections, the new getmicrotime()
is atomic, (until Bruce sets a breakpoint in it).

A couple of places needed random data, so use read_random() instead
of mucking about with time which isn't random.

Add a new nfs_curusec() function.

Mark a couple of bogosities involving the now disappeard time variable.

Update ffs_update() to avoid the weird "== &time" checks, by fixing the
one remaining call that passwd &time as args.

Change profiling in ncr.c to use ticks instead of time.  Resolution is
the same.

Add new function "tvtohz()" to avoid the bogus "splfoo(), add time, call
hzto() which subtracts time" sequences.

Reviewed by:	bde
This commit is contained in:
Poul-Henning Kamp 1998-03-30 09:56:58 +00:00
parent 20344e1582
commit 227ee8a188
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=34961
94 changed files with 627 additions and 526 deletions

View File

@ -35,7 +35,7 @@
* SUCH DAMAGE.
*
* from: @(#)trap.c 7.4 (Berkeley) 5/13/91
* $Id: trap.c,v 1.123 1998/03/23 19:52:37 jlemon Exp $
* $Id: trap.c,v 1.124 1998/03/28 10:32:57 bde Exp $
*/
/*
@ -519,11 +519,11 @@ trap(frame)
{
static unsigned lastalert = 0;
if(time.tv_sec - lastalert > 10)
if(time_second - lastalert > 10)
{
log(LOG_WARNING, "NMI: power fail\n");
sysbeep(TIMER_FREQ/880, hz);
lastalert = time.tv_sec;
lastalert = time_second;
}
return;
}

View File

@ -34,7 +34,7 @@
* SUCH DAMAGE.
*
* from: @(#)clock.c 7.2 (Berkeley) 5/12/91
* $Id: clock.c,v 1.116 1998/03/14 03:11:50 tegge Exp $
* $Id: clock.c,v 1.117 1998/03/16 10:06:58 phk Exp $
*/
/*
@ -237,12 +237,19 @@ clkintr(struct clockframe frame)
if ((timer0_prescaler_count += timer0_max_count)
>= hardclock_max_count) {
timer0_prescaler_count -= hardclock_max_count;
#ifdef FIXME
/*
* XXX: This magic doesn't work, but It shouldn't be
* needed now anyway since we will not be able to
* aquire the i8254 if it is used for timecounting.
*/
/*
* See microtime.s for this magic.
*/
time.tv_usec += (27465 * timer0_prescaler_count) >> 15;
if (time.tv_usec >= 1000000)
time.tv_usec -= 1000000;
#endif
hardclock(&frame);
setdelayed();
timer0_max_count = hardclock_max_count;
@ -844,7 +851,7 @@ inittodr(time_t base)
sec += tz.tz_minuteswest * 60 + (wall_cmos_clock ? adjkerntz : 0);
y = time.tv_sec - sec;
y = time_second - sec;
if (y <= -2 || y >= 2) {
/* badly off, adjust it */
s = splclock();
@ -873,7 +880,7 @@ resettodr()
return;
s = splclock();
tm = time.tv_sec;
tm = time_second;
splx(s);
/* Disable RTC updates and interrupts. */

View File

@ -34,7 +34,7 @@
* SUCH DAMAGE.
*
* from: @(#)clock.c 7.2 (Berkeley) 5/12/91
* $Id: clock.c,v 1.116 1998/03/14 03:11:50 tegge Exp $
* $Id: clock.c,v 1.117 1998/03/16 10:06:58 phk Exp $
*/
/*
@ -237,12 +237,19 @@ clkintr(struct clockframe frame)
if ((timer0_prescaler_count += timer0_max_count)
>= hardclock_max_count) {
timer0_prescaler_count -= hardclock_max_count;
#ifdef FIXME
/*
* XXX: This magic doesn't work, but It shouldn't be
* needed now anyway since we will not be able to
* aquire the i8254 if it is used for timecounting.
*/
/*
* See microtime.s for this magic.
*/
time.tv_usec += (27465 * timer0_prescaler_count) >> 15;
if (time.tv_usec >= 1000000)
time.tv_usec -= 1000000;
#endif
hardclock(&frame);
setdelayed();
timer0_max_count = hardclock_max_count;
@ -844,7 +851,7 @@ inittodr(time_t base)
sec += tz.tz_minuteswest * 60 + (wall_cmos_clock ? adjkerntz : 0);
y = time.tv_sec - sec;
y = time_second - sec;
if (y <= -2 || y >= 2) {
/* badly off, adjust it */
s = splclock();
@ -873,7 +880,7 @@ resettodr()
return;
s = splclock();
tm = time.tv_sec;
tm = time_second;
splx(s);
/* Disable RTC updates and interrupts. */

View File

@ -25,7 +25,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* $Id: linux_misc.c,v 1.33 1997/11/06 19:28:58 phk Exp $
* $Id: linux_misc.c,v 1.34 1998/02/25 05:33:06 bde Exp $
*/
#include <sys/param.h>
@ -73,9 +73,9 @@ linux_alarm(struct proc *p, struct linux_alarm_args *args)
it.it_value.tv_usec = 0;
it.it_interval.tv_sec = 0;
it.it_interval.tv_usec = 0;
s = splclock();
s = splclock(); /* XXX Still needed ? */
old_it = p->p_realtimer;
tv = time;
getmicrotime(&tv);
if (timerisset(&old_it.it_value))
if (timercmp(&old_it.it_value, &tv, <))
timerclear(&old_it.it_value);
@ -84,10 +84,10 @@ linux_alarm(struct proc *p, struct linux_alarm_args *args)
splx(s);
if (itimerfix(&it.it_value) || itimerfix(&it.it_interval))
return EINVAL;
s = splclock();
s = splclock(); /* XXX Still needed ? */
if (timerisset(&p->p_realtimer.it_value))
untimeout(realitexpire, (caddr_t)p, p->p_ithandle);
tv = time;
getmicrotime(&tv);
if (timerisset(&it.it_value)) {
timevaladd(&it.it_value, &tv);
p->p_ithandle = timeout(realitexpire, (caddr_t)p, hzto(&it.it_value));

View File

@ -109,7 +109,7 @@ ext2_update(vp, access, modify, waitfor)
ip->i_modrev++;
}
if (ip->i_flag & IN_CHANGE) {
ip->i_ctime = time.tv_sec;
ip->i_ctime = time_second;
}
ip->i_flag &= ~(IN_ACCESS | IN_CHANGE | IN_MODIFIED | IN_UPDATE);
fs = ip->i_e2fs;
@ -171,7 +171,7 @@ printf("ext2_truncate called %d to %d\n", VTOI(ovp)->i_number, length);
return EFBIG;
oip = VTOI(ovp);
gettime(&tv);
getmicrotime(&tv);
if (ovp->v_type == VLNK &&
oip->i_size < ovp->v_mount->mnt_maxsymlinklen) {
#if DIAGNOSTIC

View File

@ -289,7 +289,7 @@ WRITE(ap)
uio->uio_resid = resid;
}
} else if (resid > uio->uio_resid && (ioflag & IO_SYNC)) {
gettime(&tv);
getmicrotime(&tv);
error = UFS_UPDATE(vp, &tv, &tv, 1);
}
return (error);

View File

@ -837,7 +837,7 @@ ext2_sync(mp, waitfor, cred, p)
panic("update: rofs mod");
}
fs->s_dirt = 0;
fs->s_es->s_wtime = time.tv_sec;
fs->s_es->s_wtime = time_second;
allerror = ext2_sbupdate(ump, waitfor);
}
/*

View File

@ -229,7 +229,7 @@ ext2_fsync(ap)
#endif
}
splx(s);
gettime(&tv);
getmicrotime(&tv);
return (UFS_UPDATE(ap->a_vp, &tv, &tv, ap->a_waitfor == MNT_WAIT));
}
@ -354,7 +354,7 @@ ext2_link(ap)
}
ip->i_nlink++;
ip->i_flag |= IN_CHANGE;
gettime(&tv);
getmicrotime(&tv);
error = UFS_UPDATE(vp, &tv, &tv, 1);
if (!error)
error = ext2_direnter(ip, tdvp, cnp);
@ -526,7 +526,7 @@ ext2_rename(ap)
*/
ip->i_nlink++;
ip->i_flag |= IN_CHANGE;
gettime(&tv);
getmicrotime(&tv);
if (error = UFS_UPDATE(fvp, &tv, &tv, 1)) {
VOP_UNLOCK(fvp, 0, p);
goto bad;
@ -897,7 +897,7 @@ ext2_mkdir(ap)
ip->i_nlink = 2;
if (cnp->cn_flags & ISWHITEOUT)
ip->i_flags |= UF_OPAQUE;
gettime(&tv);
getmicrotime(&tv);
error = UFS_UPDATE(tvp, &tv, &tv, 1);
/*
@ -1178,7 +1178,7 @@ ext2_makeinode(mode, dvp, vpp, cnp)
/*
* Make sure inode goes to disk before directory entry.
*/
gettime(&tv);
getmicrotime(&tv);
error = UFS_UPDATE(tvp, &tv, &tv, 1);
if (error)
goto bad;

View File

@ -109,7 +109,7 @@ ext2_update(vp, access, modify, waitfor)
ip->i_modrev++;
}
if (ip->i_flag & IN_CHANGE) {
ip->i_ctime = time.tv_sec;
ip->i_ctime = time_second;
}
ip->i_flag &= ~(IN_ACCESS | IN_CHANGE | IN_MODIFIED | IN_UPDATE);
fs = ip->i_e2fs;
@ -171,7 +171,7 @@ printf("ext2_truncate called %d to %d\n", VTOI(ovp)->i_number, length);
return EFBIG;
oip = VTOI(ovp);
gettime(&tv);
getmicrotime(&tv);
if (ovp->v_type == VLNK &&
oip->i_size < ovp->v_mount->mnt_maxsymlinklen) {
#if DIAGNOSTIC

View File

@ -289,7 +289,7 @@ WRITE(ap)
uio->uio_resid = resid;
}
} else if (resid > uio->uio_resid && (ioflag & IO_SYNC)) {
gettime(&tv);
getmicrotime(&tv);
error = UFS_UPDATE(vp, &tv, &tv, 1);
}
return (error);

View File

@ -837,7 +837,7 @@ ext2_sync(mp, waitfor, cred, p)
panic("update: rofs mod");
}
fs->s_dirt = 0;
fs->s_es->s_wtime = time.tv_sec;
fs->s_es->s_wtime = time_second;
allerror = ext2_sbupdate(ump, waitfor);
}
/*

View File

@ -229,7 +229,7 @@ ext2_fsync(ap)
#endif
}
splx(s);
gettime(&tv);
getmicrotime(&tv);
return (UFS_UPDATE(ap->a_vp, &tv, &tv, ap->a_waitfor == MNT_WAIT));
}
@ -354,7 +354,7 @@ ext2_link(ap)
}
ip->i_nlink++;
ip->i_flag |= IN_CHANGE;
gettime(&tv);
getmicrotime(&tv);
error = UFS_UPDATE(vp, &tv, &tv, 1);
if (!error)
error = ext2_direnter(ip, tdvp, cnp);
@ -526,7 +526,7 @@ ext2_rename(ap)
*/
ip->i_nlink++;
ip->i_flag |= IN_CHANGE;
gettime(&tv);
getmicrotime(&tv);
if (error = UFS_UPDATE(fvp, &tv, &tv, 1)) {
VOP_UNLOCK(fvp, 0, p);
goto bad;
@ -897,7 +897,7 @@ ext2_mkdir(ap)
ip->i_nlink = 2;
if (cnp->cn_flags & ISWHITEOUT)
ip->i_flags |= UF_OPAQUE;
gettime(&tv);
getmicrotime(&tv);
error = UFS_UPDATE(tvp, &tv, &tv, 1);
/*
@ -1178,7 +1178,7 @@ ext2_makeinode(mode, dvp, vpp, cnp)
/*
* Make sure inode goes to disk before directory entry.
*/
gettime(&tv);
getmicrotime(&tv);
error = UFS_UPDATE(tvp, &tv, &tv, 1);
if (error)
goto bad;

View File

@ -15,7 +15,7 @@
*
* Sep, 1994 Implemented on FreeBSD 1.1.5.1R (Toshiba AVS001WD)
*
* $Id: apm.c,v 1.68 1998/01/24 02:54:08 eivind Exp $
* $Id: apm.c,v 1.69 1998/02/09 06:08:06 eivind Exp $
*/
#include "opt_devfs.h"
@ -364,9 +364,14 @@ apm_default_resume(void *arg)
pl = splsoftclock();
inittodr(0); /* adjust time to RTC */
microtime(&resume_time);
tmp_time = time; /* because 'time' is volatile */
getmicrotime(&tmp_time);
timevaladd(&tmp_time, &diff_time);
#ifdef FIXME
/* XXX THIS DOESN'T WORK!!! */
time = tmp_time;
#endif
#ifdef APM_FIXUP_CALLTODO
/* Calculate the delta time suspended */
timevalsub(&resume_time, &suspend_time);

View File

@ -15,7 +15,7 @@
*
* Sep, 1994 Implemented on FreeBSD 1.1.5.1R (Toshiba AVS001WD)
*
* $Id: apm.c,v 1.68 1998/01/24 02:54:08 eivind Exp $
* $Id: apm.c,v 1.69 1998/02/09 06:08:06 eivind Exp $
*/
#include "opt_devfs.h"
@ -364,9 +364,14 @@ apm_default_resume(void *arg)
pl = splsoftclock();
inittodr(0); /* adjust time to RTC */
microtime(&resume_time);
tmp_time = time; /* because 'time' is volatile */
getmicrotime(&tmp_time);
timevaladd(&tmp_time, &diff_time);
#ifdef FIXME
/* XXX THIS DOESN'T WORK!!! */
time = tmp_time;
#endif
#ifdef APM_FIXUP_CALLTODO
/* Calculate the delta time suspended */
timevalsub(&resume_time, &suspend_time);

View File

@ -1,6 +1,6 @@
# @(#)symbols.raw 7.6 (Berkeley) 5/8/91
#
# $Id: symbols.raw,v 1.10 1997/04/16 15:09:37 ache Exp $
# $Id: symbols.raw,v 1.11 1997/04/26 11:45:26 peter Exp $
#
@ -72,8 +72,8 @@
#savecore
_dumpdev
_dumplo
_time_second
_version
_time
_dumpsize
_panicstr
_dumpmag

View File

@ -35,7 +35,7 @@
* SUCH DAMAGE.
*
* from: @(#)trap.c 7.4 (Berkeley) 5/13/91
* $Id: trap.c,v 1.123 1998/03/23 19:52:37 jlemon Exp $
* $Id: trap.c,v 1.124 1998/03/28 10:32:57 bde Exp $
*/
/*
@ -519,11 +519,11 @@ trap(frame)
{
static unsigned lastalert = 0;
if(time.tv_sec - lastalert > 10)
if(time_second - lastalert > 10)
{
log(LOG_WARNING, "NMI: power fail\n");
sysbeep(TIMER_FREQ/880, hz);
lastalert = time.tv_sec;
lastalert = time_second;
}
return;
}

View File

@ -34,7 +34,7 @@
* SUCH DAMAGE.
*
* from: @(#)clock.c 7.2 (Berkeley) 5/12/91
* $Id: clock.c,v 1.116 1998/03/14 03:11:50 tegge Exp $
* $Id: clock.c,v 1.117 1998/03/16 10:06:58 phk Exp $
*/
/*
@ -237,12 +237,19 @@ clkintr(struct clockframe frame)
if ((timer0_prescaler_count += timer0_max_count)
>= hardclock_max_count) {
timer0_prescaler_count -= hardclock_max_count;
#ifdef FIXME
/*
* XXX: This magic doesn't work, but It shouldn't be
* needed now anyway since we will not be able to
* aquire the i8254 if it is used for timecounting.
*/
/*
* See microtime.s for this magic.
*/
time.tv_usec += (27465 * timer0_prescaler_count) >> 15;
if (time.tv_usec >= 1000000)
time.tv_usec -= 1000000;
#endif
hardclock(&frame);
setdelayed();
timer0_max_count = hardclock_max_count;
@ -844,7 +851,7 @@ inittodr(time_t base)
sec += tz.tz_minuteswest * 60 + (wall_cmos_clock ? adjkerntz : 0);
y = time.tv_sec - sec;
y = time_second - sec;
if (y <= -2 || y >= 2) {
/* badly off, adjust it */
s = splclock();
@ -873,7 +880,7 @@ resettodr()
return;
s = splclock();
tm = time.tv_sec;
tm = time_second;
splx(s);
/* Disable RTC updates and interrupts. */

View File

@ -34,7 +34,7 @@
* SUCH DAMAGE.
*
* from: @(#)clock.c 7.2 (Berkeley) 5/12/91
* $Id: clock.c,v 1.116 1998/03/14 03:11:50 tegge Exp $
* $Id: clock.c,v 1.117 1998/03/16 10:06:58 phk Exp $
*/
/*
@ -237,12 +237,19 @@ clkintr(struct clockframe frame)
if ((timer0_prescaler_count += timer0_max_count)
>= hardclock_max_count) {
timer0_prescaler_count -= hardclock_max_count;
#ifdef FIXME
/*
* XXX: This magic doesn't work, but It shouldn't be
* needed now anyway since we will not be able to
* aquire the i8254 if it is used for timecounting.
*/
/*
* See microtime.s for this magic.
*/
time.tv_usec += (27465 * timer0_prescaler_count) >> 15;
if (time.tv_usec >= 1000000)
time.tv_usec -= 1000000;
#endif
hardclock(&frame);
setdelayed();
timer0_max_count = hardclock_max_count;
@ -844,7 +851,7 @@ inittodr(time_t base)
sec += tz.tz_minuteswest * 60 + (wall_cmos_clock ? adjkerntz : 0);
y = time.tv_sec - sec;
y = time_second - sec;
if (y <= -2 || y >= 2) {
/* badly off, adjust it */
s = splclock();
@ -873,7 +880,7 @@ resettodr()
return;
s = splclock();
tm = time.tv_sec;
tm = time_second;
splx(s);
/* Disable RTC updates and interrupts. */

View File

@ -1923,7 +1923,7 @@ getrand(void)
#endif
static unsigned long seed = 1;
register u_short res = (u_short)seed;
seed = seed * 1103515245L + time.tv_sec;
seed = seed * 1103515245L + time_second;
return res;
}
@ -2082,9 +2082,9 @@ pcvt_scrnsv_reset(void)
int reschedule = 0;
if((scrnsv_active == 1 || scrnsv_timeout) &&
last_schedule != time.tv_sec)
last_schedule != time_second)
{
last_schedule = time.tv_sec;
last_schedule = time_second;
reschedule = 1;
untimeout(scrnsv_timedout, NULL, scrnsv_timeout_ch);
}

View File

@ -25,7 +25,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* $Id: linux_misc.c,v 1.33 1997/11/06 19:28:58 phk Exp $
* $Id: linux_misc.c,v 1.34 1998/02/25 05:33:06 bde Exp $
*/
#include <sys/param.h>
@ -73,9 +73,9 @@ linux_alarm(struct proc *p, struct linux_alarm_args *args)
it.it_value.tv_usec = 0;
it.it_interval.tv_sec = 0;
it.it_interval.tv_usec = 0;
s = splclock();
s = splclock(); /* XXX Still needed ? */
old_it = p->p_realtimer;
tv = time;
getmicrotime(&tv);
if (timerisset(&old_it.it_value))
if (timercmp(&old_it.it_value, &tv, <))
timerclear(&old_it.it_value);
@ -84,10 +84,10 @@ linux_alarm(struct proc *p, struct linux_alarm_args *args)
splx(s);
if (itimerfix(&it.it_value) || itimerfix(&it.it_interval))
return EINVAL;
s = splclock();
s = splclock(); /* XXX Still needed ? */
if (timerisset(&p->p_realtimer.it_value))
untimeout(realitexpire, (caddr_t)p, p->p_ithandle);
tv = time;
getmicrotime(&tv);
if (timerisset(&it.it_value)) {
timevaladd(&it.it_value, &tv);
p->p_ithandle = timeout(realitexpire, (caddr_t)p, hzto(&it.it_value));

View File

@ -34,7 +34,7 @@
* SUCH DAMAGE.
*
* from: @(#)clock.c 7.2 (Berkeley) 5/12/91
* $Id: clock.c,v 1.116 1998/03/14 03:11:50 tegge Exp $
* $Id: clock.c,v 1.117 1998/03/16 10:06:58 phk Exp $
*/
/*
@ -237,12 +237,19 @@ clkintr(struct clockframe frame)
if ((timer0_prescaler_count += timer0_max_count)
>= hardclock_max_count) {
timer0_prescaler_count -= hardclock_max_count;
#ifdef FIXME
/*
* XXX: This magic doesn't work, but It shouldn't be
* needed now anyway since we will not be able to
* aquire the i8254 if it is used for timecounting.
*/
/*
* See microtime.s for this magic.
*/
time.tv_usec += (27465 * timer0_prescaler_count) >> 15;
if (time.tv_usec >= 1000000)
time.tv_usec -= 1000000;
#endif
hardclock(&frame);
setdelayed();
timer0_max_count = hardclock_max_count;
@ -844,7 +851,7 @@ inittodr(time_t base)
sec += tz.tz_minuteswest * 60 + (wall_cmos_clock ? adjkerntz : 0);
y = time.tv_sec - sec;
y = time_second - sec;
if (y <= -2 || y >= 2) {
/* badly off, adjust it */
s = splclock();
@ -873,7 +880,7 @@ resettodr()
return;
s = splclock();
tm = time.tv_sec;
tm = time_second;
splx(s);
/* Disable RTC updates and interrupts. */

View File

@ -39,7 +39,7 @@
* SUCH DAMAGE.
*
* @(#)init_main.c 8.9 (Berkeley) 1/21/94
* $Id: init_main.c,v 1.83 1998/02/06 12:13:21 eivind Exp $
* $Id: init_main.c,v 1.84 1998/02/15 04:16:57 dyson Exp $
*/
#include "opt_devfs.h"
@ -447,7 +447,7 @@ 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.
*/
gettime(&boottime);
getmicrotime(&boottime);
proc0.p_stats->p_start = runtime = mono_time = boottime;
proc0.p_rtime.tv_sec = proc0.p_rtime.tv_usec = 0;

View File

@ -39,7 +39,7 @@ static volatile int print_tci = 1;
* SUCH DAMAGE.
*
* @(#)kern_clock.c 8.5 (Berkeley) 1/21/94
* $Id: kern_clock.c,v 1.58 1998/03/16 10:19:12 phk Exp $
* $Id: kern_clock.c,v 1.59 1998/03/26 20:51:31 phk Exp $
*/
#include <sys/param.h>
@ -97,6 +97,8 @@ long tk_rawcc;
struct timecounter *timecounter;
time_t time_second;
/*
* Clock handling routines.
*
@ -136,7 +138,6 @@ int ticks;
static int psdiv, pscnt; /* prof => stat divider */
int psratio; /* ratio: prof / stat */
struct timeval time;
volatile struct timeval mono_time;
/*
@ -223,14 +224,10 @@ hardclock(frame)
}
/*
* Compute number of hz until specified time. Used to
* compute third argument to timeout() from an absolute time.
* XXX this interface is often inconvenient. We often just need the
* number of ticks in a timeval, but to use hzto() for that we have
* to add `time' to the timeval and do everything at splclock().
* Compute number of ticks in the specified amount of time.
*/
int
hzto(tv)
tvtohz(tv)
struct timeval *tv;
{
register unsigned long ticks;
@ -257,10 +254,8 @@ hzto(tv)
* If ints have 32 bits, then the maximum value for any timeout in
* 10ms ticks is 248 days.
*/
s = splclock();
sec = tv->tv_sec - time.tv_sec;
usec = tv->tv_usec - time.tv_usec;
splx(s);
sec = tv->tv_sec;
usec = tv->tv_usec;
if (usec < 0) {
sec--;
usec += 1000000;
@ -271,7 +266,7 @@ hzto(tv)
sec++;
usec -= 1000000;
}
printf("hzto: negative time difference %ld sec %ld usec\n",
printf("tvotohz: negative time difference %ld sec %ld usec\n",
sec, usec);
#endif
ticks = 1;
@ -288,6 +283,24 @@ hzto(tv)
return (ticks);
}
/*
* Compute number of hz until specified time. Used to
* compute third argument to timeout() from an absolute time.
*/
int
hzto(tv)
struct timeval *tv;
{
register long sec, usec;
struct timeval t2;
getmicrotime(&t2);
t2.tv_sec = tv->tv_sec - t2.tv_sec;
t2.tv_usec = tv->tv_usec - t2.tv_usec;
return (tvtohz(&t2));
}
/*
* Start profiling on a process.
*
@ -637,8 +650,7 @@ set_timecounter(struct timespec *ts)
tc->offset_nano = (u_int64_t)ts->tv_nsec << 32;
tc->offset_micro = ts->tv_nsec / 1000;
tc->offset_count = tc->get_timecount();
time.tv_sec = tc->offset_sec;
time.tv_usec = tc->offset_micro;
time_second = tc->offset_sec;
timecounter = tc;
splx(s);
}
@ -711,8 +723,7 @@ tco_forward(void)
tc->offset_micro = (tc->offset_nano / 1000) >> 32;
time.tv_usec = tc->offset_micro;
time.tv_sec = tc->offset_sec;
time_second = tc->offset_sec;
timecounter = tc;
}

View File

@ -255,9 +255,9 @@ hardupdate(offset)
* multiply/divide should be replaced someday.
*/
if (time_status & STA_FREQHOLD || time_reftime == 0)
time_reftime = time.tv_sec;
mtemp = time.tv_sec - time_reftime;
time_reftime = time.tv_sec;
time_reftime = time_second;
mtemp = time_second - time_reftime;
time_reftime = time_second;
if (time_status & STA_FLL) {
if (mtemp >= MINSEC) {
ltemp = ((time_offset / mtemp) << (SHIFT_USEC -

View File

@ -39,7 +39,7 @@ static volatile int print_tci = 1;
* SUCH DAMAGE.
*
* @(#)kern_clock.c 8.5 (Berkeley) 1/21/94
* $Id: kern_clock.c,v 1.58 1998/03/16 10:19:12 phk Exp $
* $Id: kern_clock.c,v 1.59 1998/03/26 20:51:31 phk Exp $
*/
#include <sys/param.h>
@ -97,6 +97,8 @@ long tk_rawcc;
struct timecounter *timecounter;
time_t time_second;
/*
* Clock handling routines.
*
@ -136,7 +138,6 @@ int ticks;
static int psdiv, pscnt; /* prof => stat divider */
int psratio; /* ratio: prof / stat */
struct timeval time;
volatile struct timeval mono_time;
/*
@ -223,14 +224,10 @@ hardclock(frame)
}
/*
* Compute number of hz until specified time. Used to
* compute third argument to timeout() from an absolute time.
* XXX this interface is often inconvenient. We often just need the
* number of ticks in a timeval, but to use hzto() for that we have
* to add `time' to the timeval and do everything at splclock().
* Compute number of ticks in the specified amount of time.
*/
int
hzto(tv)
tvtohz(tv)
struct timeval *tv;
{
register unsigned long ticks;
@ -257,10 +254,8 @@ hzto(tv)
* If ints have 32 bits, then the maximum value for any timeout in
* 10ms ticks is 248 days.
*/
s = splclock();
sec = tv->tv_sec - time.tv_sec;
usec = tv->tv_usec - time.tv_usec;
splx(s);
sec = tv->tv_sec;
usec = tv->tv_usec;
if (usec < 0) {
sec--;
usec += 1000000;
@ -271,7 +266,7 @@ hzto(tv)
sec++;
usec -= 1000000;
}
printf("hzto: negative time difference %ld sec %ld usec\n",
printf("tvotohz: negative time difference %ld sec %ld usec\n",
sec, usec);
#endif
ticks = 1;
@ -288,6 +283,24 @@ hzto(tv)
return (ticks);
}
/*
* Compute number of hz until specified time. Used to
* compute third argument to timeout() from an absolute time.
*/
int
hzto(tv)
struct timeval *tv;
{
register long sec, usec;
struct timeval t2;
getmicrotime(&t2);
t2.tv_sec = tv->tv_sec - t2.tv_sec;
t2.tv_usec = tv->tv_usec - t2.tv_usec;
return (tvtohz(&t2));
}
/*
* Start profiling on a process.
*
@ -637,8 +650,7 @@ set_timecounter(struct timespec *ts)
tc->offset_nano = (u_int64_t)ts->tv_nsec << 32;
tc->offset_micro = ts->tv_nsec / 1000;
tc->offset_count = tc->get_timecount();
time.tv_sec = tc->offset_sec;
time.tv_usec = tc->offset_micro;
time_second = tc->offset_sec;
timecounter = tc;
splx(s);
}
@ -711,8 +723,7 @@ tco_forward(void)
tc->offset_micro = (tc->offset_nano / 1000) >> 32;
time.tv_usec = tc->offset_micro;
time.tv_sec = tc->offset_sec;
time_second = tc->offset_sec;
timecounter = tc;
}

View File

@ -46,7 +46,7 @@
* in Germany will I accept domestic beer. This code may or may not work
* and I certainly make no claims as to its fitness for *any* purpose.
*
* $Id: kern_threads.c,v 1.5 1997/11/07 08:52:57 phk Exp $
* $Id: kern_threads.c,v 1.6 1998/02/25 06:30:15 bde Exp $
*/
#include <sys/param.h>
@ -91,10 +91,7 @@ thr_sleep(struct proc *p, struct thr_sleep_args *uap) {
p->p_wakeup = 0;
return (EINVAL);
}
s = splclock();
timevaladd(&atv, &time);
timo = hzto(&atv);
splx(s);
timo = tvtohz(&atv);
}
p->p_retval[0] = 0;

View File

@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* @(#)kern_time.c 8.1 (Berkeley) 6/10/93
* $Id: kern_time.c,v 1.42 1998/02/25 04:10:32 bde Exp $
* $Id: kern_time.c,v 1.43 1998/03/26 20:51:41 phk Exp $
*/
#include <sys/param.h>
@ -229,10 +229,7 @@ nanosleep1(p, rqt, rmt)
atv.tv_usec = 0;
}
}
s = splclock();
timevaladd(&atv, &time);
timo = hzto(&atv);
splx(s);
timo = tvtohz(&atv);
p->p_sleepend = &atv;
error = tsleep(&nanowait, PWAIT | PCATCH, "nanslp", timo);
@ -257,9 +254,7 @@ nanosleep1(p, rqt, rmt)
* problem for small timeouts, but the absolute error may
* be large for large timeouts.
*/
s = splclock();
utv = time;
splx(s);
getmicrotime(&utv);
if (i != n) {
atv.tv_sec += (n - i - 1) * 100000000;
timevaladd(&atv, &rtv);
@ -504,12 +499,13 @@ getitimer(p, uap)
struct proc *p;
register struct getitimer_args *uap;
{
struct timeval ctv;
struct itimerval aitv;
int s;
if (uap->which > ITIMER_PROF)
return (EINVAL);
s = splclock();
s = splclock(); /* XXX still needed ? */
if (uap->which == ITIMER_REAL) {
/*
* Convert from absoulte to relative time in .it_value
@ -518,11 +514,13 @@ getitimer(p, uap)
* current time and time for the timer to go off.
*/
aitv = p->p_realtimer;
if (timerisset(&aitv.it_value))
if (timercmp(&aitv.it_value, &time, <))
if (timerisset(&aitv.it_value)) {
getmicrotime(&ctv);
if (timercmp(&aitv.it_value, &ctv, <))
timerclear(&aitv.it_value);
else
timevalsub(&aitv.it_value, &time);
timevalsub(&aitv.it_value, &ctv);
}
} else
aitv = p->p_stats->p_timer[uap->which];
splx(s);
@ -543,6 +541,7 @@ setitimer(p, uap)
register struct setitimer_args *uap;
{
struct itimerval aitv;
struct timeval ctv;
register struct itimerval *itvp;
int s, error;
@ -563,12 +562,13 @@ setitimer(p, uap)
timerclear(&aitv.it_interval);
else if (itimerfix(&aitv.it_interval))
return (EINVAL);
s = splclock();
s = splclock(); /* XXX: still needed ? */
if (uap->which == ITIMER_REAL) {
if (timerisset(&p->p_realtimer.it_value))
untimeout(realitexpire, (caddr_t)p, p->p_ithandle);
if (timerisset(&aitv.it_value)) {
timevaladd(&aitv.it_value, &time);
getmicrotime(&ctv);
timevaladd(&aitv.it_value, &ctv);
p->p_ithandle = timeout(realitexpire, (caddr_t)p,
hzto(&aitv.it_value));
}
@ -596,6 +596,7 @@ realitexpire(arg)
void *arg;
{
register struct proc *p;
struct timeval ctv;
int s;
p = (struct proc *)arg;
@ -605,10 +606,11 @@ realitexpire(arg)
return;
}
for (;;) {
s = splclock();
s = splclock(); /* XXX: still neeeded ? */
timevaladd(&p->p_realtimer.it_value,
&p->p_realtimer.it_interval);
if (timercmp(&p->p_realtimer.it_value, &time, >)) {
getmicrotime(&ctv);
if (timercmp(&p->p_realtimer.it_value, &ctv, >)) {
p->p_ithandle =
timeout(realitexpire, (caddr_t)p,
hzto(&p->p_realtimer.it_value) - 1);

View File

@ -35,7 +35,7 @@
* SUCH DAMAGE.
*
* from: @(#)trap.c 7.4 (Berkeley) 5/13/91
* $Id: trap.c,v 1.123 1998/03/23 19:52:37 jlemon Exp $
* $Id: trap.c,v 1.124 1998/03/28 10:32:57 bde Exp $
*/
/*
@ -519,11 +519,11 @@ trap(frame)
{
static unsigned lastalert = 0;
if(time.tv_sec - lastalert > 10)
if(time_second - lastalert > 10)
{
log(LOG_WARNING, "NMI: power fail\n");
sysbeep(TIMER_FREQ/880, hz);
lastalert = time.tv_sec;
lastalert = time_second;
}
return;
}

View File

@ -36,7 +36,7 @@
* SUCH DAMAGE.
*
* @(#)sys_generic.c 8.5 (Berkeley) 1/21/94
* $Id: sys_generic.c,v 1.32 1997/11/06 19:29:20 phk Exp $
* $Id: sys_generic.c,v 1.33 1997/11/23 10:30:50 bde Exp $
*/
#include "opt_ktrace.h"
@ -539,7 +539,7 @@ select(p, uap)
fd_mask s_selbits[howmany(2048, NFDBITS)];
fd_mask *ibits[3], *obits[3], *selbits, *sbp;
struct timeval atv;
int s, ncoll, error, timo;
int s, ncoll, error, timo, term;
u_int nbufbytes, ncpbytes, nfdbits;
if (uap->nd < 0)
@ -600,12 +600,11 @@ select(p, uap)
error = EINVAL;
goto done;
}
s = splclock();
timevaladd(&atv, &time);
timo = hzto(&atv);
splx(s);
timo = tvtohz(&atv);
} else
timo = 0;
if (timo)
term = timo + ticks;
retry:
ncoll = nselcoll;
p->p_flag |= P_SELECT;
@ -613,9 +612,7 @@ select(p, uap)
if (error || p->p_retval[0])
goto done;
s = splhigh();
/* this should be timercmp(&time, &atv, >=) */
if (uap->tv && (time.tv_sec > atv.tv_sec ||
(time.tv_sec == atv.tv_sec && time.tv_usec >= atv.tv_usec))) {
if (timo && term <= ticks) {
splx(s);
goto done;
}
@ -706,7 +703,7 @@ poll(p, uap)
caddr_t bits;
char smallbits[32 * sizeof(struct pollfd)];
struct timeval atv;
int s, ncoll, error = 0, timo;
int s, ncoll, error = 0, timo, term;
size_t ni;
if (SCARG(uap, nfds) > p->p_fd->fd_nfiles) {
@ -728,20 +725,19 @@ poll(p, uap)
error = EINVAL;
goto done;
}
s = splclock();
timevaladd(&atv, &time);
timo = hzto(&atv);
splx(s);
timo = tvtohz(&atv);
} else
timo = 0;
if (timo)
term = timo + ticks;
retry:
ncoll = nselcoll;
p->p_flag |= P_SELECT;
error = pollscan(p, (struct pollfd *)bits, SCARG(uap, nfds));
if (error || p->p_retval[0])
goto done;
s = splhigh();
if (timo && timercmp(&time, &atv, >=)) {
s = splhigh();
if (timo && term <= ticks) {
splx(s);
goto done;
}

View File

@ -1,4 +1,4 @@
/* $Id: sysv_msg.c,v 1.16 1997/08/02 14:31:37 bde Exp $ */
/* $Id: sysv_msg.c,v 1.17 1997/11/06 19:29:24 phk Exp $ */
/*
* Implementation of SVID messages
@ -272,7 +272,7 @@ msgctl(p, uap)
msqptr->msg_perm.mode = (msqptr->msg_perm.mode & ~0777) |
(msqbuf.msg_perm.mode & 0777);
msqptr->msg_qbytes = msqbuf.msg_qbytes;
msqptr->msg_ctime = time.tv_sec;
msqptr->msg_ctime = time_second;
break;
case IPC_STAT:
@ -390,7 +390,7 @@ msgget(p, uap)
msqptr->msg_lrpid = 0;
msqptr->msg_stime = 0;
msqptr->msg_rtime = 0;
msqptr->msg_ctime = time.tv_sec;
msqptr->msg_ctime = time_second;
} else {
#ifdef MSG_DEBUG_OK
printf("didn't find it and wasn't asked to create it\n");
@ -732,7 +732,7 @@ msgsnd(p, uap)
msqptr->msg_cbytes += msghdr->msg_ts;
msqptr->msg_qnum++;
msqptr->msg_lspid = p->p_pid;
msqptr->msg_stime = time.tv_sec;
msqptr->msg_stime = time_second;
wakeup((caddr_t)msqptr);
p->p_retval[0] = 0;
@ -954,7 +954,7 @@ msgrcv(p, uap)
msqptr->msg_cbytes -= msghdr->msg_ts;
msqptr->msg_qnum--;
msqptr->msg_lrpid = p->p_pid;
msqptr->msg_rtime = time.tv_sec;
msqptr->msg_rtime = time_second;
/*
* Make msgsz the actual amount that we'll be returning.

View File

@ -1,4 +1,4 @@
/* $Id: sysv_sem.c,v 1.19 1997/08/02 14:31:38 bde Exp $ */
/* $Id: sysv_sem.c,v 1.20 1997/11/06 19:29:24 phk Exp $ */
/*
* Implementation of SVID semaphores
@ -388,7 +388,7 @@ __semctl(p, uap)
semaptr->sem_perm.gid = sbuf.sem_perm.gid;
semaptr->sem_perm.mode = (semaptr->sem_perm.mode & ~0777) |
(sbuf.sem_perm.mode & 0777);
semaptr->sem_ctime = time.tv_sec;
semaptr->sem_ctime = time_second;
break;
case IPC_STAT:
@ -575,7 +575,7 @@ semget(p, uap)
(sema[semid].sem_perm.seq + 1) & 0x7fff;
sema[semid].sem_nsems = nsems;
sema[semid].sem_otime = 0;
sema[semid].sem_ctime = time.tv_sec;
sema[semid].sem_ctime = time_second;
sema[semid].sem_base = &sem[semtot];
semtot += nsems;
bzero(sema[semid].sem_base,

View File

@ -1,4 +1,4 @@
/* $Id: sysv_shm.c,v 1.33 1997/12/16 17:40:23 eivind Exp $ */
/* $Id: sysv_shm.c,v 1.34 1998/02/09 06:09:25 eivind Exp $ */
/* $NetBSD: sysv_shm.c,v 1.23 1994/07/04 23:25:12 glass Exp $ */
/*
@ -170,7 +170,7 @@ shm_delete_mapping(p, shmmap_s)
if (result != KERN_SUCCESS)
return EINVAL;
shmmap_s->shmid = -1;
shmseg->shm_dtime = time.tv_sec;
shmseg->shm_dtime = time_second;
if ((--shmseg->shm_nattch <= 0) &&
(shmseg->shm_perm.mode & SHMSEG_REMOVED)) {
shm_deallocate_segment(shmseg);
@ -281,7 +281,7 @@ shmat(p, uap)
shmmap_s->va = attach_va;
shmmap_s->shmid = uap->shmid;
shmseg->shm_lpid = p->p_pid;
shmseg->shm_atime = time.tv_sec;
shmseg->shm_atime = time_second;
shmseg->shm_nattch++;
p->p_retval[0] = attach_va;
return 0;
@ -389,7 +389,7 @@ shmctl(p, uap)
shmseg->shm_perm.mode =
(shmseg->shm_perm.mode & ~ACCESSPERMS) |
(inbuf.shm_perm.mode & ACCESSPERMS);
shmseg->shm_ctime = time.tv_sec;
shmseg->shm_ctime = time_second;
break;
case IPC_RMID:
error = ipcperm(cred, &shmseg->shm_perm, IPC_M);
@ -512,7 +512,7 @@ shmget_allocate_segment(p, uap, mode)
shmseg->shm_cpid = p->p_pid;
shmseg->shm_lpid = shmseg->shm_nattch = 0;
shmseg->shm_atime = shmseg->shm_dtime = 0;
shmseg->shm_ctime = time.tv_sec;
shmseg->shm_ctime = time_second;
shm_committed += btoc(size);
shm_nused++;
if (shmseg->shm_perm.mode & SHMSEG_WANTED) {

View File

@ -38,7 +38,7 @@ static volatile int ttyverbose = 0;
* SUCH DAMAGE.
*
* @(#)tty.c 8.8 (Berkeley) 1/21/94
* $Id: tty.c,v 1.100 1997/12/16 17:40:24 eivind Exp $
* $Id: tty.c,v 1.101 1998/03/07 15:36:21 bde Exp $
*/
/*-
@ -1499,7 +1499,7 @@ ttread(tp, uio, flag)
goto sleep;
if (qp->c_cc >= m)
goto read;
gettime(&timecopy);
getmicrotime(&timecopy);
if (!has_stime) {
/* first character, start timer */
has_stime = 1;
@ -1519,7 +1519,7 @@ ttread(tp, uio, flag)
} else { /* m == 0 */
if (qp->c_cc > 0)
goto read;
gettime(&timecopy);
getmicrotime(&timecopy);
if (!has_stime) {
has_stime = 1;
stime = timecopy;

View File

@ -13,7 +13,7 @@
* bad that happens because of using this software isn't the responsibility
* of the author. This software is distributed AS-IS.
*
* $Id: vfs_aio.c,v 1.25 1998/03/28 10:33:09 bde Exp $
* $Id: vfs_aio.c,v 1.26 1998/03/28 11:50:04 dufault Exp $
*/
/*
@ -1484,10 +1484,7 @@ aio_suspend(struct proc *p, struct aio_suspend_args *uap)
TIMESPEC_TO_TIMEVAL(&atv, &ts)
if (itimerfix(&atv))
return (EINVAL);
s = splclock();
timevaladd(&atv, &time);
timo = hzto(&atv);
splx(s);
timo = tvtohz(&atv);
}
ki = p->p_aioinfo;

View File

@ -36,7 +36,7 @@
* SUCH DAMAGE.
*
* @(#)vfs_subr.c 8.31 (Berkeley) 5/26/95
* $Id: vfs_subr.c,v 1.146 1998/03/28 12:04:32 bde Exp $
* $Id: vfs_subr.c,v 1.147 1998/03/28 13:24:54 bde Exp $
*/
/*
@ -920,7 +920,7 @@ sched_sync(void)
struct proc *p = updateproc;
for (;;) {
starttime = time.tv_sec;
starttime = time_second;
/*
* Push files whose dirty time has expired.
@ -976,7 +976,7 @@ sched_sync(void)
* matter as we are just trying to generally pace the
* filesystem activity.
*/
if (time.tv_sec == starttime)
if (time_second == starttime)
tsleep(&lbolt, PPAUSE, "syncer", 0);
}
}

View File

@ -36,7 +36,7 @@
* SUCH DAMAGE.
*
* @(#)vfs_subr.c 8.31 (Berkeley) 5/26/95
* $Id: vfs_subr.c,v 1.146 1998/03/28 12:04:32 bde Exp $
* $Id: vfs_subr.c,v 1.147 1998/03/28 13:24:54 bde Exp $
*/
/*
@ -920,7 +920,7 @@ sched_sync(void)
struct proc *p = updateproc;
for (;;) {
starttime = time.tv_sec;
starttime = time_second;
/*
* Push files whose dirty time has expired.
@ -976,7 +976,7 @@ sched_sync(void)
* matter as we are just trying to generally pace the
* filesystem activity.
*/
if (time.tv_sec == starttime)
if (time_second == starttime)
tsleep(&lbolt, PPAUSE, "syncer", 0);
}
}

View File

@ -108,7 +108,7 @@ atm_output(ifp, m0, dst, rt0)
if ((ifp->if_flags & (IFF_UP|IFF_RUNNING)) != (IFF_UP|IFF_RUNNING))
senderr(ENETDOWN);
gettime(&ifp->if_lastchange);
getmicrotime(&ifp->if_lastchange);
/*
* check route
@ -263,7 +263,7 @@ atm_input(ifp, ah, m, rxhand)
m_freem(m);
return;
}
gettime(&ifp->if_lastchange);
getmicrotime(&ifp->if_lastchange);
ifp->if_ibytes += m->m_pkthdr.len;
#if NBPFILTER > 0

View File

@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* @(#)if_ethersubr.c 8.1 (Berkeley) 6/10/93
* $Id: if_ethersubr.c,v 1.45 1998/02/20 13:11:49 bde Exp $
* $Id: if_ethersubr.c,v 1.46 1998/03/18 01:40:11 wollman Exp $
*/
#include "opt_atalk.h"
@ -162,7 +162,7 @@ ether_output(ifp, m0, dst, rt0)
}
if (rt->rt_flags & RTF_REJECT)
if (rt->rt_rmx.rmx_expire == 0 ||
time.tv_sec < rt->rt_rmx.rmx_expire)
time_second < rt->rt_rmx.rmx_expire)
senderr(rt == rt0 ? EHOSTDOWN : EHOSTUNREACH);
}
switch (dst->sa_family) {

View File

@ -33,7 +33,7 @@
* SUCH DAMAGE.
*
* from: if_ethersubr.c,v 1.5 1994/12/13 22:31:45 wollman Exp
* $Id: if_fddisubr.c,v 1.25 1998/01/09 00:51:55 eivind Exp $
* $Id: if_fddisubr.c,v 1.26 1998/02/20 13:11:49 bde Exp $
*/
#include "opt_atalk.h"
@ -149,7 +149,7 @@ fddi_output(ifp, m0, dst, rt0)
if ((ifp->if_flags & (IFF_UP|IFF_RUNNING)) != (IFF_UP|IFF_RUNNING))
senderr(ENETDOWN);
gettime(&ifp->if_lastchange);
getmicrotime(&ifp->if_lastchange);
#if !defined(__bsdi__) || _BSDI_VERSION >= 199401
if (rt = rt0) {
if ((rt->rt_flags & RTF_UP) == 0) {
@ -170,7 +170,7 @@ fddi_output(ifp, m0, dst, rt0)
}
if (rt->rt_flags & RTF_REJECT)
if (rt->rt_rmx.rmx_expire == 0 ||
time.tv_sec < rt->rt_rmx.rmx_expire)
time_second < rt->rt_rmx.rmx_expire)
senderr(rt == rt0 ? EHOSTDOWN : EHOSTUNREACH);
}
#endif
@ -474,7 +474,7 @@ fddi_input(ifp, fh, m)
m_freem(m);
return;
}
gettime(&ifp->if_lastchange);
getmicrotime(&ifp->if_lastchange);
ifp->if_ibytes += m->m_pkthdr.len + sizeof (*fh);
if (fh->fddi_dhost[0] & 1) {
if (bcmp((caddr_t)fddibroadcastaddr, (caddr_t)fh->fddi_dhost,

View File

@ -69,7 +69,7 @@
* Paul Mackerras (paulus@cs.anu.edu.au).
*/
/* $Id: if_ppp.c,v 1.53 1998/01/08 23:41:28 eivind Exp $ */
/* $Id: if_ppp.c,v 1.54 1998/03/22 06:51:54 peter Exp $ */
/* from if_sl.c,v 1.11 84/10/04 12:54:47 rick Exp */
/* from NetBSD: if_ppp.c,v 1.15.2.2 1994/07/28 05:17:58 cgd Exp */
@ -275,7 +275,7 @@ pppalloc(pid)
sc->sc_npmode[i] = NPMODE_ERROR;
sc->sc_npqueue = NULL;
sc->sc_npqtail = &sc->sc_npqueue;
sc->sc_last_sent = sc->sc_last_recv = time.tv_sec;
sc->sc_last_sent = sc->sc_last_recv = time_second;
return sc;
}
@ -511,7 +511,7 @@ pppioctl(sc, cmd, data, flag, p)
case PPPIOCGIDLE:
s = splsoftnet();
t = time.tv_sec;
t = time_second;
((struct ppp_idle *)data)->xmit_idle = t - sc->sc_last_sent;
((struct ppp_idle *)data)->recv_idle = t - sc->sc_last_recv;
splx(s);
@ -820,14 +820,14 @@ pppoutput(ifp, m0, dst, rtp)
*/
if (sc->sc_active_filt.bf_insns == 0
|| bpf_filter(sc->sc_active_filt.bf_insns, (u_char *) m0, len, 0))
sc->sc_last_sent = time.tv_sec;
sc->sc_last_sent = time_second;
*mtod(m0, u_char *) = address;
#else
/*
* Update the time we sent the most recent data packet.
*/
sc->sc_last_sent = time.tv_sec;
sc->sc_last_sent = time_second;
#endif /* PPP_FILTER */
}
@ -862,7 +862,7 @@ pppoutput(ifp, m0, dst, rtp)
IF_ENQUEUE(ifq, m0);
(*sc->sc_start)(sc);
}
gettime(&ifp->if_lastchange);
getmicrotime(&ifp->if_lastchange);
ifp->if_opackets++;
ifp->if_obytes += len;
@ -1455,14 +1455,14 @@ ppp_inproc(sc, m)
}
if (sc->sc_active_filt.bf_insns == 0
|| bpf_filter(sc->sc_active_filt.bf_insns, (u_char *) m, ilen, 0))
sc->sc_last_recv = time.tv_sec;
sc->sc_last_recv = time_second;
*mtod(m, u_char *) = adrs;
#else
/*
* Record the time that we received this packet.
*/
sc->sc_last_recv = time.tv_sec;
sc->sc_last_recv = time_second;
#endif /* PPP_FILTER */
}
@ -1490,7 +1490,7 @@ ppp_inproc(sc, m)
m->m_len -= PPP_HDRLEN;
schednetisr(NETISR_IP);
inq = &ipintrq;
sc->sc_last_recv = time.tv_sec; /* update time of last pkt rcvd */
sc->sc_last_recv = time_second; /* update time of last pkt rcvd */
break;
#endif
#ifdef IPX
@ -1509,7 +1509,7 @@ ppp_inproc(sc, m)
m->m_len -= PPP_HDRLEN;
schednetisr(NETISR_IPX);
inq = &ipxintrq;
sc->sc_last_recv = time.tv_sec; /* update time of last pkt rcvd */
sc->sc_last_recv = time_second; /* update time of last pkt rcvd */
break;
#endif
@ -1538,7 +1538,7 @@ ppp_inproc(sc, m)
splx(s);
ifp->if_ipackets++;
ifp->if_ibytes += ilen;
gettime(&ifp->if_lastchange);
getmicrotime(&ifp->if_lastchange);
if (rv)
(*sc->sc_ctlp)(sc);

View File

@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* @(#)if_sl.c 8.6 (Berkeley) 2/1/94
* $Id: if_sl.c,v 1.66 1998/02/09 06:09:54 eivind Exp $
* $Id: if_sl.c,v 1.67 1998/02/13 12:46:14 phk Exp $
*/
/*
@ -792,15 +792,15 @@ slinput(c, tp)
* this one is within the time limit.
*/
if (sc->sc_abortcount &&
time.tv_sec >= sc->sc_starttime + ABT_WINDOW)
time_second >= sc->sc_starttime + ABT_WINDOW)
sc->sc_abortcount = 0;
/*
* If we see an abort after "idle" time, count it;
* record when the first abort escape arrived.
*/
if (time.tv_sec >= sc->sc_lasttime + ABT_IDLE) {
if (time_second >= sc->sc_lasttime + ABT_IDLE) {
if (++sc->sc_abortcount == 1)
sc->sc_starttime = time.tv_sec;
sc->sc_starttime = time_second;
if (sc->sc_abortcount >= ABT_COUNT) {
slclose(tp,0);
return 0;
@ -808,7 +808,7 @@ slinput(c, tp)
}
} else
sc->sc_abortcount = 0;
sc->sc_lasttime = time.tv_sec;
sc->sc_lasttime = time_second;
}
switch (c) {

View File

@ -17,7 +17,7 @@
*
* From: Version 2.4, Thu Apr 30 17:17:21 MSD 1997
*
* $Id: if_spppsubr.c,v 1.33 1998/02/28 21:01:09 phk Exp $
* $Id: if_spppsubr.c,v 1.34 1998/03/01 06:01:33 bde Exp $
*/
#include "opt_inet.h"
@ -29,6 +29,7 @@
#include <sys/sockio.h>
#include <sys/socket.h>
#include <sys/syslog.h>
#include <machine/random.h>
#include <sys/malloc.h>
#include <sys/mbuf.h>
#include <sys/md5.h>
@ -989,7 +990,7 @@ sppp_cisco_input(struct sppp *sp, struct mbuf *m)
++sp->pp_loopcnt;
/* Generate new local sequence number */
sp->pp_seq ^= time.tv_sec ^ time.tv_usec;
read_random((char*)&sp->pp_seq, sizeof sp->pp_seq);
break;
}
sp->pp_loopcnt = 0;
@ -1017,7 +1018,7 @@ sppp_cisco_send(struct sppp *sp, int type, long par1, long par2)
struct ppp_header *h;
struct cisco_packet *ch;
struct mbuf *m;
u_long t = (time.tv_sec - boottime.tv_sec) * 1000;
u_long t = (time_second - boottime.tv_sec) * 1000;
MGETHDR (m, M_DONTWAIT, MT_DATA);
if (! m)
@ -2114,7 +2115,7 @@ sppp_lcp_RCN_nak(struct sppp *sp, struct lcp_header *h, int len)
if (magic == ~sp->lcp.magic) {
if (debug)
addlog("magic glitch ");
sp->lcp.magic += time.tv_sec + time.tv_usec;
read_random((char*)&sp->lcp.magic, sizeof sp->lcp.magic);
} else {
sp->lcp.magic = magic;
if (debug)
@ -2274,7 +2275,7 @@ sppp_lcp_scr(struct sppp *sp)
if (sp->lcp.opts & (1 << LCP_OPT_MAGIC)) {
if (! sp->lcp.magic)
sp->lcp.magic = time.tv_sec + time.tv_usec;
read_random((char*)&sp->lcp.magic, sizeof sp->lcp.magic);
opt[i++] = LCP_OPT_MAGIC;
opt[i++] = 6;
opt[i++] = sp->lcp.magic >> 24;

View File

@ -70,7 +70,7 @@
* Paul Mackerras (paulus@cs.anu.edu.au).
*/
/* $Id: ppp_tty.c,v 1.30 1998/02/13 12:46:15 phk Exp $ */
/* $Id: ppp_tty.c,v 1.31 1998/03/28 10:33:12 bde Exp $ */
#include "ppp.h"
#if NPPP > 0
@ -618,7 +618,7 @@ pppasyncstart(sc)
/* Calculate the FCS for the first mbuf's worth. */
sc->sc_outfcs = pppfcs(PPP_INITFCS, mtod(m, u_char *), m->m_len);
gettime(&sc->sc_if.if_lastchange);
getmicrotime(&sc->sc_if.if_lastchange);
}
for (;;) {

View File

@ -446,7 +446,7 @@ at_ifinit( ifp, aa, sat )
* XXX use /dev/random?
*/
if ( nnets != 1 ) {
net = ntohs( nr.nr_firstnet ) + time.tv_sec % ( nnets - 1 );
net = ntohs( nr.nr_firstnet ) + time_second % ( nnets - 1 );
} else {
net = ntohs( nr.nr_firstnet );
}
@ -483,7 +483,7 @@ at_ifinit( ifp, aa, sat )
* XXX use /dev/random?
*/
if ( sat->sat_addr.s_node == ATADDR_ANYNODE ) {
AA_SAT( aa )->sat_addr.s_node = time.tv_sec;
AA_SAT( aa )->sat_addr.s_node = time_second;
} else {
AA_SAT( aa )->sat_addr.s_node = sat->sat_addr.s_node;
}
@ -508,7 +508,7 @@ at_ifinit( ifp, aa, sat )
* Once again, starting at the (possibly random)
* initial node address.
*/
for ( j = 0, nodeinc = time.tv_sec | 1; j < 256;
for ( j = 0, nodeinc = time_second | 1; j < 256;
j++, AA_SAT( aa )->sat_addr.s_node += nodeinc ) {
if ( AA_SAT( aa )->sat_addr.s_node > 253 ||
AA_SAT( aa )->sat_addr.s_node < 1 ) {
@ -552,7 +552,7 @@ at_ifinit( ifp, aa, sat )
break;
}
/* reset node for next network */
AA_SAT( aa )->sat_addr.s_node = time.tv_sec;
AA_SAT( aa )->sat_addr.s_node = time_second;
}
/*

View File

@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* @(#)if_ether.c 8.1 (Berkeley) 6/10/93
* $Id: if_ether.c,v 1.42 1997/12/20 00:07:11 bde Exp $
* $Id: if_ether.c,v 1.43 1998/01/08 23:41:43 eivind Exp $
*/
/*
@ -130,7 +130,7 @@ arptimer(ignored_arg)
while ((ola = la) != 0) {
register struct rtentry *rt = la->la_rt;
la = la->la_le.le_next;
if (rt->rt_expire && rt->rt_expire <= time.tv_sec)
if (rt->rt_expire && rt->rt_expire <= time_second)
arptfree(ola); /* timer has expired, clear */
}
splx(s);
@ -177,7 +177,7 @@ arp_rtrequest(req, rt, sa)
gate = rt->rt_gateway;
SDL(gate)->sdl_type = rt->rt_ifp->if_type;
SDL(gate)->sdl_index = rt->rt_ifp->if_index;
rt->rt_expire = time.tv_sec;
rt->rt_expire = time_second;
break;
}
/* Announce a new entry if requested. */
@ -354,7 +354,7 @@ arpresolve(ac, rt, m, dst, desten, rt0)
* Check the address family and length is valid, the address
* is resolved; otherwise, try to resolve.
*/
if ((rt->rt_expire == 0 || rt->rt_expire > time.tv_sec) &&
if ((rt->rt_expire == 0 || rt->rt_expire > time_second) &&
sdl->sdl_family == AF_LINK && sdl->sdl_alen != 0) {
bcopy(LLADDR(sdl), desten, sdl->sdl_alen);
return 1;
@ -369,8 +369,8 @@ arpresolve(ac, rt, m, dst, desten, rt0)
la->la_hold = m;
if (rt->rt_expire) {
rt->rt_flags &= ~RTF_REJECT;
if (la->la_asked == 0 || rt->rt_expire != time.tv_sec) {
rt->rt_expire = time.tv_sec;
if (la->la_asked == 0 || rt->rt_expire != time_second) {
rt->rt_expire = time_second;
if (la->la_asked++ < arp_maxtries)
arprequest(ac,
&(SIN(rt->rt_ifa->ifa_addr)->sin_addr.s_addr),
@ -501,7 +501,7 @@ in_arpinput(m)
(void)memcpy(LLADDR(sdl), ea->arp_sha, sizeof(ea->arp_sha));
sdl->sdl_alen = sizeof(ea->arp_sha);
if (rt->rt_expire)
rt->rt_expire = time.tv_sec + arpt_keep;
rt->rt_expire = time_second + arpt_keep;
rt->rt_flags &= ~RTF_REJECT;
la->la_asked = 0;
if (la->la_hold) {

View File

@ -26,7 +26,7 @@
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: in_rmx.c,v 1.32 1998/02/06 12:13:50 eivind Exp $
* $Id: in_rmx.c,v 1.33 1998/03/27 14:30:18 peter Exp $
*/
/*
@ -202,7 +202,7 @@ in_clsroute(struct radix_node *rn, struct radix_node_head *head)
*/
if(rtq_reallyold != 0) {
rt->rt_flags |= RTPRF_OURS;
rt->rt_rmx.rmx_expire = time.tv_sec + rtq_reallyold;
rt->rt_rmx.rmx_expire = time_second + rtq_reallyold;
} else {
rtrequest(RTM_DELETE,
(struct sockaddr *)rt_key(rt),
@ -235,7 +235,7 @@ in_rtqkill(struct radix_node *rn, void *rock)
if(rt->rt_flags & RTPRF_OURS) {
ap->found++;
if(ap->draining || rt->rt_rmx.rmx_expire <= time.tv_sec) {
if(ap->draining || rt->rt_rmx.rmx_expire <= time_second) {
if(rt->rt_refcnt > 0)
panic("rtqkill route really not free");
@ -250,9 +250,9 @@ in_rtqkill(struct radix_node *rn, void *rock)
}
} else {
if(ap->updating
&& (rt->rt_rmx.rmx_expire - time.tv_sec
&& (rt->rt_rmx.rmx_expire - time_second
> rtq_reallyold)) {
rt->rt_rmx.rmx_expire = time.tv_sec
rt->rt_rmx.rmx_expire = time_second
+ rtq_reallyold;
}
ap->nextstop = lmin(ap->nextstop,
@ -277,7 +277,7 @@ in_rtqtimo(void *rock)
arg.found = arg.killed = 0;
arg.rnh = rnh;
arg.nextstop = time.tv_sec + rtq_timeout;
arg.nextstop = time_second + rtq_timeout;
arg.draining = arg.updating = 0;
s = splnet();
rnh->rnh_walktree(rnh, in_rtqkill, &arg);
@ -292,14 +292,14 @@ in_rtqtimo(void *rock)
* hard.
*/
if((arg.found - arg.killed > rtq_toomany)
&& (time.tv_sec - last_adjusted_timeout >= rtq_timeout)
&& (time_second - last_adjusted_timeout >= rtq_timeout)
&& rtq_reallyold > rtq_minreallyold) {
rtq_reallyold = 2*rtq_reallyold / 3;
if(rtq_reallyold < rtq_minreallyold) {
rtq_reallyold = rtq_minreallyold;
}
last_adjusted_timeout = time.tv_sec;
last_adjusted_timeout = time_second;
#ifdef DIAGNOSTIC
log(LOG_DEBUG, "in_rtqtimo: adjusted rtq_reallyold to %d\n",
rtq_reallyold);

View File

@ -12,7 +12,7 @@
*
* This software is provided ``AS IS'' without any warranties of any kind.
*
* $Id: ip_fw.c,v 1.78 1998/02/12 00:57:04 alex Exp $
* $Id: ip_fw.c,v 1.79 1998/03/15 00:36:27 alex Exp $
*/
/*
@ -561,7 +561,7 @@ ip_fw_chk(struct ip **pip, int hlen,
/* Update statistics */
f->fw_pcnt += 1;
f->fw_bcnt += ip->ip_len;
f->timestamp = time.tv_sec;
f->timestamp = time_second;
/* Log to console if desired */
if ((f->fw_flg & IP_FW_F_PRN) && fw_verbose)

View File

@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* @(#)ip_input.c 8.2 (Berkeley) 1/4/94
* $Id: ip_input.c,v 1.79 1998/02/26 08:31:53 dima Exp $
* $Id: ip_input.c,v 1.80 1998/03/21 11:34:11 peter Exp $
* $ANA: ip_input.c,v 1.5 1996/09/18 14:34:59 wollman Exp $
*/
@ -219,7 +219,7 @@ ip_init()
maxnipq = nmbclusters/4;
ip_id = time.tv_sec & 0xffff;
ip_id = time_second & 0xffff;
ipintrq.ifq_maxlen = ipqmaxlen;
#ifdef IPFIREWALL
ip_fw_init();

View File

@ -33,7 +33,7 @@
*
* @(#)ipx_input.c
*
* $Id: ipx_input.c,v 1.14 1997/06/26 19:35:46 jhay Exp $
* $Id: ipx_input.c,v 1.15 1998/02/09 06:10:19 eivind Exp $
*/
#include <sys/param.h>
@ -54,6 +54,8 @@
#include <netipx/ipx_pcb.h>
#include <netipx/ipx_var.h>
#include <machine/random.h>
int ipxcksum = 0;
SYSCTL_INT(_net_ipx_ipx, OID_AUTO, checksum, CTLFLAG_RW,
&ipxcksum, 0, "");
@ -105,7 +107,7 @@ ipx_init()
ipx_broadnet = *(union ipx_net *)allones;
ipx_broadhost = *(union ipx_host *)allones;
ipx_pexseq = time.tv_usec;
read_random((char *)&ipx_pexseq, sizeof ipx_pexseq);
ipxintrq.ifq_maxlen = ipxqmaxlen;
ipxpcb.ipxp_next = ipxpcb.ipxp_prev = &ipxpcb;
ipxrawpcb.ipxp_next = ipxrawpcb.ipxp_prev = &ipxrawpcb;

View File

@ -1254,7 +1254,7 @@ key_getspi(type, vers, src, dst, lowval, highval, spi)
* reasons. This is another task that key_reaper can
* do once we have it coded.
*/
secassoc->lifetime1 += time.tv_sec + maxlarvallifetime;
secassoc->lifetime1 += time_second + maxlarvallifetime;
if (!(keynode = key_addnode(indx, secassoc))) {
DPRINTF(IDL_ERROR,("key_getspi: can't add node\n"));
@ -1498,7 +1498,7 @@ key_acquire(type, src, dst)
if (addrpart_equal(dst, ap->target) &&
(etype == ap->type)) {
DPRINTF(IDL_EVENT,("acquire message previously sent!\n"));
if (ap->expiretime < time.tv_sec) {
if (ap->expiretime < time_second) {
DPRINTF(IDL_EVENT,("acquire message has expired!\n"));
ap->count = 0;
break;
@ -1508,7 +1508,7 @@ key_acquire(type, src, dst)
break;
}
return(0);
} else if (ap->expiretime < time.tv_sec) {
} else if (ap->expiretime < time_second) {
/*
* Since we're already looking at the list, we may as
* well delete expired entries as we scan through the list.
@ -1594,7 +1594,7 @@ key_acquire(type, src, dst)
}
DPRINTF(IDL_GROSS_EVENT,("Updating acquire counter, expiration time\n"));
ap->count++;
ap->expiretime = time.tv_sec + maxacquiretime;
ap->expiretime = time_second + maxacquiretime;
}
DPRINTF(IDL_EVENT,("key_acquire: done! success=%d\n",success));
return(success ? 0 : -1);

View File

@ -1,4 +1,4 @@
/* $Id: bootp_subr.c,v 1.11 1998/03/14 04:13:56 tegge Exp $ */
/* $Id: bootp_subr.c,v 1.12 1998/03/28 10:33:15 bde Exp $ */
/*
* Copyright (c) 1995 Gordon Ross, Adam Glass
@ -769,8 +769,8 @@ bootpc_init(void)
/*
* Wait until arp entries can be handled.
*/
while (time.tv_sec == 0)
tsleep(&time, PZERO+8, "arpkludge", 10);
while (time_second == 0)
tsleep(&time_second, PZERO+8, "arpkludge", 10);
/*
* Find a network interface.

View File

@ -34,7 +34,7 @@
* SUCH DAMAGE.
*
* @(#)nfs.h 8.4 (Berkeley) 5/1/95
* $Id: nfs.h,v 1.32 1997/10/12 20:25:38 phk Exp $
* $Id: nfs.h,v 1.33 1998/02/01 21:23:29 bde Exp $
*/
#ifndef _NFS_NFS_H_
@ -108,9 +108,9 @@
*/
#define NFS_ATTRTIMEO(np) \
((((np)->n_flag & NMODIFIED) || \
(time.tv_sec - (np)->n_mtime) / 10 < NFS_MINATTRTIMO) ? NFS_MINATTRTIMO : \
((time.tv_sec - (np)->n_mtime) / 10 > NFS_MAXATTRTIMO ? NFS_MAXATTRTIMO : \
(time.tv_sec - (np)->n_mtime) / 10))
(time_second - (np)->n_mtime) / 10 < NFS_MINATTRTIMO) ? NFS_MINATTRTIMO : \
((time_second - (np)->n_mtime) / 10 > NFS_MAXATTRTIMO ? NFS_MAXATTRTIMO : \
(time_second - (np)->n_mtime) / 10))
/*
* Expected allocation sizes for major data structures. If the actual size
@ -571,6 +571,7 @@ extern int nfs_debug;
#endif
u_quad_t nfs_curusec __P((void));
int nfs_init __P((struct vfsconf *vfsp));
int nfs_reply __P((struct nfsreq *));
int nfs_getreq __P((struct nfsrv_descript *,struct nfsd *,int));

View File

@ -34,7 +34,7 @@
* SUCH DAMAGE.
*
* @(#)nfs_subs.c 8.3 (Berkeley) 1/4/94
* $Id: nfs_subs.c,v 1.50 1998/02/04 22:33:15 eivind Exp $
* $Id: nfs_subs.c,v 1.51 1998/02/06 12:13:57 eivind Exp $
*/
/*
@ -558,6 +558,15 @@ LIST_HEAD(nfsnodehashhead, nfsnode);
int nfs_webnamei __P((struct nameidata *, struct vnode *, struct proc *));
u_quad_t
nfs_curusec()
{
struct timeval tv;
getmicrotime(&tv);
return ((u_quad_t)tv.tv_sec * 1000000 + (u_quad_t)tv.tv_usec);
}
/*
* Create the header for an rpc request packet
* The hsiz is the size of the rest of the nfs request header.
@ -1348,7 +1357,7 @@ nfs_loadattrcache(vpp, mdp, dposp, vaper)
} else
np->n_size = vap->va_size;
}
np->n_attrstamp = time.tv_sec;
np->n_attrstamp = time_second;
if (vaper != NULL) {
bcopy((caddr_t)vap, (caddr_t)vaper, sizeof(*vap));
if (np->n_flag & NCHG) {
@ -1374,7 +1383,7 @@ nfs_getattrcache(vp, vaper)
register struct nfsnode *np = VTONFS(vp);
register struct vattr *vap;
if ((time.tv_sec - np->n_attrstamp) >= NFS_ATTRTIMEO(np)) {
if ((time_second - np->n_attrstamp) >= NFS_ATTRTIMEO(np)) {
nfsstats.attrcache_misses++;
return (ENOENT);
}

View File

@ -34,7 +34,7 @@
* SUCH DAMAGE.
*
* @(#)nfsm_subs.h 8.2 (Berkeley) 3/30/95
* $Id: nfsm_subs.h,v 1.13 1997/07/16 09:06:30 dfr Exp $
* $Id: nfsm_subs.h,v 1.14 1998/02/03 21:51:56 bde Exp $
*/
@ -434,10 +434,12 @@ struct mbuf *nfsm_rpchead __P((struct ucred *cr, int nmflag, int procid,
nfsm_dissect(tl, u_long *, 2 * NFSX_UNSIGNED); \
fxdr_nfsv3time(tl, &(a)->va_atime); \
break; \
case NFSV3SATTRTIME_TOSERVER: \
(a)->va_atime.tv_sec = time.tv_sec; \
(a)->va_atime.tv_nsec = time.tv_usec * 1000; \
break; \
case NFSV3SATTRTIME_TOSERVER: { \
struct timeval tv; \
getmicrotime(&tv); \
(a)->va_atime.tv_sec = tv.tv_sec; \
(a)->va_atime.tv_nsec = tv.tv_usec * 1000; \
break; } \
}; \
nfsm_dissect(tl, u_long *, NFSX_UNSIGNED); \
switch (fxdr_unsigned(int, *tl)) { \
@ -445,10 +447,12 @@ struct mbuf *nfsm_rpchead __P((struct ucred *cr, int nmflag, int procid,
nfsm_dissect(tl, u_long *, 2 * NFSX_UNSIGNED); \
fxdr_nfsv3time(tl, &(a)->va_mtime); \
break; \
case NFSV3SATTRTIME_TOSERVER: \
(a)->va_mtime.tv_sec = time.tv_sec; \
(a)->va_mtime.tv_nsec = time.tv_usec * 1000; \
break; \
case NFSV3SATTRTIME_TOSERVER: { \
struct timeval tv; \
getmicrotime(&tv); \
(a)->va_mtime.tv_sec = tv.tv_sec; \
(a)->va_mtime.tv_nsec = tv.tv_usec * 1000; \
break; } \
}; }
#endif

View File

@ -34,7 +34,7 @@
* SUCH DAMAGE.
*
* @(#)nfs_nqlease.c 8.9 (Berkeley) 5/20/95
* $Id: nfs_nqlease.c,v 1.31 1997/10/28 15:59:03 bde Exp $
* $Id: nfs_nqlease.c,v 1.32 1997/11/07 08:53:23 phk Exp $
*/
@ -407,7 +407,7 @@ nqsrv_instimeq(lp, duration)
register struct nqlease *tlp;
time_t newexpiry;
newexpiry = time.tv_sec + duration + nqsrv_clockskew;
newexpiry = time_second + duration + nqsrv_clockskew;
if (lp->lc_expiry == newexpiry)
return;
if (lp->lc_timer.cqe_next != 0) {
@ -602,7 +602,7 @@ nqsrv_waitfor_expiry(lp)
int len, ok;
tryagain:
if (time.tv_sec > lp->lc_expiry)
if (time_second > lp->lc_expiry)
return;
lph = &lp->lc_host;
lphnext = lp->lc_morehosts;
@ -648,7 +648,7 @@ nqnfs_serverd()
for (lp = nqtimerhead.cqh_first; lp != (void *)&nqtimerhead;
lp = nextlp) {
if (lp->lc_expiry >= time.tv_sec)
if (lp->lc_expiry >= time_second)
break;
nextlp = lp->lc_timer.cqe_next;
if (lp->lc_flag & LC_EXPIREDWANTED) {
@ -883,13 +883,13 @@ nqnfs_getlease(vp, rwflag, cred, p)
nfsm_build(tl, u_long *, 2 * NFSX_UNSIGNED);
*tl++ = txdr_unsigned(rwflag);
*tl = txdr_unsigned(nmp->nm_leaseterm);
reqtime = time.tv_sec;
reqtime = time_second;
nfsm_request(vp, NQNFSPROC_GETLEASE, p, cred);
np = VTONFS(vp);
nfsm_dissect(tl, u_long *, 4 * NFSX_UNSIGNED);
cachable = fxdr_unsigned(int, *tl++);
reqtime += fxdr_unsigned(int, *tl++);
if (reqtime > time.tv_sec) {
if (reqtime > time_second) {
fxdr_hyper(tl, &frev);
nqnfs_clientlease(nmp, np, rwflag, cachable, reqtime, frev);
nfsm_loadattr(vp, (struct vattr *)0);
@ -1089,7 +1089,7 @@ nqnfs_clientd(nmp, cred, ncd, flag, argp, p)
(nmp->nm_flag & NFSMNT_DISMINPROG) == 0) {
vp = NFSTOV(np);
vpid = vp->v_id;
if (np->n_expiry < time.tv_sec) {
if (np->n_expiry < time_second) {
if (vget(vp, LK_EXCLUSIVE, p) == 0) {
nmp->nm_inprog = vp;
if (vpid == vp->v_id) {
@ -1114,7 +1114,7 @@ nqnfs_clientd(nmp, cred, ncd, flag, argp, p)
vrele(vp);
nmp->nm_inprog = NULLVP;
}
} else if ((np->n_expiry - NQ_RENEWAL) < time.tv_sec) {
} else if ((np->n_expiry - NQ_RENEWAL) < time_second) {
if ((np->n_flag & (NQNFSWRITE | NQNFSNONCACHE))
== NQNFSWRITE && vp->v_dirtyblkhd.lh_first &&
vget(vp, LK_EXCLUSIVE, p) == 0) {

View File

@ -34,7 +34,7 @@
* SUCH DAMAGE.
*
* @(#)nfs_serv.c 8.3 (Berkeley) 1/12/94
* $Id: nfs_serv.c,v 1.57 1998/02/06 12:13:56 eivind Exp $
* $Id: nfs_serv.c,v 1.58 1998/02/09 06:10:35 eivind Exp $
*/
/*
@ -979,7 +979,7 @@ nfsrv_writegather(ndp, slp, procp, mrq)
LIST_INIT(&nfsd->nd_coalesce);
nfsd->nd_mreq = NULL;
nfsd->nd_stable = NFSV3WRITE_FILESYNC;
cur_usec = (u_quad_t)time.tv_sec * 1000000 + (u_quad_t)time.tv_usec;
cur_usec = nfs_curusec();
nfsd->nd_time = cur_usec +
(v3 ? nfsrvw_procrastinate_v3 : nfsrvw_procrastinate);
@ -1095,7 +1095,7 @@ nfsrv_writegather(ndp, slp, procp, mrq)
* and generate the associated reply mbuf list(s).
*/
loop1:
cur_usec = (u_quad_t)time.tv_sec * 1000000 + (u_quad_t)time.tv_usec;
cur_usec = nfs_curusec();
s = splsoftclock();
for (nfsd = slp->ns_tq.lh_first; nfsd; nfsd = owp) {
owp = nfsd->nd_tq.le_next;

View File

@ -34,7 +34,7 @@
* SUCH DAMAGE.
*
* @(#)nfs_socket.c 8.5 (Berkeley) 3/30/95
* $Id: nfs_socket.c,v 1.29 1997/10/12 20:25:44 phk Exp $
* $Id: nfs_socket.c,v 1.30 1997/10/28 15:59:07 bde Exp $
*/
/*
@ -769,7 +769,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;
gettime(&rt->tstamp);
getmicrotime(&rt->tstamp);
if (rep->r_flags & R_TIMING)
rt->rtt = rep->r_rtt;
else
@ -952,7 +952,7 @@ nfs_request(vp, mrest, procnum, procp, cred, mrp, mdp, dposp)
TAILQ_INSERT_TAIL(&nfs_reqq, rep, r_chain);
/* Get send time for nqnfs */
reqtime = time.tv_sec;
reqtime = time_second;
/*
* If backing off another request or avoiding congestion, don't
@ -1062,8 +1062,8 @@ nfs_request(vp, mrest, procnum, procp, cred, mrp, mdp, dposp)
error == NFSERR_TRYLATER) {
m_freem(mrep);
error = 0;
waituntil = time.tv_sec + trylater_delay;
while (time.tv_sec < waituntil)
waituntil = time_second + trylater_delay;
while (time_second < waituntil)
(void) tsleep((caddr_t)&lbolt,
PSOCK, "nqnfstry", 0);
trylater_delay *= nfs_backoff[trylater_cnt];
@ -1101,7 +1101,7 @@ nfs_request(vp, mrest, procnum, procp, cred, mrp, mdp, dposp)
nfsm_dissect(tl, u_long *, 4*NFSX_UNSIGNED);
cachable = fxdr_unsigned(int, *tl++);
reqtime += fxdr_unsigned(int, *tl++);
if (reqtime > time.tv_sec) {
if (reqtime > time_second) {
fxdr_hyper(tl, &frev);
nqnfs_clientlease(nmp, np, nqlflag,
cachable, reqtime, frev);
@ -1395,8 +1395,8 @@ nfs_timer(arg)
/*
* Call the nqnfs server timer once a second to handle leases.
*/
if (lasttime != time.tv_sec) {
lasttime = time.tv_sec;
if (lasttime != time_second) {
lasttime = time_second;
nqnfs_serverd();
}
@ -1404,7 +1404,7 @@ nfs_timer(arg)
* Scan the write gathering queues for writes that need to be
* completed now.
*/
cur_usec = (u_quad_t)time.tv_sec * 1000000 + (u_quad_t)time.tv_usec;
cur_usec = nfs_curusec();
for (slp = nfssvc_sockhead.tqh_first; slp != 0;
slp = slp->ns_chain.tqe_next) {
if (slp->ns_tq.lh_first && slp->ns_tq.lh_first->nd_time<=cur_usec)
@ -2125,7 +2125,7 @@ nfs_getreq(nd, nfsd, has_header)
tvout.tv_sec = fxdr_unsigned(long, tvout.tv_sec);
tvout.tv_usec = fxdr_unsigned(long, tvout.tv_usec);
if (nuidp->nu_expire < time.tv_sec ||
if (nuidp->nu_expire < time_second ||
nuidp->nu_timestamp.tv_sec > tvout.tv_sec ||
(nuidp->nu_timestamp.tv_sec == tvout.tv_sec &&
nuidp->nu_timestamp.tv_usec > tvout.tv_usec)) {

View File

@ -34,7 +34,7 @@
* SUCH DAMAGE.
*
* @(#)nfs_subs.c 8.3 (Berkeley) 1/4/94
* $Id: nfs_subs.c,v 1.50 1998/02/04 22:33:15 eivind Exp $
* $Id: nfs_subs.c,v 1.51 1998/02/06 12:13:57 eivind Exp $
*/
/*
@ -558,6 +558,15 @@ LIST_HEAD(nfsnodehashhead, nfsnode);
int nfs_webnamei __P((struct nameidata *, struct vnode *, struct proc *));
u_quad_t
nfs_curusec()
{
struct timeval tv;
getmicrotime(&tv);
return ((u_quad_t)tv.tv_sec * 1000000 + (u_quad_t)tv.tv_usec);
}
/*
* Create the header for an rpc request packet
* The hsiz is the size of the rest of the nfs request header.
@ -1348,7 +1357,7 @@ nfs_loadattrcache(vpp, mdp, dposp, vaper)
} else
np->n_size = vap->va_size;
}
np->n_attrstamp = time.tv_sec;
np->n_attrstamp = time_second;
if (vaper != NULL) {
bcopy((caddr_t)vap, (caddr_t)vaper, sizeof(*vap));
if (np->n_flag & NCHG) {
@ -1374,7 +1383,7 @@ nfs_getattrcache(vp, vaper)
register struct nfsnode *np = VTONFS(vp);
register struct vattr *vap;
if ((time.tv_sec - np->n_attrstamp) >= NFS_ATTRTIMEO(np)) {
if ((time_second - np->n_attrstamp) >= NFS_ATTRTIMEO(np)) {
nfsstats.attrcache_misses++;
return (ENOENT);
}

View File

@ -34,7 +34,7 @@
* SUCH DAMAGE.
*
* @(#)nfs_syscalls.c 8.5 (Berkeley) 3/30/95
* $Id: nfs_syscalls.c,v 1.35 1998/02/06 12:13:57 eivind Exp $
* $Id: nfs_syscalls.c,v 1.36 1998/02/09 06:10:37 eivind Exp $
*/
#include <sys/param.h>
@ -300,7 +300,7 @@ nfssvc(p, uap)
nuidp->nu_cr.cr_ngroups = NGROUPS;
nuidp->nu_cr.cr_ref = 1;
nuidp->nu_timestamp = nsd->nsd_timestamp;
nuidp->nu_expire = time.tv_sec + nsd->nsd_ttl;
nuidp->nu_expire = time_second + nsd->nsd_ttl;
/*
* and save the session key in nu_key.
*/
@ -520,8 +520,7 @@ nfssvc_nfsd(nsd, argp, p)
nfs_sndunlock(&slp->ns_solock);
}
error = nfsrv_dorec(slp, nfsd, &nd);
cur_usec = (u_quad_t)time.tv_sec * 1000000 +
(u_quad_t)time.tv_usec;
cur_usec = nfs_curusec();
if (error && slp->ns_tq.lh_first &&
slp->ns_tq.lh_first->nd_time <= cur_usec) {
error = 0;
@ -553,7 +552,7 @@ nfssvc_nfsd(nsd, argp, p)
else
solockp = (int *)0;
if (nd) {
gettime(&nd->nd_starttime);
getmicrotime(&nd->nd_starttime);
if (nd->nd_nam2)
nd->nd_nam = nd->nd_nam2;
else
@ -583,9 +582,9 @@ nfssvc_nfsd(nsd, argp, p)
* Check for just starting up for NQNFS and send
* fake "try again later" replies to the NQNFS clients.
*/
if (notstarted && nqnfsstarttime <= time.tv_sec) {
if (notstarted && nqnfsstarttime <= time_second) {
if (modify_flag) {
nqnfsstarttime = time.tv_sec + nqsrv_writeslack;
nqnfsstarttime = time_second + nqsrv_writeslack;
modify_flag = 0;
} else
notstarted = 0;
@ -718,8 +717,7 @@ nfssvc_nfsd(nsd, argp, p)
* Check to see if there are outstanding writes that
* need to be serviced.
*/
cur_usec = (u_quad_t)time.tv_sec * 1000000 +
(u_quad_t)time.tv_usec;
cur_usec = nfs_curusec();
s = splsoftclock();
if (slp->ns_tq.lh_first &&
slp->ns_tq.lh_first->nd_time <= cur_usec) {
@ -972,7 +970,7 @@ nfs_getnickauth(nmp, cred, auth_str, auth_len, verf_str, verf_len)
if (nuidp->nu_cr.cr_uid == cred->cr_uid)
break;
}
if (!nuidp || nuidp->nu_expire < time.tv_sec)
if (!nuidp || nuidp->nu_expire < time_second)
return (EACCES);
/*
@ -992,10 +990,10 @@ nfs_getnickauth(nmp, cred, auth_str, auth_len, verf_str, verf_len)
*/
verfp = (u_long *)verf_str;
*verfp++ = txdr_unsigned(RPCAKN_NICKNAME);
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))
gettime(&nuidp->nu_timestamp);
if (time_second > nuidp->nu_timestamp.tv_sec ||
(time_second == nuidp->nu_timestamp.tv_sec &&
time_second > nuidp->nu_timestamp.tv_usec))
getmicrotime(&nuidp->nu_timestamp);
else
nuidp->nu_timestamp.tv_usec++;
ktvin.tv_sec = txdr_unsigned(nuidp->nu_timestamp.tv_sec);
@ -1051,7 +1049,7 @@ nfs_savenickauth(nmp, cred, len, key, mdp, dposp, mrep)
#endif
ktvout.tv_sec = fxdr_unsigned(long, ktvout.tv_sec);
ktvout.tv_usec = fxdr_unsigned(long, ktvout.tv_usec);
deltasec = time.tv_sec - ktvout.tv_sec;
deltasec = time_second - ktvout.tv_sec;
if (deltasec < 0)
deltasec = -deltasec;
/*
@ -1071,7 +1069,7 @@ nfs_savenickauth(nmp, cred, len, key, mdp, dposp, mrep)
}
nuidp->nu_flag = 0;
nuidp->nu_cr.cr_uid = cred->cr_uid;
nuidp->nu_expire = time.tv_sec + NFS_KERBTTL;
nuidp->nu_expire = time_second + NFS_KERBTTL;
nuidp->nu_timestamp = ktvout;
nuidp->nu_nickname = nick;
bcopy(key, nuidp->nu_key, sizeof (key));
@ -1184,9 +1182,8 @@ nfsd_rt(sotype, nd, cacherep)
rt->ipadr = ((struct sockaddr_in *)nd->nd_nam)->sin_addr.s_addr;
else
rt->ipadr = INADDR_ANY;
rt->resptime = ((time.tv_sec - nd->nd_starttime.tv_sec) * 1000000) +
(time.tv_usec - nd->nd_starttime.tv_usec);
gettime(&rt->tstamp);
rt->resptime = nfs_curusec() - (nd->nd_starttime.tv_sec * 1000000 + nd->nd_starttime.tv_usec);
getmicrotime(&rt->tstamp);
nfsdrt.pos = (nfsdrt.pos + 1) % NFSRTTLOGSIZ;
}
#endif /* NFS_NOSERVER */

View File

@ -34,7 +34,7 @@
* SUCH DAMAGE.
*
* @(#)nfs_vfsops.c 8.12 (Berkeley) 5/20/95
* $Id: nfs_vfsops.c,v 1.55 1998/03/01 22:46:30 msmith Exp $
* $Id: nfs_vfsops.c,v 1.56 1998/03/14 03:25:18 tegge Exp $
*/
#include <sys/param.h>
@ -399,8 +399,8 @@ nfs_mountroot(mp)
* XXX time must be non-zero when we init the interface or else
* the arp code will wedge...
*/
while (time.tv_sec == 0)
tsleep(&time, PZERO+8, "arpkludge", 10);
while (time_second == 0)
tsleep(&time_second, PZERO+8, "arpkludge", 10);
if (nfs_diskless_valid==1)
nfs_convert_diskless();

View File

@ -34,7 +34,7 @@
* SUCH DAMAGE.
*
* @(#)nfs_vnops.c 8.16 (Berkeley) 5/27/95
* $Id: nfs_vnops.c,v 1.81 1998/03/08 09:57:57 julian Exp $
* $Id: nfs_vnops.c,v 1.82 1998/03/28 12:04:40 bde Exp $
*/
@ -694,7 +694,7 @@ nfs_setattrrpc(vp, vap, cred, procp)
*tl = nfs_false;
}
if (vap->va_atime.tv_sec != VNOVAL) {
if (vap->va_atime.tv_sec != time.tv_sec) {
if (vap->va_atime.tv_sec != time_second) {
nfsm_build(tl, u_long *, 3 * NFSX_UNSIGNED);
*tl++ = txdr_unsigned(NFSV3SATTRTIME_TOCLIENT);
txdr_nfsv3time(&vap->va_atime, tl);
@ -707,7 +707,7 @@ nfs_setattrrpc(vp, vap, cred, procp)
*tl = txdr_unsigned(NFSV3SATTRTIME_DONTCHANGE);
}
if (vap->va_mtime.tv_sec != VNOVAL) {
if (vap->va_mtime.tv_sec != time.tv_sec) {
if (vap->va_mtime.tv_sec != time_second) {
nfsm_build(tl, u_long *, 3 * NFSX_UNSIGNED);
*tl++ = txdr_unsigned(NFSV3SATTRTIME_TOCLIENT);
txdr_nfsv3time(&vap->va_mtime, tl);
@ -3146,7 +3146,7 @@ nfsspec_read(ap)
* Set access flag.
*/
np->n_flag |= NACC;
gettime(&tv);
getmicrotime(&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));
@ -3171,7 +3171,7 @@ nfsspec_write(ap)
* Set update flag.
*/
np->n_flag |= NUPD;
gettime(&tv);
getmicrotime(&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));
@ -3229,7 +3229,7 @@ nfsfifo_read(ap)
* Set access flag.
*/
np->n_flag |= NACC;
gettime(&tv);
getmicrotime(&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));
@ -3254,7 +3254,7 @@ nfsfifo_write(ap)
* Set update flag.
*/
np->n_flag |= NUPD;
gettime(&tv);
getmicrotime(&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));
@ -3280,7 +3280,7 @@ nfsfifo_close(ap)
struct vattr vattr;
if (np->n_flag & (NACC | NUPD)) {
gettime(&tv);
getmicrotime(&tv);
if (np->n_flag & NACC) {
np->n_atim.tv_sec = tv.tv_sec;
np->n_atim.tv_nsec = tv.tv_usec * 1000;

View File

@ -34,7 +34,7 @@
* SUCH DAMAGE.
*
* @(#)nfsm_subs.h 8.2 (Berkeley) 3/30/95
* $Id: nfsm_subs.h,v 1.13 1997/07/16 09:06:30 dfr Exp $
* $Id: nfsm_subs.h,v 1.14 1998/02/03 21:51:56 bde Exp $
*/
@ -434,10 +434,12 @@ struct mbuf *nfsm_rpchead __P((struct ucred *cr, int nmflag, int procid,
nfsm_dissect(tl, u_long *, 2 * NFSX_UNSIGNED); \
fxdr_nfsv3time(tl, &(a)->va_atime); \
break; \
case NFSV3SATTRTIME_TOSERVER: \
(a)->va_atime.tv_sec = time.tv_sec; \
(a)->va_atime.tv_nsec = time.tv_usec * 1000; \
break; \
case NFSV3SATTRTIME_TOSERVER: { \
struct timeval tv; \
getmicrotime(&tv); \
(a)->va_atime.tv_sec = tv.tv_sec; \
(a)->va_atime.tv_nsec = tv.tv_usec * 1000; \
break; } \
}; \
nfsm_dissect(tl, u_long *, NFSX_UNSIGNED); \
switch (fxdr_unsigned(int, *tl)) { \
@ -445,10 +447,12 @@ struct mbuf *nfsm_rpchead __P((struct ucred *cr, int nmflag, int procid,
nfsm_dissect(tl, u_long *, 2 * NFSX_UNSIGNED); \
fxdr_nfsv3time(tl, &(a)->va_mtime); \
break; \
case NFSV3SATTRTIME_TOSERVER: \
(a)->va_mtime.tv_sec = time.tv_sec; \
(a)->va_mtime.tv_nsec = time.tv_usec * 1000; \
break; \
case NFSV3SATTRTIME_TOSERVER: { \
struct timeval tv; \
getmicrotime(&tv); \
(a)->va_mtime.tv_sec = tv.tv_sec; \
(a)->va_mtime.tv_nsec = tv.tv_usec * 1000; \
break; } \
}; }
#endif

View File

@ -34,7 +34,7 @@
* SUCH DAMAGE.
*
* @(#)nqnfs.h 8.3 (Berkeley) 3/30/95
* $Id: nqnfs.h,v 1.13 1997/02/22 09:42:52 peter Exp $
* $Id: nqnfs.h,v 1.14 1997/08/16 19:16:05 wollman Exp $
*/
@ -161,20 +161,20 @@ struct nqm {
* Client side macros that check for a valid lease.
*/
#define NQNFS_CKINVALID(v, n, f) \
((time.tv_sec > (n)->n_expiry && \
((time_second > (n)->n_expiry && \
VFSTONFS((v)->v_mount)->nm_timeouts < VFSTONFS((v)->v_mount)->nm_deadthresh) \
|| ((f) == ND_WRITE && ((n)->n_flag & NQNFSWRITE) == 0))
#define NQNFS_CKCACHABLE(v, f) \
((time.tv_sec <= VTONFS(v)->n_expiry || \
((time_second <= VTONFS(v)->n_expiry || \
VFSTONFS((v)->v_mount)->nm_timeouts >= VFSTONFS((v)->v_mount)->nm_deadthresh) \
&& (VTONFS(v)->n_flag & NQNFSNONCACHE) == 0 && \
((f) == ND_READ || (VTONFS(v)->n_flag & NQNFSWRITE)))
#define NQNFS_NEEDLEASE(v, p) \
(time.tv_sec > VTONFS(v)->n_expiry ? \
(time_second > VTONFS(v)->n_expiry ? \
((VTONFS(v)->n_flag & NQNFSEVICTED) ? 0 : nqnfs_piggy[p]) : \
(((time.tv_sec + NQ_RENEWAL) > VTONFS(v)->n_expiry && \
(((time_second + NQ_RENEWAL) > VTONFS(v)->n_expiry && \
nqnfs_piggy[p]) ? \
((VTONFS(v)->n_flag & NQNFSWRITE) ? \
ND_WRITE : nqnfs_piggy[p]) : 0))

View File

@ -1,4 +1,4 @@
/* $Id: bootp_subr.c,v 1.11 1998/03/14 04:13:56 tegge Exp $ */
/* $Id: bootp_subr.c,v 1.12 1998/03/28 10:33:15 bde Exp $ */
/*
* Copyright (c) 1995 Gordon Ross, Adam Glass
@ -769,8 +769,8 @@ bootpc_init(void)
/*
* Wait until arp entries can be handled.
*/
while (time.tv_sec == 0)
tsleep(&time, PZERO+8, "arpkludge", 10);
while (time_second == 0)
tsleep(&time_second, PZERO+8, "arpkludge", 10);
/*
* Find a network interface.

View File

@ -34,7 +34,7 @@
* SUCH DAMAGE.
*
* @(#)nfs.h 8.4 (Berkeley) 5/1/95
* $Id: nfs.h,v 1.32 1997/10/12 20:25:38 phk Exp $
* $Id: nfs.h,v 1.33 1998/02/01 21:23:29 bde Exp $
*/
#ifndef _NFS_NFS_H_
@ -108,9 +108,9 @@
*/
#define NFS_ATTRTIMEO(np) \
((((np)->n_flag & NMODIFIED) || \
(time.tv_sec - (np)->n_mtime) / 10 < NFS_MINATTRTIMO) ? NFS_MINATTRTIMO : \
((time.tv_sec - (np)->n_mtime) / 10 > NFS_MAXATTRTIMO ? NFS_MAXATTRTIMO : \
(time.tv_sec - (np)->n_mtime) / 10))
(time_second - (np)->n_mtime) / 10 < NFS_MINATTRTIMO) ? NFS_MINATTRTIMO : \
((time_second - (np)->n_mtime) / 10 > NFS_MAXATTRTIMO ? NFS_MAXATTRTIMO : \
(time_second - (np)->n_mtime) / 10))
/*
* Expected allocation sizes for major data structures. If the actual size
@ -571,6 +571,7 @@ extern int nfs_debug;
#endif
u_quad_t nfs_curusec __P((void));
int nfs_init __P((struct vfsconf *vfsp));
int nfs_reply __P((struct nfsreq *));
int nfs_getreq __P((struct nfsrv_descript *,struct nfsd *,int));

View File

@ -34,7 +34,7 @@
* SUCH DAMAGE.
*
* @(#)nfs_syscalls.c 8.5 (Berkeley) 3/30/95
* $Id: nfs_syscalls.c,v 1.35 1998/02/06 12:13:57 eivind Exp $
* $Id: nfs_syscalls.c,v 1.36 1998/02/09 06:10:37 eivind Exp $
*/
#include <sys/param.h>
@ -300,7 +300,7 @@ nfssvc(p, uap)
nuidp->nu_cr.cr_ngroups = NGROUPS;
nuidp->nu_cr.cr_ref = 1;
nuidp->nu_timestamp = nsd->nsd_timestamp;
nuidp->nu_expire = time.tv_sec + nsd->nsd_ttl;
nuidp->nu_expire = time_second + nsd->nsd_ttl;
/*
* and save the session key in nu_key.
*/
@ -520,8 +520,7 @@ nfssvc_nfsd(nsd, argp, p)
nfs_sndunlock(&slp->ns_solock);
}
error = nfsrv_dorec(slp, nfsd, &nd);
cur_usec = (u_quad_t)time.tv_sec * 1000000 +
(u_quad_t)time.tv_usec;
cur_usec = nfs_curusec();
if (error && slp->ns_tq.lh_first &&
slp->ns_tq.lh_first->nd_time <= cur_usec) {
error = 0;
@ -553,7 +552,7 @@ nfssvc_nfsd(nsd, argp, p)
else
solockp = (int *)0;
if (nd) {
gettime(&nd->nd_starttime);
getmicrotime(&nd->nd_starttime);
if (nd->nd_nam2)
nd->nd_nam = nd->nd_nam2;
else
@ -583,9 +582,9 @@ nfssvc_nfsd(nsd, argp, p)
* Check for just starting up for NQNFS and send
* fake "try again later" replies to the NQNFS clients.
*/
if (notstarted && nqnfsstarttime <= time.tv_sec) {
if (notstarted && nqnfsstarttime <= time_second) {
if (modify_flag) {
nqnfsstarttime = time.tv_sec + nqsrv_writeslack;
nqnfsstarttime = time_second + nqsrv_writeslack;
modify_flag = 0;
} else
notstarted = 0;
@ -718,8 +717,7 @@ nfssvc_nfsd(nsd, argp, p)
* Check to see if there are outstanding writes that
* need to be serviced.
*/
cur_usec = (u_quad_t)time.tv_sec * 1000000 +
(u_quad_t)time.tv_usec;
cur_usec = nfs_curusec();
s = splsoftclock();
if (slp->ns_tq.lh_first &&
slp->ns_tq.lh_first->nd_time <= cur_usec) {
@ -972,7 +970,7 @@ nfs_getnickauth(nmp, cred, auth_str, auth_len, verf_str, verf_len)
if (nuidp->nu_cr.cr_uid == cred->cr_uid)
break;
}
if (!nuidp || nuidp->nu_expire < time.tv_sec)
if (!nuidp || nuidp->nu_expire < time_second)
return (EACCES);
/*
@ -992,10 +990,10 @@ nfs_getnickauth(nmp, cred, auth_str, auth_len, verf_str, verf_len)
*/
verfp = (u_long *)verf_str;
*verfp++ = txdr_unsigned(RPCAKN_NICKNAME);
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))
gettime(&nuidp->nu_timestamp);
if (time_second > nuidp->nu_timestamp.tv_sec ||
(time_second == nuidp->nu_timestamp.tv_sec &&
time_second > nuidp->nu_timestamp.tv_usec))
getmicrotime(&nuidp->nu_timestamp);
else
nuidp->nu_timestamp.tv_usec++;
ktvin.tv_sec = txdr_unsigned(nuidp->nu_timestamp.tv_sec);
@ -1051,7 +1049,7 @@ nfs_savenickauth(nmp, cred, len, key, mdp, dposp, mrep)
#endif
ktvout.tv_sec = fxdr_unsigned(long, ktvout.tv_sec);
ktvout.tv_usec = fxdr_unsigned(long, ktvout.tv_usec);
deltasec = time.tv_sec - ktvout.tv_sec;
deltasec = time_second - ktvout.tv_sec;
if (deltasec < 0)
deltasec = -deltasec;
/*
@ -1071,7 +1069,7 @@ nfs_savenickauth(nmp, cred, len, key, mdp, dposp, mrep)
}
nuidp->nu_flag = 0;
nuidp->nu_cr.cr_uid = cred->cr_uid;
nuidp->nu_expire = time.tv_sec + NFS_KERBTTL;
nuidp->nu_expire = time_second + NFS_KERBTTL;
nuidp->nu_timestamp = ktvout;
nuidp->nu_nickname = nick;
bcopy(key, nuidp->nu_key, sizeof (key));
@ -1184,9 +1182,8 @@ nfsd_rt(sotype, nd, cacherep)
rt->ipadr = ((struct sockaddr_in *)nd->nd_nam)->sin_addr.s_addr;
else
rt->ipadr = INADDR_ANY;
rt->resptime = ((time.tv_sec - nd->nd_starttime.tv_sec) * 1000000) +
(time.tv_usec - nd->nd_starttime.tv_usec);
gettime(&rt->tstamp);
rt->resptime = nfs_curusec() - (nd->nd_starttime.tv_sec * 1000000 + nd->nd_starttime.tv_usec);
getmicrotime(&rt->tstamp);
nfsdrt.pos = (nfsdrt.pos + 1) % NFSRTTLOGSIZ;
}
#endif /* NFS_NOSERVER */

View File

@ -34,7 +34,7 @@
* SUCH DAMAGE.
*
* @(#)nfs_socket.c 8.5 (Berkeley) 3/30/95
* $Id: nfs_socket.c,v 1.29 1997/10/12 20:25:44 phk Exp $
* $Id: nfs_socket.c,v 1.30 1997/10/28 15:59:07 bde Exp $
*/
/*
@ -769,7 +769,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;
gettime(&rt->tstamp);
getmicrotime(&rt->tstamp);
if (rep->r_flags & R_TIMING)
rt->rtt = rep->r_rtt;
else
@ -952,7 +952,7 @@ nfs_request(vp, mrest, procnum, procp, cred, mrp, mdp, dposp)
TAILQ_INSERT_TAIL(&nfs_reqq, rep, r_chain);
/* Get send time for nqnfs */
reqtime = time.tv_sec;
reqtime = time_second;
/*
* If backing off another request or avoiding congestion, don't
@ -1062,8 +1062,8 @@ nfs_request(vp, mrest, procnum, procp, cred, mrp, mdp, dposp)
error == NFSERR_TRYLATER) {
m_freem(mrep);
error = 0;
waituntil = time.tv_sec + trylater_delay;
while (time.tv_sec < waituntil)
waituntil = time_second + trylater_delay;
while (time_second < waituntil)
(void) tsleep((caddr_t)&lbolt,
PSOCK, "nqnfstry", 0);
trylater_delay *= nfs_backoff[trylater_cnt];
@ -1101,7 +1101,7 @@ nfs_request(vp, mrest, procnum, procp, cred, mrp, mdp, dposp)
nfsm_dissect(tl, u_long *, 4*NFSX_UNSIGNED);
cachable = fxdr_unsigned(int, *tl++);
reqtime += fxdr_unsigned(int, *tl++);
if (reqtime > time.tv_sec) {
if (reqtime > time_second) {
fxdr_hyper(tl, &frev);
nqnfs_clientlease(nmp, np, nqlflag,
cachable, reqtime, frev);
@ -1395,8 +1395,8 @@ nfs_timer(arg)
/*
* Call the nqnfs server timer once a second to handle leases.
*/
if (lasttime != time.tv_sec) {
lasttime = time.tv_sec;
if (lasttime != time_second) {
lasttime = time_second;
nqnfs_serverd();
}
@ -1404,7 +1404,7 @@ nfs_timer(arg)
* Scan the write gathering queues for writes that need to be
* completed now.
*/
cur_usec = (u_quad_t)time.tv_sec * 1000000 + (u_quad_t)time.tv_usec;
cur_usec = nfs_curusec();
for (slp = nfssvc_sockhead.tqh_first; slp != 0;
slp = slp->ns_chain.tqe_next) {
if (slp->ns_tq.lh_first && slp->ns_tq.lh_first->nd_time<=cur_usec)
@ -2125,7 +2125,7 @@ nfs_getreq(nd, nfsd, has_header)
tvout.tv_sec = fxdr_unsigned(long, tvout.tv_sec);
tvout.tv_usec = fxdr_unsigned(long, tvout.tv_usec);
if (nuidp->nu_expire < time.tv_sec ||
if (nuidp->nu_expire < time_second ||
nuidp->nu_timestamp.tv_sec > tvout.tv_sec ||
(nuidp->nu_timestamp.tv_sec == tvout.tv_sec &&
nuidp->nu_timestamp.tv_usec > tvout.tv_usec)) {

View File

@ -34,7 +34,7 @@
* SUCH DAMAGE.
*
* @(#)nfs_subs.c 8.3 (Berkeley) 1/4/94
* $Id: nfs_subs.c,v 1.50 1998/02/04 22:33:15 eivind Exp $
* $Id: nfs_subs.c,v 1.51 1998/02/06 12:13:57 eivind Exp $
*/
/*
@ -558,6 +558,15 @@ LIST_HEAD(nfsnodehashhead, nfsnode);
int nfs_webnamei __P((struct nameidata *, struct vnode *, struct proc *));
u_quad_t
nfs_curusec()
{
struct timeval tv;
getmicrotime(&tv);
return ((u_quad_t)tv.tv_sec * 1000000 + (u_quad_t)tv.tv_usec);
}
/*
* Create the header for an rpc request packet
* The hsiz is the size of the rest of the nfs request header.
@ -1348,7 +1357,7 @@ nfs_loadattrcache(vpp, mdp, dposp, vaper)
} else
np->n_size = vap->va_size;
}
np->n_attrstamp = time.tv_sec;
np->n_attrstamp = time_second;
if (vaper != NULL) {
bcopy((caddr_t)vap, (caddr_t)vaper, sizeof(*vap));
if (np->n_flag & NCHG) {
@ -1374,7 +1383,7 @@ nfs_getattrcache(vp, vaper)
register struct nfsnode *np = VTONFS(vp);
register struct vattr *vap;
if ((time.tv_sec - np->n_attrstamp) >= NFS_ATTRTIMEO(np)) {
if ((time_second - np->n_attrstamp) >= NFS_ATTRTIMEO(np)) {
nfsstats.attrcache_misses++;
return (ENOENT);
}

View File

@ -34,7 +34,7 @@
* SUCH DAMAGE.
*
* @(#)nfs_vfsops.c 8.12 (Berkeley) 5/20/95
* $Id: nfs_vfsops.c,v 1.55 1998/03/01 22:46:30 msmith Exp $
* $Id: nfs_vfsops.c,v 1.56 1998/03/14 03:25:18 tegge Exp $
*/
#include <sys/param.h>
@ -399,8 +399,8 @@ nfs_mountroot(mp)
* XXX time must be non-zero when we init the interface or else
* the arp code will wedge...
*/
while (time.tv_sec == 0)
tsleep(&time, PZERO+8, "arpkludge", 10);
while (time_second == 0)
tsleep(&time_second, PZERO+8, "arpkludge", 10);
if (nfs_diskless_valid==1)
nfs_convert_diskless();

View File

@ -34,7 +34,7 @@
* SUCH DAMAGE.
*
* @(#)nfs_vnops.c 8.16 (Berkeley) 5/27/95
* $Id: nfs_vnops.c,v 1.81 1998/03/08 09:57:57 julian Exp $
* $Id: nfs_vnops.c,v 1.82 1998/03/28 12:04:40 bde Exp $
*/
@ -694,7 +694,7 @@ nfs_setattrrpc(vp, vap, cred, procp)
*tl = nfs_false;
}
if (vap->va_atime.tv_sec != VNOVAL) {
if (vap->va_atime.tv_sec != time.tv_sec) {
if (vap->va_atime.tv_sec != time_second) {
nfsm_build(tl, u_long *, 3 * NFSX_UNSIGNED);
*tl++ = txdr_unsigned(NFSV3SATTRTIME_TOCLIENT);
txdr_nfsv3time(&vap->va_atime, tl);
@ -707,7 +707,7 @@ nfs_setattrrpc(vp, vap, cred, procp)
*tl = txdr_unsigned(NFSV3SATTRTIME_DONTCHANGE);
}
if (vap->va_mtime.tv_sec != VNOVAL) {
if (vap->va_mtime.tv_sec != time.tv_sec) {
if (vap->va_mtime.tv_sec != time_second) {
nfsm_build(tl, u_long *, 3 * NFSX_UNSIGNED);
*tl++ = txdr_unsigned(NFSV3SATTRTIME_TOCLIENT);
txdr_nfsv3time(&vap->va_mtime, tl);
@ -3146,7 +3146,7 @@ nfsspec_read(ap)
* Set access flag.
*/
np->n_flag |= NACC;
gettime(&tv);
getmicrotime(&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));
@ -3171,7 +3171,7 @@ nfsspec_write(ap)
* Set update flag.
*/
np->n_flag |= NUPD;
gettime(&tv);
getmicrotime(&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));
@ -3229,7 +3229,7 @@ nfsfifo_read(ap)
* Set access flag.
*/
np->n_flag |= NACC;
gettime(&tv);
getmicrotime(&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));
@ -3254,7 +3254,7 @@ nfsfifo_write(ap)
* Set update flag.
*/
np->n_flag |= NUPD;
gettime(&tv);
getmicrotime(&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));
@ -3280,7 +3280,7 @@ nfsfifo_close(ap)
struct vattr vattr;
if (np->n_flag & (NACC | NUPD)) {
gettime(&tv);
getmicrotime(&tv);
if (np->n_flag & NACC) {
np->n_atim.tv_sec = tv.tv_sec;
np->n_atim.tv_nsec = tv.tv_usec * 1000;

View File

@ -34,7 +34,7 @@
* SUCH DAMAGE.
*
* @(#)nfs.h 8.4 (Berkeley) 5/1/95
* $Id: nfs.h,v 1.32 1997/10/12 20:25:38 phk Exp $
* $Id: nfs.h,v 1.33 1998/02/01 21:23:29 bde Exp $
*/
#ifndef _NFS_NFS_H_
@ -108,9 +108,9 @@
*/
#define NFS_ATTRTIMEO(np) \
((((np)->n_flag & NMODIFIED) || \
(time.tv_sec - (np)->n_mtime) / 10 < NFS_MINATTRTIMO) ? NFS_MINATTRTIMO : \
((time.tv_sec - (np)->n_mtime) / 10 > NFS_MAXATTRTIMO ? NFS_MAXATTRTIMO : \
(time.tv_sec - (np)->n_mtime) / 10))
(time_second - (np)->n_mtime) / 10 < NFS_MINATTRTIMO) ? NFS_MINATTRTIMO : \
((time_second - (np)->n_mtime) / 10 > NFS_MAXATTRTIMO ? NFS_MAXATTRTIMO : \
(time_second - (np)->n_mtime) / 10))
/*
* Expected allocation sizes for major data structures. If the actual size
@ -571,6 +571,7 @@ extern int nfs_debug;
#endif
u_quad_t nfs_curusec __P((void));
int nfs_init __P((struct vfsconf *vfsp));
int nfs_reply __P((struct nfsreq *));
int nfs_getreq __P((struct nfsrv_descript *,struct nfsd *,int));

View File

@ -34,7 +34,7 @@
* SUCH DAMAGE.
*
* @(#)nfsm_subs.h 8.2 (Berkeley) 3/30/95
* $Id: nfsm_subs.h,v 1.13 1997/07/16 09:06:30 dfr Exp $
* $Id: nfsm_subs.h,v 1.14 1998/02/03 21:51:56 bde Exp $
*/
@ -434,10 +434,12 @@ struct mbuf *nfsm_rpchead __P((struct ucred *cr, int nmflag, int procid,
nfsm_dissect(tl, u_long *, 2 * NFSX_UNSIGNED); \
fxdr_nfsv3time(tl, &(a)->va_atime); \
break; \
case NFSV3SATTRTIME_TOSERVER: \
(a)->va_atime.tv_sec = time.tv_sec; \
(a)->va_atime.tv_nsec = time.tv_usec * 1000; \
break; \
case NFSV3SATTRTIME_TOSERVER: { \
struct timeval tv; \
getmicrotime(&tv); \
(a)->va_atime.tv_sec = tv.tv_sec; \
(a)->va_atime.tv_nsec = tv.tv_usec * 1000; \
break; } \
}; \
nfsm_dissect(tl, u_long *, NFSX_UNSIGNED); \
switch (fxdr_unsigned(int, *tl)) { \
@ -445,10 +447,12 @@ struct mbuf *nfsm_rpchead __P((struct ucred *cr, int nmflag, int procid,
nfsm_dissect(tl, u_long *, 2 * NFSX_UNSIGNED); \
fxdr_nfsv3time(tl, &(a)->va_mtime); \
break; \
case NFSV3SATTRTIME_TOSERVER: \
(a)->va_mtime.tv_sec = time.tv_sec; \
(a)->va_mtime.tv_nsec = time.tv_usec * 1000; \
break; \
case NFSV3SATTRTIME_TOSERVER: { \
struct timeval tv; \
getmicrotime(&tv); \
(a)->va_mtime.tv_sec = tv.tv_sec; \
(a)->va_mtime.tv_nsec = tv.tv_usec * 1000; \
break; } \
}; }
#endif

View File

@ -34,7 +34,7 @@
* SUCH DAMAGE.
*
* @(#)nfs.h 8.4 (Berkeley) 5/1/95
* $Id: nfs.h,v 1.32 1997/10/12 20:25:38 phk Exp $
* $Id: nfs.h,v 1.33 1998/02/01 21:23:29 bde Exp $
*/
#ifndef _NFS_NFS_H_
@ -108,9 +108,9 @@
*/
#define NFS_ATTRTIMEO(np) \
((((np)->n_flag & NMODIFIED) || \
(time.tv_sec - (np)->n_mtime) / 10 < NFS_MINATTRTIMO) ? NFS_MINATTRTIMO : \
((time.tv_sec - (np)->n_mtime) / 10 > NFS_MAXATTRTIMO ? NFS_MAXATTRTIMO : \
(time.tv_sec - (np)->n_mtime) / 10))
(time_second - (np)->n_mtime) / 10 < NFS_MINATTRTIMO) ? NFS_MINATTRTIMO : \
((time_second - (np)->n_mtime) / 10 > NFS_MAXATTRTIMO ? NFS_MAXATTRTIMO : \
(time_second - (np)->n_mtime) / 10))
/*
* Expected allocation sizes for major data structures. If the actual size
@ -571,6 +571,7 @@ extern int nfs_debug;
#endif
u_quad_t nfs_curusec __P((void));
int nfs_init __P((struct vfsconf *vfsp));
int nfs_reply __P((struct nfsreq *));
int nfs_getreq __P((struct nfsrv_descript *,struct nfsd *,int));

View File

@ -34,7 +34,7 @@
* SUCH DAMAGE.
*
* @(#)nfs.h 8.4 (Berkeley) 5/1/95
* $Id: nfs.h,v 1.32 1997/10/12 20:25:38 phk Exp $
* $Id: nfs.h,v 1.33 1998/02/01 21:23:29 bde Exp $
*/
#ifndef _NFS_NFS_H_
@ -108,9 +108,9 @@
*/
#define NFS_ATTRTIMEO(np) \
((((np)->n_flag & NMODIFIED) || \
(time.tv_sec - (np)->n_mtime) / 10 < NFS_MINATTRTIMO) ? NFS_MINATTRTIMO : \
((time.tv_sec - (np)->n_mtime) / 10 > NFS_MAXATTRTIMO ? NFS_MAXATTRTIMO : \
(time.tv_sec - (np)->n_mtime) / 10))
(time_second - (np)->n_mtime) / 10 < NFS_MINATTRTIMO) ? NFS_MINATTRTIMO : \
((time_second - (np)->n_mtime) / 10 > NFS_MAXATTRTIMO ? NFS_MAXATTRTIMO : \
(time_second - (np)->n_mtime) / 10))
/*
* Expected allocation sizes for major data structures. If the actual size
@ -571,6 +571,7 @@ extern int nfs_debug;
#endif
u_quad_t nfs_curusec __P((void));
int nfs_init __P((struct vfsconf *vfsp));
int nfs_reply __P((struct nfsreq *));
int nfs_getreq __P((struct nfsrv_descript *,struct nfsd *,int));

View File

@ -34,7 +34,7 @@
* SUCH DAMAGE.
*
* @(#)nfs_serv.c 8.3 (Berkeley) 1/12/94
* $Id: nfs_serv.c,v 1.57 1998/02/06 12:13:56 eivind Exp $
* $Id: nfs_serv.c,v 1.58 1998/02/09 06:10:35 eivind Exp $
*/
/*
@ -979,7 +979,7 @@ nfsrv_writegather(ndp, slp, procp, mrq)
LIST_INIT(&nfsd->nd_coalesce);
nfsd->nd_mreq = NULL;
nfsd->nd_stable = NFSV3WRITE_FILESYNC;
cur_usec = (u_quad_t)time.tv_sec * 1000000 + (u_quad_t)time.tv_usec;
cur_usec = nfs_curusec();
nfsd->nd_time = cur_usec +
(v3 ? nfsrvw_procrastinate_v3 : nfsrvw_procrastinate);
@ -1095,7 +1095,7 @@ nfsrv_writegather(ndp, slp, procp, mrq)
* and generate the associated reply mbuf list(s).
*/
loop1:
cur_usec = (u_quad_t)time.tv_sec * 1000000 + (u_quad_t)time.tv_usec;
cur_usec = nfs_curusec();
s = splsoftclock();
for (nfsd = slp->ns_tq.lh_first; nfsd; nfsd = owp) {
owp = nfsd->nd_tq.le_next;

View File

@ -34,7 +34,7 @@
* SUCH DAMAGE.
*
* @(#)nfs_socket.c 8.5 (Berkeley) 3/30/95
* $Id: nfs_socket.c,v 1.29 1997/10/12 20:25:44 phk Exp $
* $Id: nfs_socket.c,v 1.30 1997/10/28 15:59:07 bde Exp $
*/
/*
@ -769,7 +769,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;
gettime(&rt->tstamp);
getmicrotime(&rt->tstamp);
if (rep->r_flags & R_TIMING)
rt->rtt = rep->r_rtt;
else
@ -952,7 +952,7 @@ nfs_request(vp, mrest, procnum, procp, cred, mrp, mdp, dposp)
TAILQ_INSERT_TAIL(&nfs_reqq, rep, r_chain);
/* Get send time for nqnfs */
reqtime = time.tv_sec;
reqtime = time_second;
/*
* If backing off another request or avoiding congestion, don't
@ -1062,8 +1062,8 @@ nfs_request(vp, mrest, procnum, procp, cred, mrp, mdp, dposp)
error == NFSERR_TRYLATER) {
m_freem(mrep);
error = 0;
waituntil = time.tv_sec + trylater_delay;
while (time.tv_sec < waituntil)
waituntil = time_second + trylater_delay;
while (time_second < waituntil)
(void) tsleep((caddr_t)&lbolt,
PSOCK, "nqnfstry", 0);
trylater_delay *= nfs_backoff[trylater_cnt];
@ -1101,7 +1101,7 @@ nfs_request(vp, mrest, procnum, procp, cred, mrp, mdp, dposp)
nfsm_dissect(tl, u_long *, 4*NFSX_UNSIGNED);
cachable = fxdr_unsigned(int, *tl++);
reqtime += fxdr_unsigned(int, *tl++);
if (reqtime > time.tv_sec) {
if (reqtime > time_second) {
fxdr_hyper(tl, &frev);
nqnfs_clientlease(nmp, np, nqlflag,
cachable, reqtime, frev);
@ -1395,8 +1395,8 @@ nfs_timer(arg)
/*
* Call the nqnfs server timer once a second to handle leases.
*/
if (lasttime != time.tv_sec) {
lasttime = time.tv_sec;
if (lasttime != time_second) {
lasttime = time_second;
nqnfs_serverd();
}
@ -1404,7 +1404,7 @@ nfs_timer(arg)
* Scan the write gathering queues for writes that need to be
* completed now.
*/
cur_usec = (u_quad_t)time.tv_sec * 1000000 + (u_quad_t)time.tv_usec;
cur_usec = nfs_curusec();
for (slp = nfssvc_sockhead.tqh_first; slp != 0;
slp = slp->ns_chain.tqe_next) {
if (slp->ns_tq.lh_first && slp->ns_tq.lh_first->nd_time<=cur_usec)
@ -2125,7 +2125,7 @@ nfs_getreq(nd, nfsd, has_header)
tvout.tv_sec = fxdr_unsigned(long, tvout.tv_sec);
tvout.tv_usec = fxdr_unsigned(long, tvout.tv_usec);
if (nuidp->nu_expire < time.tv_sec ||
if (nuidp->nu_expire < time_second ||
nuidp->nu_timestamp.tv_sec > tvout.tv_sec ||
(nuidp->nu_timestamp.tv_sec == tvout.tv_sec &&
nuidp->nu_timestamp.tv_usec > tvout.tv_usec)) {

View File

@ -34,7 +34,7 @@
* SUCH DAMAGE.
*
* @(#)nfs_subs.c 8.3 (Berkeley) 1/4/94
* $Id: nfs_subs.c,v 1.50 1998/02/04 22:33:15 eivind Exp $
* $Id: nfs_subs.c,v 1.51 1998/02/06 12:13:57 eivind Exp $
*/
/*
@ -558,6 +558,15 @@ LIST_HEAD(nfsnodehashhead, nfsnode);
int nfs_webnamei __P((struct nameidata *, struct vnode *, struct proc *));
u_quad_t
nfs_curusec()
{
struct timeval tv;
getmicrotime(&tv);
return ((u_quad_t)tv.tv_sec * 1000000 + (u_quad_t)tv.tv_usec);
}
/*
* Create the header for an rpc request packet
* The hsiz is the size of the rest of the nfs request header.
@ -1348,7 +1357,7 @@ nfs_loadattrcache(vpp, mdp, dposp, vaper)
} else
np->n_size = vap->va_size;
}
np->n_attrstamp = time.tv_sec;
np->n_attrstamp = time_second;
if (vaper != NULL) {
bcopy((caddr_t)vap, (caddr_t)vaper, sizeof(*vap));
if (np->n_flag & NCHG) {
@ -1374,7 +1383,7 @@ nfs_getattrcache(vp, vaper)
register struct nfsnode *np = VTONFS(vp);
register struct vattr *vap;
if ((time.tv_sec - np->n_attrstamp) >= NFS_ATTRTIMEO(np)) {
if ((time_second - np->n_attrstamp) >= NFS_ATTRTIMEO(np)) {
nfsstats.attrcache_misses++;
return (ENOENT);
}

View File

@ -34,7 +34,7 @@
* SUCH DAMAGE.
*
* @(#)nfs_syscalls.c 8.5 (Berkeley) 3/30/95
* $Id: nfs_syscalls.c,v 1.35 1998/02/06 12:13:57 eivind Exp $
* $Id: nfs_syscalls.c,v 1.36 1998/02/09 06:10:37 eivind Exp $
*/
#include <sys/param.h>
@ -300,7 +300,7 @@ nfssvc(p, uap)
nuidp->nu_cr.cr_ngroups = NGROUPS;
nuidp->nu_cr.cr_ref = 1;
nuidp->nu_timestamp = nsd->nsd_timestamp;
nuidp->nu_expire = time.tv_sec + nsd->nsd_ttl;
nuidp->nu_expire = time_second + nsd->nsd_ttl;
/*
* and save the session key in nu_key.
*/
@ -520,8 +520,7 @@ nfssvc_nfsd(nsd, argp, p)
nfs_sndunlock(&slp->ns_solock);
}
error = nfsrv_dorec(slp, nfsd, &nd);
cur_usec = (u_quad_t)time.tv_sec * 1000000 +
(u_quad_t)time.tv_usec;
cur_usec = nfs_curusec();
if (error && slp->ns_tq.lh_first &&
slp->ns_tq.lh_first->nd_time <= cur_usec) {
error = 0;
@ -553,7 +552,7 @@ nfssvc_nfsd(nsd, argp, p)
else
solockp = (int *)0;
if (nd) {
gettime(&nd->nd_starttime);
getmicrotime(&nd->nd_starttime);
if (nd->nd_nam2)
nd->nd_nam = nd->nd_nam2;
else
@ -583,9 +582,9 @@ nfssvc_nfsd(nsd, argp, p)
* Check for just starting up for NQNFS and send
* fake "try again later" replies to the NQNFS clients.
*/
if (notstarted && nqnfsstarttime <= time.tv_sec) {
if (notstarted && nqnfsstarttime <= time_second) {
if (modify_flag) {
nqnfsstarttime = time.tv_sec + nqsrv_writeslack;
nqnfsstarttime = time_second + nqsrv_writeslack;
modify_flag = 0;
} else
notstarted = 0;
@ -718,8 +717,7 @@ nfssvc_nfsd(nsd, argp, p)
* Check to see if there are outstanding writes that
* need to be serviced.
*/
cur_usec = (u_quad_t)time.tv_sec * 1000000 +
(u_quad_t)time.tv_usec;
cur_usec = nfs_curusec();
s = splsoftclock();
if (slp->ns_tq.lh_first &&
slp->ns_tq.lh_first->nd_time <= cur_usec) {
@ -972,7 +970,7 @@ nfs_getnickauth(nmp, cred, auth_str, auth_len, verf_str, verf_len)
if (nuidp->nu_cr.cr_uid == cred->cr_uid)
break;
}
if (!nuidp || nuidp->nu_expire < time.tv_sec)
if (!nuidp || nuidp->nu_expire < time_second)
return (EACCES);
/*
@ -992,10 +990,10 @@ nfs_getnickauth(nmp, cred, auth_str, auth_len, verf_str, verf_len)
*/
verfp = (u_long *)verf_str;
*verfp++ = txdr_unsigned(RPCAKN_NICKNAME);
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))
gettime(&nuidp->nu_timestamp);
if (time_second > nuidp->nu_timestamp.tv_sec ||
(time_second == nuidp->nu_timestamp.tv_sec &&
time_second > nuidp->nu_timestamp.tv_usec))
getmicrotime(&nuidp->nu_timestamp);
else
nuidp->nu_timestamp.tv_usec++;
ktvin.tv_sec = txdr_unsigned(nuidp->nu_timestamp.tv_sec);
@ -1051,7 +1049,7 @@ nfs_savenickauth(nmp, cred, len, key, mdp, dposp, mrep)
#endif
ktvout.tv_sec = fxdr_unsigned(long, ktvout.tv_sec);
ktvout.tv_usec = fxdr_unsigned(long, ktvout.tv_usec);
deltasec = time.tv_sec - ktvout.tv_sec;
deltasec = time_second - ktvout.tv_sec;
if (deltasec < 0)
deltasec = -deltasec;
/*
@ -1071,7 +1069,7 @@ nfs_savenickauth(nmp, cred, len, key, mdp, dposp, mrep)
}
nuidp->nu_flag = 0;
nuidp->nu_cr.cr_uid = cred->cr_uid;
nuidp->nu_expire = time.tv_sec + NFS_KERBTTL;
nuidp->nu_expire = time_second + NFS_KERBTTL;
nuidp->nu_timestamp = ktvout;
nuidp->nu_nickname = nick;
bcopy(key, nuidp->nu_key, sizeof (key));
@ -1184,9 +1182,8 @@ nfsd_rt(sotype, nd, cacherep)
rt->ipadr = ((struct sockaddr_in *)nd->nd_nam)->sin_addr.s_addr;
else
rt->ipadr = INADDR_ANY;
rt->resptime = ((time.tv_sec - nd->nd_starttime.tv_sec) * 1000000) +
(time.tv_usec - nd->nd_starttime.tv_usec);
gettime(&rt->tstamp);
rt->resptime = nfs_curusec() - (nd->nd_starttime.tv_sec * 1000000 + nd->nd_starttime.tv_usec);
getmicrotime(&rt->tstamp);
nfsdrt.pos = (nfsdrt.pos + 1) % NFSRTTLOGSIZ;
}
#endif /* NFS_NOSERVER */

View File

@ -34,7 +34,7 @@
* SUCH DAMAGE.
*
* @(#)nfsm_subs.h 8.2 (Berkeley) 3/30/95
* $Id: nfsm_subs.h,v 1.13 1997/07/16 09:06:30 dfr Exp $
* $Id: nfsm_subs.h,v 1.14 1998/02/03 21:51:56 bde Exp $
*/
@ -434,10 +434,12 @@ struct mbuf *nfsm_rpchead __P((struct ucred *cr, int nmflag, int procid,
nfsm_dissect(tl, u_long *, 2 * NFSX_UNSIGNED); \
fxdr_nfsv3time(tl, &(a)->va_atime); \
break; \
case NFSV3SATTRTIME_TOSERVER: \
(a)->va_atime.tv_sec = time.tv_sec; \
(a)->va_atime.tv_nsec = time.tv_usec * 1000; \
break; \
case NFSV3SATTRTIME_TOSERVER: { \
struct timeval tv; \
getmicrotime(&tv); \
(a)->va_atime.tv_sec = tv.tv_sec; \
(a)->va_atime.tv_nsec = tv.tv_usec * 1000; \
break; } \
}; \
nfsm_dissect(tl, u_long *, NFSX_UNSIGNED); \
switch (fxdr_unsigned(int, *tl)) { \
@ -445,10 +447,12 @@ struct mbuf *nfsm_rpchead __P((struct ucred *cr, int nmflag, int procid,
nfsm_dissect(tl, u_long *, 2 * NFSX_UNSIGNED); \
fxdr_nfsv3time(tl, &(a)->va_mtime); \
break; \
case NFSV3SATTRTIME_TOSERVER: \
(a)->va_mtime.tv_sec = time.tv_sec; \
(a)->va_mtime.tv_nsec = time.tv_usec * 1000; \
break; \
case NFSV3SATTRTIME_TOSERVER: { \
struct timeval tv; \
getmicrotime(&tv); \
(a)->va_mtime.tv_sec = tv.tv_sec; \
(a)->va_mtime.tv_nsec = tv.tv_usec * 1000; \
break; } \
}; }
#endif

View File

@ -34,7 +34,7 @@
* SUCH DAMAGE.
*
* @(#)nfs.h 8.4 (Berkeley) 5/1/95
* $Id: nfs.h,v 1.32 1997/10/12 20:25:38 phk Exp $
* $Id: nfs.h,v 1.33 1998/02/01 21:23:29 bde Exp $
*/
#ifndef _NFS_NFS_H_
@ -108,9 +108,9 @@
*/
#define NFS_ATTRTIMEO(np) \
((((np)->n_flag & NMODIFIED) || \
(time.tv_sec - (np)->n_mtime) / 10 < NFS_MINATTRTIMO) ? NFS_MINATTRTIMO : \
((time.tv_sec - (np)->n_mtime) / 10 > NFS_MAXATTRTIMO ? NFS_MAXATTRTIMO : \
(time.tv_sec - (np)->n_mtime) / 10))
(time_second - (np)->n_mtime) / 10 < NFS_MINATTRTIMO) ? NFS_MINATTRTIMO : \
((time_second - (np)->n_mtime) / 10 > NFS_MAXATTRTIMO ? NFS_MAXATTRTIMO : \
(time_second - (np)->n_mtime) / 10))
/*
* Expected allocation sizes for major data structures. If the actual size
@ -571,6 +571,7 @@ extern int nfs_debug;
#endif
u_quad_t nfs_curusec __P((void));
int nfs_init __P((struct vfsconf *vfsp));
int nfs_reply __P((struct nfsreq *));
int nfs_getreq __P((struct nfsrv_descript *,struct nfsd *,int));

View File

@ -1,6 +1,6 @@
/**************************************************************************
**
** $Id: ncr.c,v 1.114 1998/02/04 03:47:16 eivind Exp $
** $Id: ncr.c,v 1.115 1998/02/09 06:10:56 eivind Exp $
**
** Device driver for the NCR 53C810 PCI-SCSI-Controller.
**
@ -498,14 +498,14 @@ struct usrcmd {
*/
struct tstamp {
struct timeval start;
struct timeval end;
struct timeval select;
struct timeval command;
struct timeval data;
struct timeval status;
struct timeval disconnect;
struct timeval reselect;
int start;
int end;
int select;
int command;
int data;
int status;
int disconnect;
int reselect;
};
/*
@ -1287,7 +1287,7 @@ struct scripth {
#ifdef KERNEL
static void ncr_alloc_ccb (ncb_p np, u_long target, u_long lun);
static void ncr_complete (ncb_p np, ccb_p cp);
static int ncr_delta (struct timeval * from, struct timeval * to);
static int ncr_delta (int * from, int * to);
static void ncr_exception (ncb_p np);
static void ncr_free_ccb (ncb_p np, ccb_p cp, int flags);
static void ncr_selectclock (ncb_p np, u_char scntl3);
@ -1342,7 +1342,7 @@ static void ncr_attach (pcici_t tag, int unit);
static char ident[] =
"\n$Id: ncr.c,v 1.114 1998/02/04 03:47:16 eivind Exp $\n";
"\n$Id: ncr.c,v 1.115 1998/02/09 06:10:56 eivind Exp $\n";
static const u_long ncr_version = NCR_VERSION * 11
+ (u_long) sizeof (struct ncb) * 7
@ -1471,8 +1471,8 @@ static char *ncr_name (ncb_p np)
#define FADDR(label,ofs)(RELOC_REGISTER | ((REG(label))+(ofs)))
#define KVAR(which) (RELOC_KVAR | (which))
#define KVAR_TIME_TV_SEC (0)
#define KVAR_TIME (1)
#define KVAR_SECOND (0)
#define KVAR_TICKS (1)
#define KVAR_NCR_CACHE (2)
#define SCRIPT_KVAR_FIRST (0)
@ -1483,7 +1483,7 @@ static char *ncr_name (ncb_p np)
* THESE MUST ALL BE ALIGNED TO A 4-BYTE BOUNDARY.
*/
static void *script_kvars[] =
{ &time.tv_sec, &time, &ncr_cache };
{ &time_second, &ticks, &ncr_cache };
static struct script script0 = {
/*--------------------------< START >-----------------------*/ {
@ -1491,7 +1491,7 @@ static struct script script0 = {
** Claim to be still alive ...
*/
SCR_COPY (sizeof (((struct ncb *)0)->heartbeat)),
KVAR (KVAR_TIME_TV_SEC),
KVAR (KVAR_SECOND),
NADDR (heartbeat),
/*
** Make data structure address invalid.
@ -1710,7 +1710,7 @@ static struct script script0 = {
** Set a time stamp for this selection
*/
SCR_COPY (sizeof (struct timeval)),
KVAR (KVAR_TIME),
KVAR (KVAR_TICKS),
NADDR (header.stamp.select),
/*
** load the savep (saved pointer) into
@ -1892,7 +1892,7 @@ static struct script script0 = {
** ... set a timestamp ...
*/
SCR_COPY (sizeof (struct timeval)),
KVAR (KVAR_TIME),
KVAR (KVAR_TICKS),
NADDR (header.stamp.command),
/*
** ... and send the command
@ -1914,7 +1914,7 @@ static struct script script0 = {
** set the timestamp.
*/
SCR_COPY (sizeof (struct timeval)),
KVAR (KVAR_TIME),
KVAR (KVAR_TICKS),
NADDR (header.stamp.status),
/*
** If this is a GETCC transfer,
@ -2219,7 +2219,7 @@ static struct script script0 = {
** and count the disconnects.
*/
SCR_COPY (sizeof (struct timeval)),
KVAR (KVAR_TIME),
KVAR (KVAR_TICKS),
NADDR (header.stamp.disconnect),
SCR_COPY (4),
NADDR (disc_phys),
@ -2462,7 +2462,7 @@ static struct script script0 = {
** SCR_JUMP ^ IFFALSE (WHEN (SCR_DATA_IN)),
** PADDR (no_data),
** SCR_COPY (sizeof (struct timeval)),
** KVAR (KVAR_TIME),
** KVAR (KVAR_TICKS),
** NADDR (header.stamp.data),
** SCR_MOVE_TBL ^ SCR_DATA_IN,
** offsetof (struct dsb, data[ 0]),
@ -2489,7 +2489,7 @@ static struct script script0 = {
** SCR_JUMP ^ IFFALSE (WHEN (SCR_DATA_OUT)),
** PADDR (no_data),
** SCR_COPY (sizeof (struct timeval)),
** KVAR (KVAR_TIME),
** KVAR (KVAR_TICKS),
** NADDR (header.stamp.data),
** SCR_MOVE_TBL ^ SCR_DATA_OUT,
** offsetof (struct dsb, data[ 0]),
@ -3058,7 +3058,7 @@ void ncr_script_fill (struct script * scr, struct scripth * scrh)
*p++ =SCR_JUMP ^ IFFALSE (WHEN (SCR_DATA_IN));
*p++ =PADDR (no_data);
*p++ =SCR_COPY (sizeof (struct timeval));
*p++ =(ncrcmd) KVAR (KVAR_TIME);
*p++ =(ncrcmd) KVAR (KVAR_TICKS);
*p++ =NADDR (header.stamp.data);
*p++ =SCR_MOVE_TBL ^ SCR_DATA_IN;
*p++ =offsetof (struct dsb, data[ 0]);
@ -3082,7 +3082,7 @@ void ncr_script_fill (struct script * scr, struct scripth * scrh)
*p++ =SCR_JUMP ^ IFFALSE (WHEN (SCR_DATA_OUT));
*p++ =PADDR (no_data);
*p++ =SCR_COPY (sizeof (struct timeval));
*p++ =(ncrcmd) KVAR (KVAR_TIME);
*p++ =(ncrcmd) KVAR (KVAR_TICKS);
*p++ =NADDR (header.stamp.data);
*p++ =SCR_MOVE_TBL ^ SCR_DATA_OUT;
*p++ =offsetof (struct dsb, data[ 0]);
@ -4180,7 +4180,7 @@ static int32_t ncr_start (struct scsi_xfer * xp)
*/
bzero (&cp->phys.header.stamp, sizeof (struct tstamp));
gettime(&cp->phys.header.stamp.start);
cp->phys.header.stamp.start = ticks;
/*----------------------------------------------------
**
@ -4475,7 +4475,7 @@ static int32_t ncr_start (struct scsi_xfer * xp)
*/
cp->jump_ccb.l_cmd = (SCR_JUMP ^ IFFALSE (DATA (cp->tag)));
cp->tlimit = time.tv_sec + xp->timeout / 1000 + 2;
cp->tlimit = time_second + xp->timeout / 1000 + 2;
cp->magic = CCB_MAGIC;
/*
@ -5443,7 +5443,7 @@ static void ncr_usercmd (ncb_p np)
static void ncr_timeout (void *arg)
{
ncb_p np = arg;
u_long thistime = time.tv_sec;
u_long thistime = time_second;
u_long step = np->ticks;
u_long count = 0;
long signed t;
@ -5760,9 +5760,9 @@ void ncr_exception (ncb_p np)
**========================================
*/
if (time.tv_sec - np->regtime.tv_sec>10) {
if (time_second - np->regtime.tv_sec>10) {
int i;
gettime(&np->regtime);
getmicrotime(&np->regtime);
for (i=0; i<sizeof(np->regdump); i++)
((char*)&np->regdump)[i] = INB_OFF(i);
np->regdump.nc_dstat = dstat;
@ -7326,12 +7326,11 @@ static int ncr_snooptest (struct ncb* np)
** Compute the difference in milliseconds.
**/
static int ncr_delta (struct timeval * from, struct timeval * to)
static int ncr_delta (int *from, int *to)
{
if (!from->tv_sec) return (-1);
if (!to ->tv_sec) return (-2);
return ( (to->tv_sec - from->tv_sec - 2)*1000+
+(to->tv_usec - from->tv_usec + 2000000)/1000);
if (!from) return (-1);
if (!to) return (-2);
return ((to - from) * 1000 / hz);
}
#define PROFILE cp->phys.header.stamp
@ -7340,7 +7339,7 @@ static void ncb_profile (ncb_p np, ccb_p cp)
int co, da, st, en, di, se, post,work,disc;
u_long diff;
gettime(&PROFILE.end);
PROFILE.end = ticks;
st = ncr_delta (&PROFILE.start,&PROFILE.status);
if (st<0) return; /* status not reached */

View File

@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* @(#)time.h 8.5 (Berkeley) 5/4/95
* $Id: time.h,v 1.20 1998/03/04 10:26:44 dufault Exp $
* $Id: time.h,v 1.21 1998/03/26 20:53:36 phk Exp $
*/
#ifndef _SYS_TIME_H_
@ -221,11 +221,11 @@ struct clockinfo {
#ifdef KERNEL
extern struct timecounter *timecounter;
extern time_t time_second;
void forward_timecounter __P((void));
void getmicrotime __P((struct timeval *tv));
void getnanotime __P((struct timespec *tv));
#define gettime(xxx) getmicrotime(xxx) /* XXX be compatible */
void init_timecounter __P((struct timecounter *tc));
int itimerfix __P((struct timeval *tv));
int itimerdecr __P((struct itimerval *itp, int usec));
@ -235,6 +235,7 @@ void second_overflow __P((u_int32_t *psec));
void set_timecounter __P((struct timespec *ts));
void timevaladd __P((struct timeval *, struct timeval *));
void timevalsub __P((struct timeval *, struct timeval *));
int tvtohz __P((struct timeval *));
#else /* !KERNEL */
#include <time.h>

View File

@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* @(#)time.h 8.5 (Berkeley) 5/4/95
* $Id: time.h,v 1.20 1998/03/04 10:26:44 dufault Exp $
* $Id: time.h,v 1.21 1998/03/26 20:53:36 phk Exp $
*/
#ifndef _SYS_TIME_H_
@ -221,11 +221,11 @@ struct clockinfo {
#ifdef KERNEL
extern struct timecounter *timecounter;
extern time_t time_second;
void forward_timecounter __P((void));
void getmicrotime __P((struct timeval *tv));
void getnanotime __P((struct timespec *tv));
#define gettime(xxx) getmicrotime(xxx) /* XXX be compatible */
void init_timecounter __P((struct timecounter *tc));
int itimerfix __P((struct timeval *tv));
int itimerdecr __P((struct itimerval *itp, int usec));
@ -235,6 +235,7 @@ void second_overflow __P((u_int32_t *psec));
void set_timecounter __P((struct timespec *ts));
void timevaladd __P((struct timeval *, struct timeval *));
void timevalsub __P((struct timeval *, struct timeval *));
int tvtohz __P((struct timeval *));
#else /* !KERNEL */
#include <time.h>

View File

@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* @(#)ffs_alloc.c 8.18 (Berkeley) 5/26/95
* $Id: ffs_alloc.c,v 1.47 1998/02/06 12:14:13 eivind Exp $
* $Id: ffs_alloc.c,v 1.48 1998/03/08 09:58:42 julian Exp $
*/
#include "opt_quota.h"
@ -837,7 +837,7 @@ ffs_fragextend(ip, cg, bprev, osize, nsize)
brelse(bp);
return (0);
}
cgp->cg_time = time.tv_sec;
cgp->cg_time = time_second;
bno = dtogd(fs, bprev);
for (i = numfrags(fs, osize); i < frags; i++)
if (isclr(cg_blksfree(cgp), bno + i)) {
@ -904,7 +904,7 @@ ffs_alloccg(ip, cg, bpref, size)
brelse(bp);
return (0);
}
cgp->cg_time = time.tv_sec;
cgp->cg_time = time_second;
if (size == fs->fs_bsize) {
bno = ffs_alloccgblk(ip, bp, bpref);
bdwrite(bp);
@ -1230,7 +1230,7 @@ ffs_nodealloccg(ip, cg, ipref, mode)
brelse(bp);
return (0);
}
cgp->cg_time = time.tv_sec;
cgp->cg_time = time_second;
if (ipref) {
ipref %= fs->fs_ipg;
if (isclr(cg_inosused(cgp), ipref))
@ -1322,7 +1322,7 @@ ffs_blkfree(ip, bno, size)
brelse(bp);
return;
}
cgp->cg_time = time.tv_sec;
cgp->cg_time = time_second;
bno = dtogd(fs, bno);
if (size == fs->fs_bsize) {
blkno = fragstoblks(fs, bno);
@ -1483,7 +1483,7 @@ ffs_vfree( pvp, ino, mode)
brelse(bp);
return (0);
}
cgp->cg_time = time.tv_sec;
cgp->cg_time = time_second;
ino %= fs->fs_ipg;
if (isclr(cg_inosused(cgp), ino)) {
printf("dev = 0x%lx, ino = %ld, fs = %s\n",

View File

@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* @(#)ffs_inode.c 8.13 (Berkeley) 4/21/95
* $Id: ffs_inode.c,v 1.38 1998/03/19 22:49:42 dyson Exp $
* $Id: ffs_inode.c,v 1.39 1998/03/26 20:53:49 phk Exp $
*/
#include "opt_quota.h"
@ -79,7 +79,6 @@ ffs_update(vp, access, modify, waitfor)
struct buf *bp;
struct inode *ip;
int error;
time_t tv_sec;
ip = VTOI(vp);
if (vp->v_mount->mnt_flag & MNT_RDONLY) {
@ -92,29 +91,17 @@ ffs_update(vp, access, modify, waitfor)
(waitfor != MNT_WAIT))
return (0);
/*
* Use a copy of the current time to get consistent timestamps
* (a_access and a_modify are sometimes aliases for &time).
*
* XXX in 2.0, a_access and a_modify are often pointers to the
* same copy of `time'. This is not as good. Some callers forget
* to make a copy; others make a copy too early (before the i/o
* has completed)...
*
* XXX there should be a function or macro for reading the time
* (e.g., some machines may require splclock()).
* XXX there are: they're called get{micro|nano}time
* XXX: Some callers make a copy too early (before the i/o has
* completed)...
*/
tv_sec = time.tv_sec;
if (ip->i_flag & IN_ACCESS)
ip->i_atime =
(access == &time ? tv_sec : access->tv_sec);
ip->i_atime = access->tv_sec;
if (ip->i_flag & IN_UPDATE) {
ip->i_mtime =
(modify == &time ? tv_sec : modify->tv_sec);
ip->i_mtime = modify->tv_sec;
ip->i_modrev++;
}
if (ip->i_flag & IN_CHANGE)
ip->i_ctime = tv_sec;
ip->i_ctime = time_second;
ip->i_flag &= ~(IN_ACCESS | IN_CHANGE | IN_MODIFIED | IN_UPDATE);
fs = ip->i_fs;
/*
@ -184,7 +171,7 @@ ffs_truncate(vp, length, flags, cred, p)
return (EINVAL);
if (length > fs->fs_maxfilesize)
return (EFBIG);
gettime(&tv);
getmicrotime(&tv);
if (ovp->v_type == VLNK &&
(oip->i_size < ovp->v_mount->mnt_maxsymlinklen || oip->i_din.di_blocks == 0)) {
#ifdef DIAGNOSTIC

View File

@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* @(#)ffs_vfsops.c 8.31 (Berkeley) 5/20/95
* $Id: ffs_vfsops.c,v 1.76 1998/03/08 09:59:06 julian Exp $
* $Id: ffs_vfsops.c,v 1.77 1998/03/27 14:20:57 peter Exp $
*/
#include "opt_quota.h"
@ -967,7 +967,7 @@ ffs_sync(mp, waitfor, cred, p)
} else {
simple_unlock(&mntvnode_slock);
simple_unlock(&vp->v_interlock);
gettime(&tv);
getmicrotime(&tv);
/* UFS_UPDATE(vp, &tv, &tv, waitfor == MNT_WAIT); */
UFS_UPDATE(vp, &tv, &tv, 0);
simple_lock(&mntvnode_slock);
@ -1247,7 +1247,7 @@ ffs_sbupdate(mp, waitfor)
return (allerror);
bp = getblk(mp->um_devvp, SBLOCK, (int)fs->fs_sbsize, 0, 0);
fs->fs_fmod = 0;
fs->fs_time = time.tv_sec;
fs->fs_time = time_second;
bcopy((caddr_t)fs, bp->b_data, (u_int)fs->fs_sbsize);
/* Restore compatibility to old file systems. XXX */
dfs = (struct fs *)bp->b_data; /* XXX */

View File

@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* @(#)ffs_vnops.c 8.15 (Berkeley) 5/14/95
* $Id: ffs_vnops.c,v 1.46 1998/03/21 05:16:09 dyson Exp $
* $Id: ffs_vnops.c,v 1.47 1998/03/28 10:33:26 bde Exp $
*/
#include <sys/param.h>
@ -253,7 +253,7 @@ ffs_fsync(ap)
#endif
}
}
gettime(&tv);
getmicrotime(&tv);
error = UFS_UPDATE(ap->a_vp, &tv, &tv, (ap->a_waitfor == MNT_WAIT));
if (error)
return (error);

View File

@ -36,7 +36,7 @@
* SUCH DAMAGE.
*
* @(#)ufs_inode.c 8.9 (Berkeley) 5/14/95
* $Id: ufs_inode.c,v 1.20 1997/10/16 20:32:39 phk Exp $
* $Id: ufs_inode.c,v 1.21 1997/12/02 11:43:45 bde Exp $
*/
#include "opt_quota.h"
@ -90,7 +90,7 @@ ufs_inactive(ap)
UFS_VFREE(vp, ip->i_number, mode);
}
if (ip->i_flag & (IN_ACCESS | IN_CHANGE | IN_MODIFIED | IN_UPDATE)) {
gettime(&tv);
getmicrotime(&tv);
UFS_UPDATE(vp, &tv, &tv, 0);
}
out:

View File

@ -36,7 +36,7 @@
* SUCH DAMAGE.
*
* @(#)ufs_lookup.c 8.15 (Berkeley) 6/16/95
* $Id: ufs_lookup.c,v 1.21 1998/02/06 12:14:18 eivind Exp $
* $Id: ufs_lookup.c,v 1.22 1998/03/08 09:59:29 julian Exp $
*/
#include <sys/param.h>
@ -670,6 +670,7 @@ ufs_direnter(dvp, tvp, dirp, cnp, newdirbp)
struct direct *ep, *nep;
int error, ret, blkoff, loc, spacefree, flags;
char *dirbuf;
struct timeval tv;
p = curproc; /* XXX */
cr = p->p_ucred;
@ -721,7 +722,8 @@ ufs_direnter(dvp, tvp, dirp, cnp, newdirbp)
} else {
error = VOP_BWRITE(bp);
}
ret = UFS_UPDATE(dvp, &time, &time, !DOINGSOFTDEP(dvp));
getmicrotime(&tv);
ret = UFS_UPDATE(dvp, &tv, &tv, !DOINGSOFTDEP(dvp));
if (error == 0)
return (ret);
return (error);

View File

@ -34,7 +34,7 @@
* SUCH DAMAGE.
*
* @(#)ufs_quota.c 8.5 (Berkeley) 5/20/95
* $Id: ufs_quota.c,v 1.19 1998/02/09 06:11:12 eivind Exp $
* $Id: ufs_quota.c,v 1.20 1998/03/08 09:59:33 julian Exp $
*/
#include <sys/param.h>
@ -201,7 +201,7 @@ chkdqchg(ip, change, cred, type)
*/
if (ncurblocks >= dq->dq_bsoftlimit && dq->dq_bsoftlimit) {
if (dq->dq_curblocks < dq->dq_bsoftlimit) {
dq->dq_btime = time.tv_sec +
dq->dq_btime = time_second +
VFSTOUFS(ITOV(ip)->v_mount)->um_btime[type];
if (ip->i_uid == cred->cr_uid)
uprintf("\n%s: warning, %s %s\n",
@ -209,7 +209,7 @@ chkdqchg(ip, change, cred, type)
quotatypes[type], "disk quota exceeded");
return (0);
}
if (time.tv_sec > dq->dq_btime) {
if (time_second > dq->dq_btime) {
if ((dq->dq_flags & DQ_BLKS) == 0 &&
ip->i_uid == cred->cr_uid) {
uprintf("\n%s: write failed, %s %s\n",
@ -317,7 +317,7 @@ chkiqchg(ip, change, cred, type)
*/
if (ncurinodes >= dq->dq_isoftlimit && dq->dq_isoftlimit) {
if (dq->dq_curinodes < dq->dq_isoftlimit) {
dq->dq_itime = time.tv_sec +
dq->dq_itime = time_second +
VFSTOUFS(ITOV(ip)->v_mount)->um_itime[type];
if (ip->i_uid == cred->cr_uid)
uprintf("\n%s: warning, %s %s\n",
@ -325,7 +325,7 @@ chkiqchg(ip, change, cred, type)
quotatypes[type], "inode quota exceeded");
return (0);
}
if (time.tv_sec > dq->dq_itime) {
if (time_second > dq->dq_itime) {
if ((dq->dq_flags & DQ_INODS) == 0 &&
ip->i_uid == cred->cr_uid) {
uprintf("\n%s: write failed, %s %s\n",
@ -559,11 +559,11 @@ setquota(mp, id, type, addr)
if (newlim.dqb_bsoftlimit &&
dq->dq_curblocks >= newlim.dqb_bsoftlimit &&
(dq->dq_bsoftlimit == 0 || dq->dq_curblocks < dq->dq_bsoftlimit))
newlim.dqb_btime = time.tv_sec + ump->um_btime[type];
newlim.dqb_btime = time_second + ump->um_btime[type];
if (newlim.dqb_isoftlimit &&
dq->dq_curinodes >= newlim.dqb_isoftlimit &&
(dq->dq_isoftlimit == 0 || dq->dq_curinodes < dq->dq_isoftlimit))
newlim.dqb_itime = time.tv_sec + ump->um_itime[type];
newlim.dqb_itime = time_second + ump->um_itime[type];
dq->dq_dqb = newlim;
if (dq->dq_curblocks < dq->dq_bsoftlimit)
dq->dq_flags &= ~DQ_BLKS;
@ -612,10 +612,10 @@ setuse(mp, id, type, addr)
*/
if (dq->dq_bsoftlimit && dq->dq_curblocks < dq->dq_bsoftlimit &&
usage.dqb_curblocks >= dq->dq_bsoftlimit)
dq->dq_btime = time.tv_sec + ump->um_btime[type];
dq->dq_btime = time_second + ump->um_btime[type];
if (dq->dq_isoftlimit && dq->dq_curinodes < dq->dq_isoftlimit &&
usage.dqb_curinodes >= dq->dq_isoftlimit)
dq->dq_itime = time.tv_sec + ump->um_itime[type];
dq->dq_itime = time_second + ump->um_itime[type];
dq->dq_curblocks = usage.dqb_curblocks;
dq->dq_curinodes = usage.dqb_curinodes;
if (dq->dq_curblocks < dq->dq_bsoftlimit)
@ -821,9 +821,9 @@ dqget(vp, id, ump, type, dqp)
dq->dq_flags |= DQ_FAKE;
if (dq->dq_id != 0) {
if (dq->dq_btime == 0)
dq->dq_btime = time.tv_sec + ump->um_btime[type];
dq->dq_btime = time_second + ump->um_btime[type];
if (dq->dq_itime == 0)
dq->dq_itime = time.tv_sec + ump->um_itime[type];
dq->dq_itime = time_second + ump->um_itime[type];
}
*dqp = dq;
return (0);

View File

@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* @(#)ufs_readwrite.c 8.11 (Berkeley) 5/8/95
* $Id: ufs_readwrite.c,v 1.45 1998/03/08 09:59:39 julian Exp $
* $Id: ufs_readwrite.c,v 1.46 1998/03/09 22:12:52 dyson Exp $
*/
#define BLKSIZE(a, b, c) blksize(a, b, c)
@ -390,7 +390,7 @@ WRITE(ap)
uio->uio_resid = resid;
}
} else if (resid > uio->uio_resid && (ioflag & IO_SYNC)) {
gettime(&tv);
getmicrotime(&tv);
error = UFS_UPDATE(vp, &tv, &tv, 1);
}
if (!error)

View File

@ -36,7 +36,7 @@
* SUCH DAMAGE.
*
* @(#)ufs_vnops.c 8.27 (Berkeley) 5/27/95
* $Id: ufs_vnops.c,v 1.79 1998/03/08 09:59:44 julian Exp $
* $Id: ufs_vnops.c,v 1.80 1998/03/26 20:54:05 phk Exp $
*/
#include "opt_quota.h"
@ -752,7 +752,7 @@ ufs_link(ap)
ip->i_flag |= IN_CHANGE;
if (DOINGSOFTDEP(vp))
softdep_increase_linkcnt(ip);
gettime(&tv);
getmicrotime(&tv);
error = UFS_UPDATE(vp, &tv, &tv, !DOINGSOFTDEP(vp));
if (!error) {
ufs_makedirentry(ip, cnp, &newdir);
@ -1012,7 +1012,7 @@ ufs_rename(ap)
ip->i_flag |= IN_CHANGE;
if (DOINGSOFTDEP(fvp))
softdep_increase_linkcnt(ip);
gettime(&tv);
getmicrotime(&tv);
if (error = UFS_UPDATE(fvp, &tv, &tv, !DOINGSOFTDEP(fvp))) {
VOP_UNLOCK(fvp, 0, p);
goto bad;
@ -1368,7 +1368,7 @@ ufs_mkdir(ap)
dp->i_flag |= IN_CHANGE;
if (DOINGSOFTDEP(dvp))
softdep_increase_linkcnt(dp);
gettime(&tv);
getmicrotime(&tv);
error = UFS_UPDATE(tvp, &tv, &tv, !DOINGSOFTDEP(dvp));
if (error)
goto bad;
@ -2118,7 +2118,7 @@ ufs_makeinode(mode, dvp, vpp, cnp)
/*
* Make sure inode goes to disk before directory entry.
*/
gettime(&tv);
getmicrotime(&tv);
error = UFS_UPDATE(tvp, &tv, &tv, !DOINGSOFTDEP(tvp));
if (error)
goto bad;

View File

@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* @(#)vm_meter.c 8.4 (Berkeley) 1/4/94
* $Id: vm_meter.c,v 1.23 1997/11/24 15:15:33 bde Exp $
* $Id: vm_meter.c,v 1.24 1998/03/28 10:33:27 bde Exp $
*/
#include <sys/param.h>
@ -97,7 +97,7 @@ void
vmmeter()
{
if (time.tv_sec % 5 == 0)
if (time_second % 5 == 0)
loadav(&averunnable);
if (proc0.p_slptime > maxslp / 2)
wakeup(&proc0);

View File

@ -65,7 +65,7 @@
* any improvements or extensions that they make and grant Carnegie the
* rights to redistribute these changes.
*
* $Id: vm_pageout.c,v 1.119 1998/03/08 18:19:17 dyson Exp $
* $Id: vm_pageout.c,v 1.120 1998/03/16 01:55:58 dyson Exp $
*/
/*
@ -963,10 +963,10 @@ vm_pageout_scan()
*/
if (vm_swap_idle_enabled) {
static long lsec;
if (time.tv_sec != lsec) {
if (time_second != lsec) {
vm_pageout_req_swapout |= VM_SWAP_IDLE;
vm_req_vmdaemon();
lsec = time.tv_sec;
lsec = time_second;
}
}
#endif