4-stable termios diff behaviour lc/lc_r

Daniel Eischen deischen at freebsd.org
Wed Sep 1 15:12:52 PDT 2004

On Tue, 31 Aug 2004, Julian Elischer wrote:
> this should have been sent to -threads..
> --------------------------------------------
>  >Hi list,
>  >>
>  >> I think I've found a possible bug in 4-stable, though I'm not that
>  >> kind of an expert so I'll leave that decision up to you.
>  >>
>  >> Attached is a little test program that opens /dev/cuaa0 and tries to
>  >> read a couple bytes.
>  >>
>  >> When compiled using "gcc vtime.c -o vtime" there's no problem. For
>  >> example, when you run vtime without anything attached to cuaa0,
>  >> it'll wait about 2 seconds and timeout, since VMIN=0 and VTIME=20.
>  >>
>  >> When compiled using "gcc -pthread vtime.c -o vtime" however, the
>  >> read function returns immediately, which as far as I can understand,
>  >> is not what it's supposed to do.
>  >>
>  >> Does anyone know if this intended or not, or how I can get the right
>  >> behaviour in a threaded program?
> I've done some more testing. It appears that when linked with lc_r,
> VTIME is completely ignored.

Yes, and it will always be completely ignored.  If you want to
use libc_r on 4.x, you'll have to work around it (use select()
or poll() perhaps).  It is not a problem in 5.x which will be
the next -stable.

Dan Eischen

More information about the freebsd-threads mailing list