Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
iov[1].iov_len = prod;
return 2;
}
-
-/*
- * Drain ring buffer to file referred by file descriptor @fd.
- * If ring buffer is already empty, do nothing and return 0.
- * Else attempt to write complete contents with writev(), and return
- * its value.
- */
-int
-ring_to_file(struct ring *r, int fd)
-{
- struct iovec iov[2];
- int cnt;
- ssize_t res;
-
- cnt = ring_to_iovec(r, iov);
- res = writev(fd, iov, cnt);
- if (res < 0)
- return res;
- ring_discard(r, res);
- return res;
-}
extern int ring_search(struct ring *, char *, int);
extern int ring_from_file(struct ring *, int fd);
extern int ring_to_iovec(struct ring *, struct iovec[]);
-extern int ring_to_file(struct ring *, int fd);
#endif