[comp.mail.uucp] who has the line

dg@lakart.UUCP (David Goodenough) (04/14/89)

From article <1403@auspex.auspex.com>, by guy@auspex.auspex.com (Guy Harris):
> Huh?  Its sole purpose is to prevent two programs ("getty" and the
> program that's dialing out) from gaining simultaneous access to the same
> serial line.

I thought tip / uucico did that when they opened the line. Usually an idle
getty looks like this:

       F UID   PID  PPID CP PRI NI ADDR  SZ  RSS WCHAN  STAT TT  TIME COMMAND
 1800001   0  4872     1  0   3  0  5d8  40   28 cp_tty I    h1  0:00 - std.960

where the cp_tty means it waiting for a tty to do something. I'd do it now
but I'm dialed in (catch 22 :-) ), but when uucico / tip are running, the
WCHAN changes to a 'u', and the stat goes to a 'S' (short term snooze). So
either uucico does some explicit widgetry to nuke the getty, or the open does.
I once started writing a term program, and since I'm on a BSD system, I opted
to check for a getty on the line, and if there just issue a kill -17 at it.
Held that sucker quiet real good :-). If I couldn't, I assumed that the tty
was in use and exited the term prog.

Anyway what does happen when the WCHAN changes from cp_tty to u??
Enquiring minds want to know.
-- 
	dg@lakart.UUCP - David Goodenough		+---+
						IHS	| +-+-+
	....... !harvard!xait!lakart!dg			+-+-+ |
AKA:	dg%lakart.uucp@xait.xerox.com		  	  +---+

guy@auspex.auspex.com (Guy Harris) (04/18/89)

 >> Huh?  Its sole purpose is to prevent two programs ("getty" and the
 >> program that's dialing out) from gaining simultaneous access to the same
 >> serial line.
 >
 >I thought tip / uucico did that when they opened the line.

"It", in this case, refers to the dialin/dialout feature. 
"tip"/"uucico" do *not* themselves do anything that keeps "getty" from
using the line; the serial port driver does so when the line is opened. 
("getty" is not running on the same major/minor as "tip" or "uucico", so
even if "tip" or "uucico" does a TIOCEXCL that won't stop "getty".)

 >Usually an idle getty looks like this:
 >
 >       F UID   PID  PPID CP PRI NI ADDR  SZ  RSS WCHAN  STAT TT  TIME COMMAND
 > 1800001   0  4872     1  0   3  0  5d8  40   28 cp_tty I    h1  0:00 - std.96
 >
 >where the cp_tty means it waiting for a tty to do something.

It's presumably waiting for carrier to come up on the serial port.

 >I'd do it now but I'm dialed in (catch 22 :-) ), but when uucico / tip
 >are running, the WCHAN changes to a 'u', and the stat goes to a 'S'
 >(short term snooze). So either uucico does some explicit widgetry to
 >nuke the getty, or the open does.

If you're talking about schemes of the sort used by SunOS, the "open"
does - it doesn't nuke the "getty", it just keeps the arrival of carrier
on the serial port from waking it up.