*nix Documentation Project
·  Home
 +   man pages
·  Linux HOWTOs
·  FreeBSD Tips
·  *niX Forums

  man pages->Linux man pages -> readv (2)              
Title
Content
Arch
Section
 

READV(2)

Contents


NAME    [Toc]    [Back]

       readv, writev - read or write a vector

SYNOPSIS    [Toc]    [Back]

       #include <sys/uio.h>

       int readv(int fd, const struct iovec * vector, int count);

       int writev(int fd, const struct iovec * vector, int count);

       struct iovec {
	 __ptr_t iov_base; /* Starting address.  */
	 size_t iov_len; /* Length in bytes.  */
       };

DESCRIPTION    [Toc]    [Back]

       readv  reads  data  from file descriptor fd, and puts the result in the
       buffers described by vector. The number	of  buffers  is  specified  by
       count.  The  buffers  are filled in the order specified.  Operates just
       like read except that data is put in vector  instead  of  a  contiguous
       buffer.

       writev  writes  data  to  file  descriptor  fd,	and  from  the buffers
       described by vector. The number of buffers is specified by  count.  The
       buffers	are  used  in  the  order specified.  Operates just like write
       except that data is taken from vector instead of a contiguous buffer.

RETURN VALUE    [Toc]    [Back]

       On success readv returns the number of bytes read.  On  success	writev
       returns	the  number  of  bytes written.  On error, -1 is returned, and
       errno is set appropriately.

ERRORS    [Toc]    [Back]

       EINVAL An invalid argument was  given.  For  instance  count  might  be
	      greater  than  MAX_IOVEC, or zero.  fd could also be attached to
	      an object  which	is  unsuitable	for  reading  (for  readv)  or
	      writing (for writev).

       EFAULT "Segmentation fault." Most likely vector or some of the iov_base
	      pointers points to memory that is not properly allocated.

       EBADF  The file descriptor fd is not valid.

       EINTR  The call was  interrupted  by  a	signal	before	any  data  was
	      read/written.

       EAGAIN Non-blocking  I/O has been selected using O_NONBLOCK and no data
	      was immediately available for reading.  (Or the file  descriptor
	      fd is for an object that is locked.)

       EISDIR fd refers to a directory.

       EOPNOTSUP    [Toc]    [Back]
	      fd  refers  to  a  socket  or device that does not support reading/writing.


       ENOMEM Insufficient kernel memory was available.

       Other errors may occur, depending on the object connected to fd.

CONFORMING TO    [Toc]    [Back]

       4.4BSD (the readv and writev functions  first  appeared	in  BSD  4.2),
       Unix98.	 Linux	libc5  uses size_t as the type of the count parameter,
       which is logical but non-standard.

SEE ALSO    [Toc]    [Back]

      
      
       read(2), write(2), fprintf(3), fscanf(3)



Linux 2.2.0-pre8		  1999-01-20			      READV(2)
[ Back ]
 Similar pages
Name OS Title
AFreadmisc IRIX read from / write to / move logical read/write pointer for data in a miscellaneous chunk in an audio file
tis_write_unlock Tru64 Unlocks the specified read-write lock that was acquired for write access
tis_read_unlock Tru64 Unlocks a read-write lock that was acquired for read access
pthread_rwlock_wrlock Tru64 Acquires a read-write lock for write access
tis_write_lock Tru64 Acquires the specified read-write lock for write access
tis_read_lock Tru64 Acquires a read-write lock for read access
pthread_rwlock_rdlock Tru64 Acquires a read-write lock for read access
tis_read_trylock Tru64 Attempts to acquire a read-write lock for read access and does not wait if the lock cannot be immedi...
VOP_RDWR FreeBSD read or write a file
VOP_READ FreeBSD read or write a file
Copyright © 2004-2005 DeniX Solutions SRL
newsletter delivery service