PERFORCE change 146845 for review
Ed Schouten
ed at FreeBSD.org
Thu Aug 7 17:53:45 UTC 2008
http://perforce.freebsd.org/chv.cgi?CH=146845
Change 146845 by ed at ed_dull on 2008/08/07 17:53:38
Remove the now unused t_threadcnt variable from struct tty. Now
we use the safer destroy_dev_sched_cb(), there is no harm to
destroy TTY's when threads are still inside the TTY layer
through the character devices.
Affected files ...
.. //depot/projects/mpsafetty/sys/kern/tty.c#16 edit
.. //depot/projects/mpsafetty/sys/sys/tty.h#5 edit
Differences ...
==== //depot/projects/mpsafetty/sys/kern/tty.c#16 (text+ko) ====
@@ -166,10 +166,9 @@
/* Device is already gone */
tty_unlock(tp);
return (ENXIO);
- } else {
- tp->t_threadcnt++;
- return (0);
}
+
+ return (0);
}
static void
@@ -177,10 +176,7 @@
{
tty_lock_assert(tp, MA_OWNED);
- MPASS(tp->t_threadcnt > 0);
- tp->t_threadcnt--;
- if (tty_opened(tp) || tp->t_threadcnt > 0 ||
- tp->t_flags & TF_OPENCLOSE) {
+ if (tty_opened(tp) || tp->t_flags & TF_OPENCLOSE) {
/* Device is still opened somewhere */
tty_unlock(tp);
return;
@@ -245,7 +241,6 @@
tty_unlock(tp);
return (EBUSY);
}
- tp->t_threadcnt++;
tp->t_flags |= TF_OPENCLOSE;
/*
@@ -315,7 +310,6 @@
struct tty *tp = dev->si_drv1;
tty_lock(tp);
- tp->t_threadcnt++;
/*
* This can only be called once. The callin and the callout
@@ -930,7 +924,7 @@
tty_lock_assert(tp, MA_OWNED);
- if (tp->t_sessioncnt != 0 || tp->t_threadcnt != 0 ||
+ if (tp->t_sessioncnt != 0 ||
(tp->t_flags & (TF_GONE|TF_OPENED)) != TF_GONE) {
/* TTY is still in use */
tty_unlock(tp);
==== //depot/projects/mpsafetty/sys/sys/tty.h#5 (text+ko) ====
@@ -79,8 +79,6 @@
#define TF_EXCLUDE 0x1000 /* Exclusive access */
#define TF_BYPASS 0x2000 /* Optimized input path */
#define TF_ZOMBIE 0x4000 /* Modem disconnect received */
-
- unsigned int t_threadcnt; /* (t) Threads in cdev */
unsigned int t_revokecnt; /* (t) revoke() count */
/* Buffering mechanisms */
More information about the p4-projects
mailing list