71 lines
2.1 KiB
Plaintext
71 lines
2.1 KiB
Plaintext
.if n .pH ddi.rm/d3/gen/bcanput @(#)bcanput 43.11 of 11/27/92
|
|
.\" Copyright 1992, 1991 UNIX System Laboratories, Inc.
|
|
.TH bcanput D3
|
|
.IX "\f4bcanput\fP(D3)"
|
|
.IX "STREAMS message queues"
|
|
.IX "message (STREAMS)"
|
|
.SH NAME
|
|
\f4bcanput\fP \- test for flow control in a specified priority band
|
|
.SH SYNOPSIS
|
|
.nf
|
|
.na
|
|
.ft 4
|
|
#include <sys/types.h>
|
|
#include <sys/stream.h>
|
|
#include <sys/ddi.h>
|
|
.sp 0.4
|
|
int bcanput(queue_t *\f2q\fP, uchar_t \f2pri\fP);
|
|
.ft 1
|
|
.ad
|
|
.fi
|
|
.SS Arguments
|
|
.RS 0
|
|
.IP "\f2q\fP" 10n
|
|
Pointer to the message queue.
|
|
.IP "\f2pri\fP" 10n
|
|
Message priority.
|
|
.RE
|
|
.SH DESCRIPTION
|
|
Like the \f4canput\fP(D3) function,
|
|
\f4bcanput\fP searches through the stream (starting at \f2q\fP)
|
|
until it finds a queue containing a service routine,
|
|
or until it reaches the end of the stream.
|
|
If found, the queue containing the service routine
|
|
is tested to see if a message of priority \f2pri\fP can be enqueued.
|
|
If the band is full, \f4bcanput\fP marks the queue to automatically
|
|
back-enable the caller's service routine when the amount of data
|
|
in messages on the queue has reached its low water mark.
|
|
.SS "Return Values"
|
|
\f4bcanput\fP returns 1 if a message of priority \f2pri\fP
|
|
can be sent in the stream,
|
|
or 0 if the priority band is flow-controlled.
|
|
If \f4bcanput\fP reaches the end of the stream without finding a queue
|
|
with a service routine, then it returns 1.
|
|
.SH USAGE
|
|
The driver is responsible for both testing a queue with
|
|
\f4bcanput\fP and refraining from placing a message on the queue if
|
|
\f4bcanput\fP fails.
|
|
.P
|
|
It is possible because of race conditions to test for room using \f4bcanput\fP
|
|
and get an indication that there is room for a message, and then have
|
|
the queue fill up before subsequently enqueuing the message, causing
|
|
a violation of flow control.
|
|
This is not a problem, since the violation of flow control in this case
|
|
is bounded.
|
|
.P
|
|
If \f2pri\fP is 0, the \f4bcanput\fP call is equivalent to
|
|
a call to \f4canput\fP.
|
|
.SS Level
|
|
Base or Interrupt.
|
|
.SS "Synchronization Constraints"
|
|
Does not sleep.
|
|
.P
|
|
Driver-defined basic locks, read/write locks, and sleep locks
|
|
may be held across calls to this function.
|
|
.P
|
|
.SH REFERENCES
|
|
.na
|
|
\f4canput\fP(D3),
|
|
\f4putbq\fP(D3)
|
|
.ad
|