summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThorsten Lockert <tholo@cvs.openbsd.org>2004-06-21 23:50:39 +0000
committerThorsten Lockert <tholo@cvs.openbsd.org>2004-06-21 23:50:39 +0000
commitee05a750df8c3f9f5d686affb4df7e316507797a (patch)
tree887af571215b85d480946bb169aafa0605c786db
parente84c5b85eb5d0fc9af7eb3cdcc77a22eb07dec74 (diff)
First step towards more sane time handling in the kernel -- this changes
things such that code that only need a second-resolution uptime or wall time, and used to get that from time.tv_secs or mono_time.tv_secs now get this from separate time_t globals time_second and time_uptime. ok art@ niklas@ nordin@
-rw-r--r--sys/compat/common/kern_ipc_23.c8
-rw-r--r--sys/compat/hpux/hpux_compat.c6
-rw-r--r--sys/dev/ic/ncr53c9x.c8
-rw-r--r--sys/dev/ic/smc90cx6.c4
-rw-r--r--sys/dev/ic/z8530tty.c6
-rw-r--r--sys/dev/pci/ncr.c10
-rw-r--r--sys/kern/kern_clock.c7
-rw-r--r--sys/kern/kern_synch.c3
-rw-r--r--sys/kern/kern_time.c4
-rw-r--r--sys/kern/sysv_msg.c10
-rw-r--r--sys/kern/sysv_sem.c6
-rw-r--r--sys/kern/sysv_shm.c10
-rw-r--r--sys/kern/vfs_sync.c6
-rw-r--r--sys/kern/vfs_syscalls.c6
-rw-r--r--sys/net/if_arcsubr.c4
-rw-r--r--sys/net/if_bridge.c8
-rw-r--r--sys/net/if_ethersubr.c4
-rw-r--r--sys/net/if_fddisubr.c4
-rw-r--r--sys/net/if_pfsync.c28
-rw-r--r--sys/net/if_ppp.c11
-rw-r--r--sys/net/if_sl.c10
-rw-r--r--sys/net/if_strip.c20
-rw-r--r--sys/net/if_tokensubr.c4
-rw-r--r--sys/net/pf.c40
-rw-r--r--sys/net/pf_if.c6
-rw-r--r--sys/net/pf_ioctl.c18
-rw-r--r--sys/net/pf_norm.c16
-rw-r--r--sys/net/pf_table.c18
-rw-r--r--sys/net/route.c6
-rw-r--r--sys/netccitt/if_x25subr.c3
-rw-r--r--sys/netccitt/pk_acct.c4
-rw-r--r--sys/netccitt/pk_subr.c4
-rw-r--r--sys/netinet/if_ether.c20
-rw-r--r--sys/netinet/ip_id.c6
-rw-r--r--sys/netinet/ip_ipsp.c28
-rw-r--r--sys/netinet/ip_output.c4
-rw-r--r--sys/netinet/ip_spd.c10
-rw-r--r--sys/netinet/ipsec_input.c12
-rw-r--r--sys/netinet/ipsec_output.c12
-rw-r--r--sys/netinet/tcp_subr.c6
-rw-r--r--sys/netinet6/icmp6.c6
-rw-r--r--sys/netinet6/in6.c18
-rw-r--r--sys/netinet6/in6.h6
-rw-r--r--sys/netinet6/ip6_forward.c10
-rw-r--r--sys/netinet6/ip6_id.c6
-rw-r--r--sys/netinet6/ip6_mroute.c4
-rw-r--r--sys/netinet6/nd6.c12
-rw-r--r--sys/netinet6/nd6_rtr.c20
-rw-r--r--sys/netiso/if_eon.c4
-rw-r--r--sys/netiso/iso_snpac.c8
-rw-r--r--sys/nfs/nfs.h8
-rw-r--r--sys/nfs/nfs_socket.c10
-rw-r--r--sys/nfs/nfs_subs.c8
-rw-r--r--sys/nfs/nfs_syscalls.c10
-rw-r--r--sys/nfs/nfs_vfsops.c8
-rw-r--r--sys/nfs/nfsm_subs.h6
-rw-r--r--sys/sys/time.h5
-rw-r--r--sys/ufs/ext2fs/ext2fs_alloc.c6
-rw-r--r--sys/ufs/ext2fs/ext2fs_vfsops.c10
-rw-r--r--sys/ufs/ffs/ffs_alloc.c12
-rw-r--r--sys/ufs/ffs/ffs_vfsops.c4
-rw-r--r--sys/ufs/lfs/lfs_alloc.c6
-rw-r--r--sys/ufs/lfs/lfs_bio.c4
-rw-r--r--sys/ufs/ufs/inode.h6
-rw-r--r--sys/ufs/ufs/ufs_quota.c22
-rw-r--r--sys/uvm/uvm_meter.c4
66 files changed, 305 insertions, 318 deletions
diff --git a/sys/compat/common/kern_ipc_23.c b/sys/compat/common/kern_ipc_23.c
index 9b092daff93..5b77436bf6b 100644
--- a/sys/compat/common/kern_ipc_23.c
+++ b/sys/compat/common/kern_ipc_23.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kern_ipc_23.c,v 1.3 2002/12/17 23:11:31 millert Exp $ */
+/* $OpenBSD: kern_ipc_23.c,v 1.4 2004/06/21 23:50:35 tholo Exp $ */
/*
* Implementation of SVID semaphores
@@ -182,7 +182,7 @@ compat_23_sys_msgctl(p, v, retval)
msqptr->msg_perm.mode = (msqptr->msg_perm.mode & ~0777) |
(omsqbuf.msg_perm.mode & 0777);
msqptr->msg_qbytes = omsqbuf.msg_qbytes;
- msqptr->msg_ctime = time.tv_sec;
+ msqptr->msg_ctime = time_second;
break;
case IPC_STAT:
@@ -258,7 +258,7 @@ compat_23_sys_shmctl(p, v, retval)
shmseg->shm_perm.mode =
(shmseg->shm_perm.mode & ~ACCESSPERMS) |
(oinbuf.shm_perm.mode & ACCESSPERMS);
- shmseg->shm_ctime = time.tv_sec;
+ shmseg->shm_ctime = time_second;
break;
case IPC_RMID:
if ((error = ipcperm(cred, &shmseg->shm_perm, IPC_M)) != 0)
@@ -347,7 +347,7 @@ compat_23_sys___semctl(p, v, retval)
semaptr->sem_perm.gid = osbuf.sem_perm.gid;
semaptr->sem_perm.mode = (semaptr->sem_perm.mode & ~0777) |
(osbuf.sem_perm.mode & 0777);
- semaptr->sem_ctime = time.tv_sec;
+ semaptr->sem_ctime = time_second;
break;
case IPC_STAT:
diff --git a/sys/compat/hpux/hpux_compat.c b/sys/compat/hpux/hpux_compat.c
index df082077441..792fef3a4d5 100644
--- a/sys/compat/hpux/hpux_compat.c
+++ b/sys/compat/hpux/hpux_compat.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: hpux_compat.c,v 1.24 2003/08/15 20:32:15 tedu Exp $ */
+/* $OpenBSD: hpux_compat.c,v 1.25 2004/06/21 23:50:35 tholo Exp $ */
/* $NetBSD: hpux_compat.c,v 1.35 1997/05/08 16:19:48 mycroft Exp $ */
/*
@@ -728,7 +728,7 @@ hpux_shmctl1(p, uap, retval, isnew)
shp->shm_perm.gid = sbuf.shm_perm.gid;
shp->shm_perm.mode = (shp->shm_perm.mode & ~0777)
| (sbuf.shm_perm.mode & 0777);
- shp->shm_ctime = time.tv_sec;
+ shp->shm_ctime = time_second;
}
return (error);
}
@@ -1354,7 +1354,7 @@ hpux_sys_utime_6x(p, v, retval)
if (error)
return (error);
} else
- tv[0] = tv[1] = time.tv_sec;
+ tv[0] = tv[1] = time_second;
vattr_null(&vattr);
vattr.va_atime.tv_sec = tv[0];
vattr.va_atime.tv_nsec = 0;
diff --git a/sys/dev/ic/ncr53c9x.c b/sys/dev/ic/ncr53c9x.c
index fbb978ddf08..8992f52a7fb 100644
--- a/sys/dev/ic/ncr53c9x.c
+++ b/sys/dev/ic/ncr53c9x.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ncr53c9x.c,v 1.22 2004/01/15 17:51:42 miod Exp $ */
+/* $OpenBSD: ncr53c9x.c,v 1.23 2004/06/21 23:50:35 tholo Exp $ */
/* $NetBSD: ncr53c9x.c,v 1.56 2000/11/30 14:41:46 thorpej Exp $ */
/*
@@ -781,7 +781,7 @@ ncr53c9x_scsi_cmd(xs)
return (TRY_AGAIN_LATER);
}
bzero(li, sizeof(*li));
- li->last_used = time.tv_sec;
+ li->last_used = time_second;
li->lun = lun;
s = splbio();
LIST_INSERT_HEAD(&ti->luns, li, link);
@@ -927,7 +927,7 @@ ncr53c9x_sched(sc)
if (lun < NCR_NLUN)
ti->lun[lun] = li;
}
- li->last_used = time.tv_sec;
+ li->last_used = time_second;
if (!tag) {
/* Try to issue this as an un-tagged command */
if (!li->untagged)
@@ -2787,7 +2787,7 @@ ncr53c9x_watch(arg)
struct ncr53c9x_linfo *li;
int t, s;
/* Delete any structures that have not been used in 10min. */
- time_t old = time.tv_sec - (10*60);
+ time_t old = time_second - (10*60);
s = splbio();
for (t=0; t<NCR_NTARG; t++) {
diff --git a/sys/dev/ic/smc90cx6.c b/sys/dev/ic/smc90cx6.c
index 5306648230e..d011c1308c8 100644
--- a/sys/dev/ic/smc90cx6.c
+++ b/sys/dev/ic/smc90cx6.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: smc90cx6.c,v 1.8 2004/05/26 19:56:31 brad Exp $ */
+/* $OpenBSD: smc90cx6.c,v 1.9 2004/06/21 23:50:35 tholo Exp $ */
/* $NetBSD: smc90cx6.c,v 1.17 1996/05/07 01:43:18 thorpej Exp $ */
/*
@@ -1064,7 +1064,7 @@ bahintr(sc)
* time if necessary.
*/
- newsec = time.tv_sec;
+ newsec = time_second;
if (newsec - sc->sc_recontime > 2 * sc->sc_reconcount) {
sc->sc_recontime = newsec;
sc->sc_reconcount = 0;
diff --git a/sys/dev/ic/z8530tty.c b/sys/dev/ic/z8530tty.c
index 257a86ae3c9..2068259f5d9 100644
--- a/sys/dev/ic/z8530tty.c
+++ b/sys/dev/ic/z8530tty.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: z8530tty.c,v 1.14 2003/10/03 16:44:51 miod Exp $ */
+/* $OpenBSD: z8530tty.c,v 1.15 2004/06/21 23:50:35 tholo Exp $ */
/* $NetBSD: z8530tty.c,v 1.13 1996/10/16 20:42:14 gwr Exp $ */
/*
@@ -1091,8 +1091,8 @@ zsoverrun(zst, ptime, what)
char *what;
{
- if (*ptime != time.tv_sec) {
- *ptime = time.tv_sec;
+ if (*ptime != time_second) {
+ *ptime = time_second;
log(LOG_WARNING, "%s: %s overrun\n",
zst->zst_dev.dv_xname, what);
}
diff --git a/sys/dev/pci/ncr.c b/sys/dev/pci/ncr.c
index 7b5368878e3..ff356cdd827 100644
--- a/sys/dev/pci/ncr.c
+++ b/sys/dev/pci/ncr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ncr.c,v 1.68 2003/11/07 10:16:45 jmc Exp $ */
+/* $OpenBSD: ncr.c,v 1.69 2004/06/21 23:50:35 tholo Exp $ */
/* $NetBSD: ncr.c,v 1.63 1997/09/23 02:39:15 perry Exp $ */
/**************************************************************************
@@ -1466,7 +1466,7 @@ static void ncr_attach (pcici_t tag, int unit);
#if 0
static char ident[] =
- "\n$OpenBSD: ncr.c,v 1.68 2003/11/07 10:16:45 jmc Exp $\n";
+ "\n$OpenBSD: ncr.c,v 1.69 2004/06/21 23:50:35 tholo Exp $\n";
#endif
static const u_long ncr_version = NCR_VERSION * 11
@@ -4788,7 +4788,7 @@ static int32_t ncr_start (struct scsi_xfer * xp)
cp->jump_ccb.l_cmd = SCR_BO((SCR_JUMP ^ IFFALSE (DATA (cp->tag))));
#ifdef __OpenBSD__
- cp->tlimit = mono_time.tv_sec + xp->timeout / 1000 + 2;
+ cp->tlimit = time_uptime + xp->timeout / 1000 + 2;
#else
cp->tlimit = time.tv_sec + xp->timeout / 1000 + 2;
#endif
@@ -5765,7 +5765,7 @@ static void ncr_timeout (void *arg)
{
ncb_p np = arg;
#ifdef __OpenBSD__
- u_long thistime = mono_time.tv_sec;
+ u_long thistime = time_uptime;
#else
u_long thistime = time.tv_sec;
#endif
@@ -6090,7 +6090,7 @@ void ncr_exception (ncb_p np)
*/
#ifdef __OpenBSD__
- if (mono_time.tv_sec - np->regtime.tv_sec>10) {
+ if (time_uptime - np->regtime.tv_sec>10) {
int i;
np->regtime = mono_time;
#else
diff --git a/sys/kern/kern_clock.c b/sys/kern/kern_clock.c
index 5a3df5ecec4..55a63e0bf61 100644
--- a/sys/kern/kern_clock.c
+++ b/sys/kern/kern_clock.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kern_clock.c,v 1.44 2004/06/13 21:49:26 niklas Exp $ */
+/* $OpenBSD: kern_clock.c,v 1.45 2004/06/21 23:50:35 tholo Exp $ */
/* $NetBSD: kern_clock.c,v 1.34 1996/06/09 04:51:03 briggs Exp $ */
/*-
@@ -106,6 +106,9 @@ static int tickfixcnt; /* accumulated fractional error */
long cp_time[CPUSTATES];
+volatile time_t time_second;
+volatile time_t time_uptime;
+
volatile struct timeval time
__attribute__((__aligned__(__alignof__(quad_t))));
volatile struct timeval mono_time;
@@ -234,6 +237,8 @@ hardclock(struct clockframe *frame)
BUMPTIME(&time, delta);
BUMPTIME(&mono_time, delta);
+ time_second = time.tv_sec;
+ time_uptime = mono_time.tv_sec;
#ifdef CPU_CLOCKUPDATE
CPU_CLOCKUPDATE();
diff --git a/sys/kern/kern_synch.c b/sys/kern/kern_synch.c
index ced3ee57941..91127363bbc 100644
--- a/sys/kern/kern_synch.c
+++ b/sys/kern/kern_synch.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kern_synch.c,v 1.57 2004/06/20 03:00:16 art Exp $ */
+/* $OpenBSD: kern_synch.c,v 1.58 2004/06/21 23:50:36 tholo Exp $ */
/* $NetBSD: kern_synch.c,v 1.37 1996/04/22 01:38:37 christos Exp $ */
/*-
@@ -764,6 +764,7 @@ mi_switch()
/*
* Compute the amount of time during which the current
* process was running, and add that to its total so far.
+ * XXX -- comparing wall time with uptime here!
*/
microtime(&tv);
#ifdef __HAVE_CPUINFO
diff --git a/sys/kern/kern_time.c b/sys/kern/kern_time.c
index 1ed5f182d36..3c59040fdb5 100644
--- a/sys/kern/kern_time.c
+++ b/sys/kern/kern_time.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kern_time.c,v 1.41 2004/06/13 21:49:26 niklas Exp $ */
+/* $OpenBSD: kern_time.c,v 1.42 2004/06/21 23:50:36 tholo Exp $ */
/* $NetBSD: kern_time.c,v 1.20 1996/02/18 11:57:06 fvdl Exp $ */
/*
@@ -90,7 +90,7 @@ settime(struct timeval *tv)
*/
if (securelevel > 1 && timercmp(tv, &time, <)) {
printf("denied attempt to set clock back %ld seconds\n",
- time.tv_sec - tv->tv_sec);
+ time_second - tv->tv_sec);
return (EPERM);
}
diff --git a/sys/kern/sysv_msg.c b/sys/kern/sysv_msg.c
index effbd84f601..bf7cf0fbd27 100644
--- a/sys/kern/sysv_msg.c
+++ b/sys/kern/sysv_msg.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sysv_msg.c,v 1.15 2003/07/21 22:44:50 tedu Exp $ */
+/* $OpenBSD: sysv_msg.c,v 1.16 2004/06/21 23:50:36 tholo Exp $ */
/* $NetBSD: sysv_msg.c,v 1.19 1996/02/09 19:00:18 christos Exp $ */
/*
@@ -255,7 +255,7 @@ sys_msgctl(p, v, retval)
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:
@@ -353,7 +353,7 @@ sys_msgget(p, v, retval)
msqptr->msg_lrpid = 0;
msqptr->msg_stime = 0;
msqptr->msg_rtime = 0;
- msqptr->msg_ctime = time.tv_sec;
+ msqptr->msg_ctime = time_second;
} else {
DPRINTF(("didn't find it and wasn't asked to create it\n"));
return (ENOENT);
@@ -645,7 +645,7 @@ sys_msgsnd(p, v, retval)
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(msqptr);
*retval = 0;
@@ -843,7 +843,7 @@ sys_msgrcv(p, v, retval)
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.
diff --git a/sys/kern/sysv_sem.c b/sys/kern/sysv_sem.c
index 8255a6f0160..d868dbd7ced 100644
--- a/sys/kern/sysv_sem.c
+++ b/sys/kern/sysv_sem.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sysv_sem.c,v 1.29 2004/05/03 17:38:48 millert Exp $ */
+/* $OpenBSD: sysv_sem.c,v 1.30 2004/06/21 23:50:36 tholo Exp $ */
/* $NetBSD: sysv_sem.c,v 1.26 1996/02/09 19:00:25 christos Exp $ */
/*
@@ -296,7 +296,7 @@ sys___semctl(struct proc *p, void *v, register_t *retval)
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:
@@ -475,7 +475,7 @@ sys_semget(struct proc *p, void *v, register_t *retval)
(semseqs[semid] + 1) & 0x7fff;
semaptr_new->sem_nsems = nsems;
semaptr_new->sem_otime = 0;
- semaptr_new->sem_ctime = time.tv_sec;
+ semaptr_new->sem_ctime = time_second;
sema[semid] = semaptr_new;
semtot += nsems;
} else {
diff --git a/sys/kern/sysv_shm.c b/sys/kern/sysv_shm.c
index ff614d7655e..3be8c1a1523 100644
--- a/sys/kern/sysv_shm.c
+++ b/sys/kern/sysv_shm.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sysv_shm.c,v 1.43 2004/05/03 17:38:48 millert Exp $ */
+/* $OpenBSD: sysv_shm.c,v 1.44 2004/06/21 23:50:36 tholo Exp $ */
/* $NetBSD: sysv_shm.c,v 1.50 1998/10/21 22:24:29 tron Exp $ */
/*
@@ -172,7 +172,7 @@ shm_delete_mapping(struct vmspace *vm, struct shmmap_state *shmmap_s)
size = round_page(shmseg->shm_segsz);
uvm_deallocate(&vm->vm_map, shmmap_s->va, size);
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);
@@ -286,7 +286,7 @@ sys_shmat1(struct proc *p, void *v, register_t *retval, int findremoved)
shmmap_s->va = attach_va;
shmmap_s->shmid = SCARG(uap, shmid);
shmseg->shm_lpid = p->p_pid;
- shmseg->shm_atime = time.tv_sec;
+ shmseg->shm_atime = time_second;
shmseg->shm_nattch++;
*retval = attach_va;
return (0);
@@ -329,7 +329,7 @@ sys_shmctl(struct proc *p, void *v, register_t *retval)
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:
if ((error = ipcperm(cred, &shmseg->shm_perm, IPC_M)) != 0)
@@ -446,7 +446,7 @@ shmget_allocate_segment(struct proc *p,
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;
shmseg->shm_internal = shm_handle;
*retval = IXSEQ_TO_IPCID(segnum, shmseg->shm_perm);
diff --git a/sys/kern/vfs_sync.c b/sys/kern/vfs_sync.c
index 46f93cd1b43..d1bac27b90c 100644
--- a/sys/kern/vfs_sync.c
+++ b/sys/kern/vfs_sync.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: vfs_sync.c,v 1.25 2003/09/01 18:06:03 henning Exp $ */
+/* $OpenBSD: vfs_sync.c,v 1.26 2004/06/21 23:50:36 tholo Exp $ */
/*
* Portions of this code are:
@@ -147,7 +147,7 @@ sched_sync(p)
syncerproc = curproc;
for (;;) {
- starttime = time.tv_sec;
+ starttime = time_second;
/*
* Push files whose dirty time has expired.
@@ -222,7 +222,7 @@ sched_sync(p)
* 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);
}
}
diff --git a/sys/kern/vfs_syscalls.c b/sys/kern/vfs_syscalls.c
index 37708a02b27..09df56c89ce 100644
--- a/sys/kern/vfs_syscalls.c
+++ b/sys/kern/vfs_syscalls.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: vfs_syscalls.c,v 1.111 2004/05/14 04:00:33 tedu Exp $ */
+/* $OpenBSD: vfs_syscalls.c,v 1.112 2004/06/21 23:50:36 tholo Exp $ */
/* $NetBSD: vfs_syscalls.c,v 1.71 1996/04/23 10:29:02 mycroft Exp $ */
/*
@@ -107,7 +107,6 @@ sys_mount(p, v, retval)
struct vattr va;
struct nameidata nd;
struct vfsconf *vfsp;
- struct timeval tv;
if (usermount == 0 && (error = suser(p, 0)))
return (error);
@@ -279,8 +278,7 @@ update:
*/
error = VFS_MOUNT(mp, SCARG(uap, path), SCARG(uap, data), &nd, p);
if (!error) {
- microtime(&tv);
- mp->mnt_stat.f_ctime = tv.tv_sec;
+ mp->mnt_stat.f_ctime = time_second;
}
if (mp->mnt_flag & MNT_UPDATE) {
vrele(vp);
diff --git a/sys/net/if_arcsubr.c b/sys/net/if_arcsubr.c
index ff823f8dfb9..e0fd311a8e8 100644
--- a/sys/net/if_arcsubr.c
+++ b/sys/net/if_arcsubr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_arcsubr.c,v 1.20 2004/06/21 17:20:59 tholo Exp $ */
+/* $OpenBSD: if_arcsubr.c,v 1.21 2004/06/21 23:50:36 tholo Exp $ */
/* $NetBSD: if_arcsubr.c,v 1.8 1996/05/07 02:40:29 thorpej Exp $ */
/*
@@ -128,7 +128,7 @@ arc_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);
}
diff --git a/sys/net/if_bridge.c b/sys/net/if_bridge.c
index f59549ce66f..4dd1a901602 100644
--- a/sys/net/if_bridge.c
+++ b/sys/net/if_bridge.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_bridge.c,v 1.135 2004/06/21 19:26:01 mcbride Exp $ */
+/* $OpenBSD: if_bridge.c,v 1.136 2004/06/21 23:50:36 tholo Exp $ */
/*
* Copyright (c) 1999, 2000 Jason L. Wright (jason@thought.net)
@@ -2241,11 +2241,7 @@ bridge_ipsec(int dir, int af, int hlen, struct mbuf *m)
if (tdb != NULL && (tdb->tdb_flags & TDBF_INVALID) == 0 &&
tdb->tdb_xform != NULL) {
if (tdb->tdb_first_use == 0) {
- int pri;
-
- pri = splhigh();
- tdb->tdb_first_use = time.tv_sec;
- splx(pri);
+ tdb->tdb_first_use = time_second;
tv.tv_usec = 0;
diff --git a/sys/net/if_ethersubr.c b/sys/net/if_ethersubr.c
index 0471a4ac5d3..8e9e32c3e6d 100644
--- a/sys/net/if_ethersubr.c
+++ b/sys/net/if_ethersubr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_ethersubr.c,v 1.76 2004/04/17 00:09:01 henning Exp $ */
+/* $OpenBSD: if_ethersubr.c,v 1.77 2004/06/21 23:50:36 tholo Exp $ */
/* $NetBSD: if_ethersubr.c,v 1.19 1996/05/07 02:40:30 thorpej Exp $ */
/*
@@ -277,7 +277,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);
}
diff --git a/sys/net/if_fddisubr.c b/sys/net/if_fddisubr.c
index 0b7b6dcb018..ab7ea077909 100644
--- a/sys/net/if_fddisubr.c
+++ b/sys/net/if_fddisubr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_fddisubr.c,v 1.37 2004/04/17 00:09:01 henning Exp $ */
+/* $OpenBSD: if_fddisubr.c,v 1.38 2004/06/21 23:50:36 tholo Exp $ */
/* $NetBSD: if_fddisubr.c,v 1.5 1996/05/07 23:20:21 christos Exp $ */
/*
@@ -196,7 +196,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);
}
diff --git a/sys/net/if_pfsync.c b/sys/net/if_pfsync.c
index 1f2c8f14f52..afc07b30add 100644
--- a/sys/net/if_pfsync.c
+++ b/sys/net/if_pfsync.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_pfsync.c,v 1.34 2004/06/04 22:25:09 mcbride Exp $ */
+/* $OpenBSD: if_pfsync.c,v 1.35 2004/06/21 23:50:36 tholo Exp $ */
/*
* Copyright (c) 2002 Michael Shalayeff
@@ -37,6 +37,7 @@
#include <sys/socket.h>
#include <sys/ioctl.h>
#include <sys/timeout.h>
+#include <sys/kernel.h>
#include <net/if.h>
#include <net/if_types.h>
@@ -99,9 +100,6 @@ void pfsync_bulkfail(void *);
int pfsync_sync_ok;
extern int ifqmaxlen;
-extern struct timeval time;
-extern struct timeval mono_time;
-extern int hz;
void
pfsyncattach(int npfsync)
@@ -209,8 +207,8 @@ pfsync_insert_net_state(struct pfsync_state *sp)
pf_state_peer_ntoh(&sp->dst, &st->dst);
bcopy(&sp->rt_addr, &st->rt_addr, sizeof(st->rt_addr));
- st->creation = ntohl(sp->creation) + time.tv_sec;
- st->expire = ntohl(sp->expire) + time.tv_sec;
+ st->creation = ntohl(sp->creation) + time_second;
+ st->expire = ntohl(sp->expire) + time_second;
st->af = sp->af;
st->proto = sp->proto;
@@ -452,7 +450,7 @@ pfsync_input(struct mbuf *m, ...)
}
pf_state_peer_ntoh(&sp->src, &st->src);
pf_state_peer_ntoh(&sp->dst, &st->dst);
- st->expire = ntohl(sp->expire) + time.tv_sec;
+ st->expire = ntohl(sp->expire) + time_second;
st->timeout = sp->timeout;
}
if (stale && sc->sc_mbuf != NULL)
@@ -576,7 +574,7 @@ pfsync_input(struct mbuf *m, ...)
}
pf_state_peer_ntoh(&up->src, &st->src);
pf_state_peer_ntoh(&up->dst, &st->dst);
- st->expire = ntohl(up->expire) + time.tv_sec;
+ st->expire = ntohl(up->expire) + time_second;
st->timeout = up->timeout;
}
if ((update_requested || stale) && sc->sc_mbuf)
@@ -629,7 +627,7 @@ pfsync_input(struct mbuf *m, ...)
key.creatorid = rup->creatorid;
if (key.id == 0 && key.creatorid == 0) {
- sc->sc_ureq_received = mono_time.tv_sec;
+ sc->sc_ureq_received = time_uptime;
if (pf_status.debug >= PF_DEBUG_MISC)
printf("pfsync: received "
"bulk update request\n");
@@ -669,7 +667,7 @@ pfsync_input(struct mbuf *m, ...)
"update start\n");
break;
case PFSYNC_BUS_END:
- if (mono_time.tv_sec - ntohl(bus->endtime) >=
+ if (time_uptime - ntohl(bus->endtime) >=
sc->sc_ureq_sent) {
/* that's it, we're happy */
sc->sc_ureq_sent = 0;
@@ -809,7 +807,7 @@ pfsyncioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
imo->imo_multicast_loop = 0;
/* Request a full state table update. */
- sc->sc_ureq_sent = mono_time.tv_sec;
+ sc->sc_ureq_sent = time_uptime;
#if NCARP > 0
if (pfsync_sync_ok)
carp_suppress_preempt++;
@@ -990,9 +988,9 @@ pfsync_pack_state(u_int8_t action, struct pf_state *st, int compress)
}
}
- secs = time.tv_sec;
+ secs = time_second;
- st->pfsync_time = mono_time.tv_sec;
+ st->pfsync_time = time_uptime;
TAILQ_REMOVE(&state_updates, st, u.s.entry_updates);
TAILQ_INSERT_TAIL(&state_updates, st, u.s.entry_updates);
@@ -1210,7 +1208,7 @@ pfsync_send_bus(struct pfsync_softc *sc, u_int8_t status)
bus = sc->sc_statep.b;
bus->creatorid = pf_status.hostid;
bus->status = status;
- bus->endtime = htonl(mono_time.tv_sec - sc->sc_ureq_received);
+ bus->endtime = htonl(time_uptime - sc->sc_ureq_received);
pfsync_sendout(sc);
}
}
@@ -1244,7 +1242,7 @@ pfsync_bulk_update(void *v)
/* send an update and move to end of list */
if (!state->sync_flags)
pfsync_pack_state(PFSYNC_ACT_UPD, state, 0);
- state->pfsync_time = mono_time.tv_sec;
+ state->pfsync_time = time_uptime;
TAILQ_REMOVE(&state_updates, state, u.s.entry_updates);
TAILQ_INSERT_TAIL(&state_updates, state,
u.s.entry_updates);
diff --git a/sys/net/if_ppp.c b/sys/net/if_ppp.c
index e6a45a02671..0f34d6c153f 100644
--- a/sys/net/if_ppp.c
+++ b/sys/net/if_ppp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_ppp.c,v 1.41 2004/04/25 18:50:01 henning Exp $ */
+/* $OpenBSD: if_ppp.c,v 1.42 2004/06/21 23:50:36 tholo Exp $ */
/* $NetBSD: if_ppp.c,v 1.39 1997/05/17 21:11:59 christos Exp $ */
/*
@@ -140,7 +140,6 @@
#include "bpfilter.h"
#if NBPFILTER > 0
-#include <sys/time.h>
#include <net/bpf.h>
#endif
@@ -332,7 +331,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;
}
@@ -570,7 +569,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);
@@ -822,7 +821,7 @@ 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;
}
@@ -1482,7 +1481,7 @@ 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;
}
diff --git a/sys/net/if_sl.c b/sys/net/if_sl.c
index 9d3f6425b93..02b6f723b18 100644
--- a/sys/net/if_sl.c
+++ b/sys/net/if_sl.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_sl.c,v 1.27 2004/04/25 18:50:01 henning Exp $ */
+/* $OpenBSD: if_sl.c,v 1.28 2004/06/21 23:50:36 tholo Exp $ */
/* $NetBSD: if_sl.c,v 1.39.4.1 1996/06/02 16:26:31 thorpej Exp $ */
/*
@@ -758,15 +758,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);
return;
@@ -774,7 +774,7 @@ slinput(c, tp)
}
} else
sc->sc_abortcount = 0;
- sc->sc_lasttime = time.tv_sec;
+ sc->sc_lasttime = time_second;
}
switch (c) {
diff --git a/sys/net/if_strip.c b/sys/net/if_strip.c
index 34984c4a50a..c7f27a6d256 100644
--- a/sys/net/if_strip.c
+++ b/sys/net/if_strip.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_strip.c,v 1.28 2004/04/25 18:50:01 henning Exp $ */
+/* $OpenBSD: if_strip.c,v 1.29 2004/06/21 23:50:36 tholo Exp $ */
/* $NetBSD: if_strip.c,v 1.2.4.3 1996/08/03 00:58:32 jtc Exp $ */
/* from: NetBSD: if_sl.c,v 1.38 1996/02/13 22:00:23 christos Exp $ */
@@ -315,7 +315,7 @@ void strip_timeout(void *x);
#define CLEAR_RESET_TIMER(sc) \
do {\
(sc)->sc_state = ST_ALIVE; \
- (sc)->sc_statetimo = time.tv_sec + ST_PROBE_INTERVAL; \
+ (sc)->sc_statetimo = time_second + ST_PROBE_INTERVAL; \
} while (0)
/*
@@ -324,13 +324,13 @@ void strip_timeout(void *x);
*/
#define FORCE_RESET(sc) \
do {\
- (sc)->sc_statetimo = time.tv_sec - 1; \
+ (sc)->sc_statetimo = time_second - 1; \
(sc)->sc_state = ST_DEAD; \
/*(sc)->sc_if.if_timer = 0;*/ \
} while (0)
#define RADIO_PROBE_TIMEOUT(sc) \
- ((sc)-> sc_statetimo > time.tv_sec)
+ ((sc)-> sc_statetimo > time_second)
@@ -424,7 +424,7 @@ stripinit(sc)
/* Initialize radio probe/reset state machine */
sc->sc_state = ST_DEAD; /* assumet the worst. */
- sc->sc_statetimo = time.tv_sec; /* do reset immediately */
+ sc->sc_statetimo = time_second; /* do reset immediately */
return (1);
}
@@ -686,7 +686,7 @@ strip_send(sc, m0)
* If a radio probe is due now, append it to this packet rather
* than waiting until the watchdog routine next runs.
*/
- if (time.tv_sec >= sc->sc_statetimo && sc->sc_state == ST_ALIVE)
+ if (time_second >= sc->sc_statetimo && sc->sc_state == ST_ALIVE)
strip_proberadio(sc, tp);
return (m0);
@@ -1385,7 +1385,7 @@ strip_resetradio(sc, tp)
*/
sc->sc_state = ST_DEAD;
sc->sc_lastpacket = time;
- sc->sc_statetimo = time.tv_sec + STRIP_RESET_INTERVAL;
+ sc->sc_statetimo = time_second + STRIP_RESET_INTERVAL;
/*
* XXX Does calling the tty output routine now help resets?
@@ -1428,7 +1428,7 @@ strip_proberadio(sc, tp)
sc->sc_if.if_xname);
/* Go to probe-sent state, set timeout accordingly. */
sc->sc_state = ST_PROBE_SENT;
- sc->sc_statetimo = time.tv_sec + ST_PROBERESPONSE_INTERVAL;
+ sc->sc_statetimo = time_second + ST_PROBERESPONSE_INTERVAL;
} else {
addlog("%s: incomplete probe, tty queue %d bytes overfull\n",
sc->sc_if.if_xname, overflow);
@@ -1498,13 +1498,13 @@ strip_watchdog(ifp)
ifp->if_xname,
((unsigned) sc->sc_state < 3) ?
strip_statenames[sc->sc_state] : "<<illegal state>>",
- sc->sc_statetimo - time.tv_sec);
+ sc->sc_statetimo - time_second);
#endif
/*
* If time in this state hasn't yet expired, return.
*/
- if ((ifp->if_flags & IFF_UP) == 0 || sc->sc_statetimo > time.tv_sec) {
+ if ((ifp->if_flags & IFF_UP) == 0 || sc->sc_statetimo > time_second) {
goto done;
}
diff --git a/sys/net/if_tokensubr.c b/sys/net/if_tokensubr.c
index b58bb40e22a..d5b9ece85fe 100644
--- a/sys/net/if_tokensubr.c
+++ b/sys/net/if_tokensubr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_tokensubr.c,v 1.14 2004/04/17 00:09:01 henning Exp $ */
+/* $OpenBSD: if_tokensubr.c,v 1.15 2004/06/21 23:50:36 tholo Exp $ */
/* $NetBSD: if_tokensubr.c,v 1.7 1999/05/30 00:39:07 bad Exp $ */
/*
@@ -171,7 +171,7 @@ token_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);
}
diff --git a/sys/net/pf.c b/sys/net/pf.c
index 826fb6f57d0..278c6cdfecc 100644
--- a/sys/net/pf.c
+++ b/sys/net/pf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pf.c,v 1.452 2004/06/21 19:26:01 mcbride Exp $ */
+/* $OpenBSD: pf.c,v 1.453 2004/06/21 23:50:36 tholo Exp $ */
/*
* Copyright (c) 2001 Daniel Hartmeier
@@ -612,7 +612,7 @@ pf_insert_src_node(struct pf_src_node **sn, struct pf_rule *rule,
pool_put(&pf_src_tree_pl, *sn);
return (-1);
}
- (*sn)->creation = time.tv_sec;
+ (*sn)->creation = time_second;
(*sn)->ruletype = rule->action;
if ((*sn)->rule.ptr != NULL)
(*sn)->rule.ptr->src_nodes++;
@@ -723,7 +723,7 @@ pf_state_expires(const struct pf_state *state)
/* handle all PFTM_* > PFTM_MAX here */
if (state->timeout == PFTM_PURGE)
- return (time.tv_sec);
+ return (time_second);
if (state->timeout == PFTM_UNTIL_PACKET)
return (0);
KASSERT(state->timeout < PFTM_MAX);
@@ -744,7 +744,7 @@ pf_state_expires(const struct pf_state *state)
return (state->expire + timeout * (end - states) /
(end - start));
else
- return (time.tv_sec);
+ return (time_second);
}
return (state->expire + timeout);
}
@@ -757,7 +757,7 @@ pf_purge_expired_src_nodes(void)
for (cur = RB_MIN(pf_src_tree, &tree_src_tracking); cur; cur = next) {
next = RB_NEXT(pf_src_tree, &tree_src_tracking, cur);
- if (cur->states <= 0 && cur->expire <= time.tv_sec) {
+ if (cur->states <= 0 && cur->expire <= time_second) {
if (cur->rule.ptr != NULL) {
cur->rule.ptr->src_nodes--;
if (cur->rule.ptr->states <= 0 &&
@@ -783,7 +783,7 @@ pf_src_tree_remove_state(struct pf_state *s)
if (!timeout)
timeout =
pf_default_rule.timeout[PFTM_SRC_NODE];
- s->src_node->expire = time.tv_sec + timeout;
+ s->src_node->expire = time_second + timeout;
}
}
if (s->nat_src_node != s->src_node && s->nat_src_node != NULL) {
@@ -792,7 +792,7 @@ pf_src_tree_remove_state(struct pf_state *s)
if (!timeout)
timeout =
pf_default_rule.timeout[PFTM_SRC_NODE];
- s->nat_src_node->expire = time.tv_sec + timeout;
+ s->nat_src_node->expire = time_second + timeout;
}
}
s->src_node = s->nat_src_node = NULL;
@@ -842,7 +842,7 @@ pf_purge_expired_states(void)
for (cur = RB_MIN(pf_state_tree_id, &tree_id);
cur; cur = next) {
next = RB_NEXT(pf_state_tree_id, &tree_id, cur);
- if (pf_state_expires(cur) <= time.tv_sec)
+ if (pf_state_expires(cur) <= time_second)
pf_purge_expired_state(cur);
}
}
@@ -2784,8 +2784,8 @@ cleanup:
s->dst.max_win = 1;
s->src.state = TCPS_SYN_SENT;
s->dst.state = TCPS_CLOSED;
- s->creation = time.tv_sec;
- s->expire = time.tv_sec;
+ s->creation = time_second;
+ s->expire = time_second;
s->timeout = PFTM_TCP_FIRST_PACKET;
pf_set_rt_ifp(s, saddr);
if (sn != NULL) {
@@ -3096,8 +3096,8 @@ cleanup:
}
s->src.state = PFUDPS_SINGLE;
s->dst.state = PFUDPS_NO_TRAFFIC;
- s->creation = time.tv_sec;
- s->expire = time.tv_sec;
+ s->creation = time_second;
+ s->expire = time_second;
s->timeout = PFTM_UDP_FIRST_PACKET;
pf_set_rt_ifp(s, saddr);
if (sn != NULL) {
@@ -3376,8 +3376,8 @@ cleanup:
PF_ACPY(&s->gwy.addr, &s->lan.addr, af);
s->gwy.port = icmpid;
}
- s->creation = time.tv_sec;
- s->expire = time.tv_sec;
+ s->creation = time_second;
+ s->expire = time_second;
s->timeout = PFTM_ICMP_FIRST_PACKET;
pf_set_rt_ifp(s, saddr);
if (sn != NULL) {
@@ -3638,8 +3638,8 @@ cleanup:
}
s->src.state = PFOTHERS_SINGLE;
s->dst.state = PFOTHERS_NO_TRAFFIC;
- s->creation = time.tv_sec;
- s->expire = time.tv_sec;
+ s->creation = time_second;
+ s->expire = time_second;
s->timeout = PFTM_OTHER_FIRST_PACKET;
pf_set_rt_ifp(s, saddr);
if (sn != NULL) {
@@ -4012,7 +4012,7 @@ pf_test_state_tcp(struct pf_state **state, int direction, struct pfi_kif *kif,
src->state = dst->state = TCPS_TIME_WAIT;
/* update expire time */
- (*state)->expire = time.tv_sec;
+ (*state)->expire = time_second;
if (src->state >= TCPS_FIN_WAIT_2 &&
dst->state >= TCPS_FIN_WAIT_2)
(*state)->timeout = PFTM_TCP_CLOSED;
@@ -4200,7 +4200,7 @@ pf_test_state_udp(struct pf_state **state, int direction, struct pfi_kif *kif,
dst->state = PFUDPS_MULTIPLE;
/* update expire time */
- (*state)->expire = time.tv_sec;
+ (*state)->expire = time_second;
if (src->state == PFUDPS_MULTIPLE && dst->state == PFUDPS_MULTIPLE)
(*state)->timeout = PFTM_UDP_MULTIPLE;
else
@@ -4285,7 +4285,7 @@ pf_test_state_icmp(struct pf_state **state, int direction, struct pfi_kif *kif,
STATE_LOOKUP();
- (*state)->expire = time.tv_sec;
+ (*state)->expire = time_second;
(*state)->timeout = PFTM_ICMP_ERROR_REPLY;
/* translate source/destination address, if necessary */
@@ -4823,7 +4823,7 @@ pf_test_state_other(struct pf_state **state, int direction, struct pfi_kif *kif,
dst->state = PFOTHERS_MULTIPLE;
/* update expire time */
- (*state)->expire = time.tv_sec;
+ (*state)->expire = time_second;
if (src->state == PFOTHERS_MULTIPLE && dst->state == PFOTHERS_MULTIPLE)
(*state)->timeout = PFTM_OTHER_MULTIPLE;
else
diff --git a/sys/net/pf_if.c b/sys/net/pf_if.c
index 3a139fa0444..b7f40bf72fa 100644
--- a/sys/net/pf_if.c
+++ b/sys/net/pf_if.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pf_if.c,v 1.13 2004/05/19 17:50:52 dhartmei Exp $ */
+/* $OpenBSD: pf_if.c,v 1.14 2004/06/21 23:50:36 tholo Exp $ */
/*
* Copyright (c) 2001 Daniel Hartmeier
@@ -565,7 +565,7 @@ pfi_if_create(const char *name, struct pfi_kif *q, int flags)
RB_INIT(&p->pfik_ext_gwy);
p->pfik_flags = flags;
p->pfik_parent = q;
- p->pfik_tzero = time.tv_sec;
+ p->pfik_tzero = time_second;
RB_INSERT(pfi_ifhead, &pfi_ifs, p);
if (q != NULL) {
@@ -705,7 +705,7 @@ pfi_clr_istats(const char *name, int *nzero, int flags)
{
struct pfi_kif *p;
int n = 0, s;
- long tzero = time.tv_sec;
+ long tzero = time_second;
s = splsoftnet();
ACCEPT_FLAGS(PFI_FLAG_GROUP|PFI_FLAG_INSTANCE);
diff --git a/sys/net/pf_ioctl.c b/sys/net/pf_ioctl.c
index 924370d5fe5..bc3e5e66bb2 100644
--- a/sys/net/pf_ioctl.c
+++ b/sys/net/pf_ioctl.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pf_ioctl.c,v 1.126 2004/06/14 20:53:27 cedric Exp $ */
+/* $OpenBSD: pf_ioctl.c,v 1.127 2004/06/21 23:50:36 tholo Exp $ */
/*
* Copyright (c) 2001 Daniel Hartmeier
@@ -1047,9 +1047,9 @@ pfioctl(dev_t dev, u_long cmd, caddr_t addr, int flags, struct proc *p)
error = EEXIST;
else {
pf_status.running = 1;
- pf_status.since = time.tv_sec;
+ pf_status.since = time_second;
if (pf_status.stateid == 0) {
- pf_status.stateid = time.tv_sec;
+ pf_status.stateid = time_second;
pf_status.stateid = pf_status.stateid << 32;
}
DPFPRINTF(PF_DEBUG_MISC, ("pf: started\n"));
@@ -1061,7 +1061,7 @@ pfioctl(dev_t dev, u_long cmd, caddr_t addr, int flags, struct proc *p)
error = ENOENT;
else {
pf_status.running = 0;
- pf_status.since = time.tv_sec;
+ pf_status.since = time_second;
DPFPRINTF(PF_DEBUG_MISC, ("pf: stopped\n"));
}
break;
@@ -1551,7 +1551,7 @@ pfioctl(dev_t dev, u_long cmd, caddr_t addr, int flags, struct proc *p)
state->nat_rule.ptr = NULL;
state->anchor.ptr = NULL;
state->rt_kif = NULL;
- state->creation = time.tv_sec;
+ state->creation = time_second;
state->pfsync_time = 0;
state->packets[0] = state->packets[1] = 0;
state->bytes[0] = state->bytes[1] = 0;
@@ -1590,8 +1590,8 @@ pfioctl(dev_t dev, u_long cmd, caddr_t addr, int flags, struct proc *p)
-1 : state->anchor.ptr->nr;
splx(s);
ps->state.expire = pf_state_expires(state);
- if (ps->state.expire > time.tv_sec)
- ps->state.expire -= time.tv_sec;
+ if (ps->state.expire > time_second)
+ ps->state.expire -= time_second;
else
ps->state.expire = 0;
break;
@@ -1619,7 +1619,7 @@ pfioctl(dev_t dev, u_long cmd, caddr_t addr, int flags, struct proc *p)
TAILQ_FOREACH(kif, &pfi_statehead, pfik_w_states)
RB_FOREACH(state, pf_state_tree_ext_gwy,
&kif->pfik_ext_gwy) {
- int secs = time.tv_sec;
+ int secs = time_second;
if ((nr+1) * sizeof(*p) > (unsigned)ps->ps_len)
break;
@@ -2671,7 +2671,7 @@ pfioctl(dev_t dev, u_long cmd, caddr_t addr, int flags, struct proc *p)
s = splsoftnet();
p = psn->psn_src_nodes;
RB_FOREACH(n, pf_src_tree, &tree_src_tracking) {
- int secs = time.tv_sec;
+ int secs = time_second;
if ((nr + 1) * sizeof(*p) > (unsigned)psn->psn_len)
break;
diff --git a/sys/net/pf_norm.c b/sys/net/pf_norm.c
index 4533491fe09..69e021924b5 100644
--- a/sys/net/pf_norm.c
+++ b/sys/net/pf_norm.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pf_norm.c,v 1.88 2004/06/10 14:22:54 dhartmei Exp $ */
+/* $OpenBSD: pf_norm.c,v 1.89 2004/06/21 23:50:36 tholo Exp $ */
/*
* Copyright 2001 Niels Provos <provos@citi.umich.edu>
@@ -176,7 +176,7 @@ void
pf_purge_expired_fragments(void)
{
struct pf_fragment *frag;
- u_int32_t expire = time.tv_sec -
+ u_int32_t expire = time_second -
pf_default_rule.timeout[PFTM_FRAG];
while ((frag = TAILQ_LAST(&pf_fragqueue, pf_fragqueue)) != NULL) {
@@ -287,7 +287,7 @@ pf_find_fragment(struct ip *ip, struct pf_frag_tree *tree)
frag = RB_FIND(pf_frag_tree, tree, &key);
if (frag != NULL) {
/* XXX Are we sure we want to update the timeout? */
- frag->fr_timeout = time.tv_sec;
+ frag->fr_timeout = time_second;
if (BUFFER_FRAGMENTS(frag)) {
TAILQ_REMOVE(&pf_fragqueue, frag, frag_next);
TAILQ_INSERT_HEAD(&pf_fragqueue, frag, frag_next);
@@ -352,7 +352,7 @@ pf_reassemble(struct mbuf **m0, struct pf_fragment **frag,
(*frag)->fr_dst = frent->fr_ip->ip_dst;
(*frag)->fr_p = frent->fr_ip->ip_p;
(*frag)->fr_id = frent->fr_ip->ip_id;
- (*frag)->fr_timeout = time.tv_sec;
+ (*frag)->fr_timeout = time_second;
LIST_INIT(&(*frag)->fr_queue);
RB_INSERT(pf_frag_tree, &pf_frag_tree, *frag);
@@ -554,7 +554,7 @@ pf_fragcache(struct mbuf **m0, struct ip *h, struct pf_fragment **frag, int mff,
(*frag)->fr_dst = h->ip_dst;
(*frag)->fr_p = h->ip_p;
(*frag)->fr_id = h->ip_id;
- (*frag)->fr_timeout = time.tv_sec;
+ (*frag)->fr_timeout = time_second;
cur->fr_off = off;
cur->fr_end = max;
@@ -1539,8 +1539,8 @@ pf_normalize_tcp_stateful(struct mbuf *m, int off, struct pf_pdesc *pd,
#define TS_MAX_IDLE (24*24*60*60)
#define TS_MAX_CONN (12*24*60*60) /* XXX remove when better tsecr check */
if (src->scrub && (src->scrub->pfss_flags & PFSS_PAWS) &&
- (mono_time.tv_sec - src->scrub->pfss_last.tv_sec > TS_MAX_IDLE ||
- time.tv_sec - state->creation > TS_MAX_CONN)) {
+ (time_uptime - src->scrub->pfss_last.tv_sec > TS_MAX_IDLE ||
+ time_second - state->creation > TS_MAX_CONN)) {
if (pf_status.debug >= PF_DEBUG_MISC) {
DPFPRINTF(("src idled out of PAWS\n"));
pf_print_state(state);
@@ -1550,7 +1550,7 @@ pf_normalize_tcp_stateful(struct mbuf *m, int off, struct pf_pdesc *pd,
| PFSS_PAWS_IDLED;
}
if (dst->scrub && (dst->scrub->pfss_flags & PFSS_PAWS) &&
- mono_time.tv_sec - dst->scrub->pfss_last.tv_sec > TS_MAX_IDLE) {
+ time_uptime - dst->scrub->pfss_last.tv_sec > TS_MAX_IDLE) {
if (pf_status.debug >= PF_DEBUG_MISC) {
DPFPRINTF(("dst idled out of PAWS\n"));
pf_print_state(state);
diff --git a/sys/net/pf_table.c b/sys/net/pf_table.c
index c61571a6bb3..b91ad500aca 100644
--- a/sys/net/pf_table.c
+++ b/sys/net/pf_table.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pf_table.c,v 1.56 2004/06/11 05:21:20 mcbride Exp $ */
+/* $OpenBSD: pf_table.c,v 1.57 2004/06/21 23:50:37 tholo Exp $ */
/*
* Copyright (c) 2002 Cedric Berger
@@ -240,7 +240,7 @@ pfr_add_addrs(struct pfr_table *tbl, struct pfr_addr *addr, int size,
struct pfr_kentry *p, *q;
struct pfr_addr ad;
int i, rv, s, xadd = 0;
- long tzero = time.tv_sec;
+ long tzero = time_second;
ACCEPT_FLAGS(PFR_FLAG_ATOMIC+PFR_FLAG_DUMMY+PFR_FLAG_FEEDBACK);
if (pfr_validate_table(tbl, 0, flags & PFR_FLAG_USERIOCTL))
@@ -407,7 +407,7 @@ pfr_set_addrs(struct pfr_table *tbl, struct pfr_addr *addr, int size,
struct pfr_kentry *p, *q;
struct pfr_addr ad;
int i, rv, s, xadd = 0, xdel = 0, xchange = 0;
- long tzero = time.tv_sec;
+ long tzero = time_second;
ACCEPT_FLAGS(PFR_FLAG_ATOMIC+PFR_FLAG_DUMMY+PFR_FLAG_FEEDBACK);
if (pfr_validate_table(tbl, 0, flags & PFR_FLAG_USERIOCTL))
@@ -595,7 +595,7 @@ pfr_get_astats(struct pfr_table *tbl, struct pfr_astats *addr, int *size,
struct pfr_walktree w;
struct pfr_kentryworkq workq;
int rv, s;
- long tzero = time.tv_sec;
+ long tzero = time_second;
ACCEPT_FLAGS(PFR_FLAG_ATOMIC); /* XXX PFR_FLAG_CLSTATS disabled */
if (pfr_validate_table(tbl, 0, 0))
@@ -1115,7 +1115,7 @@ pfr_add_tables(struct pfr_table *tbl, int size, int *nadd, int flags)
struct pfr_ktableworkq addq, changeq;
struct pfr_ktable *p, *q, *r, key;
int i, rv, s, xadd = 0;
- long tzero = time.tv_sec;
+ long tzero = time_second;
ACCEPT_FLAGS(PFR_FLAG_ATOMIC+PFR_FLAG_DUMMY);
SLIST_INIT(&addq);
@@ -1267,7 +1267,7 @@ pfr_get_tstats(struct pfr_table *filter, struct pfr_tstats *tbl, int *size,
struct pfr_ktable *p;
struct pfr_ktableworkq workq;
int s, n, nn;
- long tzero = time.tv_sec;
+ long tzero = time_second;
ACCEPT_FLAGS(PFR_FLAG_ATOMIC|PFR_FLAG_ALLRSETS);
/* XXX PFR_FLAG_CLSTATS disabled */
@@ -1315,7 +1315,7 @@ pfr_clr_tstats(struct pfr_table *tbl, int size, int *nzero, int flags)
struct pfr_ktableworkq workq;
struct pfr_ktable *p, key;
int i, s, xzero = 0;
- long tzero = time.tv_sec;
+ long tzero = time_second;
ACCEPT_FLAGS(PFR_FLAG_ATOMIC+PFR_FLAG_DUMMY+PFR_FLAG_ADDRSTOO);
SLIST_INIT(&workq);
@@ -1568,7 +1568,7 @@ pfr_ina_commit(struct pfr_table *trs, u_int32_t ticket, int *nadd,
struct pfr_ktableworkq workq;
struct pf_ruleset *rs;
int s, xadd = 0, xchange = 0;
- long tzero = time.tv_sec;
+ long tzero = time_second;
ACCEPT_FLAGS(PFR_FLAG_ATOMIC+PFR_FLAG_DUMMY);
rs = pf_find_ruleset(trs->pfrt_anchor);
@@ -1977,7 +1977,7 @@ pfr_attach_table(struct pf_ruleset *rs, char *name)
strlcpy(tbl.pfrt_anchor, ac->name, sizeof(tbl.pfrt_anchor));
kt = pfr_lookup_table(&tbl);
if (kt == NULL) {
- kt = pfr_create_ktable(&tbl, time.tv_sec, 1);
+ kt = pfr_create_ktable(&tbl, time_second, 1);
if (kt == NULL)
return (NULL);
if (ac != NULL) {
diff --git a/sys/net/route.c b/sys/net/route.c
index f7cbbaba971..cbd1ff8fcb5 100644
--- a/sys/net/route.c
+++ b/sys/net/route.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: route.c,v 1.42 2004/06/19 19:55:53 cedric Exp $ */
+/* $OpenBSD: route.c,v 1.43 2004/06/21 23:50:37 tholo Exp $ */
/* $NetBSD: route.c,v 1.14 1996/02/13 22:00:46 christos Exp $ */
/*
@@ -1124,7 +1124,7 @@ rt_timer_add(rt, func, queue)
struct rttimer *r;
long current_time;
- current_time = mono_time.tv_sec;
+ current_time = time_uptime;
/*
* If there's already a timer with this action, destroy it before
@@ -1179,7 +1179,7 @@ rt_timer_timer(arg)
long current_time;
int s;
- current_time = mono_time.tv_sec;
+ current_time = time_uptime;
s = splsoftnet();
for (rtq = LIST_FIRST(&rttimer_queue_head); rtq != NULL;
diff --git a/sys/netccitt/if_x25subr.c b/sys/netccitt/if_x25subr.c
index 2a29d305fe7..ca4f2fdfbe4 100644
--- a/sys/netccitt/if_x25subr.c
+++ b/sys/netccitt/if_x25subr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_x25subr.c,v 1.15 2003/12/10 07:22:42 itojun Exp $ */
+/* $OpenBSD: if_x25subr.c,v 1.16 2004/06/21 23:50:37 tholo Exp $ */
/* $NetBSD: if_x25subr.c,v 1.13 1996/05/09 22:29:25 scottr Exp $ */
/*
@@ -170,7 +170,6 @@ x25_ifinput(m, v)
struct llinfo_x25 *lx = (struct llinfo_x25 *) lcp->lcd_upnext;
struct ifnet *ifp;
struct ifqueue *inq;
- extern struct timeval time;
int s, isr;
if (m == 0 || lcp->lcd_state != DATA_TRANSFER)
diff --git a/sys/netccitt/pk_acct.c b/sys/netccitt/pk_acct.c
index a0f6114bba0..f2c6bb220aa 100644
--- a/sys/netccitt/pk_acct.c
+++ b/sys/netccitt/pk_acct.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pk_acct.c,v 1.6 2003/12/10 07:22:42 itojun Exp $ */
+/* $OpenBSD: pk_acct.c,v 1.7 2004/06/21 23:50:37 tholo Exp $ */
/* $NetBSD: pk_acct.c,v 1.9 1996/02/13 22:05:11 christos Exp $ */
/*
@@ -117,7 +117,7 @@ pk_acct (lcp)
if (sa -> x25_opts.op_flags & X25_REVERSE_CHARGE)
acbuf.x25acct_revcharge = 1;
acbuf.x25acct_stime = lcp -> lcd_stime;
- acbuf.x25acct_etime = time.tv_sec - acbuf.x25acct_stime;
+ acbuf.x25acct_etime = time_second - acbuf.x25acct_stime;
acbuf.x25acct_uid = curproc -> p_cred -> p_ruid;
acbuf.x25acct_psize = sa -> x25_opts.op_psize;
acbuf.x25acct_net = sa -> x25_net;
diff --git a/sys/netccitt/pk_subr.c b/sys/netccitt/pk_subr.c
index b4ee3efa907..c3d8639024d 100644
--- a/sys/netccitt/pk_subr.c
+++ b/sys/netccitt/pk_subr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pk_subr.c,v 1.11 2004/01/03 14:08:53 espie Exp $ */
+/* $OpenBSD: pk_subr.c,v 1.12 2004/06/21 23:50:37 tholo Exp $ */
/* $NetBSD: pk_subr.c,v 1.12 1996/03/30 21:54:33 christos Exp $ */
/*
@@ -476,7 +476,7 @@ pk_assoc(pkp, lcp, sa)
sa->x25_opts.op_wsize = lcp->lcd_windowsize;
sa->x25_net = pkp->pk_xcp->xc_addr.x25_net;
lcp->lcd_flags |= sa->x25_opts.op_flags;
- lcp->lcd_stime = time.tv_sec;
+ lcp->lcd_stime = time_second;
}
int
diff --git a/sys/netinet/if_ether.c b/sys/netinet/if_ether.c
index 7153125e150..2b1aa14b674 100644
--- a/sys/netinet/if_ether.c
+++ b/sys/netinet/if_ether.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_ether.c,v 1.53 2003/12/18 09:23:14 ho Exp $ */
+/* $OpenBSD: if_ether.c,v 1.54 2004/06/21 23:50:37 tholo Exp $ */
/* $NetBSD: if_ether.c,v 1.31 1996/05/11 12:59:58 mycroft Exp $ */
/*
@@ -126,7 +126,7 @@ arptimer(arg)
struct rtentry *rt = la->la_rt;
nla = LIST_NEXT(la, la_list);
- if (rt->rt_expire && rt->rt_expire <= time.tv_sec)
+ if (rt->rt_expire && rt->rt_expire <= time_second)
arptfree(la); /* timer has expired; clear */
}
splx(s);
@@ -155,8 +155,8 @@ arp_rtrequest(req, rt, info)
* We generate expiration times from time.tv_sec
* so avoid accidently creating permanent routes.
*/
- if (time.tv_sec == 0) {
- time.tv_sec++;
+ if (time_second == 0) {
+ time_second++;
}
timeout_set(&arptimer_to, arptimer, &arptimer_to);
@@ -207,7 +207,7 @@ arp_rtrequest(req, rt, info)
* it's a "permanent" route, so that routes cloned
* from it do not need their expiration time set.
*/
- rt->rt_expire = time.tv_sec;
+ rt->rt_expire = time_second;
/*
* linklayers with particular link MTU limitation.
*/
@@ -401,7 +401,7 @@ arpresolve(ac, rt, m, dst, desten)
* 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;
@@ -425,13 +425,13 @@ arpresolve(ac, rt, m, dst, desten)
/* This should never happen. (Should it? -gwr) */
printf("arpresolve: unresolved and rt_expire == 0\n");
/* Set expiration time to now (expired). */
- rt->rt_expire = time.tv_sec;
+ rt->rt_expire = time_second;
}
#endif
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->ac_if,
&(SIN(rt->rt_ifa->ifa_addr)->sin_addr.s_addr),
@@ -657,7 +657,7 @@ in_arpinput(m)
bcopy(ea->arp_sha, LLADDR(sdl),
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) {
diff --git a/sys/netinet/ip_id.c b/sys/netinet/ip_id.c
index b2a946bc9ef..d8c5fe6fef5 100644
--- a/sys/netinet/ip_id.c
+++ b/sys/netinet/ip_id.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ip_id.c,v 1.12 2004/03/22 04:37:20 deraadt Exp $ */
+/* $OpenBSD: ip_id.c,v 1.13 2004/06/21 23:50:37 tholo Exp $ */
/*
* Copyright 1998 Niels Provos <provos@citi.umich.edu>
@@ -154,7 +154,7 @@ ip_initid(void)
ru_g = pmod(RU_GEN,j,RU_N);
ru_counter = 0;
- ru_reseed = time.tv_sec + RU_OUT;
+ ru_reseed = time_second + RU_OUT;
ru_msb = ru_msb == 0x8000 ? 0 : 0x8000;
}
@@ -163,7 +163,7 @@ ip_randomid(void)
{
int i, n;
- if (ru_counter >= RU_MAX || time.tv_sec > ru_reseed)
+ if (ru_counter >= RU_MAX || time_second > ru_reseed)
ip_initid();
#if 0
diff --git a/sys/netinet/ip_ipsp.c b/sys/netinet/ip_ipsp.c
index 47b280610af..4b27ebb18c5 100644
--- a/sys/netinet/ip_ipsp.c
+++ b/sys/netinet/ip_ipsp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ip_ipsp.c,v 1.158 2004/04/14 20:10:04 markus Exp $ */
+/* $OpenBSD: ip_ipsp.c,v 1.159 2004/06/21 23:50:37 tholo Exp $ */
/*
* The authors of this code are John Ioannidis (ji@tla.org),
* Angelos D. Keromytis (kermit@csd.uch.gr),
@@ -690,7 +690,7 @@ puttdb(struct tdb *tdbp)
tdb_count++;
- ipsec_last_added = time.tv_sec;
+ ipsec_last_added = time_second;
splx(s);
}
@@ -858,7 +858,7 @@ tdb_alloc(void)
TAILQ_INIT(&tdbp->tdb_policy_head);
/* Record establishment time. */
- tdbp->tdb_established = time.tv_sec;
+ tdbp->tdb_established = time_second;
tdbp->tdb_epoch = kernfs_epoch - 1;
/* Initialize timeouts. */
@@ -919,7 +919,7 @@ ipsp_print_tdb(struct tdb *tdb, char *buffer, size_t buflen)
"\tEstablished %d seconds ago\n"
"\tSource = %s",
ntohl(tdb->tdb_spi), ipsp_address(tdb->tdb_dst), tdb->tdb_sproto,
- time.tv_sec - tdb->tdb_established,
+ time_second - tdb->tdb_established,
ipsp_address(tdb->tdb_src));
l = strlen(buffer);
@@ -931,10 +931,10 @@ ipsp_print_tdb(struct tdb *tdb, char *buffer, size_t buflen)
snprintf(buffer + l, buflen - l, "\n");
l += strlen(buffer + l);
- if (tdb->tdb_mtu && tdb->tdb_mtutimeout > time.tv_sec) {
+ if (tdb->tdb_mtu && tdb->tdb_mtutimeout > time_second) {
snprintf(buffer + l, buflen - l,
"\tMTU: %d, expires in %llu seconds\n",
- tdb->tdb_mtu, tdb->tdb_mtutimeout - time.tv_sec);
+ tdb->tdb_mtu, tdb->tdb_mtutimeout - time_second);
l += strlen(buffer + l);
}
@@ -1053,14 +1053,14 @@ ipsp_print_tdb(struct tdb *tdb, char *buffer, size_t buflen)
if (tdb->tdb_last_used) {
snprintf(buffer + l, buflen - l,
"\tLast used %llu seconds ago\n",
- time.tv_sec - tdb->tdb_last_used);
+ time_second - tdb->tdb_last_used);
l += strlen(buffer + l);
}
if (tdb->tdb_last_marked) {
snprintf(buffer + l, buflen - l,
"\tLast marked/unmarked %llu seconds ago\n",
- time.tv_sec - tdb->tdb_last_marked);
+ time_second - tdb->tdb_last_marked);
l += strlen(buffer + l);
}
@@ -1071,14 +1071,14 @@ ipsp_print_tdb(struct tdb *tdb, char *buffer, size_t buflen)
if (tdb->tdb_flags & TDBF_TIMER) {
snprintf(buffer + l, buflen -l,
"\t\tHard expiration(1) in %llu seconds\n",
- tdb->tdb_established + tdb->tdb_exp_timeout - time.tv_sec);
+ tdb->tdb_established + tdb->tdb_exp_timeout - time_second);
l += strlen(buffer + l);
}
if (tdb->tdb_flags & TDBF_SOFT_TIMER) {
snprintf(buffer + l, buflen -l,
"\t\tSoft expiration(1) in %llu seconds\n",
tdb->tdb_established + tdb->tdb_soft_timeout -
- time.tv_sec);
+ time_second);
l += strlen(buffer + l);
}
if (tdb->tdb_flags & TDBF_BYTES) {
@@ -1110,7 +1110,7 @@ ipsp_print_tdb(struct tdb *tdb, char *buffer, size_t buflen)
snprintf(buffer + l, buflen -l,
"\t\tHard expiration(2) in %llu seconds\n",
(tdb->tdb_first_use + tdb->tdb_exp_first_use) -
- time.tv_sec);
+ time_second);
l += strlen(buffer + l);
} else {
snprintf(buffer + l, buflen -l,
@@ -1126,7 +1126,7 @@ ipsp_print_tdb(struct tdb *tdb, char *buffer, size_t buflen)
snprintf(buffer + l, buflen -l,
"\t\tSoft expiration(2) in %llu seconds\n",
(tdb->tdb_first_use + tdb->tdb_soft_first_use) -
- time.tv_sec);
+ time_second);
l += strlen(buffer + l);
} else {
snprintf(buffer + l, buflen -l,
@@ -1336,7 +1336,7 @@ ipsp_skipcrypto_mark(struct tdb_ident *tdbi)
tdb = gettdb(tdbi->spi, &tdbi->dst, tdbi->proto);
if (tdb != NULL) {
tdb->tdb_flags |= TDBF_SKIPCRYPTO;
- tdb->tdb_last_marked = time.tv_sec;
+ tdb->tdb_last_marked = time_second;
}
splx(s);
}
@@ -1351,7 +1351,7 @@ ipsp_skipcrypto_unmark(struct tdb_ident *tdbi)
tdb = gettdb(tdbi->spi, &tdbi->dst, tdbi->proto);
if (tdb != NULL) {
tdb->tdb_flags &= ~TDBF_SKIPCRYPTO;
- tdb->tdb_last_marked = time.tv_sec;
+ tdb->tdb_last_marked = time_second;
}
splx(s);
}
diff --git a/sys/netinet/ip_output.c b/sys/netinet/ip_output.c
index 701134d30cf..69badd9337a 100644
--- a/sys/netinet/ip_output.c
+++ b/sys/netinet/ip_output.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ip_output.c,v 1.165 2004/06/21 19:26:01 mcbride Exp $ */
+/* $OpenBSD: ip_output.c,v 1.166 2004/06/21 23:50:37 tholo Exp $ */
/* $NetBSD: ip_output.c,v 1.28 1996/02/13 23:43:07 christos Exp $ */
/*
@@ -618,7 +618,7 @@ sendit:
/* Check if we are allowed to fragment */
if (ip_mtudisc && (ip->ip_off & htons(IP_DF)) && tdb->tdb_mtu &&
ntohs(ip->ip_len) > tdb->tdb_mtu &&
- tdb->tdb_mtutimeout > time.tv_sec) {
+ tdb->tdb_mtutimeout > time_second) {
struct rtentry *rt = NULL;
int rt_mtucloned = 0;
diff --git a/sys/netinet/ip_spd.c b/sys/netinet/ip_spd.c
index a8099ead19a..357a567cdf4 100644
--- a/sys/netinet/ip_spd.c
+++ b/sys/netinet/ip_spd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ip_spd.c,v 1.49 2004/06/21 20:44:54 itojun Exp $ */
+/* $OpenBSD: ip_spd.c,v 1.50 2004/06/21 23:50:37 tholo Exp $ */
/*
* The author of this code is Angelos D. Keromytis (angelos@cis.upenn.edu)
*
@@ -386,7 +386,7 @@ ipsp_spd_lookup(struct mbuf *m, int af, int hlen, int *error, int direction,
if (ipo->ipo_last_searched <= ipsec_last_added) {
/* "Touch" the entry. */
if (dignore == 0)
- ipo->ipo_last_searched = time.tv_sec;
+ ipo->ipo_last_searched = time_second;
/* Find an appropriate SA from the existing ones. */
ipo->ipo_tdb =
@@ -500,7 +500,7 @@ ipsp_spd_lookup(struct mbuf *m, int af, int hlen, int *error, int direction,
/* Find whether there exists an appropriate SA. */
if (ipo->ipo_last_searched <= ipsec_last_added) {
if (dignore == 0)
- ipo->ipo_last_searched = time.tv_sec;
+ ipo->ipo_last_searched = time_second;
ipo->ipo_tdb =
gettdbbysrc(dignore ? &ssrc : &ipo->ipo_dst,
@@ -1005,7 +1005,7 @@ ipsp_spd_inp(struct mbuf *m, int af, int hlen, int *error, int direction,
*/
if (inp->inp_ipo->ipo_last_searched <=
ipsec_last_added) {
- inp->inp_ipo->ipo_last_searched = time.tv_sec;
+ inp->inp_ipo->ipo_last_searched = time_second;
/* Do we have an SA already established ? */
if (gettdbbysrc(&inp->inp_ipo->ipo_dst,
@@ -1058,7 +1058,7 @@ ipsp_spd_inp(struct mbuf *m, int af, int hlen, int *error, int direction,
if (inp->inp_ipo != NULL) {
if (inp->inp_ipo->ipo_last_searched <=
ipsec_last_added) {
- inp->inp_ipo->ipo_last_searched = time.tv_sec;
+ inp->inp_ipo->ipo_last_searched = time_second;
/* Update, just in case. */
ipsec_update_policy(inp, inp->inp_ipo, af,
diff --git a/sys/netinet/ipsec_input.c b/sys/netinet/ipsec_input.c
index 0765dac25cd..43bd253b723 100644
--- a/sys/netinet/ipsec_input.c
+++ b/sys/netinet/ipsec_input.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ipsec_input.c,v 1.73 2004/06/21 20:44:54 itojun Exp $ */
+/* $OpenBSD: ipsec_input.c,v 1.74 2004/06/21 23:50:37 tholo Exp $ */
/*
* The authors of this code are John Ioannidis (ji@tla.org),
* Angelos D. Keromytis (kermit@csd.uch.gr) and
@@ -242,11 +242,7 @@ ipsec_common_input(struct mbuf *m, int skip, int protoff, int af, int sproto,
/* Register first use, setup expiration timer. */
if (tdbp->tdb_first_use == 0) {
- int pri;
-
- pri = splhigh();
- tdbp->tdb_first_use = time.tv_sec;
- splx(pri);
+ tdbp->tdb_first_use = time_second;
tv.tv_usec = 0;
@@ -295,7 +291,7 @@ ipsec_common_input_cb(struct mbuf *m, struct tdb *tdbp, int skip, int protoff,
af = tdbp->tdb_dst.sa.sa_family;
sproto = tdbp->tdb_sproto;
- tdbp->tdb_last_used = time.tv_sec;
+ tdbp->tdb_last_used = time_second;
/* Sanity check */
if (m == NULL) {
@@ -868,7 +864,7 @@ ipsec_common_ctlinput(int cmd, struct sockaddr *sa, void *v, int proto)
/* Store adjusted MTU in tdb */
tdbp->tdb_mtu = mtu;
- tdbp->tdb_mtutimeout = time.tv_sec +
+ tdbp->tdb_mtutimeout = time_second +
ip_mtudisc_timeout;
}
splx(s);
diff --git a/sys/netinet/ipsec_output.c b/sys/netinet/ipsec_output.c
index d14e0abe205..3aa5abbfe1c 100644
--- a/sys/netinet/ipsec_output.c
+++ b/sys/netinet/ipsec_output.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ipsec_output.c,v 1.29 2004/06/21 23:11:39 markus Exp $ */
+/* $OpenBSD: ipsec_output.c,v 1.30 2004/06/21 23:50:37 tholo Exp $ */
/*
* The author of this code is Angelos D. Keromytis (angelos@cis.upenn.edu)
*
@@ -131,11 +131,7 @@ ipsp_process_packet(struct mbuf *m, struct tdb *tdb, int af, int tunalready)
* Register first use if applicable, setup relevant expiration timer.
*/
if (tdb->tdb_first_use == 0) {
- int pri;
-
- pri = splhigh();
- tdb->tdb_first_use = time.tv_sec;
- splx(pri);
+ tdb->tdb_first_use = time_second;
tv.tv_usec = 0;
@@ -338,7 +334,7 @@ ipsp_process_done(struct mbuf *m, struct tdb *tdb)
struct tdb_ident *tdbi;
struct m_tag *mtag;
- tdb->tdb_last_used = time.tv_sec;
+ tdb->tdb_last_used = time_second;
if ((tdb->tdb_flags & TDBF_UDPENCAP) != 0) {
struct mbuf *mi;
@@ -535,7 +531,7 @@ ipsec_adjust_mtu(struct mbuf *m, u_int32_t mtu)
mtu -= adjust;
tdbp->tdb_mtu = mtu;
- tdbp->tdb_mtutimeout = time.tv_sec + ip_mtudisc_timeout;
+ tdbp->tdb_mtutimeout = time_second + ip_mtudisc_timeout;
}
splx(s);
diff --git a/sys/netinet/tcp_subr.c b/sys/netinet/tcp_subr.c
index 13116592f04..f666cd62448 100644
--- a/sys/netinet/tcp_subr.c
+++ b/sys/netinet/tcp_subr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: tcp_subr.c,v 1.81 2004/06/08 19:47:24 markus Exp $ */
+/* $OpenBSD: tcp_subr.c,v 1.82 2004/06/21 23:50:37 tholo Exp $ */
/* $NetBSD: tcp_subr.c,v 1.22 1996/02/13 23:44:00 christos Exp $ */
/*
@@ -1128,7 +1128,7 @@ tcp_rndiss_init()
{
get_random_bytes(tcp_rndiss_sbox, sizeof(tcp_rndiss_sbox));
- tcp_rndiss_reseed = time.tv_sec + TCP_RNDISS_OUT;
+ tcp_rndiss_reseed = time_second + TCP_RNDISS_OUT;
tcp_rndiss_msb = tcp_rndiss_msb == 0x8000 ? 0 : 0x8000;
tcp_rndiss_cnt = 0;
}
@@ -1137,7 +1137,7 @@ tcp_seq
tcp_rndiss_next()
{
if (tcp_rndiss_cnt >= TCP_RNDISS_MAX ||
- time.tv_sec > tcp_rndiss_reseed)
+ time_second > tcp_rndiss_reseed)
tcp_rndiss_init();
/* (arc4random() & 0x7fff) ensures a 32768 byte gap between ISS */
diff --git a/sys/netinet6/icmp6.c b/sys/netinet6/icmp6.c
index 51b157e8e34..53292a309bb 100644
--- a/sys/netinet6/icmp6.c
+++ b/sys/netinet6/icmp6.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: icmp6.c,v 1.82 2004/03/25 14:01:20 dhartmei Exp $ */
+/* $OpenBSD: icmp6.c,v 1.83 2004/06/21 23:50:37 tholo Exp $ */
/* $KAME: icmp6.c,v 1.217 2001/06/20 15:03:29 jinmei Exp $ */
/*
@@ -1843,8 +1843,8 @@ ni6_store_addrs(ni6, nni6, ifp0, resid)
ltime = ND6_INFINITE_LIFETIME;
else {
if (ifa6->ia6_lifetime.ia6t_expire >
- time.tv_sec)
- ltime = htonl(ifa6->ia6_lifetime.ia6t_expire - time.tv_sec);
+ time_second)
+ ltime = htonl(ifa6->ia6_lifetime.ia6t_expire - time_second);
else
ltime = 0;
}
diff --git a/sys/netinet6/in6.c b/sys/netinet6/in6.c
index 7d717f8b85c..8091fe9dbe8 100644
--- a/sys/netinet6/in6.c
+++ b/sys/netinet6/in6.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: in6.c,v 1.56 2004/06/17 09:43:55 itojun Exp $ */
+/* $OpenBSD: in6.c,v 1.57 2004/06/21 23:50:37 tholo Exp $ */
/* $KAME: in6.c,v 1.372 2004/06/14 08:14:21 itojun Exp $ */
/*
@@ -528,11 +528,11 @@ in6_control(so, cmd, data, ifp, p)
/* sanity for overflow - beware unsigned */
lt = &ifr->ifr_ifru.ifru_lifetime;
if (lt->ia6t_vltime != ND6_INFINITE_LIFETIME
- && lt->ia6t_vltime + time.tv_sec < time.tv_sec) {
+ && lt->ia6t_vltime + time_second < time_second) {
return EINVAL;
}
if (lt->ia6t_pltime != ND6_INFINITE_LIFETIME
- && lt->ia6t_pltime + time.tv_sec < time.tv_sec) {
+ && lt->ia6t_pltime + time_second < time_second) {
return EINVAL;
}
break;
@@ -626,12 +626,12 @@ in6_control(so, cmd, data, ifp, p)
/* for sanity */
if (ia->ia6_lifetime.ia6t_vltime != ND6_INFINITE_LIFETIME) {
ia->ia6_lifetime.ia6t_expire =
- time.tv_sec + ia->ia6_lifetime.ia6t_vltime;
+ time_second + ia->ia6_lifetime.ia6t_vltime;
} else
ia->ia6_lifetime.ia6t_expire = 0;
if (ia->ia6_lifetime.ia6t_pltime != ND6_INFINITE_LIFETIME) {
ia->ia6_lifetime.ia6t_preferred =
- time.tv_sec + ia->ia6_lifetime.ia6t_pltime;
+ time_second + ia->ia6_lifetime.ia6t_pltime;
} else
ia->ia6_lifetime.ia6t_preferred = 0;
break;
@@ -936,7 +936,7 @@ in6_update_ifa(ifp, ifra, ia)
ia->ia_ifa.ifa_addr = (struct sockaddr *)&ia->ia_addr;
ia->ia_addr.sin6_family = AF_INET6;
ia->ia_addr.sin6_len = sizeof(ia->ia_addr);
- ia->ia6_createtime = ia->ia6_updatetime = time.tv_sec;
+ ia->ia6_createtime = ia->ia6_updatetime = time_second;
if ((ifp->if_flags & (IFF_POINTOPOINT | IFF_LOOPBACK)) != 0) {
/*
* XXX: some functions expect that ifa_dstaddr is not
@@ -1008,12 +1008,12 @@ in6_update_ifa(ifp, ifra, ia)
ia->ia6_lifetime = ifra->ifra_lifetime;
if (ia->ia6_lifetime.ia6t_vltime != ND6_INFINITE_LIFETIME) {
ia->ia6_lifetime.ia6t_expire =
- time.tv_sec + ia->ia6_lifetime.ia6t_vltime;
+ time_second + ia->ia6_lifetime.ia6t_vltime;
} else
ia->ia6_lifetime.ia6t_expire = 0;
if (ia->ia6_lifetime.ia6t_pltime != ND6_INFINITE_LIFETIME) {
ia->ia6_lifetime.ia6t_preferred =
- time.tv_sec + ia->ia6_lifetime.ia6t_pltime;
+ time_second + ia->ia6_lifetime.ia6t_pltime;
} else
ia->ia6_lifetime.ia6t_preferred = 0;
@@ -1031,7 +1031,7 @@ in6_update_ifa(ifp, ifra, ia)
*/
if ((ifra->ifra_flags & IN6_IFF_DEPRECATED) != 0) {
ia->ia6_lifetime.ia6t_pltime = 0;
- ia->ia6_lifetime.ia6t_preferred = time.tv_sec;
+ ia->ia6_lifetime.ia6t_preferred = time_second;
}
/*
* Make the address tentative before joining multicast addresses,
diff --git a/sys/netinet6/in6.h b/sys/netinet6/in6.h
index 00bb5043c56..bf1e04e31af 100644
--- a/sys/netinet6/in6.h
+++ b/sys/netinet6/in6.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: in6.h,v 1.35 2004/06/12 04:58:48 itojun Exp $ */
+/* $OpenBSD: in6.h,v 1.36 2004/06/21 23:50:37 tholo Exp $ */
/* $KAME: in6.h,v 1.83 2001/03/29 02:55:07 jinmei Exp $ */
/*
@@ -355,11 +355,11 @@ extern const struct in6_addr in6addr_linklocal_allrouters;
#define IFA6_IS_DEPRECATED(a) \
((a)->ia6_lifetime.ia6t_pltime != ND6_INFINITE_LIFETIME && \
- (u_int32_t)((time.tv_sec - (a)->ia6_updatetime)) > \
+ (u_int32_t)((time_second - (a)->ia6_updatetime)) > \
(a)->ia6_lifetime.ia6t_pltime)
#define IFA6_IS_INVALID(a) \
((a)->ia6_lifetime.ia6t_vltime != ND6_INFINITE_LIFETIME && \
- (u_int32_t)((time.tv_sec - (a)->ia6_updatetime)) > \
+ (u_int32_t)((time_second - (a)->ia6_updatetime)) > \
(a)->ia6_lifetime.ia6t_vltime)
#endif
diff --git a/sys/netinet6/ip6_forward.c b/sys/netinet6/ip6_forward.c
index bda61eb63e5..d3747a80a08 100644
--- a/sys/netinet6/ip6_forward.c
+++ b/sys/netinet6/ip6_forward.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ip6_forward.c,v 1.29 2004/06/21 19:26:02 mcbride Exp $ */
+/* $OpenBSD: ip6_forward.c,v 1.30 2004/06/21 23:50:37 tholo Exp $ */
/* $KAME: ip6_forward.c,v 1.75 2001/06/29 12:42:13 jinmei Exp $ */
/*
@@ -115,8 +115,8 @@ ip6_forward(m, srcrt)
IN6_IS_ADDR_UNSPECIFIED(&ip6->ip6_src)) {
ip6stat.ip6s_cantforward++;
/* XXX in6_ifstat_inc(rt->rt_ifp, ifs6_in_discard) */
- if (ip6_log_time + ip6_log_interval < time.tv_sec) {
- ip6_log_time = time.tv_sec;
+ if (ip6_log_time + ip6_log_interval < time_second) {
+ ip6_log_time = time_second;
log(LOG_DEBUG,
"cannot forward "
"from %s to %s nxt %d received on %s\n",
@@ -289,8 +289,8 @@ ip6_forward(m, srcrt)
ip6stat.ip6s_badscope++;
in6_ifstat_inc(rt->rt_ifp, ifs6_in_discard);
- if (ip6_log_time + ip6_log_interval < time.tv_sec) {
- ip6_log_time = time.tv_sec;
+ if (ip6_log_time + ip6_log_interval < time_second) {
+ ip6_log_time = time_second;
log(LOG_DEBUG,
"cannot forward "
"src %s, dst %s, nxt %d, rcvif %s, outif %s\n",
diff --git a/sys/netinet6/ip6_id.c b/sys/netinet6/ip6_id.c
index fd36e46f3c3..9765b4c9689 100644
--- a/sys/netinet6/ip6_id.c
+++ b/sys/netinet6/ip6_id.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ip6_id.c,v 1.3 2003/12/12 06:57:12 itojun Exp $ */
+/* $OpenBSD: ip6_id.c,v 1.4 2004/06/21 23:50:37 tholo Exp $ */
/* $NetBSD: ip6_id.c,v 1.7 2003/09/13 21:32:59 itojun Exp $ */
/* $KAME: ip6_id.c,v 1.8 2003/09/06 13:41:06 itojun Exp $ */
@@ -210,7 +210,7 @@ initid(struct randomtab *p)
p->ru_g = pmod(p->ru_gen, j, p->ru_n);
p->ru_counter = 0;
- p->ru_reseed = time.tv_sec + p->ru_out;
+ p->ru_reseed = time_second + p->ru_out;
p->ru_msb = p->ru_msb ? 0 : (1U << (p->ru_bits - 1));
}
@@ -219,7 +219,7 @@ randomid(struct randomtab *p)
{
int i, n;
- if (p->ru_counter >= p->ru_max || time.tv_sec > p->ru_reseed)
+ if (p->ru_counter >= p->ru_max || time_second > p->ru_reseed)
initid(p);
/* Skip a random number of ids */
diff --git a/sys/netinet6/ip6_mroute.c b/sys/netinet6/ip6_mroute.c
index 801e25f58ec..eac4251a1ce 100644
--- a/sys/netinet6/ip6_mroute.c
+++ b/sys/netinet6/ip6_mroute.c
@@ -1040,8 +1040,8 @@ ip6_mforward(ip6, ifp, m)
*/
if (IN6_IS_ADDR_UNSPECIFIED(&ip6->ip6_src)) {
ip6stat.ip6s_cantforward++;
- if (ip6_log_time + ip6_log_interval < time.tv_sec) {
- ip6_log_time = time.tv_sec;
+ if (ip6_log_time + ip6_log_interval < time_second) {
+ ip6_log_time = time_second;
log(LOG_DEBUG,
"cannot forward "
"from %s to %s nxt %d received on %s\n",
diff --git a/sys/netinet6/nd6.c b/sys/netinet6/nd6.c
index 36aca9bb729..22bd57c33d3 100644
--- a/sys/netinet6/nd6.c
+++ b/sys/netinet6/nd6.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: nd6.c,v 1.66 2004/05/19 17:48:19 itojun Exp $ */
+/* $OpenBSD: nd6.c,v 1.67 2004/06/21 23:50:37 tholo Exp $ */
/* $KAME: nd6.c,v 1.280 2002/06/08 19:52:07 itojun Exp $ */
/*
@@ -380,7 +380,7 @@ nd6_llinfo_settimer(struct llinfo_nd6 *ln, long tick)
ln->ln_ntick = 0;
timeout_del(&ln->ln_timer_ch);
} else {
- ln->ln_expire = time.tv_sec + tick / hz;
+ ln->ln_expire = time_second + tick / hz;
if (tick > INT_MAX) {
ln->ln_ntick = tick - INT_MAX;
timeout_add(&ln->ln_timer_ch, INT_MAX);
@@ -523,7 +523,7 @@ nd6_timer(ignored_arg)
/* expire default router list */
dr = TAILQ_FIRST(&nd_defrouter);
while (dr) {
- if (dr->expire && dr->expire < time.tv_sec) {
+ if (dr->expire && dr->expire < time_second) {
struct nd_defrouter *t;
t = TAILQ_NEXT(dr, dr_entry);
defrtrlist_del(dr);
@@ -566,7 +566,7 @@ nd6_timer(ignored_arg)
* prefix is not necessary.
*/
if (pr->ndpr_vltime != ND6_INFINITE_LIFETIME &&
- time.tv_sec - pr->ndpr_lastupdate > pr->ndpr_vltime) {
+ time_second - pr->ndpr_lastupdate > pr->ndpr_vltime) {
struct nd_prefix *t;
t = pr->ndpr_next;
@@ -863,9 +863,9 @@ nd6_free(rt, gc)
* XXX: the check for ln_state would be redundant,
* but we intentionally keep it just in case.
*/
- if (dr->expire > time.tv_sec * hz) {
+ if (dr->expire > time_second * hz) {
nd6_llinfo_settimer(ln,
- dr->expire - time.tv_sec * hz);
+ dr->expire - time_second * hz);
} else
nd6_llinfo_settimer(ln, (long)nd6_gctimer * hz);
splx(s);
diff --git a/sys/netinet6/nd6_rtr.c b/sys/netinet6/nd6_rtr.c
index 9c5169ce2c0..d6edafcb7e8 100644
--- a/sys/netinet6/nd6_rtr.c
+++ b/sys/netinet6/nd6_rtr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: nd6_rtr.c,v 1.30 2003/12/10 03:30:21 itojun Exp $ */
+/* $OpenBSD: nd6_rtr.c,v 1.31 2004/06/21 23:50:37 tholo Exp $ */
/* $KAME: nd6_rtr.c,v 1.97 2001/02/07 11:09:13 itojun Exp $ */
/*
@@ -244,7 +244,7 @@ nd6_ra_input(m, off, icmp6len)
dr0.rtaddr = saddr6;
dr0.flags = nd_ra->nd_ra_flags_reserved;
dr0.rtlifetime = ntohs(nd_ra->nd_ra_router_lifetime);
- dr0.expire = time.tv_sec + dr0.rtlifetime;
+ dr0.expire = time_second + dr0.rtlifetime;
dr0.ifp = ifp;
/* unspecified or not? (RFC 2461 6.3.4) */
if (advreachable) {
@@ -328,7 +328,7 @@ nd6_ra_input(m, off, icmp6len)
pr.ndpr_plen = pi->nd_opt_pi_prefix_len;
pr.ndpr_vltime = ntohl(pi->nd_opt_pi_valid_time);
pr.ndpr_pltime = ntohl(pi->nd_opt_pi_preferred_time);
- pr.ndpr_lastupdate = time.tv_sec;
+ pr.ndpr_lastupdate = time_second;
if (in6_init_prefix_ltimes(&pr))
continue; /* prefix lifetime init failed */
@@ -1292,7 +1292,7 @@ prelist_update(new, dr, m)
lt6_tmp = ifa6->ia6_lifetime;
if (lt6_tmp.ia6t_vltime == ND6_INFINITE_LIFETIME)
storedlifetime = ND6_INFINITE_LIFETIME;
- else if (time.tv_sec - ifa6->ia6_updatetime >
+ else if (time_second - ifa6->ia6_updatetime >
lt6_tmp.ia6t_vltime) {
/*
* The case of "invalid" address. We should usually
@@ -1301,7 +1301,7 @@ prelist_update(new, dr, m)
storedlifetime = 0;
} else
storedlifetime = lt6_tmp.ia6t_vltime -
- (time.tv_sec - ifa6->ia6_updatetime);
+ (time_second - ifa6->ia6_updatetime);
if (TWOHOUR < new->ndpr_vltime ||
storedlifetime < new->ndpr_vltime) {
lt6_tmp.ia6t_vltime = new->ndpr_vltime;
@@ -1332,7 +1332,7 @@ prelist_update(new, dr, m)
in6_init_address_ltimes(pr, &lt6_tmp);
ifa6->ia6_lifetime = lt6_tmp;
- ifa6->ia6_updatetime = time.tv_sec;
+ ifa6->ia6_updatetime = time_second;
}
if (ia6_match == NULL && new->ndpr_vltime) {
/*
@@ -1882,11 +1882,11 @@ in6_init_prefix_ltimes(struct nd_prefix *ndpr)
if (ndpr->ndpr_pltime == ND6_INFINITE_LIFETIME)
ndpr->ndpr_preferred = 0;
else
- ndpr->ndpr_preferred = time.tv_sec + ndpr->ndpr_pltime;
+ ndpr->ndpr_preferred = time_second + ndpr->ndpr_pltime;
if (ndpr->ndpr_vltime == ND6_INFINITE_LIFETIME)
ndpr->ndpr_expire = 0;
else
- ndpr->ndpr_expire = time.tv_sec + ndpr->ndpr_vltime;
+ ndpr->ndpr_expire = time_second + ndpr->ndpr_vltime;
return 0;
}
@@ -1900,7 +1900,7 @@ in6_init_address_ltimes(struct nd_prefix *new, struct in6_addrlifetime *lt6)
if (lt6->ia6t_vltime == ND6_INFINITE_LIFETIME)
lt6->ia6t_expire = 0;
else {
- lt6->ia6t_expire = time.tv_sec;
+ lt6->ia6t_expire = time_second;
lt6->ia6t_expire += lt6->ia6t_vltime;
}
@@ -1908,7 +1908,7 @@ in6_init_address_ltimes(struct nd_prefix *new, struct in6_addrlifetime *lt6)
if (lt6->ia6t_pltime == ND6_INFINITE_LIFETIME)
lt6->ia6t_preferred = 0;
else {
- lt6->ia6t_preferred = time.tv_sec;
+ lt6->ia6t_preferred = time_second;
lt6->ia6t_preferred += lt6->ia6t_pltime;
}
}
diff --git a/sys/netiso/if_eon.c b/sys/netiso/if_eon.c
index eeb0fd4636a..a202b92a12c 100644
--- a/sys/netiso/if_eon.c
+++ b/sys/netiso/if_eon.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_eon.c,v 1.23 2004/01/03 14:08:54 espie Exp $ */
+/* $OpenBSD: if_eon.c,v 1.24 2004/06/21 23:50:37 tholo Exp $ */
/* $NetBSD: if_eon.c,v 1.15 1996/05/09 22:29:37 scottr Exp $ */
/*-
@@ -105,8 +105,6 @@ SOFTWARE.
#include <sys/stdarg.h>
-extern struct timeval time;
-
#define EOK 0
struct ifnet eonif[1];
diff --git a/sys/netiso/iso_snpac.c b/sys/netiso/iso_snpac.c
index 5ab07569041..35b05ba7631 100644
--- a/sys/netiso/iso_snpac.c
+++ b/sys/netiso/iso_snpac.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: iso_snpac.c,v 1.10 2003/12/10 07:22:44 itojun Exp $ */
+/* $OpenBSD: iso_snpac.c,v 1.11 2004/06/21 23:50:37 tholo Exp $ */
/* $NetBSD: iso_snpac.c,v 1.13 1996/05/07 02:45:16 thorpej Exp $ */
/*-
@@ -90,8 +90,6 @@ SOFTWARE.
int iso_systype = SNPA_ES; /* default to be an ES */
extern short esis_holding_time, esis_config_time, esis_esconfig_time;
-extern struct timeval time;
-extern int hz;
LIST_HEAD(, llinfo_llc) llinfo_llc;
@@ -478,7 +476,7 @@ add:
}
if ((lc = (struct llinfo_llc *) rt->rt_llinfo) == 0)
panic("snpac_rtrequest");
- rt->rt_rmx.rmx_expire = ht + time.tv_sec;
+ rt->rt_rmx.rmx_expire = ht + time_second;
lc->lc_flags = SNPA_VALID | type;
if ((type & SNPA_IS) && !(iso_systype & SNPA_IS))
snpac_logdefis(rt);
@@ -633,7 +631,7 @@ snpac_age(v)
nlc = lc->lc_list.le_next;
if (lc->lc_flags & SNPA_VALID) {
rt = lc->lc_rt;
- if (rt->rt_rmx.rmx_expire && rt->rt_rmx.rmx_expire < time.tv_sec)
+ if (rt->rt_rmx.rmx_expire && rt->rt_rmx.rmx_expire < time_second)
snpac_free(lc);
}
}
diff --git a/sys/nfs/nfs.h b/sys/nfs/nfs.h
index 8cc410d114e..c52429d25cc 100644
--- a/sys/nfs/nfs.h
+++ b/sys/nfs/nfs.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: nfs.h,v 1.21 2003/10/22 04:45:54 jmc Exp $ */
+/* $OpenBSD: nfs.h,v 1.22 2004/06/21 23:50:37 tholo Exp $ */
/* $NetBSD: nfs.h,v 1.10.4.1 1996/05/27 11:23:56 fvdl Exp $ */
/*
@@ -126,9 +126,9 @@
#if 0 /* replaced by nfs_attrtimeo() in nfs_subs.c */
#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))
#endif
/*
diff --git a/sys/nfs/nfs_socket.c b/sys/nfs/nfs_socket.c
index e2798cdf0ba..43300332eb3 100644
--- a/sys/nfs/nfs_socket.c
+++ b/sys/nfs/nfs_socket.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: nfs_socket.c,v 1.35 2003/12/08 09:33:36 mickey Exp $ */
+/* $OpenBSD: nfs_socket.c,v 1.36 2004/06/21 23:50:38 tholo Exp $ */
/* $NetBSD: nfs_socket.c,v 1.27 1996/04/15 20:20:00 thorpej Exp $ */
/*
@@ -911,7 +911,7 @@ tryagain:
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
@@ -1022,8 +1022,8 @@ tryagain:
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];
@@ -1664,7 +1664,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)) {
diff --git a/sys/nfs/nfs_subs.c b/sys/nfs/nfs_subs.c
index 0cb86216853..a4fb7ee4a23 100644
--- a/sys/nfs/nfs_subs.c
+++ b/sys/nfs/nfs_subs.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: nfs_subs.c,v 1.44 2004/05/14 04:00:34 tedu Exp $ */
+/* $OpenBSD: nfs_subs.c,v 1.45 2004/06/21 23:50:38 tholo Exp $ */
/* $NetBSD: nfs_subs.c,v 1.27.4.3 1996/07/08 20:34:24 jtc Exp $ */
/*
@@ -1250,7 +1250,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) {
@@ -1269,7 +1269,7 @@ nfs_attrtimeo (np)
{
struct vnode *vp = np->n_vnode;
struct nfsmount *nmp = VFSTONFS(vp->v_mount);
- int tenthage = (time.tv_sec - np->n_mtime) / 10;
+ int tenthage = (time_second - np->n_mtime) / 10;
int minto, maxto;
if (vp->v_type == VDIR) {
@@ -1302,7 +1302,7 @@ nfs_getattrcache(vp, vaper)
struct nfsnode *np = VTONFS(vp);
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);
}
diff --git a/sys/nfs/nfs_syscalls.c b/sys/nfs/nfs_syscalls.c
index 6cc9edca2b2..790c14397c7 100644
--- a/sys/nfs/nfs_syscalls.c
+++ b/sys/nfs/nfs_syscalls.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: nfs_syscalls.c,v 1.38 2003/08/15 20:32:20 tedu Exp $ */
+/* $OpenBSD: nfs_syscalls.c,v 1.39 2004/06/21 23:50:38 tholo Exp $ */
/* $NetBSD: nfs_syscalls.c,v 1.19 1996/02/18 11:53:52 fvdl Exp $ */
/*
@@ -360,7 +360,7 @@ sys_nfssvc(p, v, retval)
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.
*/
@@ -1124,7 +1124,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);
/*
@@ -1189,7 +1189,7 @@ nfs_savenickauth(nmp, cred, len, key, mdp, dposp, mrep)
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;
/*
@@ -1209,7 +1209,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 (NFSKERBKEY_T));
diff --git a/sys/nfs/nfs_vfsops.c b/sys/nfs/nfs_vfsops.c
index 79192812a3d..90b1cb77a4e 100644
--- a/sys/nfs/nfs_vfsops.c
+++ b/sys/nfs/nfs_vfsops.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: nfs_vfsops.c,v 1.52 2004/04/12 23:58:10 tedu Exp $ */
+/* $OpenBSD: nfs_vfsops.c,v 1.53 2004/06/21 23:50:38 tholo Exp $ */
/* $NetBSD: nfs_vfsops.c,v 1.46.4.1 1996/05/25 22:40:35 fvdl Exp $ */
/*
@@ -264,10 +264,10 @@ nfs_mountroot()
* XXX time must be non-zero when we init the interface or else
* the arp code will wedge. [Fixed now in if_ether.c]
* However, the NFS attribute cache gives false "hits" when
- * time.tv_sec < NFS_ATTRTIMEO(np) so keep this in for now.
+ * time_second < NFS_ATTRTIMEO(np) so keep this in for now.
*/
- if (time.tv_sec < NFS_MAXATTRTIMO)
- time.tv_sec = NFS_MAXATTRTIMO;
+ if (time_second < NFS_MAXATTRTIMO)
+ time_second = NFS_MAXATTRTIMO;
/*
* Call nfs_boot_init() to fill in the nfs_diskless struct.
diff --git a/sys/nfs/nfsm_subs.h b/sys/nfs/nfsm_subs.h
index 581300f165d..53d0e911169 100644
--- a/sys/nfs/nfsm_subs.h
+++ b/sys/nfs/nfsm_subs.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: nfsm_subs.h,v 1.13 2003/06/02 23:28:20 millert Exp $ */
+/* $OpenBSD: nfsm_subs.h,v 1.14 2004/06/21 23:50:38 tholo Exp $ */
/* $NetBSD: nfsm_subs.h,v 1.10 1996/03/20 21:59:56 fvdl Exp $ */
/*
@@ -259,7 +259,7 @@
*tl = nfs_false; \
} \
if ((a)->va_atime.tv_sec != VNOVAL) { \
- if ((a)->va_atime.tv_sec != time.tv_sec) { \
+ if ((a)->va_atime.tv_sec != time_second) { \
nfsm_build(tl, u_int32_t *, 3 * NFSX_UNSIGNED); \
*tl++ = txdr_unsigned(NFSV3SATTRTIME_TOCLIENT); \
txdr_nfsv3time(&(a)->va_atime, tl); \
@@ -272,7 +272,7 @@
*tl = txdr_unsigned(NFSV3SATTRTIME_DONTCHANGE); \
} \
if ((a)->va_mtime.tv_sec != VNOVAL) { \
- if ((a)->va_mtime.tv_sec != time.tv_sec) { \
+ if ((a)->va_mtime.tv_sec != time_second) { \
nfsm_build(tl, u_int32_t *, 3 * NFSX_UNSIGNED); \
*tl++ = txdr_unsigned(NFSV3SATTRTIME_TOCLIENT); \
txdr_nfsv3time(&(a)->va_mtime, tl); \
diff --git a/sys/sys/time.h b/sys/sys/time.h
index 40bdcc90579..5137f7d40d4 100644
--- a/sys/sys/time.h
+++ b/sys/sys/time.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: time.h,v 1.17 2003/08/14 05:34:47 kevlo Exp $ */
+/* $OpenBSD: time.h,v 1.18 2004/06/21 23:50:38 tholo Exp $ */
/* $NetBSD: time.h,v 1.18 1996/04/23 10:29:33 mycroft Exp $ */
/*
@@ -169,6 +169,9 @@ struct clockinfo {
#define TIMER_ABSTIME 0x1 /* absolute timer */
#if defined(_KERNEL) || defined(_STANDALONE)
+extern volatile time_t time_second; /* Seconds since epoch, wall time. */
+extern volatile time_t time_uptime; /* Seconds since reboot. */
+
int itimerfix(struct timeval *tv);
int itimerdecr(struct itimerval *itp, int usec);
void microtime(struct timeval *tv);
diff --git a/sys/ufs/ext2fs/ext2fs_alloc.c b/sys/ufs/ext2fs/ext2fs_alloc.c
index 20fb531ad79..49302e497ff 100644
--- a/sys/ufs/ext2fs/ext2fs_alloc.c
+++ b/sys/ufs/ext2fs/ext2fs_alloc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ext2fs_alloc.c,v 1.14 2004/01/20 03:44:06 tedu Exp $ */
+/* $OpenBSD: ext2fs_alloc.c,v 1.15 2004/06/21 23:50:38 tholo Exp $ */
/* $NetBSD: ext2fs_alloc.c,v 1.10 2001/07/05 08:38:27 toshii Exp $ */
/*
@@ -176,8 +176,8 @@ ext2fs_inode_alloc(struct inode *pip, int mode, struct ucred *cred,
/*
* Set up a new generation number for this inode.
*/
- if (++ext2gennumber < (u_long)time.tv_sec)
- ext2gennumber = time.tv_sec;
+ if (++ext2gennumber < (u_long)time_second)
+ ext2gennumber = time_second;
ip->i_e2fs_gen = ext2gennumber;
return (0);
noinodes:
diff --git a/sys/ufs/ext2fs/ext2fs_vfsops.c b/sys/ufs/ext2fs/ext2fs_vfsops.c
index f8bc26959c4..fbb13d1458f 100644
--- a/sys/ufs/ext2fs/ext2fs_vfsops.c
+++ b/sys/ufs/ext2fs/ext2fs_vfsops.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ext2fs_vfsops.c,v 1.33 2004/06/04 08:06:04 tedu Exp $ */
+/* $OpenBSD: ext2fs_vfsops.c,v 1.34 2004/06/21 23:50:38 tholo Exp $ */
/* $NetBSD: ext2fs_vfsops.c,v 1.1 1997/06/11 09:34:07 bouyer Exp $ */
/*
@@ -310,7 +310,7 @@ ext2fs_mount(mp, path, data, ndp, p)
if (fs->e2fs_fmod != 0) { /* XXX */
fs->e2fs_fmod = 0;
if (fs->e2fs.e2fs_state == 0)
- fs->e2fs.e2fs_wtime = time.tv_sec;
+ fs->e2fs.e2fs_wtime = time_second;
else
printf("%s: file system not clean; please fsck(8)\n",
mp->mnt_stat.f_mntfromname);
@@ -812,7 +812,7 @@ ext2fs_sync(mp, waitfor, cred, p)
*/
if (fs->e2fs_fmod != 0) {
fs->e2fs_fmod = 0;
- fs->e2fs.e2fs_wtime = time.tv_sec;
+ fs->e2fs.e2fs_wtime = time_second;
if ((error = ext2fs_cgupdate(ump, waitfor)))
allerror = error;
}
@@ -924,8 +924,8 @@ ext2fs_vget(mp, ino, vpp)
* already have one. This should only happen on old filesystems.
*/
if (ip->i_e2fs_gen == 0) {
- if (++ext2gennumber < (u_long)time.tv_sec)
- ext2gennumber = time.tv_sec;
+ if (++ext2gennumber < (u_long)time_second)
+ ext2gennumber = time_second;
ip->i_e2fs_gen = ext2gennumber;
if ((vp->v_mount->mnt_flag & MNT_RDONLY) == 0)
ip->i_flag |= IN_MODIFIED;
diff --git a/sys/ufs/ffs/ffs_alloc.c b/sys/ufs/ffs/ffs_alloc.c
index c41fbb14235..2a43bc7cc07 100644
--- a/sys/ufs/ffs/ffs_alloc.c
+++ b/sys/ufs/ffs/ffs_alloc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ffs_alloc.c,v 1.46 2004/01/20 03:44:06 tedu Exp $ */
+/* $OpenBSD: ffs_alloc.c,v 1.47 2004/06/21 23:50:38 tholo Exp $ */
/* $NetBSD: ffs_alloc.c,v 1.11 1996/05/11 18:27:09 mycroft Exp $ */
/*
@@ -941,7 +941,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)) {
@@ -1008,7 +1008,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);
@@ -1339,7 +1339,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))
@@ -1432,7 +1432,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);
@@ -1538,7 +1538,7 @@ ffs_freefile(struct inode *pip, ino_t ino, int 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%x, ino = %d, fs = %s\n",
diff --git a/sys/ufs/ffs/ffs_vfsops.c b/sys/ufs/ffs/ffs_vfsops.c
index ead5f75652f..bd80d00dc65 100644
--- a/sys/ufs/ffs/ffs_vfsops.c
+++ b/sys/ufs/ffs/ffs_vfsops.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ffs_vfsops.c,v 1.65 2004/06/04 08:06:05 tedu Exp $ */
+/* $OpenBSD: ffs_vfsops.c,v 1.66 2004/06/21 23:50:38 tholo Exp $ */
/* $NetBSD: ffs_vfsops.c,v 1.19 1996/02/09 22:22:26 christos Exp $ */
/*
@@ -1340,7 +1340,7 @@ ffs_sbupdate(mp, waitfor)
bp = getblk(mp->um_devvp, SBOFF >> (fs->fs_fshift - fs->fs_fsbtodb),
(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 */
diff --git a/sys/ufs/lfs/lfs_alloc.c b/sys/ufs/lfs/lfs_alloc.c
index c0474be5f56..da823b14c1d 100644
--- a/sys/ufs/lfs/lfs_alloc.c
+++ b/sys/ufs/lfs/lfs_alloc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: lfs_alloc.c,v 1.10 2003/06/02 23:28:23 millert Exp $ */
+/* $OpenBSD: lfs_alloc.c,v 1.11 2004/06/21 23:50:38 tholo Exp $ */
/* $NetBSD: lfs_alloc.c,v 1.4 1996/03/25 12:53:37 pk Exp $ */
/*
@@ -129,8 +129,8 @@ lfs_valloc(v)
ip->i_din.ffs_din.di_inumber = new_ino;
/* Set a new generation number for this inode. */
- if (++nextgennumber < (u_long)time.tv_sec)
- nextgennumber = time.tv_sec;
+ if (++nextgennumber < (u_long)time_second)
+ nextgennumber = time_second;
ip->i_ffs_gen = nextgennumber;
/* Insert into the inode hash table. */
diff --git a/sys/ufs/lfs/lfs_bio.c b/sys/ufs/lfs/lfs_bio.c
index 0f9dde05755..8ed1e7ca754 100644
--- a/sys/ufs/lfs/lfs_bio.c
+++ b/sys/ufs/lfs/lfs_bio.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: lfs_bio.c,v 1.10 2003/06/02 23:28:23 millert Exp $ */
+/* $OpenBSD: lfs_bio.c,v 1.11 2004/06/21 23:50:38 tholo Exp $ */
/* $NetBSD: lfs_bio.c,v 1.5 1996/02/09 22:28:49 christos Exp $ */
/*
@@ -120,7 +120,7 @@ lfs_bwrite(v)
++locked_queue_count;
bp->b_flags |= B_LOCKED;
TAILQ_INSERT_TAIL(&bdirties, bp, b_synclist);
- bp->b_synctime = time.tv_sec + 30;
+ bp->b_synctime = time_second + 30;
s = splbio();
if (bdirties.tqh_first == bp) {
if (timeout_triggered(&wakeup_timeout))
diff --git a/sys/ufs/ufs/inode.h b/sys/ufs/ufs/inode.h
index 7374786db6d..1106506a099 100644
--- a/sys/ufs/ufs/inode.h
+++ b/sys/ufs/ufs/inode.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: inode.h,v 1.25 2004/01/20 03:44:06 tedu Exp $ */
+/* $OpenBSD: inode.h,v 1.26 2004/06/21 23:50:38 tholo Exp $ */
/* $NetBSD: inode.h,v 1.8 1995/06/15 23:22:50 cgd Exp $ */
/*
@@ -274,7 +274,7 @@ struct indir {
(ip)->i_modrev++; \
} \
if ((ip)->i_flag & IN_CHANGE) \
- (ip)->i_ffs_ctime = time.tv_sec; \
+ (ip)->i_ffs_ctime = time_second; \
(ip)->i_flag &= ~(IN_ACCESS | IN_CHANGE | IN_UPDATE); \
} \
}
@@ -289,7 +289,7 @@ struct indir {
(ip)->i_modrev++; \
} \
if ((ip)->i_flag & IN_CHANGE) \
- (ip)->i_e2fs_ctime = time.tv_sec; \
+ (ip)->i_e2fs_ctime = time_second; \
(ip)->i_flag &= ~(IN_ACCESS | IN_CHANGE | IN_UPDATE); \
} \
}
diff --git a/sys/ufs/ufs/ufs_quota.c b/sys/ufs/ufs/ufs_quota.c
index 63c9610a9fe..1659cfd306e 100644
--- a/sys/ufs/ufs/ufs_quota.c
+++ b/sys/ufs/ufs/ufs_quota.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ufs_quota.c,v 1.16 2004/01/20 03:44:06 tedu Exp $ */
+/* $OpenBSD: ufs_quota.c,v 1.17 2004/06/21 23:50:38 tholo Exp $ */
/* $NetBSD: ufs_quota.c,v 1.8 1996/02/09 22:36:09 christos Exp $ */
/*
@@ -285,7 +285,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 +
ip->i_ump->um_btime[type];
if (ip->i_ffs_uid == cred->cr_uid)
uprintf("\n%s: warning, %s %s\n",
@@ -293,7 +293,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_ffs_uid == cred->cr_uid) {
uprintf("\n%s: write failed, %s %s\n",
@@ -408,7 +408,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 +
ip->i_ump->um_itime[type];
if (ip->i_ffs_uid == cred->cr_uid)
uprintf("\n%s: warning, %s %s\n",
@@ -416,7 +416,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_ffs_uid == cred->cr_uid) {
uprintf("\n%s: write failed, %s %s\n",
@@ -678,11 +678,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;
@@ -730,10 +730,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)
@@ -938,9 +938,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);
diff --git a/sys/uvm/uvm_meter.c b/sys/uvm/uvm_meter.c
index 15bc3cd8651..938c9702506 100644
--- a/sys/uvm/uvm_meter.c
+++ b/sys/uvm/uvm_meter.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: uvm_meter.c,v 1.19 2004/06/13 21:49:29 niklas Exp $ */
+/* $OpenBSD: uvm_meter.c,v 1.20 2004/06/21 23:50:38 tholo Exp $ */
/* $NetBSD: uvm_meter.c,v 1.21 2001/07/14 06:36:03 matt Exp $ */
/*
@@ -84,7 +84,7 @@ static void uvm_loadav(struct loadavg *);
void
uvm_meter()
{
- if ((time.tv_sec % 5) == 0)
+ if ((time_second % 5) == 0)
uvm_loadav(&averunnable);
if (proc0.p_slptime > (maxslp / 2))
wakeup(&proc0);