putctl(D3)putctl(D3)NAMEputctl - send a control message to a queue
SYNOPSIS
#include <sys/stream.h>
#include <sys/ddi.h>
int putctl(queue_t *q, int type);
Arguments
q Pointer to the queue to which the message is to be sent.
type Message type (must be a control type).
DESCRIPTIONputctl tests the type argument to make sure a data type has not been
specified, and then attempts to allocate a message block. putctl fails
if type is M_DATA, M_PROTO, or M_PCPROTO, or if a message block cannot be
allocated. If successful, putctl calls the put(D2) routine of the queue
pointed to by q, passing it the allocated message.
Return Values
On success, 1 is returned. Otherwise, if type is a data type, or if a
message block cannot be allocated, 0 is returned.
Level
Base or Interrupt.
Synchronization Constraints
Does not sleep.
Driver-defined basic locks, read/write locks, and sleep locks may not be
held across calls to this function.
Examples
The send_ctl routine is used to pass control messages downstream.
M_BREAK messages are handled with putctl (line 9). putctl1 (line 11) is
used for M_DELAY messages, so that param can be used to specify the
length of the delay. If an invalid message type is detected, send_ctl
returns 0, indicating failure (line 13).
1 int
2 send_ctl(wrq, type, param)
3 queue_t *wrq;
4 uchar_t type;
5 uchar_t param;
6 {
7 switch (type) {
8 case M_BREAK:
9 return(putctl(wrq->q_next, M_BREAK));
10 case M_DELAY:
11 return(putctl1(wrq->q_next, M_DELAY, param));
Page 1
putctl(D3)putctl(D3)
12 default:
13 return(0);
14 }
15 }
REFERENCESput(D2), putctl1(D3)
Page 2