canput(D3)canput(D3)NAMEcanput - test for room in a message queue
SYNOPSIS
#include <sys/stream.h>
#include <sys/ddi.h>
int canput(queue_t *q);
Arguments
q Pointer to the message queue.
DESCRIPTIONcanput tests if there is room for a message in the queue pointed to by q.
The queue must have a service procedure.
Return Values
canput returns 1 if a message can be placed on the queue. 0 is returned
if a message cannot be enqueued because of flow control.
USAGE
The driver is responsible for both testing a queue with canput and
refraining from placing a message on the queue if canput fails.
It is possible because of race conditions to test for room using canput
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.
Level
Base or Interrupt.
Synchronization Constraints
Does not sleep.
Driver-defined basic locks, read/write locks, and sleep locks may be held
across calls to this function.
Examples
See bufcall(D3) for an example of canput.
REFERENCESbcanput(D3), putbq(D3), putnext(D3)
Page 1