Intel® C++ Compiler Classic Developer Guide and Reference

ID 767249
Date 3/31/2023
Public

A newer version of this document is available. Customers should click here to go to the newest version.

Document Table of Contents

lio_listio

Performs an asynchronous read operation.

Syntax

int lio_listio(int mode, struct aiocb *list[], int nent, struct sigevent *sig);

Arguments

mode

Takes following values declared in <aio.h> file:

  • LIO_WAIT: Use when you want the function to return only after completing I/O operations (synchronous I/O operations)
  • LIO_NOWAIT: Use when you want the function to return as soon as I/O operations are queued (asynchronous I/O requests)

*list[]

Array of the aiocb pointers specifying the submitted I/O requests; NULL elements in the array are ignored

nent

Number of elements in the array

*sig

Determines if asynchronous notification is sent after all I/O operations completes; takes following values:

  • 0: Asynchronous notification occurs; a queued signal, with an application-defined value, is generated when an asynchronous I/O request occurs
  • 1: Asynchronous notification does not occur even when asynchronous I/O requests are processed
  • 2: Asynchronous notification occurs; a notification function is called to perform notification

Description

The lio_listio() function initiates a list of I/O requests with a single function call.

The mode argument determines whether the function returns when all the I/O operations are completed, or as soon as the operations are queued.

If the mode argument is LIO_WAIT, the function waits until all I/O operations are complete. The sig argument is ignored in this case.

If the mode argument is LIO_NOWAIT, the function returns immediately. Asynchronous notification occurs according to the sig argument after all the I/O operations complete.

Returns

When mode=LIO_NOWAIT the lio_listio() function returns:

  • 0: I/O operations are successfully queued
  • -1: Error; I/O operations not queued; to get the proper error code, use errno.

When mode=LIO_WAIT the lio_listio() function returns:

  • 0: I/O operations specified completed successfully
  • -1: Error; I/O operations not completed; to get the proper error code, use errno.