kern/99758: chown/chmod pty slave side in kernel

Ian Dowse iedowse at iedowse.com
Fri Jul 14 09:50:24 UTC 2006


The following reply was made to PR kern/99758; it has been noted by GNATS.

From: Ian Dowse <iedowse at iedowse.com>
To: Atsuo Ohki <ohki at gssm.otsuka.tsukuba.ac.jp>
Cc: "Wojciech A. Koszek" <wkoszek at FreeBSD.org>,
    freebsd-gnats-submit at FreeBSD.org, Robert Watson <rwatson at FreeBSD.org>
Subject: Re: kern/99758: chown/chmod pty slave side in kernel 
Date: Fri, 14 Jul 2006 10:45:44 +0100

 In message <200607130915.k6D9F2eg054212 at smr00.gssm.otsuka.tsukuba.ac.jp>, Atsuo
  Ohki writes:
 > I achieved a little success.
 > Now (really now!),  pty test of stress2 is running.
 >
 > I modified as follow:
 
 I'm not sure if it is related, but the following old patch had
 solved some issue I was seeing with getty running on USB serial
 ports. Maybe it is a similar issue?
 
 Ian
 
 Index: kern_conf.c
 ===================================================================
 RCS file: /dump/FreeBSD-CVS/src/sys/kern/kern_conf.c,v
 retrieving revision 1.197
 diff -u -r1.197 kern_conf.c
 --- kern_conf.c	12 Jan 2006 19:15:14 -0000	1.197
 +++ kern_conf.c	3 Feb 2006 00:43:20 -0000
 @@ -658,6 +658,7 @@
  		dev->si_flags &= ~SI_CLONELIST;
  	}
  
 +	dev_refl(dev);	/* another thread might dev_rel() while we sleep. */
  	csw = dev->si_devsw;
  	dev->si_devsw = NULL;	/* already NULL for SI_ALIAS */
  	while (csw != NULL && csw->d_purge != NULL && dev->si_threadcount) {
 @@ -683,10 +684,15 @@
  	}
  	dev->si_flags &= ~SI_ALIAS;
  
 -	if (dev->si_refcount > 0) {
 +	if (dev->si_refcount > 1) {
 +		dev->si_refcount--;
  		LIST_INSERT_HEAD(&dead_cdevsw.d_devs, dev, si_list);
  	} else {
 +		KASSERT(dev->si_refcount == 1,
 +		    ("destroy_devl unexpected refcount %d", dev->si_refcount));
 +		dev_unlock();
  		devfs_free(dev);
 +		dev_lock();
  	}
  }
  


More information about the freebsd-bugs mailing list