NetBSD-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: cannot start detached sessions (with -m -d) back to back



In article <bf7717e-ee5-8454-52e8-197e27bafe66%SDF.ORG@localhost>,
RVP  <rvp%SDF.ORG@localhost> wrote:
>On Mon, 3 Jan 2022, Christos Zoulas wrote:
>
>> Yes, in the end screen was at fault for setting CLOCAL in the pty which
>> prevented from SIGHUP from being sent. I fixed it.
>>
>
>I think the problem may be that in canonical mode, the slave goes to
>sleep waiting for input (in tty.c:ttread()) and nothing wakes it up
>when the master side is closed. The patch below seems to work, but,
>please scrutinize it carefully as I've only tested it lightly and I'm
>also operating without a license :)
>
>---START PATCH---
>--- sys/kern/tty_pty.c.orig	2021-10-11 04:12:12.543371554 +0000
>+++ sys/kern/tty_pty.c	2022-01-04 11:08:51.163444059 +0000
>@@ -637,6 +637,7 @@
>  	mutex_spin_enter(&tty_lock);
>  	CLR(tp->t_state, TS_CARR_ON);
>  	tp->t_oproc = NULL;		/* mark closed */
>+	cv_broadcast(&tp->t_rawcv);	/* wake-up slave */
>  	mutex_spin_exit(&tty_lock);
>  	return 0;
>  }

Isn't t_rawcv used only during the open? (t_rawcvf is used in write,
and t_outcvf is used in read).

christos



Home | Main Index | Thread Index | Old Index