'\"macro stdmacro
.if n .pH ddi_dki.biowait @(#)biowait	40.5 of 10/10/89
.\" Copyright 1989 AT&T
.de IX
.ie '\\n(.z'' .tm .Index: \\$1 \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8 \\$9	\\n%
.el \\!.IX \\$1 \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8 \\$9
..
.nr X
.if \nX=0 .ds x} biowait D3DK "" DDI/DKI "\&"
.if \nX=1 .ds x} biowait D3DK "" DDI/DKI
.if \nX=2 .ds x} biowait D3DK "" "\&"
.if \nX=3 .ds x} biowait "" "" "\&"
.TH \*(x}
.SH NAME
\f4biowait\f1 \- suspend processes pending completion of block I/O
.IX "\f4biowait\fP(D3DK)"
.SH SYNOPSIS
.nf
.na
\f4#include <sys/types.h>
#include <sys/buf.h>
.sp 0.5
int biowait(\f4struct buf *\f2bp\f4);\f1
.ad
.fi
.SH ARGUMENT
.RS 0n 10
.IP "\f2*bp\f1" 10n
Pointer to the \f4buf\f1 structure.
.RE
.SH DESCRIPTION
The \f4biowait\f1 function suspends process execution during a block I/O
transfer by calling \f4sleep\f1(D3DK).  Block driver routines using the
\f4buf\f1 structure to allocate buffers can use the \f4biowait\f1
function to suspend a process while waiting for a read or write request
to complete.
.P
The \f4biowait\f1 function is one of three functions used to aid
block I/O transfers.  The other functions in this group are
\f4biodone\f1(D3DK), which notifies \f4biowait\f1 that the I/O is
complete, and \f4brelse\f1, which frees the buffer allocated for the
transfer.
.P
Drivers using the \f4biowait\f1 function must also include the
\f4biodone\f1(D3DK) function in their interrupt routines.  The 
\f4biodone\f1 function awakens \f4biowait\f1 when the I/O transfer
is complete.
.P
Because \f4biowait\f1 calls \f4sleep\f1, \f4biowait\f1 cannot be
called from an interrupt routine or from an \f4init\f1(D2D) routine.
.SH RETURN VALUE
None.  However, \f4biowait\f1 returns any error that may have occured
during the I/O transfer to the user using \f4geterror\f1(D3DK).
.SH LEVEL
Base Only  (Do not call from an interrupt routine)
.SH SEE ALSO
.na
\f4biodone\f1(D3DK),
\f4brelse\f1(D3DK),
\f4sleep\f1(D3DK),
\f4timeout\f1(D3DK),
\f4untimeout\f1(D3DK),
\f4wakeup\f1(D3DK)
.ad
