| 40 | |
| 41 | static std::string GET_ERROR() { return {strerror(errno)}; } |
| 42 | static void debug_poll_fd(const struct pollfd& poll_fd) { |
| 43 | std::stringstream ss; |
| 44 | ss << "Poll:{"; |
| 45 | if (poll_fd.events & POLLERR) { |
| 46 | ss << "POLLERR,"; |
| 47 | } |
| 48 | if (poll_fd.events & POLLHUP) { |
| 49 | ss << "POLLHUP,"; |
| 50 | } |
| 51 | if (poll_fd.events & POLLNVAL) { |
| 52 | ss << "POLLNVAL,"; |
| 53 | } |
| 54 | ss << "}\n"; |
| 55 | std::cout << ss.str(); |
| 56 | } |
| 57 | |
| 58 | // https://stackoverflow.com/questions/12340695/how-to-check-if-a-given-file-descriptor-stored-in-a-variable-is-still-valid |
| 59 | static bool is_serial_fd_still_connected(const int fd) { |
nothing calls this directly
no outgoing calls
no test coverage detected