60 lines
1.5 KiB
Plaintext
60 lines
1.5 KiB
Plaintext
.if n .pH ddi.rm/d3/gen/canput @(#)canput 43.11 of 11/27/92
|
|
.\" Copyright 1992, 1991 UNIX System Laboratories, Inc.
|
|
.TH canput D3
|
|
.IX "\f4canput\fP(D3)"
|
|
.IX "STREAMS message queues"
|
|
.IX "message (STREAMS)"
|
|
.SH NAME
|
|
\f4canput\f1 \- test for room in a message queue
|
|
.SH SYNOPSIS
|
|
.nf
|
|
.na
|
|
.ft 4
|
|
#include <sys/stream.h>
|
|
#include <sys/ddi.h>
|
|
.sp 0.4
|
|
int canput(queue_t *\f2q\fP);
|
|
.ft 4
|
|
.ad
|
|
.fi
|
|
.SS Arguments
|
|
.RS 0
|
|
.IP "\f2q\f1" 10n
|
|
Pointer to the message queue.
|
|
.RE
|
|
.SH DESCRIPTION
|
|
\f4canput\fP tests if there is room for a message
|
|
in the queue pointed to by \f2q\fP.
|
|
The queue must have a service procedure.
|
|
.SS "Return Values"
|
|
\f4canput\fP returns 1 if a message can be placed on the queue.
|
|
0 is returned if a message cannot be enqueued because of flow control.
|
|
.SH USAGE
|
|
The driver is responsible for both testing a queue with
|
|
\f4canput\f1 and refraining from placing a message on the queue if
|
|
\f4canput\f1 fails.
|
|
.P
|
|
It is possible because of race conditions to test for room using \f4canput\fP
|
|
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.
|
|
.P
|
|
.SS Level
|
|
Base or Interrupt.
|
|
.SS "Synchronization Constraints"
|
|
Does not sleep.
|
|
.P
|
|
Driver-defined basic locks, read/write locks, and sleep locks
|
|
may be held across calls to this function.
|
|
.P
|
|
.SS Examples
|
|
See \f4bufcall\fP(D3) for an example of \f4canput\fP.
|
|
.SH REFERENCES
|
|
.na
|
|
\f4bcanput\fP(D3),
|
|
\f4putbq\fP(D3),
|
|
\f4putnext\fP(D3)
|
|
.ad
|