dupb Utility

Purpose

Duplicates a message-block descriptor.

Syntax

mblk_t *
dupb(bp)
register mblk_t * bp;

Description

The dupb utility duplicates the message block descriptor (mblk_t) pointed to by the bp parameter by copying the descriptor into a newly allocated message-block descriptor. A message block is formed with the new message-block descriptor pointing to the same data block as the original descriptor. The reference count in the data-block descriptor (dblk_t) is then incremented. The dupb utility does not copy the data buffer, only the message-block descriptor.

Message blocks that exist on different queues can reference the same data block. In general, if the contents of a message block with a reference count greater than 1 are to be modified, the copymsg utility should be used to create a new message block. Only the new message block should be modified to ensure that other references to the original message block are not invalidated by unwanted changes.

This utility is part of STREAMS Kernel Extensions.

Parameters

Item Description
bp Contains a pointer to the message-block descriptor to be copied.

Return Values

On successful compilation, the dupb utility returns a pointer to the new message block. If the dupb utility cannot allocate a new message-block descriptor, it returns a null pointer.