Err SendIO( Item ior, const IOInfo *ioiP )
Call this procedure after creating the necessary IOReq item (for the ior argument, created by calling CreateIOReq()
) and an IOInfo structure (for the ioiP argument). The IOReq item specifies the device to which to send the request and the reply port, if any, while the IOInfo structure includes the I/O command to be executed and a variety of other information. For descriptions of the IOReq and IOInfo data structures, see the Data Structures and Variable Type's chapter.
To request quick I/O, set the IO_QUICK flag in the ioi_Flags field of the IOInfo structure. Quick I/O works as follows: The kernel tries to perform the I/O operation immediately; if it is successful, it sends back the resulting IOReq item immediately without setting any signal bits or sending a message. If quick I/O was successful, the IO_QUICK bit in the io_Flags field of the IOReq is set. If quick I/O was 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.
The IOInfo structure must be fully initialized before calling this function. You can use the ioi_User field of the IOInfo structure to contain whatever you want. This is a useful place to store a pointer to contextual data that needs to be associated with the I/O request. If you use message-based notification for your I/O requests, the msg_DataSize field of the notification messages will contain the value of ioi_User from the IOInfo structure.
CreateIOReq())
. It returns an error code (a negative value) if an error occurs. Possible error codes include:
If the ior and ioiP arguments were valid but an error occurred during the I/O operation, an error code is returned in the io_Error field of the IOReq structure. If SendIO()
returns 0 and a error occurs during I/O, the IOReq is returned as if it were completed, and it contains the error code in io_Error of the IOReq structure.
SendIO()
returns only BADITEM, NOTOWNER, and ER_IONotDone. All other errors codes are returned in the io_Error field of the IOReq.
AbortIO
(), CheckIO(), DoIO(), WaitIO()