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 4 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?

-- 
Tijl Coosemans
#include <fcntl.h>
#include <stdio.h>
#include <sys/types.h>
#include <termios.h>
#include <unistd.h>

int main(void) {
        int fd, len;
        struct termios termset;
        uint8_t data[4];

        fd = open("/dev/cuaa0", O_RDONLY);

        tcgetattr(fd, &termset);
//      cfmakeraw(&termset);
//      cfsetspeed(&termset, B9600);
        termset.c_cc[VMIN] = 0;
        termset.c_cc[VTIME] = 20;
        tcsetattr(fd, TCSANOW, &termset);

        len = read(fd, (void *) data, 4);
        printf("%d\n", len);

        close(fd);
        return 0;
}
_______________________________________________
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "[EMAIL PROTECTED]"

Reply via email to