| 60 | } Child; |
| 61 | |
| 62 | static bool transfer(int fd, char *value, bool writing) { |
| 63 | struct pollfd pollfd = {.fd = fd, .events = writing ? POLLOUT : POLLIN}; |
| 64 | int ready; |
| 65 | do { |
| 66 | ready = poll(&pollfd, 1, 60000); |
| 67 | } while (ready < 0 && errno == EINTR); |
| 68 | if (ready <= 0) |
| 69 | return false; |
| 70 | ssize_t count; |
| 71 | do { |
| 72 | count = writing ? write(fd, value, 1) : read(fd, value, 1); |
| 73 | } while (count < 0 && errno == EINTR); |
| 74 | return count == 1; |
| 75 | } |
| 76 | |
| 77 | static bool send_byte(int fd, char value) { |
| 78 | return transfer(fd, &value, true); |
no test coverage detected