17c478bd9Sstevel@tonic-gate #include "port_before.h"
27c478bd9Sstevel@tonic-gate 
37c478bd9Sstevel@tonic-gate #include <sys/types.h>
47c478bd9Sstevel@tonic-gate #include <sys/uio.h>
57c478bd9Sstevel@tonic-gate #include <sys/stat.h>
67c478bd9Sstevel@tonic-gate #include <sys/socket.h>
77c478bd9Sstevel@tonic-gate 
87c478bd9Sstevel@tonic-gate #include "port_after.h"
97c478bd9Sstevel@tonic-gate 
107c478bd9Sstevel@tonic-gate #ifndef NEED_READV
117c478bd9Sstevel@tonic-gate int __bindcompat_readv;
127c478bd9Sstevel@tonic-gate #else
137c478bd9Sstevel@tonic-gate 
147c478bd9Sstevel@tonic-gate int
__readv(fd,vp,vpcount)157c478bd9Sstevel@tonic-gate __readv(fd, vp, vpcount)
167c478bd9Sstevel@tonic-gate 	int fd;
177c478bd9Sstevel@tonic-gate 	const struct iovec *vp;
187c478bd9Sstevel@tonic-gate 	int vpcount;
197c478bd9Sstevel@tonic-gate {
207c478bd9Sstevel@tonic-gate 	int count = 0;
217c478bd9Sstevel@tonic-gate 
227c478bd9Sstevel@tonic-gate 	while (vpcount-- > 0) {
237c478bd9Sstevel@tonic-gate 		int bytes = read(fd, vp->iov_base, vp->iov_len);
247c478bd9Sstevel@tonic-gate 
257c478bd9Sstevel@tonic-gate 		if (bytes < 0)
267c478bd9Sstevel@tonic-gate 			return (-1);
277c478bd9Sstevel@tonic-gate 		count += bytes;
287c478bd9Sstevel@tonic-gate 		if (bytes != vp->iov_len)
297c478bd9Sstevel@tonic-gate 			break;
307c478bd9Sstevel@tonic-gate 		vp++;
317c478bd9Sstevel@tonic-gate 	}
327c478bd9Sstevel@tonic-gate 	return (count);
337c478bd9Sstevel@tonic-gate }
347c478bd9Sstevel@tonic-gate #endif /* NEED_READV */
35*9525b14bSRao Shoaib /*! \file */
36