1put(9E)                       Driver Entry Points                      put(9E)
2
3
4

NAME

6       put - receive messages from the preceding queue
7

SYNOPSIS

9       #include <sys/types.h>
10       #include <sys/stream.h>
11       #include <sys/stropts.h>
12       #include <sys/ddi.h>
13       #include <sys/sunddi.h>
14
15
16
17       int prefixrput(queue_t *q, mblk_t *mp/* read side */
18
19
20       int prefixwput(queue_t *q, mblk_t *mp/* write side */
21
22

INTERFACE LEVEL

24       Architecture  independent  level  1  (DDI/DKI).  This  entry  point  is
25       required for STREAMS.
26

ARGUMENTS

28       q      Pointer to the queue(9S) structure.
29
30
31       mp     Pointer to the message block.
32
33

DESCRIPTION

35       The primary task of the put() routine is to coordinate the  passing  of
36       messages  from  one queue to the next in a stream. The put() routine is
37       called by the preceding stream component  (stream  module,  driver,  or
38       stream  head).  put()  routines  are  designated  ``write'' or ``read''
39       depending on the direction of message flow.
40
41
42       With few exceptions, a streams module or driver must have a put()  rou‐
43       tine. One exception is the read side of a driver, which does not need a
44       put() routine because there is no component downstream to call it.  The
45       put()  routine  is  always  called before the component's corresponding
46       srv(9E) (service) routine, and so put() should be used for the  immedi‐
47       ate processing of messages.
48
49
50       A  put() routine must do at least one of the following when it receives
51       a message:
52
53           o      pass the message to the next  component  on  the  stream  by
54                  calling the putnext(9F) function;
55
56           o      process  the  message,  if  immediate processing is required
57                  (for example, to handle high priority messages); or
58
59           o      enqueue  the  message  (with  the  putq(9F)  function)   for
60                  deferred processing by the service srv(9E) routine.
61
62
63       Typically,  a  put() routine will switch on message type, which is con‐
64       tained in the db_type member of the datab structure pointed to  by  mp.
65       The  action taken by the put() routine depends on the message type. For
66       example, a put() routine might process high priority messages,  enqueue
67       normal messages, and handle an unrecognized M_IOCTL message by changing
68       its type to M_IOCNAK (negative acknowledgement) and sending it back  to
69       the stream head using the qreply(9F) function.
70
71
72       The  putq(9F)  function can be used as a module's put() routine when no
73       special processing is required and all messages are to be enqueued  for
74       the srv(9E) routine.
75

RETURN VALUES

77       Ignored.
78

CONTEXT

80       put() routines do not have user context.
81

SEE ALSO

83       srv(9E),  putctl(9F),  putctl1(9F),  putnext(9F),  putnextctl(9F), put‐
84       nextctl1(9F), putq(9F), qreply(9F), queue(9S), streamtab(9S)
85
86
87       Writing Device Drivers
88
89
90       STREAMS Programming Guide
91
92
93
94SunOS 5.11                        12 Nov 1992                          put(9E)
Impressum