MyWebUniversity.com Home Page
 



OpenSolaris man pages main menu


Driver Entry Points                                       put(9E)



NAME
     put - receive messages from the preceding queue

SYNOPSIS
     #include 
     #include 
     #include 
     #include 
     #include 



     int prefixrput(queuet *q, mblkt *mp/* read side */


     int prefixwput(queuet *q, mblkt *mp/* write side */


INTERFACE LEVEL
     Architecture independent level 1 (DI/DKI). This entry point
     is required for STREAMS.

ARGUMENTS
     q      Pointer to the queue(9S) structure.


     mp     Pointer to the message block.


DESCRIPTION
     The primary task of the put() routine is to  coordinate  the
     passing  of messages from one queue to the next in a stream.
     The put() routine is called by  the  preceding  stream  com-
     ponent  (stream  module, driver, or stream head). put() rou-
     tines are designated ``write'' or ``read'' depending on  the
     direction of message flow.


     With few exceptions, a streams module or driver must have  a
     put()  routine.  One exception is the read side of a driver,
     which does not need a put() routine because there is no com-
     ponent  downstream  to  call it. The put() routine is always
     called before the component's  corresponding  srv(9E)  (ser-
     vice) routine, and so put() should be used for the immediate
     processing of messages.


     A put() routine must do at least one of the  following  when
     it receives a message:

         o    pass the message  to  the  next  component  on  the
              stream by calling the putnext(9F) function;



SunOS 5.11          Last change: 12 Nov 1992                    1






Driver Entry Points                                       put(9E)



         o    process the message,  if  immediate  processing  is
              required (for example, to handle high priority mes-
              sages); or

         o    enqueue the message (with  the  putq(9F)  function)
              for deferred processing by the service srv(9E) rou-
              tine.


     Typically, a put() routine  will  switch  on  message  type,
     which is contained in the dbtype member of the datab struc-
     ture pointed to by mp. The action taken by the put() routine
     depends  on  the  message type. For example, a put() routine
     might process high priority messages,  enqueue  normal  mes-
     sages,  and handle an unrecognized MIOCTL message by chang-
     ing its type  to  MIOCNAK  (negative  acknowledgement)  and
     sending  it  back  to  the  stream head using the qreply(9F)
     function.


     The putq(9F) function can be used as a module's  put()  rou-
     tine when no special processing is required and all messages
     are to be enqueued for the srv(9E) routine.

RETURN VALUES
     Ignored.

CONTEXT
     put() routines do not have user context.

SEE ALSO
     srv(9E),     putctl(9F),      putctl1(9F),      putnext(9F),
     putnextctl(9F),   putnextctl1(9F),   putq(9F),   qreply(9F),
     queue(9S), streamtab(9S)


     Writing Device Drivers


     STREAMS Programming Guide















SunOS 5.11          Last change: 12 Nov 1992                    2



OpenSolaris man pages main menu

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