11 * See the License for the specific language governing permissions
12 * and limitations under the License.
13 *
14 * When distributing Covered Code, include this CDDL HEADER in each
15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 * If applicable, add the following below this CDDL HEADER, with the
17 * fields enclosed by brackets "[]" replaced with your own identifying
18 * information: Portions Copyright [yyyy] [name of copyright owner]
19 *
20 * CDDL HEADER END
21 */
22 /*
23 * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
25 */
26
27 /* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
28 /* All Rights Reserved */
29
30
31 #pragma ident "%Z%%M% %I% %E% SMI" /* from S5R4 1.10 */
32
33 /*
34 * Description: The pckt module packetizes messages on
35 * its read queue by pre-fixing an M_PROTO
36 * message type to certain incoming messages.
37 */
38
39 #include <sys/types.h>
40 #include <sys/param.h>
41 #include <sys/stream.h>
42 #include <sys/stropts.h>
43 #include <sys/kmem.h>
44 #include <sys/errno.h>
45 #include <sys/ddi.h>
46 #include <sys/sunddi.h>
47 #include <sys/debug.h>
48
49 /*
50 * This is the loadable module wrapper.
51 */
52 #include <sys/conf.h>
207 dev_t *devp, /* pointer to stream tail's dev */
208 int oflag, /* the user open(2) supplied flags */
209 int sflag, /* open state flag */
210 cred_t *credp) /* credentials */
211 {
212 struct pckt_info *pip;
213 mblk_t *mop; /* ptr to a setopts msg block */
214 struct stroptions *sop;
215
216 if (sflag != MODOPEN)
217 return (EINVAL);
218
219 if (q->q_ptr != NULL) {
220 /* It's already attached. */
221 return (0);
222 }
223
224 /*
225 * Allocate state structure.
226 */
227 pip = kmem_alloc(sizeof (*pip), KM_SLEEP);
228 bzero(pip, sizeof (*pip));
229
230 #ifdef _MULTI_DATAMODEL
231 pip->model = ddi_model_convert_from(get_udatamodel());
232 #endif /* _MULTI_DATAMODEL */
233
234 /*
235 * Cross-link.
236 */
237 pip->pi_qptr = q;
238 q->q_ptr = pip;
239 WR(q)->q_ptr = pip;
240
241 qprocson(q);
242
243 /*
244 * Initialize an M_SETOPTS message to set up hi/lo water marks on
245 * stream head read queue.
246 */
247
248 while ((mop = allocb(sizeof (struct stroptions), BPRI_MED)) == NULL) {
|
11 * See the License for the specific language governing permissions
12 * and limitations under the License.
13 *
14 * When distributing Covered Code, include this CDDL HEADER in each
15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 * If applicable, add the following below this CDDL HEADER, with the
17 * fields enclosed by brackets "[]" replaced with your own identifying
18 * information: Portions Copyright [yyyy] [name of copyright owner]
19 *
20 * CDDL HEADER END
21 */
22 /*
23 * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
25 */
26
27 /* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
28 /* All Rights Reserved */
29
30
31 /*
32 * Description: The pckt module packetizes messages on
33 * its read queue by pre-fixing an M_PROTO
34 * message type to certain incoming messages.
35 */
36
37 #include <sys/types.h>
38 #include <sys/param.h>
39 #include <sys/stream.h>
40 #include <sys/stropts.h>
41 #include <sys/kmem.h>
42 #include <sys/errno.h>
43 #include <sys/ddi.h>
44 #include <sys/sunddi.h>
45 #include <sys/debug.h>
46
47 /*
48 * This is the loadable module wrapper.
49 */
50 #include <sys/conf.h>
205 dev_t *devp, /* pointer to stream tail's dev */
206 int oflag, /* the user open(2) supplied flags */
207 int sflag, /* open state flag */
208 cred_t *credp) /* credentials */
209 {
210 struct pckt_info *pip;
211 mblk_t *mop; /* ptr to a setopts msg block */
212 struct stroptions *sop;
213
214 if (sflag != MODOPEN)
215 return (EINVAL);
216
217 if (q->q_ptr != NULL) {
218 /* It's already attached. */
219 return (0);
220 }
221
222 /*
223 * Allocate state structure.
224 */
225 pip = kmem_zalloc(sizeof (*pip), KM_SLEEP);
226
227 #ifdef _MULTI_DATAMODEL
228 pip->model = ddi_model_convert_from(get_udatamodel());
229 #endif /* _MULTI_DATAMODEL */
230
231 /*
232 * Cross-link.
233 */
234 pip->pi_qptr = q;
235 q->q_ptr = pip;
236 WR(q)->q_ptr = pip;
237
238 qprocson(q);
239
240 /*
241 * Initialize an M_SETOPTS message to set up hi/lo water marks on
242 * stream head read queue.
243 */
244
245 while ((mop = allocb(sizeof (struct stroptions), BPRI_MED)) == NULL) {
|