PERFORCE change 62866 for review

John Baldwin jhb at FreeBSD.org
Fri Oct 8 12:58:05 PDT 2004


http://perforce.freebsd.org/chv.cgi?CH=62866

Change 62866 by jhb at jhb_slimer on 2004/10/08 19:57:06

	Fixup assertions.

Affected files ...

.. //depot/projects/smpng/sys/kern/kern_descrip.c#69 edit

Differences ...

==== //depot/projects/smpng/sys/kern/kern_descrip.c#69 (text+ko) ====

@@ -179,7 +179,8 @@
 	FILEDESC_LOCK_ASSERT(fdp, MA_OWNED);
 	KASSERT(!fdisused(fdp, fd),
 	    ("fd already used"));
-	KASSERT(fdp->fd_map[NDSLOT(fd)] != 0xdeadc0de, ("writing to free'd map"));
+	KASSERT(fdp->fd_map[NDSLOT(fd)] != 0xdeadc0de,
+	    ("writing to free'd map"));
 	fdp->fd_map[NDSLOT(fd)] |= NDBIT(fd);
 	if (fd > fdp->fd_lastfile)
 		fdp->fd_lastfile = fd;
@@ -198,7 +199,8 @@
 	    ("fd is already unused"));
 	KASSERT(fdp->fd_ofiles[fd] == NULL,
 	    ("fd is still in use"));
-	KASSERT(fdp->fd_map[NDSLOT(fd)] != 0xdeadc0de, ("writing to free'd map"));	
+	KASSERT(fdp->fd_map[NDSLOT(fd)] != 0xdeadc0de,
+	    ("writing to free'd map"));	
 	fdp->fd_map[NDSLOT(fd)] &= ~NDBIT(fd);
 	if (fd < fdp->fd_freefile)
 		fdp->fd_freefile = fd;
@@ -391,7 +393,8 @@
 
 	case F_SETFD:
 		/* mtx_assert(&Giant, MA_NOTOWNED); */
-		KASSERT(*pop != (char)0xde, ("writing to free'd flags"));
+		KASSERT(*(uint32_t *)(((uintptr_t)pop) & ~3) != 0xdeadc0de,
+		    ("writing to free'd flags"));
 		*pop = (*pop &~ UF_EXCLOSE) |
 		    (arg & FD_CLOEXEC ? UF_EXCLOSE : 0);
 		FILEDESC_UNLOCK(fdp);
@@ -684,7 +687,8 @@
 	 * Duplicate the source descriptor
 	 */
 	fdp->fd_ofiles[new] = fp;
-	KASSERT(fdp->fd_ofileflags[old] != (char)0xde, ("reading/writing free'd file flags"));
+	KASSERT(*(uint32_t *)(((uintptr_t)&fdp->fd_ofileflags[old]) & ~3) !=
+	    0xdeadc0de, ("reading/writing free'd file flags"));
 	fdp->fd_ofileflags[new] = fdp->fd_ofileflags[old] &~ UF_EXCLOSE;
 	if (new > fdp->fd_lastfile)
 		fdp->fd_lastfile = new;


More information about the p4-projects mailing list