DoIO

Performs synchronous I/O.

Synopsis

Err DoIO( Item ior, const IOInfo *ioiP )

Description

This procedure is the most efficient way to perform synchronous I/O (I/O in which the task waits for the I/O request to complete before continuing). It automatically requests quick I/O (see below), sends the I/O request, and then puts the calling task into wait state until the request is complete.

DoIO() automatically sets the IO_QUICK flag in the IOInfo structure. This flag specifies quick I/O, which works as follows: The kernel tries to perform the I/O operation immediately and, if it is successful, it sends back the resulting IOReq immediately and returns 1 as the result code. The calling task can then get the necessary information from the IOReq. If quick I/O is not successful, the kernel performs normal asynchronous I/O and notifies the task with a signal or message when the I/O request is complete. This wakes up the task and DoIO() returns.

Starting with kernel folio V24, this function will automatically sample the io_Error field of the I/O request and return this to you. It is, therefore, no longer necessary to have code such as:

err = DoIO(iorItem,&ioinfo); 
0r err = DoIO(iorItem,&ioinfo);
    if (err >= 0)
        err = ior->io_Error;

You can now just look at the return value of DoIO().

Arguments

ior
The item number of the I/O request to use.
ioiP
A pointer to the IOInfo structure containing the I/O command to be executed, input and/or output data, and other information.

Return Value

The procedure returns when the I/O was successful (which means that the IOReq structure has already been returned and its contents can be examined).

Implementation

Convenience call implemented in clib.lib V20. Became a SWI in kernel folio V24.

Associated Files

io.h
ANSI C Prototype

See Also

AbortIO(), CheckIO(), CreateIOReq(), DeleteIOReq(), SendIO(), WaitIO()