unixdev.net


Switch to SpeakEasy.net DSL

The Modular Manual Browser

Home Page
Manual: (SunOS-4.1.3)
Page:
Section:
Apropos / Subsearch:
optional field

AIOREAD(3)                 Library Functions Manual                 AIOREAD(3)



NAME
       aioread, aiowrite - asynchronous I/O operations

SYNOPSIS
       #include <&lt;sys/asynch.h>&gt;

       int aioread(fd, bufp, bufs, offset, whence, resultp)
       int fd;
       char *bufp;
       int bufs;
       int offset;
       int whence;
       aio_result_t *resultp;

       int aiowrite(fd, bufp, bufs, offset, whence, resultp)
       int fd;
       char *bufp;
       int bufs;
       int offset;
       int whence;
       aio_result_t *resultp;

DESCRIPTION
       aioread()  initiates  one  asynchronous read(2V) and returns control to
       the calling program.  The  read()  continues  concurrently  with  other
       activity of the process.  An attempt is made to read bufs bytes of data
       from the object referenced by the descriptor fd into the buffer pointed
       to by bufp.

       aiowrite()  initiates one asynchronous write(2V) and returns control to
       the calling program.  The write()  continues  concurrently  with  other
       activity  of  the  process.   An attempt is made to write bufs bytes of
       data from the buffer pointed to by bufp to the object referenced by the
       descriptor fd.

       On objects capable of seeking, the I/O operation starts at the position
       specified by whence and offset.  These parameters have the same meaning
       as  the corresponding parameters to the lseek(2V) function.  On objects
       not capable of seeking the I/O operation always start from the  current
       position  and  the  parameters whence and offset are ignored.  The seek
       pointer for objects capable of seeking is not updated by  aioread()  or
       aiowrite().   Sequential  asynchronous operations on these devices must
       be managed by the application using the whence and offset parameters.

       The result of the asynchronous operation is  stored  in  the  structure
       pointed to by resultp:
              int aio_return;          /* return value of read() or write() */
              int aio_errno;      /* value of errno for read() or write() */

       Upon  completion of the operation both aio_return and aio_errno are set
       to reflect the result of the operation.  AIO_INPROGRESS is not a  value
       used  by  the system so the client may detect a change in state by ini-
       tializing aio_return to this value.

       Notification of the completion of an asynchronous I/O operation may  be
       obtained  synchronously  through  the  aiowait(3)  function,  or  asyn-
       chronously through the signal mechanism.  Asynchronous notification  is
       accomplished  by  generating  the  SIGIO  signal.  The delivery of this
       instance of the SIGIO signal is reliable in  that  a  signal  delivered
       while the handler is executing is not lost.  If the client ensures that
       aiowait(3) returns nothing (using a polling timeout)  before  returning
       from  the  signal  handler, no asynchronous I/O notifications are lost.
       The aiowait(3) function is the only  way  to  dequeue  an  asynchronous
       notification.   Note:  SIGIO  may have several meanings simultaneously:
       for example, that a descriptor  generated  SIGIO  and  an  asynchronous
       operation completed.  Further, issuing an asynchronous request success-
       fully guarantees that space exists to queue  the  completion  notifica-
       tion.

       close(2V),  exit(2V)  and execve(2V) will block until all pending asyn-
       chronous I/O operations can be cancelled by the system.

       It is an error to use the same result buffer in more than one outstand-
       ing  request.  These structures may only be reused after the system has
       completed the operation.

RETURN VALUES
       aioread() and aiowrite() return:

       0      on success.

       -1     on failure and set errno to indicate the error.

ERRORS
       EBADF          fd is not a valid file descriptor open for reading.

       EFAULT         At least one of bufp or resultp points to an address out
                      side the address space of the requesting process.

       EINVAL         The parameter resultp is currently being used by an out-
                      standing asynchronous request.

       EPROCLIM       The number of asynchronous requests that the system  can
                      handle at any one time has been exceeded

SEE ALSO
       close(2V),   execve(2V),   exit(2V),   lseek(2V),  open(2V),  read(2V),
       sigvec(2), write(2V), aiocancel(3), aiowait(3)



                                21 January 1990                     AIOREAD(3)