| Summary: | libc_r does not honor socket timeouts | ||
|---|---|---|---|
| Product: | Base System | Reporter: | jml <jml> |
| Component: | kern | Assignee: | freebsd-threads (Nobody) <threads> |
| Status: | Closed FIXED | ||
| Severity: | Affects Only Me | ||
| Priority: | Normal | ||
| Version: | 4.1-RELEASE | ||
| Hardware: | Any | ||
| OS: | Any | ||
Responsible Changed From-To: freebsd-bugs->jasone Over to maintainer. Responsible Changed From-To: jasone->freebsd-bugs Responsible Changed From-To: freebsd-bugs->freebsd-threads Assign to threads mailing list State Changed From-To: open->closed Superseded by threads/24472. |
read(), write(), et al. in libc_r do not honor socket timeouts set via setsockopt(sd, SOL_SOCKET, SO_{SND,RCV}TIMEO, ...). Timeout is always set to NULL and the read loops consume EAGAIN. Fix: In read/write/etc. implementation, do a S_ISSOCK() on the descriptor, and if true, get a proper timeout value using _thread_sys_getsockopt() instead of assuming NULL. When the timeout expires, return EAGAIN if a proper timeout was used. How-To-Repeat: s = socket(...); setsockopt(s, SOL_SOCKET, SO_RCVTIMEO, (void*) &timeout, sizeof(timeout)); connect(s, ...); read(s, buf, nbytes); <-- blocks and never returns EAGAIN