[ Previous | Next | Table of Contents | Index | Library Home | Legal | Search ]

Technical Reference: Communications, Volume 2


insq Utility

Purpose

Puts a message at a specific place in a queue.

Syntax


int
insq(q, emp, mp)
register queue_t * q;
register mblk_t * emp;
register mblk_t * mp;

Description

The insq utility places the message pointed to by the mp parameter in the message queue pointed to by the q parameter, immediately before the already-queued message pointed to by the emp parameter.

If an attempt is made to insert a message out of order in a queue by using the insq utility, the message will not be inserted and the routine is not successful.

The queue class of the new message is ignored. However, the priority band of the new message must adhere to the following format:

emp->b_prev->b_band >= mp->b_band >= emp->b_band.

Parameters


q Specifies the queue on which to place the message.
emp Specifies the existing message before which the new message is to be placed.

If the emp parameter has a value of null, the message is placed at the end of the queue. If the emp parameter is nonnull, it must point to a message that exists on the queue specified by the q parameter, or undesirable results could occur.

mp Specifies the message that is to be inserted on the queue.

Return Values

On successful completion, the insq utility returns a value of 1. Otherwise, it returns a value of 0.

Implementation Specifics

This utility is part of STREAMS Kernel Extensions.

Related Information

The getq utility.

List of Streams Programming References and Understanding STREAMS Messages in AIX 5L Version 5.1 Communications Programming Concepts.


[ Previous | Next | Table of Contents | Index | Library Home | Legal | Search ]