summaryrefslogtreecommitdiff
path: root/src/file.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/file.cc')
-rw-r--r--src/file.cc10
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;