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



I can't reproduce this... Trying the following works:

christos

screen -S ses -d -m -p 0 cat
screen -S sys -X quit



On Jan 4, 2022, at 6:45 AM, 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;
}
---END PATCH---

-RVP

Attachment: signature.asc
Description: Message signed with OpenPGP



Home | Main Index | Thread Index | Old Index