dupb(D3)

dupb - duplicate a message block

As shipped in IRIX 6.5. First release of IRIX 6.5.

NAME
     dupb - duplicate a message block

SYNOPSIS
     #include <sys/stream.h>
     #include <sys/ddi.h>
     mblk_t *dupb(mblk_t *bp);

   Arguments
     bp        Pointer to the message block to be duplicated.

DESCRIPTION
     dupb creates a new message block structure that references the same data
     block that is referenced by bp.  Unlike copyb(D3), dupb does not copy the
     information in the data block, but creates a new structure to point to
     it.

   Return Values
     On success, dupb returns a pointer to the new message block.  On failure,
     it returns a NULL pointer.

USAGE
     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.
           ______













                   |



















            |
            ___
























































                                   .
                                   .
                                    .
                                    .
                                     .
                                     .
                                      .
                                      .
                                       .
                                       .
                                        .
                                        .
                                   .
                                   .
                                    .
                                    .
                                     .
                                     .
                                      .
                                      .
                                       .
                                       .
                                        .
                                        .
                                   |
                                   ______
                                        |
                                  ______
              .
               .
               .
                .
                .
                 .
                 .
                  .
                  .
                   .
                   .
                    .
              .
               .
               .
                .
                .
                 .
                 .
                  .
                  .
                   .
                   .
                    .
              |
              ______
                    |
              ______













                                      |





















                    nbp=dupb(bp);
                       |
                       __________________________
     __________________
          Before
                                    After
                                 db_base
                                db_ref (2)
                                 |
                                 _________
                                          |
                                 _________
             |
             _________
                      |
             _________
             db_base
            db_ref (1)
                            bp











                                         |
                                         ______
                                                |
                                          ______
                                         b_datap











                                         b_rptr
                                         b_wptr
                            |
                            ______
                                  |
                            ______
                            b_datap











                           b_rptr
                           b_wptr
     |
     ______
           |
     ______
     b_datap











     b_rptr
     b_wptr
                          _________






















                          |
                                              nbp







                           ________



















                           |














                                        _________






















                                                 |







                                        ________



















                                                |





























     bp

















   Level
     Base or Interrupt.
   Synchronization Constraints
     Does not sleep.

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

REFERENCES
     copyb(D3), dupmsg(D3), datab(D4), msgb(D4)