View Bug Activity | Format For Printing
The vfprintf equivalent of fprintf(4, "load\r") returns 5 instead of -1 on EAGAIN and doesn't retry the operation. The output file was a serial port opened with serial_fd = open("/dev/ttyUSB0", 0_RDWR|O_NOCTTY|O_NONBLOCK); serial_out = fdopen(serial_fd, "w"); serial_in = fdopen(serial_fd, "r"); There is some question as to whether it should retry the operation or return -1 but simply returning no error without retrying is clearly broken behavior. O_NONBLOCK is necessary because the program must be able to read "silence" on the serial port as part of detecting a remote prompt. I.E. to read a prompt of "S>", the program will read "S", ">", EAGAIN, (delay), EAGAIN. It would be better in this case if NONBLOCK didn't affect output at all, of course. The problem came to light when using a program that worked on a 16550 based serial port on a byterunner USB to serial pod which has a driver problem that apparently causes it to stop accepting data as soon as an XOFF is received instead of later when the buffer fills up (which would never happen because the program is designed to never overflow the buffers).
You have to provide a test case.
No reply in 6+ months. Closing.