DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 
SVR5

bcanputnext(D3str)


bcanputnext -- test for flow control in a specified priority band

Synopsis (Not in ODDI)

   #include <sys/types.h>
   #include <sys/stream.h>
   #include <sys/ddi.h>
   

int bcanputnext(queue_t *q, uchar_t pri);

Description

bcanputnext searches through the stream (starting at q->q_next) 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 in priority band pri can be enqueued. If the band is full, bcanputnext 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.

Arguments


q
Pointer to a message queue.

pri
Message priority.

Return values

bcanputnext returns 1 if a message of priority pri can be sent in the stream, or 0 if the priority band is flow-controlled. If bcanputnext reaches the end of the stream without finding a queue with a service routine, then it returns 1.

Usage

The driver writer is responsible for both testing a queue with bcanputnext and refraining from placing a message on the queue if bcanputnext fails.

It is possible because of race conditions to test for room using bcanputnext 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.

If pri is 0, the bcanputnext call is equivalent to a call to canputnext.

Context

Initialization, Base or Interrupt.

Synchronization constraints

Does not block.

Driver defined basic locks, read/write locks, and sleep locks may be held across calls to this function.

The caller cannot have the stream frozen (see freezestr(D3str)) when calling this function.

Hardware applicability

All

Version applicability

ddi: 3, 5, 5mp, 6, 6mp, 7, 7mp, 7.1, 7.1mp, 8, 8mp

References

bcanput(D3str), canput(D3str), canputnext(D3str), putbq(D3str), putnext(D3str)
19 June 2005
© 2005 The SCO Group, Inc. All rights reserved.
OpenServer 6 and UnixWare (SVR5) HDK - June 2005