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



On Wed, Dec 29, 2021 at 13:40:31 -0500, Adam Russell wrote:

> What I am finding is that works to some extent, but then that second session
> seems to quickly end.
> 
> Here I start a session, list all sessions, quit all sessions, sleep for 10
> seconds, start a new session, list all sessions, sleep one second, and then
> list all sessions again.
> 
> As you can see the second sessions, created after the ten second sleep, does
> get created, but is gone a second later.

Building screeen with debugging shows that succesful session start has
for the first read from the window:

     + hit ev fd 5 type 1!
    going to read from window fd 5
     -> 5 bytes

but failed attempt has

     + hit ev fd 5 type 1!
    going to read from window fd 5
    Window 0: EOF - killing window

where fd 5 is obtained from the cloning pty device /dev/ptmx (ptm(4))

The comment in ptcread says:

	/*
	 * We want to block until the slave
	 * is open, and there's something to read;
	 * but if we lost the slave or we're NBIO,
	 * then return the appropriate error instead.
	 */
...
		if (!ISSET(tp->t_state, TS_CARR_ON)) {
			error = 0;   /* EOF */
			goto out;
		}

Need to ask someone familiar with the pty internals.

-uwe


Home | Main Index | Thread Index | Old Index