DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 
SVR5 and SCO OpenServer 5

dupb(D3str)


dupb -- duplicate a message block descriptor

Synopsis

#include <sys/stream.h>

mblk_t *dupb(mblk_t *bp);

Description

The dupb function duplicates the specified message block descriptor.

Arguments


bp
points to the start address of a msgb(D4str) message block descriptor that will be duplicated.

Return values

On successful completion, dupb returns a pointer to the new message block. If dupb cannot allocate a new message block descriptor, it returns NULL.

Usage

dupb copies the message block 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. dupb does not copy the data buffer, only the message block descriptor. The values of the b_datap, b_rptr, and b_wptr members in the original message block descriptor are copied into the new message block descriptor. The reference count (db_ref) in the data block descriptor (dblk_t structure) is also incremented.

This routine allows message blocks that exist on different queues to 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, copyb(D3str) should be used to create a new message block, and only the new message block should be modified. This ensures that other references to the original message block are not invalidated by unwanted changes.

bufcall(D3str) can be used to recover from failure by requesting a block of size 0.

Context

Base or interrupt.

Synchronization constraints

Does not block.

Driver-defined basic locks, read/write locks, and sleep locks may be held across calls to this function.

Hardware applicability

All

Version applicability

ddi: 1, 2, 3, 4, 5, 5mp, 6, 6mp, 7, 7mp, 7.1, 7.1mp, 8, 8mp

oddi: 1 , 2, 2mp, 3, 3mp, 4, 4mp, 5, 5mp, 6, 6mp

References

allocb(D3str), bufcall(D3str), copyb(D3str), dupmsg(D3str), freeb(D3str), msgb(D4str)
19 June 2005
© 2005 The SCO Group, Inc. All rights reserved.
OpenServer 6 and UnixWare (SVR5) HDK - June 2005