datamsg(D3DK) —
.IX \f4datamsg\fP(D3DK)
.IX STREAMS messages
NAME
datamsg − test whether a message is a data message
SYNOPSIS
#include <sys/types.h>
#include <sys/stream.h>
#include <sys/ddi.h>
int datamsg(uchar_t type);
ARGUMENTS
typeThe type of message to be tested. The db_type field of the datab structure contains the message type. This field may be accessed through the message block using mp->b_datap->db_type.
DESCRIPTION
The datamsg function tests the type of message to determine if it is a data message type (M_DATA, M_DELAY, M_PROTO, or M_PCPROTO). .IX STREAMS messages
RETURN VALUE
datamsg returns 1 if the message is a data 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 \f4datamsg\fP(D3DK), example
.IX \f4putq\fP(D3DK), example
The put(D2DK) routine enqueues all data messages for handling by the srv(D2DK) (service) routine. All non-data messages are handled in the put routine.
1 xxxput(q, mp)
2queue_t ∗q;
3mblk_t ∗mp;
4 {
5if (datamsg(mp->b_datap->db_type)) {
6putq(q, mp);
7return;
8}
9switch (mp->b_datap->db_type) {
10case M_FLUSH:
...
11}
12 }
.IX STREAMS messages
DDI/DKI — STREAMS