Import bind 9.5.2 vendor sources.
[dragonfly.git] / contrib / bind-9.5.2 / lib / bind / bsd / readv.c
blob5fa691a92f22b36a9931b93fe98de2d51a388cf1
1 #ifndef LINT
2 static const char rcsid[] = "$Id: readv.c,v 1.2 2005/04/27 04:56:11 sra Exp $";
3 #endif
5 #include "port_before.h"
7 #include <sys/types.h>
8 #include <sys/uio.h>
9 #include <sys/stat.h>
10 #include <sys/socket.h>
12 #include "port_after.h"
14 #ifndef NEED_READV
15 int __bindcompat_readv;
16 #else
18 int
19 __readv(fd, vp, vpcount)
20 int fd;
21 const struct iovec *vp;
22 int vpcount;
24 int count = 0;
26 while (vpcount-- > 0) {
27 int bytes = read(fd, vp->iov_base, vp->iov_len);
29 if (bytes < 0)
30 return (-1);
31 count += bytes;
32 if (bytes != vp->iov_len)
33 break;
34 vp++;
36 return (count);
38 #endif /* NEED_READV */
39 /*! \file */