STREAMS-UX Programmer's Guide (February 2007)

STREAMS Utilities Supported by HP-UX
Appendix B
162
NAME
copyb () – Creates a copy of a specified message block.
SYNOPSIS
#include <sys/stream.h>
mblk_t *copyb (mblk_t *mp);
PARAMETERS
mp
Pointer to message block from which data is to be copied.
DESCRIPTION
copyb() calls allocb() to allocate a new message. The new block will be at least as large as the block being
copied. The data between the b->rptr and b->wptr in the source message block is copied into the newly
allocated message block, and these pointers in the new message block are given the same offset values they
had in the original message block.
RETURN VALUES
copyb()returns a pointer to the newly allocated message block when successful, or a NULL pointer when
message block allocation fails.
CONSTRAINTS
copyb() can be called from thread or interrupt context. Only spinlocks of STREAMS/UX user lock order can
be held across this call.