pcmsg(D3DK) —
.IX \f4pcmsg\fP(D3DK)
.IX STREAMS messages
NAME
pcmsg − test whether a message is a priority control message
SYNOPSIS
#include <sys/types.h>
#include <sys/stream.h>
#include <sys/ddi.h>
int pcmsg(uchar_t type);
ARGUMENTS
typeThe type of message to be tested.
DESCRIPTION
The pcmsg function tests the type of message to determine if it is a priority control message (also known as a high priority message.) The db_type field of the datab(D4DK) structure contains the message type. This field may be accessed through the message block using mp->b_datap->db_type. .IX STREAMS messages
RETURN VALUE
pcmsg returns 1 if the message is a priority control message and 0 if the message is any other type.
LEVEL
Base or Interrupt.
NOTES
Does not sleep. Driver defined basic locks, read/write locks, and sleep locks may be held across calls to this function.
SEE ALSO
allocb(D3DK), datab(D4DK), msgb(D4DK), messages(D5DK)
EXAMPLE
.IX \f4canputnext\fP(D3DK), example
.IX \f4pcmsg\fP(D3DK), example
.IX \f4putbq\fP(D3DK), example
.IX \f4putnext\fP(D3DK), example
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.
1xxxsrv(q)
2queue_t ∗q;
3{
4mblk_t ∗mp;
5while ((mp = getq(q)) != NULL) {
6if (pcmsg(mp->b_datap->db_type) || canputnext(q)) {
7/∗ process message ∗/
8putnext(q, mp);
9} else {
10putbq(q, mp);
11return;
12}
13}
14}
DDI/DKI — STREAMS