.TH insq() "" "" "DDI/DKI Kernel Routine"
.PC "Insert a message into a queue"
.B "#include <sys/stream.h>"
\fBint insq(\fIqueue\^\fB, \fIoldmsg\^\fB, \fInewmsg\^\fB)\fR
\fBqueue_t *\fIqueue\^\fB; mblk_t *\fIoldmsg\^\fB, *\fInewmsg\^\fB;\fR
.PP
.B insq()
inserts
.I newmsg
into
.IR queue ,
at the point immediately preceding
.IR oldmsg .
If
.I oldmsg
is NULL,
.B insq()
inserts
.I newmsg
at the end of
.IR queue .
.PP
If all goes well,
.B insq()
returns one; otherwise, it returns zero.
.PP
.B insq()
updates all flow-control parameters.
It schedules the service procedure to be run,
unless it had been disabled by a call to
.BR noenable() .
.PP
\*(ST requires that messages be ordered by their priority.
If a driver attempts to insert a message out of order,
.B insq()
will not enqueue it.
.SH "See Also"
.B
DDI/DKi kernel routines,
freezestr(),
getq(),
putbq(),
putq(),
rmvq(),
unfreezestr()
.R
.SH Notes
.B insq()
has base or interrupt level.
It does not sleep.
.PP
The caller must have the stream frozen when calling this function.
.PP
A driver can hold a
driver-defined basic lock, read/write lock, or sleep lock
across a call to this function.
