diff --git a/sys/dev/snp/snp.c b/sys/dev/snp/snp.c index 06f17dd6e71e..ba71a949fb3b 100644 --- a/sys/dev/snp/snp.c +++ b/sys/dev/snp/snp.c @@ -136,7 +136,7 @@ snpread(dev, uio, flag) char *nbuf; KASSERT(snp->snp_len + snp->snp_base <= snp->snp_blen, - ("snoop buffer error")); + ("snoop buffer error")); if (snp->snp_tty == NULL) return (EIO); @@ -206,12 +206,11 @@ snpin(snp, buf, n) caddr_t from, to; char *nbuf; + KASSERT(n >= 0, ("negative snoop char count")); if (n == 0) return 0; - KASSERT(n > 0, ("negative snoop char count")); - #ifdef DIAGNOSTIC if (!(snp->snp_flags & SNOOP_OPEN)) { printf("Snoop: data coming to closed device.\n"); diff --git a/sys/kern/kern_lock.c b/sys/kern/kern_lock.c index 0bf31d07c601..0903f6e1e035 100644 --- a/sys/kern/kern_lock.c +++ b/sys/kern/kern_lock.c @@ -38,7 +38,7 @@ * SUCH DAMAGE. * * @(#)kern_lock.c 8.18 (Berkeley) 5/21/95 - * $Id: kern_lock.c,v 1.20 1998/11/26 18:50:23 eivind Exp $ + * $Id: kern_lock.c,v 1.21 1999/01/08 17:31:08 eivind Exp $ */ #include "opt_lint.h" @@ -83,6 +83,7 @@ sharelock(struct lock *lkp, int incr) { static LOCK_INLINE void shareunlock(struct lock *lkp, int decr) { + KASSERT(lkp->lk_sharecount >= decr, ("shareunlock: count < decr")); if (lkp->lk_sharecount == decr) { diff --git a/sys/kern/kern_malloc.c b/sys/kern/kern_malloc.c index 4cd7b7317665..a9776a5f9a8c 100644 --- a/sys/kern/kern_malloc.c +++ b/sys/kern/kern_malloc.c @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * @(#)kern_malloc.c 8.3 (Berkeley) 1/4/94 - * $Id: kern_malloc.c,v 1.49 1998/11/10 08:46:24 peter Exp $ + * $Id: kern_malloc.c,v 1.50 1999/01/08 17:31:09 eivind Exp $ */ #include "opt_vm.h" @@ -64,7 +64,7 @@ static char *kmembase; static char *kmemlimit; static int vm_kmem_size; -#if defined(INVARIANTS) +#ifdef INVARIANTS /* * This structure provides a set of masks to catch unaligned frees. */ @@ -261,7 +261,7 @@ free(addr, type) panic("freeing with unknown type (%s)", type->ks_shortdesc); KASSERT(kmembase <= (char *)addr && (char *)addr < kmemlimit, - ("free: address %p out of range", (void *)addr)); + ("free: address %p out of range", (void *)addr)); kup = btokup(addr); size = 1 << kup->ku_indx; kbp = &bucket[kup->ku_indx]; @@ -302,11 +302,10 @@ free(addr, type) if (freep->spare0 == WEIRD_ADDR) { fp = (struct freelist *)kbp->kb_next; while (fp) { - if (fp->spare0 != WEIRD_ADDR) { + if (fp->spare0 != WEIRD_ADDR) panic("free: free item %p modified", fp); - } else if (addr == (caddr_t)fp) { + else if (addr == (caddr_t)fp) panic("free: multiple freed item %p", addr); - } fp = (struct freelist *)fp->next; } } diff --git a/sys/kern/kern_proc.c b/sys/kern/kern_proc.c index 313a9e7fd01d..c615d951a398 100644 --- a/sys/kern/kern_proc.c +++ b/sys/kern/kern_proc.c @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * @(#)kern_proc.c 8.7 (Berkeley) 2/14/95 - * $Id: kern_proc.c,v 1.40 1998/11/11 10:55:56 truckman Exp $ + * $Id: kern_proc.c,v 1.41 1999/01/08 17:31:09 eivind Exp $ */ #include @@ -196,9 +196,10 @@ enterpgrp(p, pgid, mksess) register struct pgrp *pgrp = pgfind(pgid); KASSERT(pgrp == NULL || !mksess, - ("enterpgrp: setsid into non-empty pgrp")); + ("enterpgrp: setsid into non-empty pgrp")); KASSERT(!SESS_LEADER(p), - ("enterpgrp: session leader attempted setpgrp")); + ("enterpgrp: session leader attempted setpgrp")); + if (pgrp == NULL) { pid_t savepid = p->p_pid; struct proc *np; @@ -206,7 +207,7 @@ enterpgrp(p, pgid, mksess) * new process group */ KASSERT(p->p_pid == pgid, - ("enterpgrp: new pgrp and pid != pgid")); + ("enterpgrp: new pgrp and pid != pgid")); MALLOC(pgrp, struct pgrp *, sizeof(struct pgrp), M_PGRP, M_WAITOK); if ((np = pfind(savepid)) == NULL || np != p) @@ -229,7 +230,7 @@ enterpgrp(p, pgid, mksess) p->p_flag &= ~P_CONTROLT; pgrp->pg_session = sess; KASSERT(p == curproc, - ("enterpgrp: mksession and p != curproc")); + ("enterpgrp: mksession and p != curproc")); } else { pgrp->pg_session = p->p_session; pgrp->pg_session->s_count++; diff --git a/sys/kern/kern_sig.c b/sys/kern/kern_sig.c index e9a51d4c76f3..bf89d8a745de 100644 --- a/sys/kern/kern_sig.c +++ b/sys/kern/kern_sig.c @@ -36,7 +36,7 @@ * SUCH DAMAGE. * * @(#)kern_sig.c 8.7 (Berkeley) 4/18/94 - * $Id: kern_sig.c,v 1.51 1998/12/19 02:55:33 julian Exp $ + * $Id: kern_sig.c,v 1.52 1999/01/08 17:31:10 eivind Exp $ */ #include "opt_compat.h" @@ -1213,7 +1213,7 @@ postsig(signum) * If we get here, the signal must be caught. */ KASSERT(action != SIG_IGN && (p->p_sigmask & mask) == 0, - ("postsig action")); + ("postsig action")); /* * Set the new mask value and also defer further * occurences of this signal. diff --git a/sys/kern/kern_subr.c b/sys/kern/kern_subr.c index d775d970a5ce..a96d554b6517 100644 --- a/sys/kern/kern_subr.c +++ b/sys/kern/kern_subr.c @@ -36,7 +36,7 @@ * SUCH DAMAGE. * * @(#)kern_subr.c 8.3 (Berkeley) 1/21/94 - * $Id: kern_subr.c,v 1.22 1998/08/04 09:21:04 phk Exp $ + * $Id: kern_subr.c,v 1.23 1999/01/08 17:31:10 eivind Exp $ */ #include @@ -62,9 +62,9 @@ uiomove(cp, n, uio) int error; KASSERT(uio->uio_rw == UIO_READ || uio->uio_rw == UIO_WRITE, - ("uiomove: mode")); + ("uiomove: mode")); KASSERT(uio->uio_segflg != UIO_USERSPACE || uio->uio_procp == curproc, - ("uiomove proc")); + ("uiomove proc")); while (n > 0 && uio->uio_resid) { iov = uio->uio_iov; @@ -120,9 +120,9 @@ uiomoveco(cp, n, uio, obj) int error; KASSERT(uio->uio_rw == UIO_READ || uio->uio_rw == UIO_WRITE, - ("uiomoveco: mode")); + ("uiomoveco: mode")); KASSERT(uio->uio_segflg != UIO_USERSPACE || uio->uio_procp == curproc, - ("uiomoveco proc")); + ("uiomoveco proc")); while (n > 0 && uio->uio_resid) { iov = uio->uio_iov; diff --git a/sys/kern/kern_synch.c b/sys/kern/kern_synch.c index 3a9391de88c2..f8baf85461ca 100644 --- a/sys/kern/kern_synch.c +++ b/sys/kern/kern_synch.c @@ -36,7 +36,7 @@ * SUCH DAMAGE. * * @(#)kern_synch.c 8.9 (Berkeley) 5/19/95 - * $Id: kern_synch.c,v 1.70 1998/12/21 07:41:51 dillon Exp $ + * $Id: kern_synch.c,v 1.71 1999/01/08 17:31:10 eivind Exp $ */ #include "opt_ktrace.h" @@ -401,11 +401,8 @@ tsleep(ident, priority, wmesg, timo) splx(s); return (0); } - KASSERT(p != NULL, ("tsleep1")); - KASSERT(ident != NULL && p->p_stat == SRUN, - ("tsleep")); - + KASSERT(ident != NULL && p->p_stat == SRUN, ("tsleep")); /* * Process may be sitting on a slpque if asleep() was called, remove * it before re-adding. diff --git a/sys/kern/subr_rlist.c b/sys/kern/subr_rlist.c index c3fdabf51a65..d637ab428f77 100644 --- a/sys/kern/subr_rlist.c +++ b/sys/kern/subr_rlist.c @@ -54,7 +54,7 @@ * functioning of this software, nor does the author assume any responsibility * for damages incurred with its use. * - * $Id: subr_rlist.c,v 1.27 1998/08/05 14:06:04 dg Exp $ + * $Id: subr_rlist.c,v 1.28 1999/01/08 17:31:12 eivind Exp $ */ #include @@ -139,11 +139,11 @@ rlist_free(rlh, start, end) break; if (prev_rlp) { KASSERT(prev_rlp->rl_end + 1 != cur_rlp->rl_start, - ("rlist_free: missed coalesce opportunity")); + ("rlist_free: missed coalesce opportunity")); KASSERT(prev_rlp->rl_end != cur_rlp->rl_start, - ("rlist_free: entries overlap")); + ("rlist_free: entries overlap")); KASSERT(prev_rlp->rl_end <= cur_rlp->rl_start, - ("entries out of order")); + ("entries out of order")); } prev_rlp = cur_rlp; cur_rlp = cur_rlp->rl_next; diff --git a/sys/kern/tty_snoop.c b/sys/kern/tty_snoop.c index 06f17dd6e71e..ba71a949fb3b 100644 --- a/sys/kern/tty_snoop.c +++ b/sys/kern/tty_snoop.c @@ -136,7 +136,7 @@ snpread(dev, uio, flag) char *nbuf; KASSERT(snp->snp_len + snp->snp_base <= snp->snp_blen, - ("snoop buffer error")); + ("snoop buffer error")); if (snp->snp_tty == NULL) return (EIO); @@ -206,12 +206,11 @@ snpin(snp, buf, n) caddr_t from, to; char *nbuf; + KASSERT(n >= 0, ("negative snoop char count")); if (n == 0) return 0; - KASSERT(n > 0, ("negative snoop char count")); - #ifdef DIAGNOSTIC if (!(snp->snp_flags & SNOOP_OPEN)) { printf("Snoop: data coming to closed device.\n"); diff --git a/sys/kern/uipc_socket.c b/sys/kern/uipc_socket.c index f7fe5a705cef..5ce603bd6634 100644 --- a/sys/kern/uipc_socket.c +++ b/sys/kern/uipc_socket.c @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * @(#)uipc_socket.c 8.3 (Berkeley) 4/15/94 - * $Id: uipc_socket.c,v 1.47 1998/12/07 21:58:29 archie Exp $ + * $Id: uipc_socket.c,v 1.48 1999/01/08 17:31:13 eivind Exp $ */ #include @@ -736,7 +736,7 @@ soreceive(so, psa, uio, mp0, controlp, flagsp) break; else KASSERT(m->m_type == MT_DATA || m->m_type == MT_HEADER, - ("receive 3")); + ("receive 3")); so->so_state &= ~SS_RCVATMARK; len = uio->uio_resid; if (so->so_oobmark && len > so->so_oobmark - offset) diff --git a/sys/kern/vfs_bio.c b/sys/kern/vfs_bio.c index 28d8a03868a2..6ed2d6b25399 100644 --- a/sys/kern/vfs_bio.c +++ b/sys/kern/vfs_bio.c @@ -11,7 +11,7 @@ * 2. Absolutely no warranty of function or purpose is made by the author * John S. Dyson. * - * $Id: vfs_bio.c,v 1.189 1998/12/22 18:57:30 dillon Exp $ + * $Id: vfs_bio.c,v 1.190 1999/01/08 17:31:14 eivind Exp $ */ /* @@ -692,6 +692,7 @@ brelse(struct buf * bp) int poffset = foff & PAGE_MASK; int presid = resid > (PAGE_SIZE - poffset) ? (PAGE_SIZE - poffset) : resid; + KASSERT(presid >= 0, ("brelse: extra page")); vm_page_set_invalid(m, poffset, presid); } @@ -998,10 +999,8 @@ getnewbuf(struct vnode *vp, daddr_t blkno, while (needsbuffer & VFS_BIO_NEED_ANY); return (0); } - KASSERT(!(bp->b_flags & B_BUSY), - ("getnewbuf: busy buffer on free list\n")); - + ("getnewbuf: busy buffer on free list\n")); /* * We are fairly aggressive about freeing VMIO buffers, but since * the buffering is intact without buffer headers, there is not @@ -1453,10 +1452,8 @@ getblk(struct vnode * vp, daddr_t blkno, int size, int slpflag, int slptimeo) goto loop; } } - KASSERT(bp->b_offset != NOOFFSET, - ("getblk: no buffer offset")); - + ("getblk: no buffer offset")); /* * Check that the constituted buffer really deserves for the * B_CACHE bit to be set. B_VMIO type buffers might not @@ -1704,7 +1701,7 @@ allocbuf(struct buf * bp, int size) */ m = bp->b_pages[i]; KASSERT(m != bogus_page, - ("allocbuf: bogus page found")); + ("allocbuf: bogus page found")); vm_page_sleep(m, "biodep", &m->busy); bp->b_pages[i] = NULL; @@ -1738,8 +1735,7 @@ allocbuf(struct buf * bp, int size) off = bp->b_offset; KASSERT(bp->b_offset != NOOFFSET, - ("allocbuf: no buffer offset")); - + ("allocbuf: no buffer offset")); curbpnpages = bp->b_npages; doretry: bp->b_validoff = orig_validoff; @@ -1927,7 +1923,7 @@ biodone(register struct buf * bp) foff = bp->b_offset; KASSERT(bp->b_offset != NOOFFSET, - ("biodone: no buffer offset")); + ("biodone: no buffer offset")); #if !defined(MAX_PERF) if (!obj) { @@ -2200,8 +2196,7 @@ vfs_busy_pages(struct buf * bp, int clear_modify) foff = bp->b_offset; KASSERT(bp->b_offset != NOOFFSET, - ("vfs_busy_pages: no buffer offset")); - + ("vfs_busy_pages: no buffer offset")); vfs_setdirty(bp); retry: @@ -2249,10 +2244,8 @@ vfs_clean_pages(struct buf * bp) if (bp->b_flags & B_VMIO) { vm_ooffset_t foff; foff = bp->b_offset; - KASSERT(bp->b_offset != NOOFFSET, - ("vfs_clean_pages: no buffer offset")); - + ("vfs_clean_pages: no buffer offset")); for (i = 0; i < bp->b_npages; i++) { vm_page_t m = bp->b_pages[i]; vfs_page_set_valid(bp, foff, i, m); diff --git a/sys/kern/vfs_cluster.c b/sys/kern/vfs_cluster.c index 07434ce1d485..ce842ad204cf 100644 --- a/sys/kern/vfs_cluster.c +++ b/sys/kern/vfs_cluster.c @@ -33,7 +33,7 @@ * SUCH DAMAGE. * * @(#)vfs_cluster.c 8.7 (Berkeley) 2/13/94 - * $Id: vfs_cluster.c,v 1.75 1998/12/05 06:12:14 mckusick Exp $ + * $Id: vfs_cluster.c,v 1.76 1999/01/08 17:31:15 eivind Exp $ */ #include "opt_debug_cluster.h" @@ -166,10 +166,10 @@ cluster_read(vp, filesize, lblkno, size, cred, totread, seqcount, bpp) } reqbp = bp = NULL; } else { - off_t firstread; - firstread = bp->b_offset; + off_t firstread = bp->b_offset; + KASSERT(bp->b_offset != NOOFFSET, - ("cluster_read: no buffer offset")); + ("cluster_read: no buffer offset")); if (firstread + totread > filesize) totread = filesize - firstread; if (totread > size) { @@ -311,8 +311,9 @@ cluster_rbuild(vp, filesize, lbn, blkno, size, run, fbp) int i, inc, j; KASSERT(size == vp->v_mount->mnt_stat.f_iosize, - ("cluster_rbuild: size %ld != filesize %ld\n", - size, vp->v_mount->mnt_stat.f_iosize)); + ("cluster_rbuild: size %ld != filesize %ld\n", + size, vp->v_mount->mnt_stat.f_iosize)); + /* * avoid a division */ @@ -346,8 +347,7 @@ cluster_rbuild(vp, filesize, lbn, blkno, size, run, fbp) bp->b_blkno = blkno; bp->b_lblkno = lbn; bp->b_offset = tbp->b_offset; - KASSERT(bp->b_offset != NOOFFSET, - ("cluster_rbuild: no buffer offset")); + KASSERT(bp->b_offset != NOOFFSET, ("cluster_rbuild: no buffer offset")); pbgetvp(vp, bp); TAILQ_INIT(&bp->b_cluster.cluster_head); @@ -510,7 +510,6 @@ cluster_write(bp, filesize) lblocksize = bp->b_bufsize; } lbn = bp->b_lblkno; - KASSERT(bp->b_offset != NOOFFSET, ("cluster_write: no buffer offset")); /* Initialize vnode to beginning of file. */ diff --git a/sys/kern/vfs_export.c b/sys/kern/vfs_export.c index 92a8710e9734..179ef7899463 100644 --- a/sys/kern/vfs_export.c +++ b/sys/kern/vfs_export.c @@ -36,7 +36,7 @@ * SUCH DAMAGE. * * @(#)vfs_subr.c 8.31 (Berkeley) 5/26/95 - * $Id: vfs_subr.c,v 1.180 1999/01/05 18:49:53 eivind Exp $ + * $Id: vfs_subr.c,v 1.181 1999/01/08 17:31:17 eivind Exp $ */ /* @@ -797,6 +797,7 @@ bgetvp(vp, bp) int s; KASSERT(bp->b_vp == NULL, ("bgetvp: not free")); + vhold(vp); bp->b_vp = vp; if (vp->v_type == VBLK || vp->v_type == VCHR) @@ -990,6 +991,7 @@ pbgetvp(vp, bp) register struct vnode *vp; register struct buf *bp; { + KASSERT(bp->b_vp == NULL, ("pbgetvp: not free")); bp->b_vp = vp; @@ -1302,7 +1304,7 @@ vrele(vp) { struct proc *p = curproc; /* XXX */ - KASSERT(vp, ("vrele: null vp")); + KASSERT(vp != NULL, ("vrele: null vp")); simple_lock(&vp->v_interlock); diff --git a/sys/kern/vfs_lookup.c b/sys/kern/vfs_lookup.c index e6e8a6fff1bc..67efd523706d 100644 --- a/sys/kern/vfs_lookup.c +++ b/sys/kern/vfs_lookup.c @@ -36,7 +36,7 @@ * SUCH DAMAGE. * * @(#)vfs_lookup.c 8.4 (Berkeley) 2/16/94 - * $Id: vfs_lookup.c,v 1.29 1999/01/05 18:49:52 eivind Exp $ + * $Id: vfs_lookup.c,v 1.30 1999/01/08 17:31:16 eivind Exp $ */ #include "opt_ktrace.h" @@ -91,9 +91,9 @@ namei(ndp) ndp->ni_cnd.cn_cred = ndp->ni_cnd.cn_proc->p_ucred; KASSERT(cnp->cn_cred && cnp->cn_proc, ("namei: bad cred/proc")); KASSERT((cnp->cn_nameiop & (~OPMASK)) == 0, - ("namei: nameiop contaminated with flags")); + ("namei: nameiop contaminated with flags")); KASSERT((cnp->cn_flags & OPMASK) == 0, - ("namei: flags contaminated with nameiops")); + ("namei: flags contaminated with nameiops")); fdp = cnp->cn_proc->p_fd; /* @@ -670,7 +670,7 @@ relookup(dvp, vpp, cnp) * Check for symbolic link */ KASSERT(dp->v_type != VLNK || !(cnp->cn_flags & FOLLOW), - ("relookup: symlink found.\n")); + ("relookup: symlink found.\n")); /* * Disallow directory write attempts on read-only file systems. diff --git a/sys/kern/vfs_subr.c b/sys/kern/vfs_subr.c index 92a8710e9734..179ef7899463 100644 --- a/sys/kern/vfs_subr.c +++ b/sys/kern/vfs_subr.c @@ -36,7 +36,7 @@ * SUCH DAMAGE. * * @(#)vfs_subr.c 8.31 (Berkeley) 5/26/95 - * $Id: vfs_subr.c,v 1.180 1999/01/05 18:49:53 eivind Exp $ + * $Id: vfs_subr.c,v 1.181 1999/01/08 17:31:17 eivind Exp $ */ /* @@ -797,6 +797,7 @@ bgetvp(vp, bp) int s; KASSERT(bp->b_vp == NULL, ("bgetvp: not free")); + vhold(vp); bp->b_vp = vp; if (vp->v_type == VBLK || vp->v_type == VCHR) @@ -990,6 +991,7 @@ pbgetvp(vp, bp) register struct vnode *vp; register struct buf *bp; { + KASSERT(bp->b_vp == NULL, ("pbgetvp: not free")); bp->b_vp = vp; @@ -1302,7 +1304,7 @@ vrele(vp) { struct proc *p = curproc; /* XXX */ - KASSERT(vp, ("vrele: null vp")); + KASSERT(vp != NULL, ("vrele: null vp")); simple_lock(&vp->v_interlock); diff --git a/sys/sys/systm.h b/sys/sys/systm.h index 158fa1d6fb3b..71374837891b 100644 --- a/sys/sys/systm.h +++ b/sys/sys/systm.h @@ -36,7 +36,7 @@ * SUCH DAMAGE. * * @(#)systm.h 8.7 (Berkeley) 3/29/95 - * $Id: systm.h,v 1.80 1998/12/21 07:41:50 dillon Exp $ + * $Id: systm.h,v 1.81 1999/01/08 17:31:21 eivind Exp $ */ #ifndef _SYS_SYSTM_H_ @@ -76,10 +76,10 @@ extern struct vnode *swapdev_vp;/* vnode for swap device */ extern int boothowto; /* reboot flags, from console subsystem */ extern int bootverbose; /* nonzero to print verbose messages */ -#ifdef INVARIANTS /* The option is always available */ -#define KASSERT(exp,msg) do { if (!(exp)) panic msg; } while(0) +#ifdef INVARIANTS /* The option is always available */ +#define KASSERT(exp,msg) do { if (!(exp)) panic msg; } while (0) #else -#define KASSERT(exp,msg) +#define KASSERT(exp,msg) #endif /* diff --git a/sys/vm/swap_pager.c b/sys/vm/swap_pager.c index dff0490abf8c..16911684c998 100644 --- a/sys/vm/swap_pager.c +++ b/sys/vm/swap_pager.c @@ -39,7 +39,7 @@ * from: Utah $Hdr: swap_pager.c 1.4 91/04/30$ * * @(#)swap_pager.c 8.9 (Berkeley) 3/21/94 - * $Id: swap_pager.c,v 1.105 1998/12/29 22:53:51 dt Exp $ + * $Id: swap_pager.c,v 1.106 1999/01/08 17:31:23 eivind Exp $ */ /* @@ -1297,7 +1297,7 @@ swap_pager_putpages(object, m, count, sync, rtvals) swb[i]->swb_locked--; } -#if defined(INVARIANTS) +#ifdef INVARIANTS for (i = firstidx; i < lastidx; i++) { if (reqaddr[i] == SWB_EMPTY) { printf("I/O to empty block???? -- pindex: %d, i: %d\n", @@ -1348,7 +1348,7 @@ swap_pager_putpages(object, m, count, sync, rtvals) } spc = TAILQ_FIRST(&swap_pager_free); - KASSERT(spc, + KASSERT(spc != NULL, ("swap_pager_putpages: free queue is empty, %d expected\n", swap_pager_free_count)); TAILQ_REMOVE(&swap_pager_free, spc, spc_list); diff --git a/sys/vm/vm_fault.c b/sys/vm/vm_fault.c index f1456b68e1df..e3d64f92108d 100644 --- a/sys/vm/vm_fault.c +++ b/sys/vm/vm_fault.c @@ -66,7 +66,7 @@ * any improvements or extensions that they make and grant Carnegie the * rights to redistribute these changes. * - * $Id: vm_fault.c,v 1.91 1998/11/25 07:40:49 dg Exp $ + * $Id: vm_fault.c,v 1.92 1999/01/08 17:31:24 eivind Exp $ */ /* @@ -527,7 +527,6 @@ RetryFault:; vm_object_pip_add(fs.object, 1); } } - KASSERT((fs.m->flags & PG_BUSY) != 0, ("vm_fault: not busy after main loop")); diff --git a/sys/vm/vm_object.c b/sys/vm/vm_object.c index a00e9957c131..a1477f222822 100644 --- a/sys/vm/vm_object.c +++ b/sys/vm/vm_object.c @@ -61,7 +61,7 @@ * any improvements or extensions that they make and grant Carnegie the * rights to redistribute these changes. * - * $Id: vm_object.c,v 1.136 1999/01/02 11:34:57 bde Exp $ + * $Id: vm_object.c,v 1.137 1999/01/08 17:31:26 eivind Exp $ */ /* @@ -243,7 +243,7 @@ vm_object_reference(object) return; KASSERT(!(object->flags & OBJ_DEAD), - ("vm_object_reference: attempting to reference dead obj")); + ("vm_object_reference: attempting to reference dead obj")); object->ref_count++; if (object->type == OBJT_VNODE) { @@ -260,10 +260,11 @@ vm_object_vndeallocate(object) vm_object_t object; { struct vnode *vp = (struct vnode *) object->handle; + KASSERT(object->type == OBJT_VNODE, - ("vm_object_vndeallocate: not a vnode object")); - KASSERT(vp, ("vm_object_vndeallocate: missing vp")); -#if defined(INVARIANTS) + ("vm_object_vndeallocate: not a vnode object")); + KASSERT(vp != NULL, ("vm_object_vndeallocate: missing vp")); +#ifdef INVARIANTS if (object->ref_count == 0) { vprint("vm_object_vndeallocate", vp); panic("vm_object_vndeallocate: bad object reference count"); @@ -326,8 +327,7 @@ vm_object_deallocate(object) robject = TAILQ_FIRST(&object->shadow_head); KASSERT(robject != NULL, - ("vm_object_deallocate: ref_count: %d," - " shadow_count: %d", + ("vm_object_deallocate: ref_count: %d, shadow_count: %d", object->ref_count, object->shadow_count)); if ((robject->handle == NULL) && diff --git a/sys/vm/vm_page.c b/sys/vm/vm_page.c index 08bfc60a7a84..c953559da668 100644 --- a/sys/vm/vm_page.c +++ b/sys/vm/vm_page.c @@ -34,7 +34,7 @@ * SUCH DAMAGE. * * from: @(#)vm_page.c 7.4 (Berkeley) 5/7/91 - * $Id: vm_page.c,v 1.114 1998/12/23 01:52:47 dillon Exp $ + * $Id: vm_page.c,v 1.115 1999/01/08 17:31:27 eivind Exp $ */ /* @@ -884,7 +884,7 @@ vm_page_alloc(object, pindex, page_req) case VM_ALLOC_NORMAL: if (cnt.v_free_count >= cnt.v_free_reserved) { m = vm_page_select_free(object, pindex, PQ_FREE); - KASSERT(m, ("vm_page_alloc(NORMAL): missing page on free queue\n")); + KASSERT(m != NULL, ("vm_page_alloc(NORMAL): missing page on free queue\n")); } else { m = vm_page_select_cache(object, pindex); if (m == NULL) { @@ -903,7 +903,7 @@ vm_page_alloc(object, pindex, page_req) case VM_ALLOC_ZERO: if (cnt.v_free_count >= cnt.v_free_reserved) { m = vm_page_select_free(object, pindex, PQ_ZERO); - KASSERT(m, ("vm_page_alloc(ZERO): missing page on free queue\n")); + KASSERT(m != NULL, ("vm_page_alloc(ZERO): missing page on free queue\n")); } else { m = vm_page_select_cache(object, pindex); if (m == NULL) { @@ -924,7 +924,7 @@ vm_page_alloc(object, pindex, page_req) ((cnt.v_cache_count == 0) && (cnt.v_free_count >= cnt.v_interrupt_free_min))) { m = vm_page_select_free(object, pindex, PQ_FREE); - KASSERT(m, ("vm_page_alloc(SYSTEM): missing page on free queue\n")); + KASSERT(m != NULL, ("vm_page_alloc(SYSTEM): missing page on free queue\n")); } else { m = vm_page_select_cache(object, pindex); if (m == NULL) { @@ -943,7 +943,7 @@ vm_page_alloc(object, pindex, page_req) case VM_ALLOC_INTERRUPT: if (cnt.v_free_count > 0) { m = vm_page_select_free(object, pindex, PQ_FREE); - KASSERT(m, ("vm_page_alloc(INTERRUPT): missing page on free queue\n")); + KASSERT(m != NULL, ("vm_page_alloc(INTERRUPT): missing page on free queue\n")); } else { splx(s); vm_pageout_deficit++; diff --git a/sys/vm/vm_zone.c b/sys/vm/vm_zone.c index d90784e7de84..0d684a74d321 100644 --- a/sys/vm/vm_zone.c +++ b/sys/vm/vm_zone.c @@ -11,7 +11,7 @@ * 2. Absolutely no warranty of function or purpose is made by the author * John S. Dyson. * - * $Id: vm_zone.c,v 1.24 1998/12/04 22:54:57 archie Exp $ + * $Id: vm_zone.c,v 1.25 1999/01/08 17:31:29 eivind Exp $ */ #include @@ -194,7 +194,7 @@ zbootinit(vm_zone_t z, char *name, int size, void *item, int nitems) z->zitems = NULL; for (i = 0; i < nitems; i++) { ((void **) item)[0] = z->zitems; -#if defined(INVARIANTS) +#ifdef INVARIANTS ((void **) item)[1] = (void *) ZENTRY_FREE; #endif z->zitems = item; @@ -357,7 +357,7 @@ _zget(vm_zone_t z) nitems -= 1; for (i = 0; i < nitems; i++) { ((void **) item)[0] = z->zitems; -#if defined(INVARIANTS) +#ifdef INVARIANTS ((void **) item)[1] = (void *) ZENTRY_FREE; #endif z->zitems = item; @@ -367,7 +367,7 @@ _zget(vm_zone_t z) } else if (z->zfreecnt > 0) { item = z->zitems; z->zitems = ((void **) item)[0]; -#if defined(INVARIANTS) +#ifdef INVARIANTS if (((void **) item)[1] != (void *) ZENTRY_FREE) zerror(ZONE_ERROR_NOTFREE); ((void **) item)[1] = 0; @@ -432,7 +432,7 @@ sysctl_vm_zone SYSCTL_HANDLER_ARGS return (0); } -#if defined(INVARIANT_SUPPORT) +#ifdef INVARIANT_SUPPORT void zerror(int error) { diff --git a/sys/vm/vm_zone.h b/sys/vm/vm_zone.h index 6b322f5ee373..8fe91d1e1aaf 100644 --- a/sys/vm/vm_zone.h +++ b/sys/vm/vm_zone.h @@ -11,10 +11,10 @@ * 2. Absolutely no warranty of function or purpose is made by the author * John S. Dyson. * - * $Id: vm_zone.h,v 1.10 1998/04/25 04:50:03 dyson Exp $ + * $Id: vm_zone.h,v 1.11 1999/01/08 17:31:30 eivind Exp $ */ -#if !defined(_SYS_ZONE_H) +#ifndef _SYS_ZONE_H #define _SYS_ZONE_H @@ -76,7 +76,7 @@ _zalloc(vm_zone_t z) { void *item; -#if defined(INVARIANTS) +#ifdef INVARIANTS if (z == 0) zerror(ZONE_ERROR_INVALID); #endif @@ -86,7 +86,7 @@ _zalloc(vm_zone_t z) item = z->zitems; z->zitems = ((void **) item)[0]; -#if defined(INVARIANTS) +#ifdef INVARIANTS if (((void **) item)[1] != (void *) ZENTRY_FREE) zerror(ZONE_ERROR_NOTFREE); ((void **) item)[1] = 0; @@ -101,7 +101,7 @@ static __inline__ void _zfree(vm_zone_t z, void *item) { ((void **) item)[0] = z->zitems; -#if defined(INVARIANTS) +#ifdef INVARIANTS if (((void **) item)[1] == (void *) ZENTRY_FREE) zerror(ZONE_ERROR_ALREADYFREE); ((void **) item)[1] = (void *) ZENTRY_FREE; @@ -123,7 +123,7 @@ zalloc(vm_zone_t z) static __inline__ void zfree(vm_zone_t z, void *item) { -#if defined(SMP) +#ifdef SMP zfreei(z, item); #else _zfree(z, item);