[net.unix-wizards] WOPEN|ISOPEN, etc.

ptw@vaxine.UUCP (P. T. Withington) (05/04/84)

I am working on a tty driver for a Un*x port that will deal with modem signals
and am looking for some enlightenment on the original intent of the various
"state" flags.  I cannot discern any clear-cut philosophy from the drivers that
I know of.

Particular questions include:

Is WOPEN set while you sleep for a carrier?  Presumably you should clear it
when you wake up.  Several drivers I have seen set it and forget it.  Other
drivers seem to assume that WOPEN == !ISOPEN.

Should ISOPEN only be set *after* the carrier comes on?  Most drivers I know
of punt this issue by ignoring carrier.

It appears you should use WOPEN to decide whether to turn off the device in
close, so you don't get unwanted interrupts.  Most drivers punt this issue by
leaving interrupts on all the time and throwing away characters that arrive
for unopened devices.

Is there a conventional place to sleep when waiting for carrier?  I have seen
rawq, outq and tp all used.

Does anybody use BUSY for anything?  How about ASLEEP?  Most of the places I
can find where they could be used, the designer played it safe and called
ttstart/wakeup anyways.

(I hesitate to ask, but) Is there anything more than "The UNIX I/O System"
written down anywhere?

                                o.o     --ptw
                                 ~

chris@umcp-cs.UUCP (05/07/84)

*	From: ptw@vaxine.UUCP

	Is WOPEN set while you sleep for a carrier?

It's supposed to mean ``Waiting for OPEN''.  WOPEN *should*
imply !ISOPEN *for normal usage*, because no one should still be
waiting if someone else has it open.

	Should ISOPEN only be set *after* the carrier comes on?

ISOPEN should be set whenever the line is open.  Typically this
can only be true if the carrier is on (or if it's not on anymore
but some process still has a descriptor to the terminal, which
is actually fairly common... vhangup() was apparently an attempt
to rectify this, but has its own bugs).

	Is there a conventional place to sleep when waiting for
	carrier?  I have seen rawq, outq and tp all used.

Anyplace that's not used by something else... rawq, canq, and
outq aren't likely to be used if no one has the thing open yet.

	Does anybody use BUSY for anything?

Huh?  BUSY?  (I guess not ...)

	How about ASLEEP?

Means the tty is waiting for output to drain, and should be awakend
(on outq I think, too much effort to check from vi here) once the
queue has drained below ttlowat[tp->t_speed].

-- 
In-Real-Life: Chris Torek, Univ of MD Comp Sci (301) 454-7690
UUCP:	{seismo,allegra,brl-bmd}!umcp-cs!chris
CSNet:	chris@umcp-cs		ARPA:	chris@maryland

msc@qubix.UUCP (Mark Callow) (05/10/84)

*	From: ptw@vaxine.UUCP
>	From: chris@umcp-cs.UUCP

*	Is WOPEN set while you sleep for a carrier?

> It's supposed to mean ``Waiting for OPEN''.  WOPEN *should*
> imply !ISOPEN *for normal usage*, because no one should still be
> waiting if someone else has it open.

Chris shows a highly developed politician's skill for not answering
the question asked.  The *simple* answer is yes.

But that's not the point of this note.  I want to correct one answer.

*	Does anybody use BUSY for anything?

> Huh?  BUSY?  (I guess not ...)

BUSY (or TS_BUSY in 4.2) is used by certain serial port drivers.  It is
set in the start routine when the command issued makes the device busy
and unable to accept more commands.  It is cleared by the interrupt
routine.
-- 
From the TARDIS of Mark Callow
msc@qubix.UUCP,  decwrl!qubix!msc@Berkeley.ARPA
...{decvax,ucbvax,ihnp4}!decwrl!qubix!msc, ...{ittvax,amd70}!qubix!msc

"I'm a citizen of the Universe, and a gentleman to boot!"