Waits for block I/O completion.
#include <sys/types.h> #include <sys/errno.h> #include <sys/buf.h>
int iowait (bp) struct buf *bp;
bp | Specifies the address of the buf structure for the buffer with in-process I/O. |
The iowait kernel service causes a process to wait until the I/O is complete for the buffer specified by the bp parameter. Only the caller of the strategy routine can call the iowait service. The B_ASYNC bit in the buffer's b_flags field should not be set.
The iodone kernel service must be called when the block I/O transfer is complete. The buf structure pointed to by the bp parameter must specify an iodone routine. This routine is called by the iodone interrupt handler in response to the call to the iodone kernel service. This iodone routine must call the e_wakeup service with the bp->b_events field as the event. This action awakens all processes waiting on I/O completion for the buf structure using the iowait service.
The iowait kernel service can be called from the process environment only.
The iowait service uses the geterror service to determine which of the following values to return:
0 | Indicates that I/O was successful on this buffer. |
EIO | Indicates that an I/O error has occurred. |
b_error value | Indicates that an I/O error has occurred on the buffer. |
The iowait kernel service is part of Base Operating System (BOS) Runtime.
The geterror kernel service, iodone kernel service.
The buf structure.