Add BIND 9.2.4rc7.
[dragonfly.git] / contrib / bind-9.2.4rc7 / lib / bind / bsd / readv.c
blobccfcb5af332a3fbb0e8347b865ba45cdc0b67e70
1 #ifndef LINT
2 static const char rcsid[] = "$Id: readv.c,v 1.1 2001/03/29 06:30:35 marka 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 */