diff options
Diffstat (limited to 'src/file.cc')
| -rw-r--r-- | src/file.cc | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/file.cc b/src/file.cc index 1455624b..64061d09 100644 --- a/src/file.cc +++ b/src/file.cc @@ -143,6 +143,16 @@ bool fd_readable(int fd) return select(fd+1, &rfds, nullptr, nullptr, &tv) == 1; } +bool fd_writable(int fd) +{ + fd_set rfds; + FD_ZERO(&rfds); + FD_SET(fd, &rfds); + + timeval tv{0,0}; + return select(fd+1, nullptr, &rfds, nullptr, &tv) == 1; +} + String read_fd(int fd, bool text) { String content; |
