STREAMS-UX Programmer's Guide (February 2007)

STREAMS Utilities Supported by HP-UX
Appendix B
181
NAME
insq ()To insert a message into a queue.
SYNOPSIS
#include <sys/stream.h>
int insq (queue_t *q, mblk_t *mp, mblk_t *newmp);
PARAMETERS
q
Queue pointer.
mp
Pointer to message before which the new message is to be inserted.
newmp
Pointer to the new message to be inserted.
DESCRIPTION
The new message is inserted before the message pointed to by
mp
. The new message will be placed in an
appropriate priority order, i.e., insq() will make an attempt to place the new message before, and as close as
possible to the message pointed to by mp. If the new message priority does not allow the message to be placed
before
mp
, insq() will fail. Further, the
mp
pointer needs to be a valid message pointer in the queue, otherwise
the results will be unpredictable.
A queue belonging to a module/driver with a synchronization level of SQLVL_NOSYNC may be simultaneously
manipulated by multiple threads. Therefore, the queue specified by q must be frozen by calling freezestr()
before calling insq(), rmvq(), strqget(), and strqset(). A call to unfreezestr() must be made to
unfreeze the queue after the above operations are complete.
RETURN VALUES
insq() returns a 1 on success and a 0 on failure.
CONSTRAINTS
insq() can be called from thread or interrupt context. Only spinlocks of STREAMS/UX user lock order can be
held across this call.