home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 15 / 15.iso / s / s053 / 8.ddi / usr / include / sys / asyncio.h < prev    next >
Encoding:
C/C++ Source or Header  |  1990-12-08  |  6.3 KB  |  195 lines

  1. /*    Copyright (c) 1990 UNIX System Laboratories, Inc.    */
  2. /*    Copyright (c) 1984, 1986, 1987, 1988, 1989, 1990 AT&T    */
  3. /*      All Rights Reserved      */
  4.  
  5. /*    THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF         */
  6. /*    UNIX System Laboratories, Inc.                         */
  7. /*    The copyright notice above does not evidence any       */
  8. /*    actual or intended publication of such source code.    */
  9.  
  10. #ifndef _SYS_ASYNCIO_H
  11. #define _SYS_ASYNCIO_H
  12.  
  13. #ident    "@(#)/usr/include/sys/asyncio.h.sl 1.1 4.0 12/08/90 18085 AT&T-USL"
  14. /*
  15. **        File Contents
  16. **        =============
  17. **
  18. **    This file contains data which must be included in an 
  19. **    application program using the Async system call facility.
  20. */
  21.  
  22. /*
  23. **    Structure user used to pass async I/O request parameters to asyncio()
  24. */
  25.  
  26. typedef    struct aioop {
  27.     ushort        aio_cmd;    /* one of the command codes defined below */
  28.     ushort        aio_flags;    /* the flags defined below           */
  29.     int        aio_error;    /* error code; the field is used to save  */
  30.                     /* error encountered in processing the    */
  31.                     /* asyncio() function. It is not for      */
  32.                     /* any error found in the actual I/O      */
  33.                     /* run asynchronously because the          */
  34.                     /* aioop struct may be reused after       */
  35.                     /* returning from asyncio() function.      */
  36.     char        *aio_bufp;    /* ptr to the buffer for the operation      */
  37.     uint        aio_bufs;    /* size of buffer pointed to by aio_bufp  */
  38.     int        aio_fd;        /* file descriptor on which to do I/O      */
  39.     off_t        aio_offset;    /* relative offset in bytes               */
  40.     pcparms_t    aio_pri;    /* I/O priority                */
  41.     ecb_t        aio_ecb;    /* ecb for event notification            */
  42. } aioop_t;
  43.  
  44. /*    The possible values for the aio_cmd field     */
  45.  
  46. #define    AIOC_READ    0x01        /* read from the file descriptor aio_fd   */
  47.  
  48. #define    AIOC_WRITE    0x02        /* write to the file descriptor aio_fd    */
  49.  
  50. /*    The flags in the aio_flags and a_flags field are defined as follows.      */
  51.  
  52. #define AIOF_SEEK_SET    0x01        /* This flag has the same meaning as an   */
  53.                     /* lseek with whence set to 0. An explicit*/
  54.                     /* seek will be done before an I/O request*/
  55.                     /* is queued. This flag has no effect on  */
  56.                     /* a non-I/O async call.          */
  57.  
  58. #define AIOF_SEEK_CUR    0x02        /* This flag has the same meaning as an   */
  59.                     /* lseek with whence set to 1. An explicit*/
  60.                     /* seek will be done before an I/O request*/
  61.                     /* is queued. This flag has no effect on  */
  62.                     /* a non-I/O async call.          */
  63.  
  64. #define AIOF_SEEK_FLAGS    (AIOF_SEEK_SET | AIOF_SEEK_CUR) 
  65.  
  66. #define    AIOF_NONBLOCK    0x04        /* This flag has the same meaning as the  */
  67.                     /* O_NONBLOCK flag for the file descriptor*/
  68.                     /* ar_ofilep. If set, it overrides the    */
  69.                     /* O_NONBLOCK setting of ar_ofilep and       */  
  70.                     /* will be used for this I/O. Note, the   */
  71.                     /* effect of this flag is local to this   */
  72.                     /* request only and does not apply to     */
  73.                     /* any I/Os on the same file descriptor.  */
  74.  
  75. #define    AIOF_SCHEDPRI    0x08        /* When set, indicate the request comes      */
  76.                     /* with a priority parameter to override  */
  77.                     /* default FIFO operation. The request      */
  78.                     /* should be processed with the specified */
  79.                     /* priority                  */
  80.  
  81. #define AIOF_UFLAGS    (AIOF_SEEK_SET|AIOF_SEEK_CUR|AIOF_NONBLOCK|AIOF_SCHEDPRI) 
  82.                     /* User defined flags              */
  83.  
  84. #define    AIOF_ACCEPTED    0x10        /* When set, indicate the request has       */
  85.                     /* been accepted and will be processed by */
  86.                     /* the server.                  */
  87.  
  88. #define    AIOF_ERROR    0x20        /* When set, indicate the request has       */
  89.                     /* been rejected during the validity       */
  90.                     /* check. The actual error code will be   */
  91.                     /* set in rt_error.              */
  92.  
  93. #define AIOF_PROCESS    (AIOF_ACCEPTED | AIOF_ERROR)
  94.  
  95.                     /* If neither of AIOF_ACCEPTED nor AIOF_ERROR
  96.                     ** is set, the request was not processed at all
  97.                     ** because some system resources are not avail.
  98.                     */
  99. /*
  100. **    The following structure describes the data
  101. **    returned for an ET_ASYNC event.
  102. */
  103.    
  104. typedef struct evd_async {
  105.      long        ea_rval;    /* # of bytes read/write*/
  106.      int        ea_errno;    /* error code        */
  107.      off_t        ea_offset;    /* initial file offest    */
  108. } evd_async_t;
  109.  
  110. /*
  111. **        The Async System Call Facility Version Number
  112. **        =============================================
  113. **
  114. **    In order to be able to make changes to the Async Facility in the
  115. **    future, we define a version number which is automatically passed
  116. **    through from the application program to the libraries and then
  117. **    to the kernel.  If we want to change the Async interface, we
  118. **    just increase the version number so the library routines
  119. **    and the kernel can tell the difference.  This works with either
  120. **    private or shared libraries.
  121. **    The current version number is as follows.
  122. **
  123. */
  124.  
  125. #define    ASYNC_VERSION    2    /* The current version number.    */
  126.  
  127. /*    The following are previously used version numbers which are
  128. **    still supported.
  129. */
  130.  
  131. /*    None yet.
  132. */
  133.  
  134. /*    The following are previously used version numbers which are no
  135. **    longer supported.
  136. */
  137.  
  138. #define    ASYNC_VER_PROTO    1    /* Version number used in the    */
  139.                 /* first prototype of Async I/O.*/
  140. /*
  141. **        The Async Facility Interfaces
  142. **        =============================
  143. **
  144. **    When a user program calls one of the functions described on one of
  145. **    the async facility manual pages, it is actually invoking one of the
  146. **    following macros.  The purpose of the macros is to pass the
  147. **    version number to the library routines.  The library routines
  148. **    will, in turn, pass the version number down to the kernel.  This
  149. **    will allow us to make changes to the Async facility in the future 
  150. **    and still support old *.o and a.out files.
  151. **
  152. */
  153.  
  154. #define    aread(fildes, bufp, bufs, ecbp)    \
  155.     __aread(ASYNC_VERSION, fildes, bufp, bufs, ecbp)
  156.  
  157. #define    awrite(fildes, bufp, bufs, ecbp)    \
  158.     __awrite(ASYNC_VERSION, fildes, bufp, bufs, ecbp)
  159.  
  160. #define    asyncio(asyncp, asyncs)    \
  161.     __asyncio(ASYNC_VERSION, asyncp, asyncs)
  162.  
  163. #define    acancel(eidp, eids) \
  164.     __acancel(ASYNC_VERSION, eidp, eids)
  165.  
  166.  
  167. /*
  168. **        Function Prototypes
  169. **        ===================
  170. **
  171. **    The following are prototypes for the library functions which
  172. **    users call (indirectly using the macros defined above).
  173. **
  174. */
  175.  
  176. #if defined(__STDC__)
  177.  
  178. int    __aread(const int, const int, char *, const uint, \
  179.         ecb_t *);
  180. int    __awrite(const int, const int, char *, const uint, \
  181.         ecb_t *);
  182. int    __asyncio(const int, aioop_t *, const int);
  183. int    __acancel(const int, const long *const, const int);
  184.  
  185. #else
  186.  
  187. int    __aread();
  188. int    __awrite();
  189. int    __asyncio();
  190. int    __acancel();
  191.  
  192. #endif
  193.  
  194. #endif    /* _SYS_ASYNCIO_H */
  195.