Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ rmvq(9F) — SunOS 5.1

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

freemsg(9F)

getq(9F)

rmvq(9F)

NAME

rmvq − remove a message from a queue

SYNOPSIS

#include <sys/stream.h>
void rmvq(queue_t ∗q, mblk_t ∗mp);

ARGUMENTS

q Queue containing the message to be removed. 

mp Message to remove. 

INTERFACE LEVEL

Architecture independent level 1 (DDI/DKI). 

DESCRIPTION

rmvq() removes a message from a queue. A message can be removed from anywhere on a queue. To prevent modules and drivers from having to deal with the internals of message linkage on a queue, either rmvq() or getq(9F) should be used to remove a message from a queue. 

CONTEXT

rmvq() can be called from user or interrupt context. 

EXAMPLE

This code fragment illustrates how one may flush one type of message from a queue.  In this case, only M_PROTO T_DATA_IND messages are flushed.  For each message on the queue, if it is an M_PROTO message (line 8) of type T_DATA_IND (line 10), save a pointer to the next message (line 11), remove the T_DATA_IND message (line 12) and free it (line 13).  Continue with the next message in the list (line 19). 

 1  mblk_t ∗mp;
 2  mblk_t ∗nmp;
 3  queue_t ∗q;
 4  union T_primitives ∗tp;
 5
 6  mp = q->q_first;
 7  while (mp) {
 8if (mp->b_datap->db_type == M_PROTO) {
 9tp = (union T_primitives ∗)mp->b_rptr;
10if (tp->type == T_DATA_IND) {
11nmp = mp->b_next;
12rmvq(q, mp);
13freemsg(mp);
14mp = nmp;
15} else {
16mp = mp->b_next;
17}
18} else {
19mp = mp->b_next;
20}
21  }

SEE ALSO

freemsg(9F), getq(9F)

SunOS 5.1 Writing Device Drivers
SunOS 5.1 STREAMS Programmer’s Guide

WARNINGS

Make sure that the message mp is linked onto q to avoid a possible system panic. 

SunOS 5.1  —  Last change: 11 Apr 1991

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026