MyWebUniversity.com Home Page
 



OpenSolaris man pages main menu


Kernel Functions for Drivers                             rmvb(9F)



NAME
     rmvb - remove a message block from a message

SYNOPSIS
     #include 



     mblkt *rmvb(mblkt *mp, mblkt *bp);


INTERFACE LEVEL
     Architecture independent level 1 (DI/DKI).

PARAMETERS
     mp    Message from which a block is to be removed. mblkt is
           an instance of the msgb(9S) structure.


     bp    Message block to be removed.


DESCRIPTION
     The rmvb() function removes a message block (bp) from a mes-
     sage (mp), and returns a pointer to the altered message. The
     message block is not freed, merely removed from the message.
     It is the module or driver's responsibility to free the mes-
     sage block.

RETURN VALUES
     If successful, a pointer to the message (minus  the  removed
     block)  is  returned. The pointer is NUL if bp was the only
     block of the message  before   rmvb()  was  called.  If  the
     designated   message  block  (bp)  does  not  exist,  -1  is
     returned.

CONTEXT
     The rmvb() function can be called from user,  interrupt,  or
     kernel context.

EXAMPLES
     This routine removes all zero-length MDATA  message  blocks
     from  the  given message. For each message block in the mes-
     sage, save the next message block (line 10). If the  current
     message  block  is  of  type  MDATA  and has no data in its
     buffer (line 11), then remove it from the message (line  12)
     and  free  it  (line  13). In either case, continue with the
     next message block in the message (line 16).

       1  void
        2  xxclean(mp)
        3      mblkt *mp;



SunOS 5.11          Last change: 16 Jan 2006                    1






Kernel Functions for Drivers                             rmvb(9F)



        4  {
        5          mblkt *tmp;
        6          mblkt *nmp;
        7
        8          tmp = mp;
        9          while (tmp) {
       10                   nmp = tmp->bcont;
       11                   if ((tmp->bdatap->dbtype == MDATA) &&
                                  (tmp->brptr == tmp->bwptr)) {
       12                        (void) rmvb(mp, tmp);
       13                        freeb(tmp);
       14                   }
       15                   tmp = nmp;
       16          }
       17  }


SEE ALSO
     freeb(9F), msgb(9S)


     Writing Device Drivers


     STREAMS Programming Guide






























SunOS 5.11          Last change: 16 Jan 2006                    2



OpenSolaris man pages main menu

Contact us      |       About us      |       Term of use      |       Copyright © 2000-2010 MyWebUniversity.com ™