88 lines
2.1 KiB
Plaintext
88 lines
2.1 KiB
Plaintext
.if n .pH ddi.rm/d3/gen/pcmsg @(#)pcmsg 43.8 of 11/27/92
|
|
.\" Copyright 1991, 1992 UNIX System Laboratories, Inc.
|
|
.\" Copyright 1989 AT&T
|
|
.TH pcmsg D3
|
|
.IX "\f4pcmsg\fP(D3)"
|
|
.IX "STREAMS messages"
|
|
.SH NAME
|
|
\f4pcmsg\fP \- test whether a message is a priority control message
|
|
.SH SYNOPSIS
|
|
.nf
|
|
.na
|
|
.ft 4
|
|
#include <sys/types.h>
|
|
#include <sys/stream.h>
|
|
#include <sys/ddi.h>
|
|
.sp 0.4
|
|
int pcmsg(uchar_t \f2type\fP);
|
|
.ft 1
|
|
.ad
|
|
.fi
|
|
.SS Arguments
|
|
.RS 0
|
|
.IP "\f2type\fP" 10n
|
|
The type of message to be tested.
|
|
.RE
|
|
.SH DESCRIPTION
|
|
The \f4pcmsg\fP function tests the type of message to determine
|
|
if it is a priority control message (also known as a high
|
|
priority message).
|
|
.SS "Return Values"
|
|
\f4pcmsg\fP returns 1
|
|
if the message is a priority control message and 0
|
|
if the message is any other type.
|
|
.SH USAGE
|
|
The \f4db_type\fP field of the \f4datab\fP(D4) structure
|
|
contains the message type.
|
|
This field may be accessed through the message block using
|
|
\f4mp->b_datap->db_type\fP.
|
|
.IX STREAMS messages
|
|
.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.
|
|
.SS Examples
|
|
.IX "\f4pcmsg\fP(D3), example"
|
|
.IX "\f4putbq\fP(D3), example"
|
|
.IX "\f4putnext\fP(D3), example"
|
|
.P
|
|
The service routine processes messages on the queue.
|
|
If the message is a high priority message, or if it is a normal message and
|
|
the stream is not flow-controlled, the message is processed and passed
|
|
along in the stream. Otherwise, the message is placed back on the
|
|
head of the queue and the service routine returns.
|
|
.P
|
|
.nf
|
|
.ft 4
|
|
.ps -1
|
|
.vs -1
|
|
1 xxxsrv(q)
|
|
2 queue_t *q;
|
|
3 {
|
|
4 mblk_t *mp;
|
|
.sp 0.4
|
|
5 while ((mp = getq(q)) != NULL) {
|
|
6 if (pcmsg(mp->b_datap->db_type) || canputnext(q->g_next)) {
|
|
7 /* process message */
|
|
8 putnext(q, mp);
|
|
9 } else {
|
|
10 putbq(q, mp);
|
|
11 return;
|
|
12 }
|
|
13 }
|
|
14 }
|
|
.ft 1
|
|
.fi
|
|
.ps
|
|
.vs
|
|
.SH REFERENCES
|
|
.na
|
|
\f4allocb\fP(D3),
|
|
\f4datab\fP(D4),
|
|
\f4msgb\fP(D4),
|
|
\f4messages\fP(D5)
|
|
.ad
|