bcanput(D3DK) —
.IX \f4bcanput\fP(D3DK)
.IX STREAMS message queues
.IX message (STREAMS)
NAME
bcanput − test for flow control in specified priority band
SYNOPSIS
#include <sys/types.h>
#include <sys/stream.h>
int bcanput(queue_t ∗q, uchar_t pri);
ARGUMENTS
qPointer to the message queue.
priMessage priority.
DESCRIPTION
bcanput tests if there is room for a message in priority band pri of the queue pointed to by q. The queue must have a service procedure.
If pri is 0, the bcanput call is equivalent to a call to canput.
It is possible because of race conditions to test for room using bcanput 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.
RETURN VALUE
bcanput returns 1 if a message of priority pri can be placed on the queue. 0 is returned if a message of priority pri cannot be enqueued because of flow control within the priority band.
LEVEL
Base or Interrupt.
NOTES
Does not sleep.
The driver is responsible for both testing a queue with bcanput and refraining from placing a message on the queue if bcanput fails.
Driver-defined basic locks, read/write locks, and sleep locks may be held across calls to this function.
The q argument may not reference q_next (for example, an argument of q->q_next is erroneous on a multiprocessor and is disallowed by the DDI/DKI). bcanputnext(q) is provided as a multiprocessor-safe equivalent to the common call bcanput(q->q_next), which is no longer allowed [see bcanputnext(D3DK)].
SEE ALSO
bcanputnext(D3DK), canput(D3DK), canputnext(D3DK), putbq(D3DK), putnext(D3DK)
DDI/DKI — STREAMS