PERFORCE change 93652 for review

Todd Miller millert at FreeBSD.org
Mon Mar 20 18:57:53 UTC 2006


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

Change 93652 by millert at millert_p3 on 2006/03/20 18:54:48

	Back out fdcopy() changes to ease upcoming integration.

Affected files ...

.. //depot/projects/trustedbsd/sebsd/sys/kern/kern_descrip.c#20 edit

Differences ...

==== //depot/projects/trustedbsd/sebsd/sys/kern/kern_descrip.c#20 (text+ko) ====

@@ -1502,6 +1502,8 @@
 	newfdp->fd_fd.fd_cmask = CMASK;
 	newfdp->fd_fd.fd_ofiles = newfdp->fd_dfiles;
 	newfdp->fd_fd.fd_ofileflags = newfdp->fd_dfileflags;
+	newfdp->fd_fd.fd_lastfile = 0;	/* XXX */
+	newfdp->fd_fd.fd_freefile = 0;	/* XXX */
 	newfdp->fd_fd.fd_nfiles = NDFILE;
 	newfdp->fd_fd.fd_map = newfdp->fd_dmap;
 	return (&newfdp->fd_fd);
@@ -1592,6 +1594,8 @@
 	}
 	/* copy everything except kqueue descriptors */
 	newfdp->fd_freefile = -1;
+	if (fdp->fd_lastfile < 0)
+		printf("%s: fd_lastfile is %d\n", __func__, fdp->fd_lastfile);
 	for (i = 0; i <= fdp->fd_lastfile; ++i) {
 		if (fdisused(fdp, i) &&
 		    fdp->fd_ofiles[i]->f_type != DTYPE_KQUEUE) {
@@ -1604,15 +1608,17 @@
 				newfdp->fd_freefile = i;
 		}
 	}
-	newfdp->fd_cmask = fdp->fd_cmask;
 	FILEDESC_UNLOCK_FAST(fdp);
 	FILEDESC_LOCK(newfdp);
-	if (newfdp->fd_freefile == -1)
-		newfdp->fd_freefile = i;
 	for (i = 0; i <= newfdp->fd_lastfile; ++i)
 		if (newfdp->fd_ofiles[i] != NULL)
 			fdused(newfdp, i);
 	FILEDESC_UNLOCK(newfdp);
+	FILEDESC_LOCK_FAST(fdp);
+	if (newfdp->fd_freefile == -1)
+		newfdp->fd_freefile = i;
+	newfdp->fd_cmask = fdp->fd_cmask;
+	FILEDESC_UNLOCK_FAST(fdp);
 	return (newfdp);
 }
 


More information about the trustedbsd-cvs mailing list