termios problem or feature?

Mike Siers mikes at poliac.com
Tue Aug 14 19:02:44 UTC 2001


Hi Joel,
The General Terminal Interface document that you sent me states that
if VMIN = 0 and VTIME = 0, then read() should return the minimum of
two values:
  a) number of bytes available
  b) number of bytes requested (I assume from the read call)

The current implementation of the fillBufferQueue() in termios.c is
always return 1 character with these setting values.  I know the
termios buffer has more than one character available and my read()
call is requesting 1024 bytes.

Also, I have written a small test case on Unix using the same termios
settings.  This test program always return more than 1 character per
read() call.

Any thoughts?  Has anyone else noticed this problem?  I have a simple
patch that fixes this problem but I want to make sure it is the
correct solution.

Thanks
Mike Siers


-----Original Message-----
From: joel at poliac.com [mailto:joel at poliac.com]On Behalf Of Joel Sherrill
Sent: Monday, August 13, 2001 3:27 PM
To: Mike Siers
Cc: rtems-users at oarcorp.com
Subject: Re: termios problem or feature?


> Mike Siers wrote:
>
> Hi,
> I am using the latest RTEMS snapshot with the i386/pc586 BSP.
> I have a simple program that is just opening up a serial port and
> writing out a string.  The application on the other end of the serial
> port will write out a block of information to the serial port when it
> receives this initial string.
>
> I have noticed that the read() function call will only return one
> character at a time even though I know the termios buffer has
> more information than that.
>
> Basically, the function fillBufferQueue() in libc/termios.c returns
> as soon as it has copied VMIN characters.  Should it instead
> copy all available characters that will fit into the given buffer?
> Is this a bug or is termios behaving correctly?

I think this is a feature. :)

You might be better served setting VTIM and having a higher VMIN.
See if this link explains your behavior:

http://www.opengroup.org/onlinepubs/7908799/xbd/termios.html#tag_008_001_006

> I have a simple patch to allow it return more than VMIN characters
> but I want to ensure this is the correct behavior.
>
> Thanks
> Mike Siers
>
>

--
Joel Sherrill, Ph.D.             Director of Research & Development
joel at OARcorp.com                 On-Line Applications Research
Ask me about RTEMS: a free RTOS  Huntsville AL 35805
   Support Available             (256) 722-9985





More information about the users mailing list