STREAMS-UX Programmer's Guide (February 2007)
STREAMS Utilities Supported by HP-UX
Appendix B
152
NAME
adjmsg () – Trim bytes in a message.
SYNOPSIS
#include <sys/stream.h>
int adjmsg (mblk_t *mp , int len);
PARAMETERS
mp
Pointer to a message block in a message. This block will be treated as the start of the
message.
len
The number of bytes to be removed.
DESCRIPTION
adjmsg() trims a specific number of bytes from either the head or tail of the message pointed by
mp
. If
len
is
greater than 0, adjmsg() trims
len
bytes from the beginning of the message starting with the first message
block. If
len
is less than 0, then adjmsg ()removes
len
bytes from the end of the message block. No operation
is performed for 0
len
bytes.
adjmsg() only trims bytes across message blocks of the same message type. It fails if
mp
points to a message
containing fewer than
len
bytes of the same message type starting at the message block pointed to by
mp
. The
message type is determined by the type of the first message block pointed to by m
p
.
RETURN VALUES
adjmsg() returns 1 upon successful execution, and 0 on failure.
CONSTRAINTS
adjmsg() can be called from interrupt or thread context. Spinlocks can be held across a adjmsg() call.