NetBSD-Bugs archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: kern/46522
The following reply was made to PR kern/46522; it has been noted by GNATS.
From: Nat Sloss <nathanialsloss%yahoo.com.au@localhost>
To: gnats-bugs%netbsd.org@localhost
Cc:
Subject: Re: kern/46522
Date: Tue, 5 Jun 2012 03:07:06 +1000
Hi.
Sorry for the trouble again.
I'm retyping my message so hopefully it'll get through un-garbled.
So here's my new patch:
Index: sys/kern/tty.c
===================================================================
RCS file: /cvsroot/src/sys/kern/tty.c,v
retrieving revision 1.250
diff -u -r1.250 tty.c
--- sys/kern/tty.c 12 Mar 2012 18:27:08 -0000 1.250
+++ sys/kern/tty.c 4 Jun 2012 17:06:48 -0000
@@ -422,7 +422,6 @@
ttyflush(tp, FREAD | FWRITE);
tp->t_gen++;
- tp->t_pgrp = NULL;
tp->t_state = 0;
sess = tp->t_session;
tp->t_session = NULL;
@@ -2762,7 +2761,12 @@
void
tty_free(struct tty *tp)
{
- int i;
+ int i, timeout;
+ struct proc *p;
+
+ timeout = mstohz(200);
+ if (timeout == 0)
+ timeout = 1;
mutex_enter(proc_lock);
mutex_enter(&tty_lock);
@@ -2770,9 +2774,17 @@
sigemptyset(&tp->t_sigs[i]);
if (tp->t_sigcount != 0)
TAILQ_REMOVE(&tty_sigqueue, tp, t_sigqueue);
- mutex_exit(&tty_lock);
mutex_exit(proc_lock);
+ while (tp->t_pgrp != NULL) {
+ if ((p = LIST_FIRST(&tp->t_pgrp->pg_members)) != NULL)
+ ttysleep(tp, &tp->t_rawcv, true, timeout);
+ else if (LIST_EMPTY(&tp->t_pgrp->pg_members))
+ tp->t_pgrp = NULL;
+ }
+ tp->t_pgrp = NULL;
+ mutex_exit(&tty_lock);
+
callout_halt(&tp->t_rstrt_ch, NULL);
callout_destroy(&tp->t_rstrt_ch);
ttyldisc_release(tp->t_linesw);
Note: This patch is my own work which I submit under the NetBSD license.
Regards,
Nat.
Home |
Main Index |
Thread Index |
Old Index