| 189 | } |
| 190 | |
| 191 | static int do_poll(int fd, int events) |
| 192 | { |
| 193 | struct pollfd pfd; |
| 194 | int ret; |
| 195 | |
| 196 | pfd.events = events; |
| 197 | pfd.revents = 0; |
| 198 | pfd.fd = fd; |
| 199 | |
| 200 | ret = poll(&pfd, 1, -1); |
| 201 | if (ret == -1) |
| 202 | t_error(1, errno, "poll"); |
| 203 | |
| 204 | return ret && (pfd.revents & events); |
| 205 | } |
| 206 | |
| 207 | /* Flush all outstanding bytes for the tcp receive queue */ |
| 208 | static int do_flush_tcp(struct thread_data *td, int fd) |