canput(9F)
NAME
canput − test for room in a message queue
SYNOPSIS
#include <sys/stream.h>
int canput(queue_t ∗cq);
ARGUMENTS
cq Pointer to the message queue.
INTERFACE LEVEL
Architecture independent level 1 (DDI/DKI).
DESCRIPTION
canput() searches through the stream (starting at cq) until it finds a queue containing a service routine where the message can be enqueued, 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, canput() sets the QWANTW flag to back-enable the caller’s service routine.
RETURN VALUES
If the message queue is not full, 1 is returned. A 0 is returned if the queue is full.
CONTEXT
canput() can be called from user or interrupt context.
EXAMPLE
See the bufcall(9F) function page for an example of canput.
WARNINGS
Drivers are responsible for both testing a queue with canput() and refraining from placing a message on the queue if canput() fails.
SEE ALSO
bcanput(9F), putbq(9F), putnext(9F)
SunOS 5.1 Writing Device Drivers
SunOS 5.1 STREAMS Programmer’s Guide
SunOS 5.1 — Last change: 11 Apr 1991