1
0
Files
irix-657m-src/eoe/man/manD/putctl.d3
2022-09-29 17:59:04 +03:00

89 lines
2.1 KiB
Plaintext

.if n .pH ddi.rm/d3/gen/putctl @(#)putctl 43.11 of 11/30/92
.\" Copyright 1992, 1991 UNIX System Laboratories, Inc.
.TH putctl D3
.IX "\f4putctl\fP(D3)"
.SH NAME
\f4putctl\f1 \- send a control message to a queue
.SH SYNOPSIS
.nf
.na
.ft 4
#include <sys/stream.h>
#include <sys/ddi.h>
.sp 0.4
int putctl(queue_t *\f2q\fP, int \f2type\fP);
.ft 1
.ad
.fi
.SS Arguments
.RS 0
.IP "\f2q\f1" 10n
Pointer to the queue to which the message is to be sent.
.IP "\f2type\f1" 10n
Message type (must be a control type).
.RE
.SH DESCRIPTION
\f4putctl\f1 tests the \f2type\f1 argument
to make sure a data type has not been specified,
and then attempts to allocate a message block.
\f4putctl\f1 fails if \f2type\f1
is \f4M_DATA\f1, \f4M_PROTO\f1, or \f4M_PCPROTO\f1,
or if a message block cannot be allocated.
If successful, \f4putctl\f1 calls the \f4put\f1(D2) routine
of the queue pointed to by \f2q\f1,
passing it the allocated message.
.SS "Return Values"
On success, 1 is returned.
Otherwise, if \f2type\f1 is a data type,
or if a message block cannot be allocated,
0 is returned.
.SS Level
Base or Interrupt.
.SS "Synchronization Constraints"
Does not sleep.
.P
Driver-defined basic locks, read/write locks, and sleep locks
may not be held across calls to this function.
.SS Examples
The \f4send_ctl\f1 routine is used to pass control messages downstream.
\f4M_BREAK\f1 messages are handled with \f4putctl\f1 (line 9).
\f4putctl1\f1 (line 11) is used for \f4M_DELAY\f1 messages,
so that \f2param\f1 can be
used to specify the length of the delay.
If an invalid message type is detected, \f4send_ctl\f1 returns 0, indicating failure
(line 13).
.sp 0.4
.nf
.ft 4
.ps -1
.vs -2
1 int
2 send_ctl(wrq, type, param)
3 queue_t *wrq;
4 uchar_t type;
5 uchar_t param;
6 {
.sp 0.4
7 switch (type) {
8 case M_BREAK:
9 return(putctl(wrq->q_next, M_BREAK));
.sp 0.4
10 case M_DELAY:
11 return(putctl1(wrq->q_next, M_DELAY, param));
.sp 0.4
12 default:
13 return(0);
14 }
15 }
.vs
.ps
.ft 1
.fi
.IX "\f4putctl\fP(D3), example"
.IX "\f4putctl1\fP(D3), example"
.SH REFERENCES
.na
\f4put\fP(D2),
\f4putctl1\fP(D3)
.ad