commit - 05fd31691c7f3c33867fb0acd5008fa2f555b461
commit + e0cc3e2b4793098f30708f83c18cf466a59aa9d3
blob - 4f41b7577755f2ed3b7dcbb4e217ed32d08d0bde
blob + 7f3896a299ca2c51b65a3d3e6c5fafe1452500d2
--- lib/got_lib_poll.h
+++ lib/got_lib_poll.h
*/
const struct got_error *got_poll_fd(int fd, int events, int timeout);
+const struct got_error *got_poll_read_full_timeout(int, size_t *, void *,
+ size_t, size_t, int);
const struct got_error *got_poll_read_full(int, size_t *, void *, size_t,
size_t);
const struct got_error *got_poll_write_full(int, const void *, off_t);
blob - 32efcd7f1a512fe6f1444aaba4ff7e8aa6d051b1
blob + f98dea71e976cc360e1d5c6bc803c2c26f6ffff3
--- lib/pollfd.c
+++ lib/pollfd.c
}
const struct got_error *
-got_poll_read_full(int fd, size_t *len, void *buf, size_t bufsize,
- size_t minbytes)
+got_poll_read_full_timeout(int fd, size_t *len, void *buf, size_t bufsize,
+ size_t minbytes, int timeout)
{
const struct got_error *err = NULL;
size_t have = 0;
return got_error(GOT_ERR_NO_SPACE);
while (have < minbytes) {
- err = got_poll_fd(fd, POLLIN, INFTIM);
+ err = got_poll_fd(fd, POLLIN, timeout);
if (err)
return err;
r = read(fd, buf + have, bufsize - have);
}
const struct got_error *
+got_poll_read_full(int fd, size_t *len, void *buf, size_t bufsize,
+ size_t minbytes)
+{
+ return got_poll_read_full_timeout(fd, len, buf, bufsize,
+ minbytes, INFTIM);
+}
+
+const struct got_error *
got_poll_write_full(int fd, const void *buf, off_t len)
{
const struct got_error *err = NULL;