canputnext(D3) canputnext(D3)
NAME
canputnext - test for flow control in a stream
SYNOPSIS
#include <sys/stream.h>
#include <sys/ddi.h>
int canputnext(queue_t *q);
Arguments
q Pointer to a message queue.
DESCRIPTION
canputnext 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 there is
room for a message in the queue. If the queue is full,
canputnext 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.
Return Values
canputnext returns 1 if a message can be sent in the stream,
or 0 if the stream is flow-controlled. If canputnext reaches
the end of the stream without finding a queue with a service
routine, then it returns 1.
USAGE
The driver is responsible for both testing a queue with
canputnext and refraining from placing a message on the queue
if canputnext fails.
It is possible because of race conditions to test for room
using canputnext 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.
The q argument may not reference q_next (for example, an
argument of q->q_next is erroneous in a multithreaded driver
and is disallowed by the DDI/DKI).
Level
Base or Interrupt.
Copyright 1994 Novell, Inc. Page 1
canputnext(D3) canputnext(D3)
Synchronization Constraints
Does not sleep.
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(D3)]
when calling this function.
REFERENCES
bcanput(D3), bcanputnext(D3), canput(D3), putbq(D3),
putnext(D3)
NOTICES
Portability
All processors
Applicability
ddi: 3, 5, 5mp, 6, 6mp, 7, 7mp
Copyright 1994 Novell, Inc. Page 2