[ Previous | Next | Table of Contents | Index | Library Home | Legal | Search ]

Technical Reference: Communications, Volume 2


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.

Parameters


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.

Implementation Specifics

This utility is part of STREAMS Kernel Extensions.

Related Information

The copymsg utility, dupmsg utility.

List of Streams Programming References and Understanding STREAMS Messages in AIX 5L Version 5.1 Communications Programming Concepts.


[ Previous | Next | Table of Contents | Index | Library Home | Legal | Search ]