Print this page
XXXX adding PID information to netstat output
Split |
Close |
Expand all |
Collapse all |
--- old/usr/src/uts/common/fs/sockfs/sockcommon.h
+++ new/usr/src/uts/common/fs/sockfs/sockcommon.h
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 (the "License").
6 6 * You may not use this file except in compliance with the License.
7 7 *
8 8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 9 * or http://www.opensolaris.org/os/licensing.
10 10 * See the License for the specific language governing permissions
11 11 * and limitations under the License.
12 12 *
13 13 * When distributing Covered Code, include this CDDL HEADER in each
14 14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 15 * If applicable, add the following below this CDDL HEADER, with the
16 16 * fields enclosed by brackets "[]" replaced with your own identifying
17 17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 18 *
19 19 * CDDL HEADER END
20 20 */
21 21
22 22 /*
23 23 * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
24 24 */
25 25
26 26 #ifndef _SOCKCOMMON_H_
27 27 #define _SOCKCOMMON_H_
28 28
29 29 #ifdef __cplusplus
30 30 extern "C" {
31 31 #endif
32 32
33 33 #include <sys/filio.h>
34 34 #include <sys/socket_proto.h>
35 35
36 36 struct sonode;
37 37
38 38 extern kmem_cache_t *socket_cache;
39 39
40 40 /*
41 41 * Socket access functions
42 42 *
43 43 * The following functions should only be used by sockfs, and are common
44 44 * functions that can be used both by kernel sockets (i.e., no file
45 45 * descriptors should ever be expected, or created), and to implement
46 46 * the socket system calls.
47 47 */
48 48 extern struct sonode *socket_create(int, int, int, char *, char *, int, int,
49 49 struct cred *, int *);
50 50 extern struct sonode *socket_newconn(struct sonode *, sock_lower_handle_t,
51 51 sock_downcalls_t *, int, int *);
52 52 extern int socket_bind(struct sonode *, struct sockaddr *, socklen_t, int,
53 53 struct cred *);
54 54 extern int socket_accept(struct sonode *, int, struct cred *, struct sonode **);
55 55 extern int socket_listen(struct sonode *, int, struct cred *);
56 56 extern int socket_connect(struct sonode *, struct sockaddr *,
57 57 socklen_t, int, int, struct cred *);
58 58 extern int socket_getpeername(struct sonode *, struct sockaddr *, socklen_t *,
59 59 boolean_t, struct cred *);
60 60 extern int socket_getsockname(struct sonode *, struct sockaddr *, socklen_t *,
61 61 struct cred *);
62 62 extern int socket_shutdown(struct sonode *, int, struct cred *);
63 63 extern int socket_getsockopt(struct sonode *, int, int, void *, socklen_t *,
64 64 int, struct cred *);
65 65 extern int socket_setsockopt(struct sonode *, int, int, const void *,
66 66 socklen_t, struct cred *);
67 67 extern int socket_recvmsg(struct sonode *, struct nmsghdr *, struct uio *,
68 68 struct cred *);
69 69 extern int socket_sendmsg(struct sonode *, struct nmsghdr *, struct uio *,
70 70 struct cred *);
71 71 extern int socket_sendmblk(struct sonode *, struct nmsghdr *, int,
72 72 struct cred *, mblk_t **);
73 73 extern int socket_ioctl(struct sonode *, int, intptr_t, int, struct cred *,
74 74 int32_t *);
75 75 extern int socket_poll(struct sonode *, short, int, short *,
76 76 struct pollhead **);
77 77 extern int socket_close(struct sonode *, int, struct cred *);
78 78 extern void socket_destroy(struct sonode *);
79 79
80 80 /*
81 81 * Cancel the socket push timer.
82 82 */
83 83 #define SOCKET_TIMER_CANCEL(so) { \
84 84 timeout_id_t tid; \
85 85 \
86 86 ASSERT(MUTEX_HELD(&(so)->so_lock)); \
87 87 if ((so)->so_rcv_timer_tid != 0) { \
88 88 tid = (so)->so_rcv_timer_tid; \
89 89 (so)->so_rcv_timer_tid = 0; \
90 90 mutex_exit(&(so)->so_lock); \
91 91 \
92 92 (void) untimeout(tid); \
93 93 \
94 94 mutex_enter(&(so)->so_lock); \
95 95 } \
96 96 }
97 97
98 98 #define SOCKET_TIMER_START(so) { \
99 99 ASSERT(MUTEX_HELD(&(so)->so_lock)); \
100 100 if ((so)->so_rcv_timer_interval != SOCKET_NO_RCVTIMER) { \
101 101 (so)->so_rcv_timer_tid = timeout(so_timer_callback, \
102 102 (so), MSEC_TO_TICK((so)->so_rcv_timer_interval)); \
103 103 } \
104 104 }
105 105
106 106 /* Common sonode ops not support */
107 107 extern int so_listen_notsupp(struct sonode *, int, struct cred *);
108 108 extern int so_accept_notsupp(struct sonode *, int, struct cred *,
109 109 struct sonode **);
110 110 extern int so_getpeername_notsupp(struct sonode *, struct sockaddr *,
111 111 socklen_t *, boolean_t, struct cred *);
112 112 extern int so_shutdown_notsupp(struct sonode *, int, struct cred *);
113 113 extern int so_sendmblk_notsupp(struct sonode *, struct nmsghdr *,
114 114 int, struct cred *, mblk_t **);
115 115
116 116 /* Common sonode ops */
117 117 extern int so_init(struct sonode *, struct sonode *, struct cred *, int);
118 118 extern int so_accept(struct sonode *, int, struct cred *, struct sonode **);
119 119 extern int so_bind(struct sonode *, struct sockaddr *, socklen_t, int,
120 120 struct cred *);
121 121 extern int so_listen(struct sonode *, int, struct cred *);
122 122 extern int so_connect(struct sonode *, struct sockaddr *,
123 123 socklen_t, int, int, struct cred *);
124 124 extern int so_getsockopt(struct sonode *, int, int, void *,
125 125 socklen_t *, int, struct cred *);
126 126 extern int so_setsockopt(struct sonode *, int, int, const void *,
127 127 socklen_t, struct cred *);
128 128 extern int so_getpeername(struct sonode *, struct sockaddr *,
129 129 socklen_t *, boolean_t, struct cred *);
130 130 extern int so_getsockname(struct sonode *, struct sockaddr *,
131 131 socklen_t *, struct cred *);
132 132 extern int so_ioctl(struct sonode *, int, intptr_t, int, struct cred *,
133 133 int32_t *);
134 134 extern int so_poll(struct sonode *, short, int, short *,
135 135 struct pollhead **);
136 136 extern int so_sendmsg(struct sonode *, struct nmsghdr *, struct uio *,
137 137 struct cred *);
138 138 extern int so_sendmblk_impl(struct sonode *, struct nmsghdr *, int,
139 139 struct cred *, mblk_t **, struct sof_instance *, boolean_t);
140 140 extern int so_sendmblk(struct sonode *, struct nmsghdr *, int,
141 141 struct cred *, mblk_t **);
142 142 extern int so_recvmsg(struct sonode *, struct nmsghdr *, struct uio *,
143 143 struct cred *);
144 144 extern int so_shutdown(struct sonode *, int, struct cred *);
145 145 extern int so_close(struct sonode *, int, struct cred *);
146 146
147 147 extern int so_tpi_fallback(struct sonode *, struct cred *);
148 148
149 149 /* Common upcalls */
150 150 extern sock_upper_handle_t so_newconn(sock_upper_handle_t,
151 151 sock_lower_handle_t, sock_downcalls_t *, struct cred *, pid_t,
152 152 sock_upcalls_t **);
153 153 extern void so_set_prop(sock_upper_handle_t,
154 154 struct sock_proto_props *);
155 155 extern ssize_t so_queue_msg(sock_upper_handle_t, mblk_t *, size_t, int,
↓ open down ↓ |
155 lines elided |
↑ open up ↑ |
156 156 int *, boolean_t *);
157 157 extern ssize_t so_queue_msg_impl(struct sonode *, mblk_t *, size_t, int,
158 158 int *, boolean_t *, struct sof_instance *);
159 159 extern void so_signal_oob(sock_upper_handle_t, ssize_t);
160 160
161 161 extern void so_connected(sock_upper_handle_t, sock_connid_t, struct cred *,
162 162 pid_t);
163 163 extern int so_disconnected(sock_upper_handle_t, sock_connid_t, int);
164 164 extern void so_txq_full(sock_upper_handle_t, boolean_t);
165 165 extern void so_opctl(sock_upper_handle_t, sock_opctl_action_t, uintptr_t);
166 +extern mblk_t *so_get_sock_pid_mblk(sock_upper_handle_t);
166 167 /* Common misc. functions */
167 168
168 169 /* accept queue */
169 170 extern int so_acceptq_enqueue(struct sonode *, struct sonode *);
170 171 extern int so_acceptq_enqueue_locked(struct sonode *, struct sonode *);
171 172 extern int so_acceptq_dequeue(struct sonode *, boolean_t,
172 173 struct sonode **);
173 174 extern void so_acceptq_flush(struct sonode *, boolean_t);
174 175
175 176 /* connect */
176 177 extern int so_wait_connected(struct sonode *, boolean_t, sock_connid_t);
177 178
178 179 /* send */
179 180 extern int so_snd_wait_qnotfull(struct sonode *, boolean_t);
180 181 extern void so_snd_qfull(struct sonode *so);
181 182 extern void so_snd_qnotfull(struct sonode *so);
182 183
183 184 extern int socket_chgpgrp(struct sonode *, pid_t);
184 185 extern void socket_sendsig(struct sonode *, int);
185 186 extern int so_dequeue_msg(struct sonode *, mblk_t **, struct uio *,
186 187 rval_t *, int);
187 188 extern void so_enqueue_msg(struct sonode *, mblk_t *, size_t);
188 189 extern void so_process_new_message(struct sonode *, mblk_t *, mblk_t *);
189 190 extern boolean_t so_check_flow_control(struct sonode *);
190 191
191 192 extern mblk_t *socopyinuio(uio_t *, ssize_t, size_t, ssize_t, size_t, int *);
192 193 extern mblk_t *socopyoutuio(mblk_t *, struct uio *, ssize_t, int *);
193 194
194 195 extern boolean_t somsghasdata(mblk_t *);
195 196 extern void so_rcv_flush(struct sonode *);
196 197 extern int sorecvoob(struct sonode *, struct nmsghdr *, struct uio *,
197 198 int, boolean_t);
198 199
199 200 extern void so_timer_callback(void *);
200 201
201 202 extern struct sonode *socket_sonode_create(struct sockparams *, int, int, int,
202 203 int, int, int *, struct cred *);
203 204
204 205 extern void socket_sonode_destroy(struct sonode *);
205 206 extern int socket_init_common(struct sonode *, struct sonode *, int flags,
206 207 struct cred *);
207 208 extern int socket_getopt_common(struct sonode *, int, int, void *, socklen_t *,
208 209 int);
209 210 extern int socket_ioctl_common(struct sonode *, int, intptr_t, int,
210 211 struct cred *, int32_t *);
211 212 extern int socket_strioc_common(struct sonode *, int, intptr_t, int,
212 213 struct cred *, int32_t *);
213 214
214 215 extern int so_zcopy_wait(struct sonode *);
215 216 extern int so_get_mod_version(struct sockparams *);
216 217
217 218 /* Notification functions */
218 219 extern void so_notify_connected(struct sonode *);
219 220 extern void so_notify_disconnecting(struct sonode *);
220 221 extern void so_notify_disconnected(struct sonode *, boolean_t, int);
221 222 extern void so_notify_writable(struct sonode *);
222 223 extern void so_notify_data(struct sonode *, size_t);
223 224 extern void so_notify_oobsig(struct sonode *);
224 225 extern void so_notify_oobdata(struct sonode *, boolean_t);
225 226 extern void so_notify_eof(struct sonode *);
↓ open down ↓ |
50 lines elided |
↑ open up ↑ |
226 227 extern void so_notify_newconn(struct sonode *);
227 228 extern void so_notify_shutdown(struct sonode *);
228 229 extern void so_notify_error(struct sonode *);
229 230
230 231 /* Common sonode functions */
231 232 extern int sonode_constructor(void *, void *, int);
232 233 extern void sonode_destructor(void *, void *);
233 234 extern void sonode_init(struct sonode *, struct sockparams *,
234 235 int, int, int, sonodeops_t *);
235 236 extern void sonode_fini(struct sonode *);
237 +extern void sonode_insert_pid(struct sonode *, pid_t);
238 +extern void sonode_remove_pid(struct sonode *, pid_t);
236 239
237 240 /*
238 241 * Event flags to socket_sendsig().
239 242 */
240 243 #define SOCKETSIG_WRITE 0x1
241 244 #define SOCKETSIG_READ 0x2
242 245 #define SOCKETSIG_URG 0x4
243 246
244 247 extern sonodeops_t so_sonodeops;
245 248 extern sock_upcalls_t so_upcalls;
246 249
247 250 #ifdef __cplusplus
248 251 }
249 252 #endif
250 253 #endif /* _SOCKCOMMON_H_ */
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX