10Sstevel@tonic-gate #ifndef LINT 2*11038SRao.Shoaib@Sun.COM static const char rcsid[] = "$Id: readv.c,v 1.2 2005/04/27 04:56:11 sra Exp $"; 30Sstevel@tonic-gate #endif 40Sstevel@tonic-gate 50Sstevel@tonic-gate #include "port_before.h" 60Sstevel@tonic-gate 70Sstevel@tonic-gate #include <sys/types.h> 80Sstevel@tonic-gate #include <sys/uio.h> 90Sstevel@tonic-gate #include <sys/stat.h> 100Sstevel@tonic-gate #include <sys/socket.h> 110Sstevel@tonic-gate 120Sstevel@tonic-gate #include "port_after.h" 130Sstevel@tonic-gate 140Sstevel@tonic-gate #ifndef NEED_READV 150Sstevel@tonic-gate int __bindcompat_readv; 160Sstevel@tonic-gate #else 170Sstevel@tonic-gate 180Sstevel@tonic-gate int __readv(fd,vp,vpcount)190Sstevel@tonic-gate__readv(fd, vp, vpcount) 200Sstevel@tonic-gate int fd; 210Sstevel@tonic-gate const struct iovec *vp; 220Sstevel@tonic-gate int vpcount; 230Sstevel@tonic-gate { 240Sstevel@tonic-gate int count = 0; 250Sstevel@tonic-gate 260Sstevel@tonic-gate while (vpcount-- > 0) { 270Sstevel@tonic-gate int bytes = read(fd, vp->iov_base, vp->iov_len); 280Sstevel@tonic-gate 290Sstevel@tonic-gate if (bytes < 0) 300Sstevel@tonic-gate return (-1); 310Sstevel@tonic-gate count += bytes; 320Sstevel@tonic-gate if (bytes != vp->iov_len) 330Sstevel@tonic-gate break; 340Sstevel@tonic-gate vp++; 350Sstevel@tonic-gate } 360Sstevel@tonic-gate return (count); 370Sstevel@tonic-gate } 380Sstevel@tonic-gate #endif /* NEED_READV */ 39*11038SRao.Shoaib@Sun.COM /*! \file */ 40