dupb(D3DK) —
.IX \f4dupb\fP(D3DK)
.IX STREAMS message blocks
.IX message block descriptor
NAME
dupb − duplicate a message block
SYNOPSIS
#include <sys/stream.h>
mblk_t ∗dupb(mblk_t ∗bp);
ARGUMENTS
bpPointer to the message block to be duplicated.
DESCRIPTION
dupb creates a new message block structure to reference the message block pointed to by bp. Unlike copyb(D3DK), dupb does not copy the information in the data block, but creates a new structure to point to it.
.IX \f4msgb\fP(D4DK)
The following figure shows how the db_ref field of the data block structure has been changed from 1 to 2, reflecting the increase in the number of references to the data block. The new message block contains the same information as the first. Note that b_rptr and b_wptr are copied from bp, and that db_ref is incremented. .IX \f4datab\fP(D4DK)
scale=100
define m0 |
[ box invis ht 24 wid 1 with .sw at 0,0
line -> from 0,0 to 0,24
] |
define m1 |
[ box invis ht 62 wid 56 with .sw at 0,0
line from 0,42 to 56,42 dotted
line from 0,22 to 56,22 dotted
box ht 62 wid 56 with .nw at 0,62
] |
define m2 |
[ box invis ht 62 wid 86 with .sw at 0,0
box ht 62 wid 86 with .nw at 0,62
] |
define m3 |
[ box invis ht 62 wid 64 with .sw at 0,0
box ht 62 wid 64 with .nw at 0,62
"b_datap" at 28,47
"" at 8,43 ljust
"" at 8,33 ljust
"b_rptr" at 26,21
"b_wptr" at 26,9
] |
box invis ht 242 wid 442 with .sw at 0,0
line from 64,154 to 120,154
line -> from 120,154 to 120,178
line -> from 136,204 to 136,122
line from 64,116 to 68,116
line from 68,116 to 68,82
line -> from 68,82 to 94,82
line from 64,126 to 80,126
line from 80,126 to 80,102
line -> from 80,102 to 94,102
m1 with .nw at 296,98
m1 with .nw at 94,122
m0 with .nw at 306,178
line -> from 326,206 to 326,98
line from 292,154 to 306,154
"nbp=dupb(bp);" at 150,-7 ljust
line from 180,242 to 180,16
line from 180,16 to 440,16
line from 180,16 to 0,16
"Before" at 78,23
"After" at 326,23
"db_base" at 312,211
"db_ref (2)" at 320,227
m2 with .nw at 280,240
box ht 62 wid 86 with .nw at 82,240
"db_base" at 114,211
"db_ref (1)" at 122,227
"bp" at 228,181 ljust
"" at 236,137 ljust
"" at 236,147 ljust
m3 with .nw at 364,168
m3 with .nw at 228,168
m3 with .nw at 0,168
line -> from 208,58 to 296,58
line from 208,126 to 208,58
"nbp" at 416,181
line from 228,126 to 208,126
line -> from 216,78 to 296,78
line from 216,118 to 216,78
line from 228,118 to 216,118
line from 428,118 to 434,118
line -> from 442,58 to 354,58
line from 442,126 to 442,58
line from 428,126 to 442,126
line -> from 434,78 to 354,78
line from 434,118 to 434,78
"" at 374,137 ljust
"" at 374,147 ljust
line -> from 346,154 to 346,178
line from 364,154 to 346,154
"bp" at 0,181 ljust
RETURN VALUE
If successful, dupb returns a pointer to the new message block. Otherwise, it returns a NULL pointer.
LEVEL
Base or Interrupt
NOTES
Does not sleep.
Driver-defined basic locks, read/write locks, and sleep locks may be held across calls to this function.
SEE ALSO
copyb(D3DK), dupmsg(D3DK), datab(D4DK), msgb(D4DK)
DDI/DKI — STREAMS