pullupmsg man page on SmartOS

Man page or keyword search:  
man Server   16655 pages
apropos Keyword Search (all sections)
Output format
SmartOS logo
[printable version]

PULLUPMSG(9F)							 PULLUPMSG(9F)

NAME
       pullupmsg - concatenate bytes in a message

SYNOPSIS
       #include <sys/stream.h>

       int pullupmsg(mblk_t *mp, ssize_t len);

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

PARAMETERS
       mp
	      Pointer  to  the	message	 whose	blocks are to be concatenated.
	      mblk_t is an instance of the msgb(9S) structure.

       len
	      Number of bytes to concatenate.

DESCRIPTION
       The pullupmsg() function tries to combine multiple data blocks  into  a
       single  block.  pullupmsg()  concatenates and aligns the first len data
       bytes of the message pointed to by mp. If len equals -1, all  data  are
       concatenated.  If  len  bytes of the same message type cannot be found,
       pullupmsg() fails and returns 0.

RETURN VALUES
       On success, 1 is returned; on failure, 0 is returned.

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

EXAMPLES
       Example 1 Using pullupmsg()

       This is a driver write srv(9E) (service) routine for a device that does
       not support scatter/gather DMA. For all	M_DATA messages, the data will
       be  transferred	to the device with DMA. First, try to pull up the mes‐
       sage into one message block with the pullupmsg()	 function  (line  12).
       If successful, the transfer can be accomplished in one DMA job.	Other‐
       wise, it must be done one message block at a time (lines 19-22).	 After
       the  data has been transferred to the device, free the message and con‐
       tinue processing messages on the queue.

	  1 xxxwsrv(q)
	  2    queue_t *q;
	  3 {
	  4	  mblk_t *mp;
	  5	  mblk_t *tmp;
	  6	  caddr_t dma_addr;
	  7	ssize_t dma_len;
	  8
	  9	  while ((mp = getq(q)) != NULL) {
	 10		  switch (mp->b_datap->db_type) {
	 11		case M_DATA:
	 12			 if (pullupmsg(mp, -1)) {
	 13			       dma_addr = vtop(mp->b_rptr);
	 14				 dma_len = mp->b_wptr - mp->b_rptr;
	 15				 xxx_do_dma(dma_addr, dma_len);
	 16				 freemsg(mp);
	 17				 break;
	 18			 }
	 19			 for (tmp = mp; tmp; tmp = tmp->b_cont) {
	 20			       dma_addr = vtop(tmp->b_rptr);
	 21			       dma_len = tmp->b_wptr - tmp->b_rptr;
	 22			       xxx_do_dma(dma_addr, dma_len);
	 23		       }
	 24			 freemsg(mp);
	 25			 break;
		    . . .
	 26		   }
	 27	  }
	 28 }

SEE ALSO
       srv(9E), allocb(9F), msgpullup(9F), msgb(9S)

       Writing Device Drivers

       STREAMS Programming Guide

NOTES
       The pullupmsg() function is not included in the DKI and will be removed
       from the system in a future release. Device driver writers are strongly
       encouraged to use msgpullup(9F) instead of pullupmsg().

				 Jan 16, 2006			 PULLUPMSG(9F)
[top]

List of man pages available for SmartOS

Copyright (c) for man pages and the logo by the respective OS vendor.

For those who want to learn more, the polarhome community provides shell access and support.

[legal] [privacy] [GNU] [policy] [cookies] [netiquette] [sponsors] [FAQ]
Tweet
Polarhome, production since 1999.
Member of Polarhome portal.
Based on Fawad Halim's script.
....................................................................
Vote for polarhome
Free Shell Accounts :: the biggest list on the net