canput Utility

Purpose

Tests for available room in a queue.

Syntax

int
canput(q)
register queue_t * q;

Description

The canput utility determines if there is room left in a message queue. If the queue does not have a service procedure, the canput utility searches farther in the same direction in the stream until it finds a queue containing a service procedure. This is the first queue on which the passed message can actually be queued. If such a queue cannot be found, the search terminates on the queue at the end of the stream.

The canput utility only takes into account normal data flow control.

This utility is part of STREAMS Kernel Extensions.

Parameters

Item Description
q Specifies the queue at which to begin the search.

Return Values

The canput utility tests the queue found by the search. If the message queue in this queue is not full, the canput utility returns a value of 1. This return indicates that a message can be put to the queue. If the message queue is full, the canput utility returns a value of 0. In this case, the caller is generally referred to as "blocked".