Linux 异步IO

编译时链接实时库,使用选项 -lrt

aiocbstruct

aiocb是”asynchronous I/O control block”的缩写。

  1. struct aiocb {
  2. /* The order of these fields is implementation-dependent */
  3. int aio_fildes; /* File descriptor */
  4. off_t aio_offset; /* File offset */
  5. volatile void *aio_buf; /* Location of buffer */
  6. size_t aio_nbytes; /* Length of transfer */
  7. int aio_reqprio; /* Request priority */
  8. struct sigevent aio_sigevent; /* Notification method */
  9. int aio_lio_opcode; /* Operation to be performed;
  10. lio_listio() only */
  11. /* Various implementation-internal fields not shown */
  12. };
  13. /* aio_lio_opcode: */
  14. enum { LIO_READ, LIO_WRITE, LIO_NOP };