STREAMS-UX Programmer's Guide (February 2007)

STREAMS Utilities Supported by HP-UX
Appendix B
167
NAME
dupb () – Pointer to the message block, which is to be duplicated.
SYNOPSIS
#include <sys/stream.h>
mblk_t *dupb (mblk_t *mp);
PARAMETERS
mp
Pointer to message block descriptor that will be duplicated.
DESCRIPTION
dupb() allocates a new message block structure, and copies into it the message block structure pointed by mp.
It does not copy the data buffer. The data block pointer for the newly allocated message block is set to point to
the same data block as the original message block. The reference count (db_ref) in the data block descriptor
is incremented.
When the db_ref count of data block descriptor is greater than 1, then STREAMS module/driver must not
modify the contents of the data buffer. If the data has to be modified, then copyb() should be used to create a
new message block, and only the new message block should be modified.
RETURN VALUES
dupb() returns a pointer to the newly created message block structure if successful, and a NULL pointer
upon failure.
CONSTRAINTS
dupb() can be called from thread or interrupt context. Only spinlocks of STREAMS/UX user lock order can be
held across this call.