'\" te .\" Copyright (c) 1992, Sun Microsystems, Inc. All Rights Reserved. .\" Copyright 1989 AT&T .TH put 9E "12 Nov 1992" "SunOS 5.11" "Driver Entry Points" .SH NAME put \- receive messages from the preceding queue .SH SYNOPSIS .LP .nf #include #include #include #include #include \fBint prefix\fR\fBrput\fR(\fBqueue_t *\fR\fIq\fR, \fBmblk_t\fR \fI*mp\fR/* read side */ .fi .LP .nf \fBint prefix\fR\fBwput\fR(\fBqueue_t *\fR\fIq\fR, \fBmblk_t\fR \fI*mp\fR/* write side */ .fi .SH INTERFACE LEVEL .sp .LP Architecture independent level 1 (DDI/DKI). This entry point is required for \fBSTREAMS. \fR .SH ARGUMENTS .sp .ne 2 .mk .na \fB\fIq\fR \fR .ad .RS 7n .rt Pointer to the \fBqueue\fR(9S) structure. .RE .sp .ne 2 .mk .na \fB\fImp\fR \fR .ad .RS 7n .rt Pointer to the message block. .RE .SH DESCRIPTION .sp .LP The primary task of the \fBput()\fR routine is to coordinate the passing of messages from one queue to the next in a stream. The \fBput()\fR routine is called by the preceding stream component (stream module, driver, or stream head). \fBput()\fR routines are designated ``write'' or ``read'' depending on the direction of message flow. .sp .LP With few exceptions, a streams module or driver must have a \fBput()\fR routine. One exception is the read side of a driver, which does not need a \fBput()\fR routine because there is no component downstream to call it. The \fBput()\fR routine is always called before the component's corresponding \fBsrv\fR(9E) (service) routine, and so \fBput()\fR should be used for the immediate processing of messages. .sp .LP A \fBput()\fR routine must do at least one of the following when it receives a message: .RS +4 .TP .ie t \(bu .el o pass the message to the next component on the stream by calling the \fBputnext\fR(9F) function; .RE .RS +4 .TP .ie t \(bu .el o process the message, if immediate processing is required (for example, to handle high priority messages); or .RE .RS +4 .TP .ie t \(bu .el o enqueue the message (with the \fBputq\fR(9F) function) for deferred processing by the service \fBsrv\fR(9E) routine. .RE .sp .LP Typically, a \fBput()\fR routine will switch on message type, which is contained in the \fBdb_type\fR member of the \fBdatab\fR structure pointed to by \fImp\fR. The action taken by the \fBput()\fR routine depends on the message type. For example, a \fBput()\fR routine might process high priority messages, enqueue normal messages, and handle an unrecognized \fBM_IOCTL\fR message by changing its type to \fBM_IOCNAK\fR (negative acknowledgement) and sending it back to the stream head using the \fBqreply\fR(9F) function. .sp .LP The \fBputq\fR(9F) function can be used as a module's \fBput()\fR routine when no special processing is required and all messages are to be enqueued for the \fBsrv\fR(9E) routine. .SH RETURN VALUES .sp .LP Ignored. .SH CONTEXT .sp .LP \fBput()\fR routines do not have user context. .SH SEE ALSO .sp .LP \fBsrv\fR(9E), \fBputctl\fR(9F), \fBputctl1\fR(9F), \fBputnext\fR(9F), \fBputnextctl\fR(9F), \fBputnextctl1\fR(9F), \fBputq\fR(9F), \fBqreply\fR(9F), \fBqueue\fR(9S), \fBstreamtab\fR(9S) .sp .LP \fIWriting Device Drivers for Oracle Solaris 11.2\fR .sp .LP \fISTREAMS Programming Guide\fR