Print this page
7127 remove -Wno-missing-braces from Makefile.uts
Split |
Close |
Expand all |
Collapse all |
--- old/usr/src/uts/common/io/connld.c
+++ new/usr/src/uts/common/io/connld.c
1 1 /*
2 2 * CDDL HEADER START
3 3 *
4 4 * The contents of this file are subject to the terms of the
5 5 * Common Development and Distribution License, Version 1.0 only
6 6 * (the "License"). You may not use this file except in compliance
7 7 * with the License.
8 8 *
9 9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 10 * or http://www.opensolaris.org/os/licensing.
11 11 * See the License for the specific language governing permissions
12 12 * and limitations under the License.
13 13 *
14 14 * When distributing Covered Code, include this CDDL HEADER in each
15 15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 16 * If applicable, add the following below this CDDL HEADER, with the
17 17 * fields enclosed by brackets "[]" replaced with your own identifying
18 18 * information: Portions Copyright [yyyy] [name of copyright owner]
19 19 *
20 20 * CDDL HEADER END
↓ open down ↓ |
20 lines elided |
↑ open up ↑ |
21 21 */
22 22 /*
23 23 * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
24 24 * Use is subject to license terms.
25 25 */
26 26
27 27 /* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
28 28 /* All Rights Reserved */
29 29
30 30
31 -#pragma ident "%Z%%M% %I% %E% SMI" /* SVr4 1.8 */
32 -
33 31 /*
34 32 * This module establishes a unique connection on
35 33 * a STREAMS-based pipe.
36 34 */
37 35 #include <sys/types.h>
38 36 #include <sys/sysmacros.h>
39 37 #include <sys/param.h>
40 38 #include <sys/systm.h>
41 39 #include <sys/errno.h>
42 40 #include <sys/signal.h>
43 41 #include <sys/user.h>
44 42 #include <sys/fstyp.h>
45 43 #include <sys/stropts.h>
46 44 #include <sys/stream.h>
47 45 #include <sys/strsubr.h>
48 46 #include <sys/vnode.h>
49 47 #include <sys/file.h>
50 48 #include <sys/fs/fifonode.h>
51 49 #include <sys/debug.h>
52 50 #include <sys/ddi.h>
53 51
54 52 /*
55 53 * This is the loadable module wrapper.
56 54 */
57 55 #include <sys/conf.h>
58 56 #include <sys/modctl.h>
59 57
60 58 extern struct streamtab conninfo;
61 59
62 60 static struct fmodsw fsw = {
63 61 "connld",
64 62 &conninfo,
65 63 D_NEW | D_MP
66 64 };
↓ open down ↓ |
24 lines elided |
↑ open up ↑ |
67 65
68 66 /*
69 67 * Module linkage information for the kernel.
70 68 */
71 69
72 70 static struct modlstrmod modlstrmod = {
73 71 &mod_strmodops, "Streams-based pipes", &fsw
74 72 };
75 73
76 74 static struct modlinkage modlinkage = {
77 - MODREV_1, (void *)&modlstrmod, NULL
75 + MODREV_1, { (void *)&modlstrmod, NULL }
78 76 };
79 77
80 78 int
81 79 _init()
82 80 {
83 81 return (mod_install(&modlinkage));
84 82 }
85 83
86 84 int
87 85 _fini()
88 86 {
89 87 return (mod_remove(&modlinkage));
90 88 }
91 89
92 90 int
93 91 _info(struct modinfo *modinfop)
94 92 {
95 93 return (mod_info(&modlinkage, modinfop));
96 94 }
97 95
98 96 /*
99 97 * Define local and external routines.
100 98 */
101 99 int connopen(queue_t *, dev_t *, int, int, cred_t *);
102 100 int connclose(queue_t *, int, cred_t *);
103 101 int connput(queue_t *, mblk_t *);
104 102
105 103 /*
106 104 * Define STREAMS header information.
107 105 */
108 106 static struct module_info conn_info = {
109 107 1003,
110 108 "connld",
111 109 0,
112 110 INFPSZ,
113 111 STRHIGH,
114 112 STRLOW
115 113 };
116 114 static struct qinit connrinit = {
117 115 connput,
118 116 NULL,
119 117 connopen,
120 118 connclose,
121 119 NULL,
122 120 &conn_info,
123 121 NULL
124 122 };
125 123 static struct qinit connwinit = {
126 124 connput,
127 125 NULL,
128 126 NULL,
129 127 NULL,
130 128 NULL,
131 129 &conn_info,
132 130 NULL
133 131 };
134 132 struct streamtab conninfo = {
135 133 &connrinit,
136 134 &connwinit
137 135 };
138 136
139 137 /*
140 138 * For each invocation of connopen(), create a new pipe. One end of the pipe
141 139 * is sent to the process on the other end of this STREAM. The vnode for
142 140 * the other end is returned to the open() system call as the vnode for
143 141 * the opened object.
144 142 *
145 143 * On the first invocation of connopen(), a flag is set and the routine
146 144 * returns 0, since the first open corresponds to the pushing of the module.
147 145 */
148 146 /*ARGSUSED*/
149 147 int
150 148 connopen(queue_t *rqp, dev_t *devp, int flag, int sflag, cred_t *crp)
151 149 {
152 150 int error = 0;
153 151 vnode_t *streamvp;
154 152 fifonode_t *streamfnp;
155 153
156 154 if ((streamvp = strq2vp(rqp)) == NULL) {
157 155 return (EINVAL);
158 156 }
159 157
160 158 /*
161 159 * CONNLD is only allowed to be pushed onto a "pipe" that has both
162 160 * of its ends open.
163 161 */
164 162 if (streamvp->v_type != VFIFO) {
165 163 error = EINVAL;
166 164 goto out;
167 165 }
168 166
169 167 streamfnp = VTOF(streamvp);
170 168
171 169 if (!(streamfnp->fn_flag & ISPIPE) ||
172 170 streamfnp->fn_dest->fn_open == 0) {
173 171 error = EPIPE;
174 172 goto out;
175 173 }
176 174
177 175 /*
178 176 * If this is the first time CONNLD was opened while on this stream,
179 177 * it is being pushed. Therefore, set a flag and return 0.
180 178 */
181 179 if (rqp->q_ptr == 0) {
182 180 if (streamfnp->fn_flag & FIFOCONNLD) {
183 181 error = ENXIO;
184 182 goto out;
185 183 }
186 184 rqp->q_ptr = (caddr_t)1;
187 185 streamfnp->fn_flag |= FIFOCONNLD;
188 186 qprocson(rqp);
189 187 }
190 188 out:
191 189 VN_RELE(streamvp);
192 190 return (error);
193 191 }
194 192
195 193 /*ARGSUSED*/
196 194 int
197 195 connclose(queue_t *q, int cflag, cred_t *crp)
198 196 {
199 197 vnode_t *streamvp;
200 198 fifonode_t *streamfnp;
201 199
202 200 qprocsoff(q);
203 201 streamvp = strq2vp(q);
204 202
205 203 ASSERT(streamvp != NULL);
206 204 ASSERT(streamvp->v_type == VFIFO);
207 205
208 206 streamfnp = VTOF(streamvp);
209 207 streamfnp->fn_flag &= ~FIFOCONNLD;
210 208 VN_RELE(streamvp);
211 209 return (0);
212 210 }
213 211
214 212 /*
215 213 * Use same put procedure for write and read queues.
216 214 */
217 215 int
218 216 connput(queue_t *q, mblk_t *bp)
219 217 {
220 218 putnext(q, bp);
221 219 return (0);
222 220 }
↓ open down ↓ |
135 lines elided |
↑ open up ↑ |
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX