home *** CD-ROM | disk | FTP | other *** search
/ IRIX Patches 1995 March / SGI IRIX Patches 1995 Mar.iso / 5.3_patches / patchSG0000221 / patchSG0000221.idb / usr / include / aio.h.z / aio.h
Encoding:
C/C++ Source or Header  |  1995-03-10  |  6.2 KB  |  182 lines

  1. /*************************************************************************
  2. *                                                                        *
  3. *               Copyright (C) 1992,1994 Silicon Graphics, Inc.            *
  4. *                                                                        *
  5. *  These coded instructions, statements, and computer programs  contain  *
  6. *  unpublished  proprietary  information of Silicon Graphics, Inc., and  *
  7. *  are protected by Federal copyright law.  They  may  not be disclosed  *
  8. *  to  third  parties  or copied or duplicated in any form, in whole or  *
  9. *  in part, without the prior written consent of Silicon Graphics, Inc.  *
  10. *                                                                        *
  11. **************************************************************************/
  12. #ident  "$Revision: 1.6 $ $Author: doucette $"
  13.  
  14. #ifndef __AIO_H__
  15. #define __AIO_H__
  16.  
  17. #ifdef __cplusplus
  18. extern "C" {
  19. #endif
  20.  
  21. #include <sys/types.h>
  22. #include <sys/signal.h>
  23. #include <sys/timers.h>
  24. #include <sys/fcntl.h>
  25.  
  26. #ifdef  _ABI_SOURCE
  27. /*
  28.  * aio - POSIX 1003.1b-1993
  29.  */
  30.  
  31. typedef struct aiocb {
  32.     int    aio_fildes;        /* file descriptor to perform aio on */
  33.     volatile void *aio_buf;     /* Data buffer */
  34.     size_t    aio_nbytes;    /* number of bytes of data */
  35.     off_t    aio_offset;    /* file offset position */
  36.     int        aio_reqprio;    /* aio priority, (Currently must be 0) */
  37.     sigevent_t    aio_sigevent;    /* notification information */
  38.     int        aio_lio_opcode;    /* opcode for lio_listio() call */
  39.     ulong    aio_reserved[7];/* reserved for internal use */
  40.     ulong    aio_pad[6];
  41. } aiocb_t;
  42.  
  43. /* for aio_cancel() return values */
  44. #define AIO_CANCELED    1    /* cancelled operation */
  45. #define AIO_NOTCANCELED 2    /* some ops not cancelled */
  46. #define AIO_ALLDONE    3    /* all aio has completed */
  47.  
  48. /* for aiocb.aio_lio_opcode */
  49. #define LIO_NOP        0    /* listio request with no data */
  50. #define LIO_READ    1    /* listio read request */
  51. #define LIO_WRITE    2    /* listio write request */
  52.  
  53. /* for lio_listio mode flag */
  54. #define LIO_WAIT    4    /* blocks until lio_listio complete */
  55. #define LIO_NOWAIT    3    /* asynchronous lio_listio call, doesn't block */
  56.  
  57. /* for lio_hold routine */
  58. #define AIO_HOLD_CALLBACK    1
  59. #define AIO_RELEASE_CALLBACK    2
  60. #define AIO_ISHELD_CALLBACK    3
  61.  
  62. #if defined(_SGI_SOURCE)
  63. /* These defines are not for use by applications. */
  64. #define _AIO_SGI_LISTIO_MAX    2048
  65. #define _AIO_SGI_MAX        2048
  66. #define _AIO_SGI_PRIO_DELTA_MAX    0
  67. #endif
  68. #if !defined(_POSIX_SOURCE)
  69. /*
  70.  * This stucture is the optional argument to aio_sgi_init. The defaults
  71.  * that are used if NULL is given as the argument are in parentheses at the
  72.  * end of each comment.
  73.  */
  74. typedef struct aioinit {
  75.     int aio_threads;    /* The number of threads started (5) */
  76.     int aio_locks;    /* Initial number of preallocated locks (3) */
  77.     int aio_num;    /* estimated total simultanious aiobc structs (1000) */
  78.     int aio_usedba;    /* Try to use DBA for raw I/O in lio_listio (0) */
  79.     int aio_debug;    /* turn on debugging (0) */
  80.     int aio_pad[4];        
  81. } aioinit_t;
  82. #endif /* !_POSIX_SOURCE */
  83. #ifndef aio_init
  84. #define aio_init() aio_sgi_init(NULL);
  85. #endif /* aio_init */
  86. extern void aio_sgi_init(aioinit_t *);
  87. extern int aio_read(aiocb_t *);
  88. extern int aio_write(aiocb_t *);
  89. extern int lio_listio(int, aiocb_t * const [], int, sigevent_t *);
  90. extern int aio_cancel(int, aiocb_t *);
  91. extern int aio_error(const aiocb_t *);
  92. extern ssize_t aio_return(aiocb_t *);
  93. extern int aio_suspend(const aiocb_t * const [], int, const timespec_t *);
  94. extern int aio_fsync(int, aiocb_t *);
  95. extern int aio_hold(int);
  96. #if(defined(_SGI_SOURCE) && !defined(_POSIX_SOURCE) && !defined(_XOPEN_SOURCE)) 
  97. typedef struct aiocb64 {
  98.     int    aio_fildes;        /* file descriptor to perform aio on */
  99.     volatile void *aio_buf;     /* Data buffer */
  100.     size_t    aio_nbytes;    /* number of bytes of data */
  101. #if (_MIPS_SZLONG == 32)
  102.     off_t    aio_oldoff;    /* old: file offset position */
  103. #else
  104.     off_t    aio_offset;    /* file offset position */
  105. #endif
  106.     int        aio_reqprio;    /* aio priority, (Currently must be 0) */
  107.     sigevent_t    aio_sigevent;    /* notification information */
  108.     int        aio_lio_opcode;    /* opcode for lio_listio() call */
  109.     ulong    aio_reserved[7];/* reserved for internal use */
  110.     ulong    aio_pad[6];
  111. #if (_MIPS_SZLONG == 32)
  112.     off64_t    aio_offset;    /* file offset position */
  113. #endif
  114. } aiocb64_t;
  115. extern void aio_sgi_init64(aioinit_t *);
  116. extern int aio_read64(aiocb64_t *);
  117. extern int aio_write64(aiocb64_t *);
  118. extern int lio_listio64(int, aiocb64_t * const [], int, sigevent_t *);
  119. extern int aio_cancel64(int, aiocb64_t *);
  120. extern int aio_error64(const aiocb64_t *);
  121. extern ssize_t aio_return64(aiocb64_t *);
  122. extern int aio_suspend64(const aiocb64_t * const [], int, const timespec_t *);
  123. extern int aio_fsync64(int, aiocb64_t *);
  124. #endif
  125.  
  126. #else /* _ABI_SOURCE */
  127. /*
  128.  * aio - POSIX 1003.4 Draft 12
  129.  */
  130.  
  131. typedef struct aiocb {
  132.     /* defined by Posix.4 D12 */
  133.     int    aio_fildes;    /* file descriptor to perform aio on */
  134.     off_t    aio_offset;    /* file offset position */
  135.     volatile void *aio_buf;
  136.     size_t    aio_nbytes;
  137.     int    aio_reqprio;    /* aio priority, larger values lowers pri */
  138.     sigevent_t aio_sigevent;/* signal to be generated on completion */
  139.     int    aio_lio_opcode;    /* opcode for lio_listio() call */
  140.     /* SGI defined */
  141.     size_t    aio_nobytes;    /* return bytes */
  142.     int    aio_whence;    /* for seeking */
  143.     int    aio_errno;    /* return error from this aio op */
  144.     int    aio_ret;    /* returned status */
  145. } aiocb_t;
  146.  
  147.  
  148. /* for aio_cancel() return values */
  149. #define AIO_CANCELED    1    /* cancelled operation */
  150. #define AIO_NOTCANCELED 2    /* some ops not cancelled */
  151. #define AIO_ALLDONE    3    /* all aio has completed */
  152.  
  153. /* for aiocb.aio_lio_opcode */
  154. #define LIO_READ    1
  155. #define LIO_WRITE    2
  156. #define LIO_NOP        3
  157.  
  158. /* for lio_listio mode flag */
  159. #define LIO_WAIT    1
  160. #define LIO_NOWAIT    2
  161.  
  162. #if defined(_SGI_SOURCE)
  163. #define _AIO_LISTIO_MAX        255
  164. #define _AIO_MAX        4
  165. #define _AIO_PRIO_DELTA_MAX    100
  166. #endif
  167.  
  168. extern void aio_init(void);
  169. extern int aio_read(struct aiocb *);
  170. extern int aio_write(struct aiocb *);
  171. extern int lio_listio(int, struct aiocb *[], int, sigevent_t *);
  172. extern int aio_cancel(int, struct aiocb *);
  173. extern int aio_error(struct aiocb *);
  174. extern ssize_t aio_return(struct aiocb *);
  175. extern int aio_suspend(const struct aiocb *[], int, timespec_t *);
  176. extern int aio_fsync(int, struct aiocb *);
  177. #ifdef __cplusplus
  178. }
  179. #endif
  180. #endif /*  _ABI_SOURCE */
  181. #endif /* __AIO_H__ */
  182.