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 <>
Subject: Re: kern/46522
Date: Tue, 5 Jun 2012 02:37:59 +1000

 Hi Sorry for the previous posting.  I was using yahoo web mail and the resu=
 were unexpected.  All is well again my email is working as it should.
 =2D---------  Forwarded Message  ----------
 Subject: Re: kern/46522
 Date: Tue, 5 Jun 2012
 =46rom: Nathanial Sloss <>
 To: "" <>
 The getty doesn't have to be killed it's dying it's just that before it is=
 finished the cvs' are being destroyed.
 So I came up with another patch,=A0 If t_pgrp isn't nullified in ttyclose i=
 would be possible to wait on processes in the list until they die and then=
 safely free the screen.=A0 So what I did was this:
 Index: sys/kern/tty.c
 RCS file: /cvsroot/src/sys/kern/tty.c,v
 retrieving revision 1.250
 diff -u -r1.250 tty.c
 =2D-- sys/kern/tty.c=A0=A0=A0=A0=A0 12 Mar 2012 18:27:08 -0000=A0=A0=A0=A0=
 =A0 1.250
 +++ sys/kern/tty.c=A0=A0=A0=A0=A0 4 Jun 2012 15:46:59 -0000
 @@ -422,7 +422,6 @@
 =A0=A0=A0=A0=A0=A0=A0 ttyflush(tp, FREAD | FWRITE);
 =A0=A0=A0=A0=A0=A0=A0 tp->t_gen++;
 =2D=A0=A0=A0=A0=A0=A0 tp->t_pgrp =3D NULL;
 =A0=A0=A0=A0=A0=A0=A0 tp->t_state =3D 0;
 =A0=A0=A0=A0=A0=A0=A0 sess =3D tp->t_session;
 =A0=A0=A0=A0=A0=A0=A0 tp->t_session =3D NULL;
 @@ -2762,7 +2761,12 @@
 =A0tty_free(struct tty *tp)
 =2D=A0=A0=A0=A0=A0=A0 int i;
 +=A0=A0=A0=A0=A0=A0 int i, timeout;
 +=A0=A0=A0=A0=A0=A0 struct proc *p;
 +=A0=A0=A0=A0=A0=A0 timeout =3D mstohz(200);
 +=A0=A0=A0=A0=A0=A0 if (timeout =3D=3D 0)
 +=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 timeout =3D 1;
 =A0=A0=A0=A0=A0=A0=A0 mutex_enter(proc_lock);
 =A0=A0=A0=A0=A0=A0=A0 mutex_enter(&tty_lock);
 @@ -2770,9 +2774,17 @@
 =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 sigemptyset(&tp->t_sigs[i]);
 =A0=A0=A0=A0=A0=A0=A0 if (tp->t_sigcount !=3D 0)
 =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 TAILQ_REMOVE(&tty_sigqueue, t=
 p, t_sigqueue);
 =2D=A0=A0=A0=A0=A0=A0 mutex_exit(&tty_lock);
 =A0=A0=A0=A0=A0=A0=A0 mutex_exit(proc_lock);
 +=A0=A0=A0=A0=A0=A0 while (tp->t_pgrp !=3D NULL) {
 +=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 if ((p =3D LIST_FIRST(&tp->t_pg=
 rp->pg_members)) !=3D NULL)
 +=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 ttyslee=
 p(tp, &tp->t_rawcv, true, timeout);
 +=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 else if (LIST_EMPTY(&tp->t_pgrp=
 +=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 tp->t_p=
 grp =3D NULL;
 +=A0=A0=A0=A0=A0=A0 }
 +=A0=A0=A0=A0=A0=A0 tp->t_pgrp =3D NULL;
 +=A0=A0=A0=A0=A0=A0 mutex_exit(&tty_lock);
 =A0=A0=A0=A0=A0=A0=A0 callout_halt(&tp->t_rstrt_ch, NULL);
 =A0=A0=A0=A0=A0=A0=A0 callout_destroy(&tp->t_rstrt_ch);
 =A0=A0=A0=A0=A0=A0=A0 ttyldisc_release(tp->t_linesw);
 Note: This patch is my own work which I submit under the NetBSD license.
 I hope this is a better patch.

Home | Main Index | Thread Index | Old Index