Subject: Re: ptys are not always freed
To: None <current-users@NetBSD.ORG>
From: proprietor - Foo Bar And Grill <greywolf@starwolf.starwolf.com>
List: current-users
Date: 01/24/1998 19:17:04
Greg A. Woods sez:
/*
 * ...
 * exampe on page 504 he verifies that the inode times associated with the
 * socket are no older than 30 seconds, and if they are he fails the
 * connection with no other justification than the comment "the i-node is
 * too old".
 * 
 * I'm wondering if this hack might work with stale pty's too.

I think this is not quite the right answer.  I leave connections to ptys
up overnight on occasion.  Besides that, it would cause problems with
"screen" as well.  Granted, in this day and age, screen is rather
antiquated, what with ppp and other ways of accessing a host, but I know
I had some needs to access a machine whose only recourse was a direct
dialup.  As I had only one line at the time, I had to share the line
between the modem and a voice on occasion, and so I'd have to terminate
the connection rather abruptly.  Screen, upon receiving a HUP signal,
would save its state and "exit", and I could take the incoming call,
hang up, redial thru the modem and reaquire my screen session and be
able to pick up where I left off.  Rather nice, really.  It certainly
didn't cause rlogin or telnet timeouts if I accidentally hit a key while
not connected or connectable.

I think that if the process holding the pty exits or is killed, as in
the case of "pine", something is going seriously wrong if init or the
kernel or whoever's supposed to be revoke()ing the tty/pty isn't, and
there's obviously something wrong with the pty allocation code if it's
attempting an exclusive open and setsid() on a pty/tty and succeeding.

Of course I'm stating the obvious without really fixing the problem;
perhaps someone could throw in some PTYDEBUG #ifdef/#endif printf()s
and debug the hell out of this puppy...?

Also, how hard would it to be to make revoke() work on normal files?

 * 
 * Indeed though there does seem to be something quirky with the pty
 * driver....
 * 
 * -- 
 * 							Greg A. Woods
 * 
 * +1 416 443-1734			VE3TCP			robohack!woods
 * Planix, Inc. <woods@planix.com>; Secrets Of The Weird <woods@weird.com>
 */





				--*greywolf;
--
Been there.  Done that.  Bought the T-shirt.  Destroyed the planet.  Left.