termios problem or feature?

Mike Siers mikes at poliac.com
Wed Aug 15 19:35:26 UTC 2001

Hi Joel,
Attached are my proposed changes to termios.  Please review
and let me know if you think they can be merged into the
source tree.

Mike Siers

-----Original Message-----
From: Mike Siers [mailto:mikes at poliac.com]
Sent: Tuesday, August 14, 2001 2:03 PM
To: joel.sherrill at OARcorp.com
Cc: rtems-users at oarcorp.com
Subject: RE: termios problem or feature?

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.

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:


> 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

-------------- next part --------------
A non-text attachment was scrubbed...
Name: termios.diff
Type: application/octet-stream
Size: 1137 bytes
Desc: not available
URL: <http://lists.rtems.org/pipermail/users/attachments/20010815/d5dc098e/attachment-0001.obj>

More information about the users mailing list