use of SGTTY.H and stuff involving IOCTLs

David B. Anderson davea at quasar.wpd.sgi.com
Thu Dec 21 12:19:15 AEST 1989


In article <8912200949.aa18764 at VMB.BRL.MIL> moss at BRL.MIL ("Gary S. Moss", VLD/VMB) writes:
>Dave Ciemiewicz has got the right idea, but based on some of my code that
>seems to work I would make some changes.  I already sent some code to Thomas,
>but for the benefit of other readers, take this for what its worth:
>< 	tty_new.c_cc[VMIN] = 1;		/* MIN characters */
>< 	tty_new.c_cc[VTIME] = 1;	/* TIME in tenths of seconds */
>I set the VTIME field to 0, not sure if it matters, though termio(7)
>on my 4D says to set them both to one to simulate BSD RAW mode.

>From the post-release-3.2 termio man page:  (see also POSIX 1003.1 7.1.1.7)

If MIN and TIME are both greater than 0:

In this case, TIME serves as an inter-character timer activated after the
first character is received, and reset upon receipt of each character.  MIN
and TIME interact as follows:

As soon as one character is received the inter-character timer is started.

If MIN characters are received before the inter-character timer expires the
read is satisfied.

If the timer expires before MIN characters are received the characters
received to that point are returned to the user.

A read(2) operation will sleep until the MIN and TIME mechanisms are
activated by the receipt of the first character; thus, at least one
character must be returned.

---------------------
If MIN > 0, TIME = 0:

In this case, because TIME = 0, the timer plays no role and only MIN is
significant.  A read operation is not satisfied until MIN characters are
received.

---------------------
If MIN = 0, TIME > 0:

In this case, because MIN = 0, TIME no longer serves as an inter-character
timer, but now serves as a read timer that is activated as soon as the read
operation is processed (in canon).  A read operation is satisfied as soon
as a single character is received or the timer expires, in which case the
read operation will not return any characters.

---------------------
If MIN = 0, TIME = 0:

In this case, return is immediate.  If characters are present, they will be
returned to the user.

Regards,
[ David B. Anderson  Silicon Graphics  (415)335-1548  davea at sgi.com ]



More information about the Comp.sys.sgi mailing list