WG15 Defect Report Ref: 9945-1-51
Topic: cfsetospeed()


This is an approved interpretation of 9945-1:1990.

.

Last update: 1997-05-20


                                                                9945-1-90 #51
	Classification:  No change



 _____________________________________________________________________________


	Topic:			cfsetospeed()
	Relevant Sections:	7


Defect Report:
-----------------------

       +Interpretation Request ref     : VWG/012/063092
       [Problem	description]
       During the test of ISO ISO/IEC 9945-1:90 the following question
       with regard to the cfsetospeed()	function was raised.

       [Request	text starts] In	the test of cfsetospeed() with
       speed B0, the test is performed on the controlling terminal
       rather than the other side of the loopback in order to
       simulate	what a normal application would	do.  The test
       expects this to cause a SIGHUP, but on some systems this
       only occurs when	a modem	disconnect is detected,	not when
       one is generated, so the	test relies on "reflection" of the
       modem disconnect	by the loopback	connection on such systems,
       and if this does	not happen the test fails.

       X/Open believes POSIX says that SIGHUP is generated when
       disconnected is detected	and not	before.	 [text ends]

(Josey-X/Open)

WG15 response for ISO/IEC 9945-1:1990 (IEEE Std 1003.1-1990)
--------------------------------------------------

Modem disconnect is a function that is initiated when the signal
that indicates continuity of the serial communications link is
interrupted, either because the asynchronous serial communications
port at the opposite end of a serial communications link ceases to
maintain the signal or because the integrity of the communications
link is lost for some other reason.

When the asynchronous serial communications port associated with
a controlling terminal detects that the connection has been lost
it causes the behavior associated with modem disconnect to
occur, including the generation of a SIGHUP signal.

The precise physical nature of the indicator of communications
continuity depends on the communications protocol that is in use
and is not specified by ISO/IEC 9945-1:1990.

Setting a terminal's output speed terminal to B0 causes the
associated asynchronous serial communications port to interrupt
its continuity signal ("the modem control lines shall no longer
be asserted": page 144, lines 624-625).  If the local terminal
is the controlling terminal for a session, a SIGHUP must be
generated for the controlling process if and when the
asynchronous serial communications port at the other end of the
connection responds by interrupting its own continuity signal.

It is unspecified whether a modem disconnect is detected
immediately when the output baud rate of the local terminal is
set to B0.  Since this is unspecified, it is conforming (but not
required) for the local asynchronous serial communications port
to perform a complete communications disconnect when its speed
is changed to B0 without monitoring the response from the remote
port.  In this case the modem disconnect would be performed
immediately, and if the local port were a controlling terminal
the SIGHUP signal would be generated immediately for the
controlling process.


Rationale for Interpretation:
-----------------------------

Modem control is provided to allow applications to make a clean
break when a remote device hangs up.  Modem disconnect behavior,
including the generation of a SIGHUP signal, is intended to
allow a shell to log out a user who is no longer connected.
This frees the terminal port to accept a new connection and
closes the security risk of leaving a live login connected to a
communications port.

These purposes depend on the modem disconnect being initiated as
soon as the hardware detects that the connection has been lost.


A test suite should not depend on unspecified behavior.
Therefore, it should test modem disconnect by causing the local
terminal to be the controlling terminal for a session, and
having the remote terminal set its output baud rate to B0.  A
modem disconnect by the remote terminal must be detected
immediately at the local terminal, and SIGHUP must be generated
for the controlling process for which the local terminal is the
controlling terminal.  Note also that the input baud rate must
be set to 0 or to B0 when this is done, in case the
implementation considers it an error to attempt to set input and
output baud rates to different values.  See ISO/IEC
13210:1994, subclause 7.2.1.2.2, assertion 10.


Suggested Change to 9945-1:
----------------------------

Add a definition of the term "modem disconnect", or refer to
another standard for a definition.
 _____________________________________________________________________________