.TH ttread0() "" "" "Internal Kernel Routine"
.PC "Read from tty"
.B "#include <sys/io.h>"
.B "#include <sys/tty.h>"
\fBvoid ttread0(\fItp\^\fB, \fIiop\^\fB, \fIfunc1\^\fB, \fIarg1\^\fB, \fIfunc2\^\fB, \fIarg2\^\fB)\fR
\fBTTY *\fItp\^\fB; IO *\fIiop\^\fB; int (*\fIfunc1\^\fB)(), \fIarg1\^\fB, (*\fIfunc2\^\fB)(), \fIarg2\^\fB;\fR
.PP
.B ttread0()
moves data from the input queue associated with
.I tp
to the I/O area referenced by
.IR iop .
If an error occurs, it calls
.B set_user_error()
with an appropriate value.
.PP
The following behavior allows a driver to prevent deadlocks between
coupled drivers, such as master-slave pairs of pseudoterminals.
If
.I func1
is not null, the function call \fB(*\fIfunc1\^\fB)(\fIarg1\^\fB)\fR
is performed whenever
.B ttread0()
is about to sleep.
Likewise, if
.I func2
is not null, \fB(*\fIfunc2\^\fB)(\fIarg2\^\fB)\fR
is performed whenever
.B ttread0()
is about to sleep.
.PP
\fBttread(\fItp\^\fB, \fIiop\^\fB)\fR
is equivalent to
\fBttread0(\fItp\^\fB, \fIiop\^\fB, 0, 0, 0, 0)\fR.
.SH "See Also"
.B
internal kernel routines
.R
