svn commit: r192566 - user/kmacy/releng_7_2_fcs/sys/kern

Kip Macy kmacy at FreeBSD.org
Thu May 21 19:50:48 UTC 2009


Author: kmacy
Date: Thu May 21 19:50:47 2009
New Revision: 192566
URL: http://svn.freebsd.org/changeset/base/192566

Log:
  reduce differences with HEAD

Modified:
  user/kmacy/releng_7_2_fcs/sys/kern/kern_descrip.c
  user/kmacy/releng_7_2_fcs/sys/kern/kern_kthread.c
  user/kmacy/releng_7_2_fcs/sys/kern/kern_subr.c

Modified: user/kmacy/releng_7_2_fcs/sys/kern/kern_descrip.c
==============================================================================
--- user/kmacy/releng_7_2_fcs/sys/kern/kern_descrip.c	Thu May 21 19:47:22 2009	(r192565)
+++ user/kmacy/releng_7_2_fcs/sys/kern/kern_descrip.c	Thu May 21 19:50:47 2009	(r192566)
@@ -1474,9 +1474,9 @@ falloc(struct thread *td, struct file **
 	 * descriptor to the list of open files at that point, otherwise
 	 * put it at the front of the list of open files.
 	 */
-	fp->f_count = 1;
+	refcount_init(&fp->f_count, 1);
 	if (resultfp)
-		fp->f_count++;
+		fhold(fp);
 	fp->f_cred = crhold(td->td_ucred);
 	fp->f_ops = &badfileops;
 	fp->f_data = NULL;
@@ -2276,14 +2276,13 @@ _fdrop(struct file *fp, struct thread *t
 		panic("fdrop: count %d", fp->f_count);
 	if (fp->f_ops != &badfileops)
 		error = fo_close(fp, td);
-	atomic_subtract_int(&openfiles, 1);
-
 	/*
 	 * The f_cdevpriv cannot be assigned non-NULL value while we
 	 * are destroying the file.
 	 */
 	if (fp->f_cdevpriv != NULL)
 		devfs_fpdrop(fp);
+	atomic_subtract_int(&openfiles, 1);
 	crfree(fp->f_cred);
 	uma_zfree(file_zone, fp);
 
@@ -2526,7 +2525,8 @@ sysctl_kern_file(SYSCTL_HANDLER_ARGS)
 			if (fdp == NULL)
 				continue;
 			/* overestimates sparse tables. */
-			n += fdp->fd_lastfile;
+			if (fdp->fd_lastfile > 0)
+				n += fdp->fd_lastfile;
 			fddrop(fdp);
 		}
 		sx_sunlock(&allproc_lock);
@@ -2907,7 +2907,6 @@ sysctl_kern_proc_filedesc(SYSCTL_HANDLER
 		case DTYPE_VNODE:
 			kif->kf_type = KF_TYPE_VNODE;
 			vp = fp->f_vnode;
-			vref(vp);
 			break;
 
 		case DTYPE_SOCKET:
@@ -2964,6 +2963,7 @@ sysctl_kern_proc_filedesc(SYSCTL_HANDLER
 			kif->kf_flags |= KF_FLAG_HASLOCK;
 		kif->kf_offset = fp->f_offset;
 		if (vp != NULL) {
+			vref(vp);
 			switch (vp->v_type) {
 			case VNON:
 				kif->kf_vnode_type = KF_VTYPE_VNON;

Modified: user/kmacy/releng_7_2_fcs/sys/kern/kern_kthread.c
==============================================================================
--- user/kmacy/releng_7_2_fcs/sys/kern/kern_kthread.c	Thu May 21 19:47:22 2009	(r192565)
+++ user/kmacy/releng_7_2_fcs/sys/kern/kern_kthread.c	Thu May 21 19:50:47 2009	(r192566)
@@ -94,7 +94,9 @@ kthread_create_pri_v(void (*func)(void *
 
 	/* this is a non-swapped system process */
 	PROC_LOCK(p2);
+	td = FIRST_THREAD_IN_PROC(p2);
 	p2->p_flag |= P_SYSTEM | P_KTHREAD;
+	td->td_pflags |= TDP_KTHREAD;
 	mtx_lock(&p2->p_sigacts->ps_mtx);
 	p2->p_sigacts->ps_flag |= PS_NOCLDWAIT;
 	mtx_unlock(&p2->p_sigacts->ps_mtx);

Modified: user/kmacy/releng_7_2_fcs/sys/kern/kern_subr.c
==============================================================================
--- user/kmacy/releng_7_2_fcs/sys/kern/kern_subr.c	Thu May 21 19:47:22 2009	(r192565)
+++ user/kmacy/releng_7_2_fcs/sys/kern/kern_subr.c	Thu May 21 19:50:47 2009	(r192566)
@@ -456,7 +456,7 @@ uio_yield(void)
 	DROP_GIANT();
 	thread_lock(td);
 	sched_prio(td, td->td_user_pri);
-	mi_switch(SW_INVOL, NULL);
+	mi_switch(SW_INVOL | SWT_RELINQUISH, NULL);
 	thread_unlock(td);
 	PICKUP_GIANT();
 }


More information about the svn-src-user mailing list