Print this page
3354 kernel crash in rpcsec_gss after using gsscred
Reviewed by: Toomas Soome <tsoome@me.com>
Reviewed by: Carlos Neira <cneirabustos@gmail.com>
Approved by: Robert Mustacchi <rm@joyent.com>
re #12783 rb4338 Flow control is needed in rpcmod when the NFS server is unable to keep up with the network
| Split |
Close |
| Expand all |
| Collapse all |
--- old/usr/src/uts/common/rpc/svc.h
+++ new/usr/src/uts/common/rpc/svc.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 *
|
↓ open down ↓ |
12 lines elided |
↑ open up ↑ |
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 * Copyright (c) 1989, 2010, Oracle and/or its affiliates. All rights reserved.
23 + * Copyright 2012 Marcel Telka <marcel@telka.sk>
23 24 * Copyright 2013 Nexenta Systems, Inc. All rights reserved.
25 + * Copyright 2018 OmniOS Community Edition (OmniOSce) Association.
24 26 */
25 27 /* Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T */
26 28 /* All Rights Reserved */
27 29 /*
28 30 * Portions of this source code were derived from Berkeley
29 31 * 4.3 BSD under license from the Regents of the University of
30 32 * California.
31 33 */
32 34
33 35 /*
34 36 * svc.h, Server-side remote procedure call interface.
35 37 */
36 38
37 39 #ifndef _RPC_SVC_H
38 40 #define _RPC_SVC_H
39 41
40 42 #include <rpc/rpc_com.h>
41 43 #include <rpc/rpc_msg.h>
42 44 #include <sys/tihdr.h>
43 45 #include <sys/poll.h>
44 46 #include <sys/tsol/label.h>
45 47
46 48 #ifdef _KERNEL
47 49 #include <rpc/svc_auth.h>
48 50 #include <sys/callb.h>
49 51 #endif /* _KERNEL */
50 52
51 53 /*
52 54 * This interface must manage two items concerning remote procedure calling:
53 55 *
54 56 * 1) An arbitrary number of transport connections upon which rpc requests
55 57 * are received. They are created and registered by routines in svc_generic.c,
56 58 * svc_vc.c and svc_dg.c; they in turn call xprt_register and
57 59 * xprt_unregister.
58 60 *
59 61 * 2) An arbitrary number of locally registered services. Services are
60 62 * described by the following four data: program number, version number,
61 63 * "service dispatch" function, a transport handle, and a boolean that
62 64 * indicates whether or not the exported program should be registered with a
63 65 * local binder service; if true the program's number and version and the
64 66 * address from the transport handle are registered with the binder.
65 67 * These data are registered with rpcbind via svc_reg().
66 68 *
67 69 * A service's dispatch function is called whenever an rpc request comes in
68 70 * on a transport. The request's program and version numbers must match
69 71 * those of the registered service. The dispatch function is passed two
70 72 * parameters, struct svc_req * and SVCXPRT *, defined below.
71 73 */
72 74
73 75 #ifdef __cplusplus
74 76 extern "C" {
75 77 #endif
76 78
77 79 /*
78 80 * Server-side transport handles.
79 81 * The actual type definitions are below.
80 82 */
81 83 #ifdef _KERNEL
82 84 typedef struct __svcmasterxprt SVCMASTERXPRT; /* Master transport handle */
83 85 typedef struct __svcxprt SVCXPRT; /* Per-thread clone handle */
84 86 typedef struct __svcpool SVCPOOL; /* Kernel thread pool */
85 87 #else /* _KERNEL */
86 88 typedef struct __svcxprt SVCXPRT; /* Server transport handle */
87 89 #endif /* _KERNEL */
88 90
89 91 /*
90 92 * Prototype of error handler callback
91 93 */
92 94 #ifndef _KERNEL
93 95 typedef void (*svc_errorhandler_t)(const SVCXPRT* svc, const bool_t isAConn);
94 96 #endif
95 97
96 98 /*
97 99 * Service request.
98 100 *
99 101 * PSARC 2003/523 Contract Private Interface
100 102 * svc_req
101 103 * Changes must be reviewed by Solaris File Sharing
102 104 * Changes must be communicated to contract-2003-523@sun.com
103 105 */
104 106 struct svc_req {
105 107 rpcprog_t rq_prog; /* service program number */
106 108 rpcvers_t rq_vers; /* service protocol version */
107 109 rpcproc_t rq_proc; /* the desired procedure */
108 110 struct opaque_auth rq_cred; /* raw creds from the wire */
109 111 caddr_t rq_clntcred; /* read only cooked cred */
110 112 SVCXPRT *rq_xprt; /* associated transport */
111 113 bslabel_t *rq_label; /* TSOL label of the request */
112 114 };
113 115
114 116 #ifdef _KERNEL
115 117 struct dupreq {
116 118 uint32_t dr_xid;
117 119 rpcproc_t dr_proc;
118 120 rpcvers_t dr_vers;
119 121 rpcprog_t dr_prog;
120 122 struct netbuf dr_addr;
121 123 struct netbuf dr_resp;
122 124 void (*dr_resfree)();
123 125 int dr_status;
124 126 struct dupreq *dr_next;
125 127 struct dupreq *dr_chain;
126 128 };
127 129
128 130 /*
129 131 * States of requests for duplicate request caching.
130 132 */
131 133 #define DUP_NEW 0x00 /* new entry */
132 134 #define DUP_INPROGRESS 0x01 /* request already going */
133 135 #define DUP_DONE 0x02 /* request done */
134 136 #define DUP_DROP 0x03 /* request dropped */
135 137 #define DUP_ERROR 0x04 /* error in dup req cache */
136 138
137 139 /*
138 140 * Prototype for a service dispatch routine.
139 141 */
140 142 typedef void (SVC_DISPATCH)(struct svc_req *, SVCXPRT *);
141 143
142 144 /*
143 145 * The service provider callout.
144 146 * Each entry identifies a dispatch routine to be called
145 147 * for a given RPC program number and a version fitting
146 148 * into the registered range.
147 149 */
148 150 typedef struct {
149 151 rpcprog_t sc_prog; /* RPC Program number */
150 152 rpcvers_t sc_versmin; /* Min version number */
151 153 rpcvers_t sc_versmax; /* Max version number */
152 154 SVC_DISPATCH *sc_dispatch; /* Dispatch routine */
153 155 } SVC_CALLOUT;
154 156
155 157 /*
156 158 * Table of service provider `callouts' for an RPC
157 159 * transport handle. If sct_free is TRUE then transport
158 160 * destructor is supposed to deallocate this table.
159 161 */
160 162 typedef struct {
161 163 size_t sct_size; /* Number of entries */
162 164 bool_t sct_free; /* Deallocate if true */
163 165 SVC_CALLOUT *sct_sc; /* Callout entries */
164 166 } SVC_CALLOUT_TABLE;
165 167
166 168 struct svc_ops {
167 169 bool_t (*xp_recv)(SVCXPRT *, mblk_t *, struct rpc_msg *);
168 170 /* receive incoming requests */
169 171 bool_t (*xp_getargs)(SVCXPRT *, xdrproc_t, caddr_t);
170 172 /* get arguments */
171 173 bool_t (*xp_reply)(SVCXPRT *, struct rpc_msg *);
172 174 /* send reply */
173 175 bool_t (*xp_freeargs)(SVCXPRT *, xdrproc_t, caddr_t);
174 176 /* free mem allocated for args */
175 177 void (*xp_destroy)(SVCMASTERXPRT *);
176 178 /* destroy this struct */
177 179 int (*xp_dup)(struct svc_req *, caddr_t, int,
178 180 struct dupreq **, bool_t *);
179 181 /* check for dup */
180 182 void (*xp_dupdone)(struct dupreq *, caddr_t, void (*)(), int, int);
181 183 /* mark dup entry as completed */
|
↓ open down ↓ |
148 lines elided |
↑ open up ↑ |
182 184 int32_t *(*xp_getres)(SVCXPRT *, int);
183 185 /* get pointer to response buffer */
184 186 void (*xp_freeres)(SVCXPRT *);
185 187 /* destroy pre-serialized response */
186 188 void (*xp_clone_destroy)(SVCXPRT *);
187 189 /* destroy a clone xprt */
188 190 void (*xp_start)(SVCMASTERXPRT *);
189 191 /* `ready-to-receive' */
190 192 void (*xp_clone_xprt)(SVCXPRT *, SVCXPRT *);
191 193 /* transport specific clone function */
192 - void (*xp_tattrs) (SVCXPRT *, int, void **);
194 + void (*xp_tattrs)(SVCXPRT *, int, void **);
195 + /* transport specific hold function */
196 + void (*xp_hold)(queue_t *);
197 + /* transport specific release function */
198 + void (*xp_release)(queue_t *, mblk_t *, bool_t);
193 199 };
194 200
195 201 #define SVC_TATTR_ADDRMASK 1
196 202
197 203 #else /* _KERNEL */
198 204 /*
199 205 * Service control requests
200 206 */
201 207 #define SVCGET_VERSQUIET 1
202 208 #define SVCSET_VERSQUIET 2
203 209 #define SVCGET_XID 4
204 210 #define SVCSET_KEEPALIVE 5
205 211 #define SVCSET_CONNMAXREC 6
206 212 #define SVCGET_CONNMAXREC 7
207 213 #define SVCGET_RECVERRHANDLER 8
208 214 #define SVCSET_RECVERRHANDLER 9
209 215
210 216 enum xprt_stat {
211 217 XPRT_DIED,
212 218 XPRT_MOREREQS,
213 219 XPRT_IDLE
214 220 };
215 221
216 222 struct xp_ops {
217 223 #ifdef __STDC__
218 224 bool_t (*xp_recv)(SVCXPRT *, struct rpc_msg *);
219 225 /* receive incoming requests */
220 226 enum xprt_stat (*xp_stat)(SVCXPRT *);
221 227 /* get transport status */
222 228 bool_t (*xp_getargs)(SVCXPRT *, xdrproc_t, caddr_t);
223 229 /* get arguments */
224 230 bool_t (*xp_reply)(SVCXPRT *, struct rpc_msg *);
225 231 /* send reply */
226 232 bool_t (*xp_freeargs)(SVCXPRT *, xdrproc_t, caddr_t);
227 233 /* free mem allocated for args */
228 234 void (*xp_destroy)(SVCXPRT *);
229 235 /* destroy this struct */
230 236 bool_t (*xp_control)(SVCXPRT *, const uint_t, void *);
231 237 /* catch-all control function */
232 238 #else /* __STDC__ */
233 239 bool_t (*xp_recv)(); /* receive incoming requests */
234 240 enum xprt_stat (*xp_stat)(); /* get transport status */
235 241 bool_t (*xp_getargs)(); /* get arguments */
236 242 bool_t (*xp_reply)(); /* send reply */
237 243 bool_t (*xp_freeargs)(); /* free mem allocated for args */
238 244 void (*xp_destroy)(); /* destroy this struct */
239 245 bool_t (*xp_control)(); /* catch-all control function */
240 246 #endif /* __STDC__ */
241 247 };
242 248 #endif /* _KERNEL */
243 249
244 250 #ifdef _KERNEL
245 251 /*
246 252 * SVCPOOL
247 253 * Kernel RPC server-side thread pool structure.
248 254 */
249 255 typedef struct __svcxprt_qnode __SVCXPRT_QNODE; /* Defined in svc.c */
250 256
251 257 struct __svcpool {
252 258 /*
253 259 * Thread pool variables.
254 260 *
255 261 * The pool's thread lock p_thread_lock protects:
256 262 * - p_threads, p_detached_threads, p_reserved_threads and p_closing
257 263 * The pool's request lock protects:
258 264 * - p_asleep, p_drowsy, p_reqs, p_size, p_walkers, p_req_cv.
259 265 * The following fields are `initialized constants':
260 266 * - p_id, p_stksize, p_timeout.
261 267 * Access to p_next and p_prev is protected by the pool
262 268 * list lock.
263 269 */
264 270 SVCPOOL *p_next; /* Next pool in the list */
|
↓ open down ↓ |
62 lines elided |
↑ open up ↑ |
265 271 SVCPOOL *p_prev; /* Prev pool in the list */
266 272 int p_id; /* Pool id */
267 273 int p_threads; /* Non-detached threads */
268 274 int p_detached_threads; /* Detached threads */
269 275 int p_maxthreads; /* Max threads in the pool */
270 276 int p_redline; /* `Redline' for the pool */
271 277 int p_reserved_threads; /* Reserved threads */
272 278 kmutex_t p_thread_lock; /* Thread lock */
273 279 int p_asleep; /* Asleep threads */
274 280 int p_drowsy; /* Drowsy flag */
275 - kcondvar_t p_req_cv; /* svc_poll() sleep var. */
281 + kcondvar_t p_req_cv; /* svc_poll() sleep var. */
276 282 clock_t p_timeout; /* svc_poll() timeout */
277 283 kmutex_t p_req_lock; /* Request lock */
278 284 int p_reqs; /* Pending requests */
279 285 int p_walkers; /* Walking threads */
280 286 int p_max_same_xprt; /* Max reqs from the xprt */
281 287 int p_stksize; /* Stack size for svc_run */
282 288 bool_t p_closing : 1; /* Pool is closing */
283 289
284 290 /*
285 291 * Thread creator variables.
286 292 * The `creator signaled' flag is turned on when a signal is send
287 293 * to the creator thread (to create a new service thread). The
288 294 * creator clears when the thread is created. The protocol is not
289 295 * to signal the creator thread when the flag is on. However,
290 296 * a new thread should signal the creator if there are more
291 297 * requests in the queue.
292 298 *
293 299 * When the pool is closing (ie it has been already unregistered from
294 300 * the pool list) the last thread on the last transport should turn
295 301 * the p_creator_exit flag on. This tells the creator thread to
296 302 * free the pool structure and exit.
297 303 */
298 304 bool_t p_creator_signaled : 1; /* Create requested flag */
299 305 bool_t p_creator_exit : 1; /* If true creator exits */
300 306 kcondvar_t p_creator_cv; /* Creator cond. variable */
301 307 kmutex_t p_creator_lock; /* Creator lock */
302 308
303 309 /*
304 310 * Doubly linked list containing `registered' master transport handles.
305 311 * There is no special structure for a list node. Instead the
306 312 * SVCMASTERXPRT structure has the xp_next and xp_prev fields.
307 313 *
308 314 * The p_lrwlock protects access to xprt->xp_next and xprt->xp_prev.
309 315 * A service thread should also acquire a reader lock before accessing
310 316 * any transports it is no longer linked to (to prevent them from
311 317 * being destroyed).
312 318 *
313 319 * The list lock governs also the `pool is closing' flag.
314 320 */
315 321 size_t p_lcount; /* Current count */
316 322 SVCMASTERXPRT *p_lhead; /* List head */
317 323 krwlock_t p_lrwlock; /* R/W lock */
318 324
319 325 /*
320 326 * Circular linked list for the `xprt-ready' queue (FIFO).
321 327 * Must be initialized with svc_xprt_qinit() before it is used.
322 328 *
323 329 * The writer's end is protected by the pool's request lock
324 330 * (pool->p_req_lock). The reader's end is protected by q_end_lock.
325 331 *
326 332 * When the queue is full the p_qoverflow flag is raised. It stays
327 333 * on until all the pending request are drained.
328 334 */
329 335 size_t p_qsize; /* Number of queue nodes */
330 336 int p_qoverflow : 1; /* Overflow flag */
331 337 __SVCXPRT_QNODE *p_qbody; /* Queue body (array) */
332 338 __SVCXPRT_QNODE *p_qtop; /* Writer's end of FIFO */
333 339 __SVCXPRT_QNODE *p_qend; /* Reader's end of FIFO */
334 340 kmutex_t p_qend_lock; /* Reader's end lock */
335 341
336 342 /*
337 343 * Userspace thread creator variables.
338 344 * Thread creation is actually done in userland, via a thread
339 345 * that is parked in the kernel. When that thread is signaled,
340 346 * it returns back down to the daemon from whence it came and
341 347 * does the lwp create.
342 348 *
343 349 * A parallel "creator" thread runs in the kernel. That is the
344 350 * thread that will signal for the user thread to return to
345 351 * userland and do its work.
346 352 *
347 353 * Since the thread doesn't always exist (there could be a race
348 354 * if two threads are created in rapid succession), we set
349 355 * p_signal_create_thread to FALSE when we're ready to accept work.
350 356 *
351 357 * p_user_exit is set to true when the service pool is about
352 358 * to close. This is done so that the user creation thread
353 359 * can be informed and cleanup any userland state.
354 360 */
355 361
356 362 bool_t p_signal_create_thread : 1; /* Create requested flag */
357 363 bool_t p_user_exit : 1; /* If true creator exits */
358 364 bool_t p_user_waiting : 1; /* Thread waiting for work */
359 365 kcondvar_t p_user_cv; /* Creator cond. variable */
360 366 kmutex_t p_user_lock; /* Creator lock */
361 367 void (*p_offline)(); /* callout for unregister */
362 368 void (*p_shutdown)(); /* callout for shutdown */
363 369
364 370 size_t p_size; /* Total size of queued msgs */
365 371 };
366 372
367 373 /*
368 374 * Server side transport handle (SVCMASTERXPRT).
369 375 * xprt->xp_req_lock governs the following fields in xprt:
370 376 * xp_req_head, xp_req_tail.
371 377 * xprt->xp_thread_lock governs the following fields in xprt:
372 378 * xp_threads, xp_detached_threads.
373 379 *
374 380 * xp_req_tail is only valid if xp_req_head is non-NULL
375 381 *
376 382 * The xp_threads count is the number of attached threads. These threads
377 383 * are able to handle new requests, and it is expected that they will not
378 384 * block for a very long time handling a given request. The
379 385 * xp_detached_threads count is the number of threads that have detached
380 386 * themselves from the transport. These threads can block indefinitely
381 387 * while handling a request. Once they complete the request, they exit.
382 388 *
383 389 * A kernel service provider may register a callback function "closeproc"
384 390 * for a transport. When the transport is closing the last exiting attached
385 391 * thread - xp_threads goes to zero - it calls the callback function, passing
386 392 * it a reference to the transport. This call is made with xp_thread_lock
387 393 * held, so any cleanup bookkeeping it does should be done quickly.
388 394 *
389 395 * When the transport is closing the last exiting thread is supposed
390 396 * to destroy/free the data structure.
391 397 */
392 398 typedef struct __svcxprt_common {
393 399 struct file *xpc_fp;
394 400 struct svc_ops *xpc_ops;
395 401 queue_t *xpc_wq; /* queue to write onto */
396 402 cred_t *xpc_cred; /* cached cred for server to use */
397 403 int32_t xpc_type; /* transport type */
398 404 int xpc_msg_size; /* TSDU or TIDU size */
399 405 struct netbuf xpc_rtaddr; /* remote transport address */
400 406 struct netbuf xpc_lcladdr; /* local transport address */
401 407 char *xpc_netid; /* network token */
402 408 SVC_CALLOUT_TABLE *xpc_sct;
403 409 } __SVCXPRT_COMMON;
404 410
405 411 #define xp_fp xp_xpc.xpc_fp
406 412 #define xp_ops xp_xpc.xpc_ops
|
↓ open down ↓ |
121 lines elided |
↑ open up ↑ |
407 413 #define xp_wq xp_xpc.xpc_wq
408 414 #define xp_cred xp_xpc.xpc_cred
409 415 #define xp_type xp_xpc.xpc_type
410 416 #define xp_msg_size xp_xpc.xpc_msg_size
411 417 #define xp_rtaddr xp_xpc.xpc_rtaddr
412 418 #define xp_lcladdr xp_xpc.xpc_lcladdr
413 419 #define xp_sct xp_xpc.xpc_sct
414 420 #define xp_netid xp_xpc.xpc_netid
415 421
416 422 struct __svcmasterxprt {
417 - SVCMASTERXPRT *xp_next; /* Next transport in the list */
418 - SVCMASTERXPRT *xp_prev; /* Prev transport in the list */
423 + SVCMASTERXPRT *xp_next; /* Next transport in the list */
424 + SVCMASTERXPRT *xp_prev; /* Prev transport in the list */
419 425 __SVCXPRT_COMMON xp_xpc; /* Fields common with the clone */
420 426 SVCPOOL *xp_pool; /* Pointer to the pool */
421 427 mblk_t *xp_req_head; /* Request queue head */
422 428 mblk_t *xp_req_tail; /* Request queue tail */
423 429 kmutex_t xp_req_lock; /* Request lock */
424 430 int xp_threads; /* Current num. of attached threads */
425 431 int xp_detached_threads; /* num. of detached threads */
426 432 kmutex_t xp_thread_lock; /* Thread count lock */
427 433 void (*xp_closeproc)(const SVCMASTERXPRT *);
428 434 /* optional; see comments above */
429 435 struct netbuf xp_addrmask; /* address mask */
430 436
431 437 caddr_t xp_p2; /* private: for use by svc ops */
432 438
433 439 int xp_full : 1; /* xprt is full */
434 440 int xp_enable : 1; /* xprt needs to be enabled */
435 441 int xp_reqs; /* number of requests queued */
436 442 size_t xp_size; /* total size of queued msgs */
437 443 };
438 444
439 445 /*
440 446 * Service thread `clone' transport handle (SVCXPRT)
441 447 *
442 448 * PSARC 2003/523 Contract Private Interface
443 449 * SVCXPRT
444 450 * Changes must be reviewed by Solaris File Sharing
445 451 * Changes must be communicated to contract-2003-523@sun.com
446 452 *
447 453 * The xp_p2buf buffer is used as the storage for a transport type
448 454 * specific structure. It is private for the svc ops for a given
449 455 * transport type.
450 456 */
451 457
452 458 #define SVC_P2LEN 128
453 459
454 460 struct __svcxprt {
455 461 __SVCXPRT_COMMON xp_xpc;
456 462 SVCMASTERXPRT *xp_master; /* back ptr to master */
457 463
458 464 /* The following fileds are on a per-thread basis */
459 465 callb_cpr_t *xp_cprp; /* unused padding for Contract */
460 466 bool_t xp_reserved : 1; /* is thread reserved? */
461 467 bool_t xp_detached : 1; /* is thread detached? */
462 468 int xp_same_xprt; /* Reqs from the same xprt */
463 469
464 470 /* The following fields are used on a per-request basis */
465 471 struct opaque_auth xp_verf; /* raw response verifier */
466 472 SVCAUTH xp_auth; /* auth flavor of current req */
467 473 void *xp_cookie; /* a cookie */
468 474 uint32_t xp_xid; /* id */
469 475 XDR xp_xdrin; /* input xdr stream */
470 476 XDR xp_xdrout; /* output xdr stream */
471 477
472 478 /* Private for svc ops */
473 479 char xp_p2buf[SVC_P2LEN]; /* udp_data or cots_data_t */
474 480 /* or clone_rdma_data_t */
475 481 };
476 482 #else /* _KERNEL */
477 483 struct __svcxprt {
478 484 int xp_fd;
479 485 #define xp_sock xp_fd
480 486 ushort_t xp_port;
481 487 /*
482 488 * associated port number.
483 489 * Obsolete, but still used to
484 490 * specify whether rendezvouser
485 491 * or normal connection
486 492 */
487 493 struct xp_ops *xp_ops;
488 494 int xp_addrlen; /* length of remote addr. Obsoleted */
489 495 char *xp_tp; /* transport provider device name */
490 496 char *xp_netid; /* network token */
491 497 struct netbuf xp_ltaddr; /* local transport address */
492 498 struct netbuf xp_rtaddr; /* remote transport address */
493 499 char xp_raddr[16]; /* remote address. Now obsoleted */
494 500 struct opaque_auth xp_verf; /* raw response verifier */
495 501 caddr_t xp_p1; /* private: for use by svc ops */
496 502 caddr_t xp_p2; /* private: for use by svc ops */
497 503 caddr_t xp_p3; /* private: for use by svc lib */
498 504 int xp_type; /* transport type */
499 505 /*
500 506 * callback on client death
501 507 * First parameter is the current structure,
502 508 * Second parameter :
503 509 * - FALSE for the service listener
504 510 * - TRUE for a real connected socket
505 511 */
506 512 svc_errorhandler_t xp_closeclnt;
507 513 };
508 514 #endif /* _KERNEL */
509 515
510 516 /*
511 517 * Approved way of getting address of caller,
512 518 * address mask, and netid of transport.
513 519 */
514 520 #define svc_getrpccaller(x) (&(x)->xp_rtaddr)
515 521 #ifdef _KERNEL
516 522 #define svc_getcaller(x) (&(x)->xp_rtaddr.buf)
517 523 #define svc_getaddrmask(x) (&(x)->xp_master->xp_addrmask)
518 524 #define svc_getnetid(x) ((x)->xp_netid)
519 525 #endif /* _KERNEL */
520 526
521 527 /*
522 528 * Operations defined on an SVCXPRT handle
523 529 */
524 530
|
↓ open down ↓ |
96 lines elided |
↑ open up ↑ |
525 531 #ifdef _KERNEL
526 532
527 533 #define SVC_GETADDRMASK(clone_xprt, attrflag, tattr) \
528 534 (*(clone_xprt)->xp_ops->xp_tattrs)((clone_xprt), (attrflag), (tattr))
529 535
530 536 #define SVC_CLONE_XPRT(src_xprt, dst_xprt) \
531 537 if ((src_xprt)->xp_ops->xp_clone_xprt) \
532 538 (*(src_xprt)->xp_ops->xp_clone_xprt) \
533 539 (src_xprt, dst_xprt)
534 540
541 +#define SVC_HOLD(xprt) \
542 + if ((xprt)->xp_ops->xp_hold) \
543 + (*(xprt)->xp_ops->xp_hold)((xprt)->xp_wq)
544 +
545 +#define SVC_RELE(xprt, mp, enable) \
546 + if ((xprt)->xp_ops->xp_release) \
547 + (*(xprt)->xp_ops->xp_release)((xprt)->xp_wq, (mp), (enable))
548 +
535 549 #define SVC_RECV(clone_xprt, mp, msg) \
536 550 (*(clone_xprt)->xp_ops->xp_recv)((clone_xprt), (mp), (msg))
537 551
538 552 /*
539 553 * PSARC 2003/523 Contract Private Interface
540 554 * SVC_GETARGS
541 555 * Changes must be reviewed by Solaris File Sharing
542 556 * Changes must be communicated to contract-2003-523@sun.com
543 557 */
544 558 #define SVC_GETARGS(clone_xprt, xargs, argsp) \
545 559 (*(clone_xprt)->xp_ops->xp_getargs)((clone_xprt), (xargs), (argsp))
546 560
547 561 #define SVC_REPLY(clone_xprt, msg) \
548 562 (*(clone_xprt)->xp_ops->xp_reply) ((clone_xprt), (msg))
549 563
550 564 #define SVC_FREEARGS(clone_xprt, xargs, argsp) \
551 565 (*(clone_xprt)->xp_ops->xp_freeargs)((clone_xprt), (xargs), (argsp))
552 566
553 567 #define SVC_GETRES(clone_xprt, size) \
554 568 (*(clone_xprt)->xp_ops->xp_getres)((clone_xprt), (size))
555 569
556 570 #define SVC_FREERES(clone_xprt) \
557 571 (*(clone_xprt)->xp_ops->xp_freeres)(clone_xprt)
558 572
559 573 #define SVC_DESTROY(xprt) \
560 574 (*(xprt)->xp_ops->xp_destroy)(xprt)
561 575
562 576 /*
563 577 * PSARC 2003/523 Contract Private Interfaces
564 578 * SVC_DUP, SVC_DUPDONE, SVC_DUP_EXT, SVC_DUPDONE_EXT
565 579 * Changes must be reviewed by Solaris File Sharing
566 580 * Changes must be communicated to contract-2003-523@sun.com
567 581 *
568 582 * SVC_DUP and SVC_DUPDONE are defined here for backward compatibility.
569 583 */
570 584 #define SVC_DUP_EXT(clone_xprt, req, res, size, drpp, dupcachedp) \
571 585 (*(clone_xprt)->xp_ops->xp_dup)(req, res, size, drpp, dupcachedp)
572 586
573 587 #define SVC_DUPDONE_EXT(clone_xprt, dr, res, resfree, size, status) \
574 588 (*(clone_xprt)->xp_ops->xp_dupdone)(dr, res, resfree, size, status)
575 589
576 590 #define SVC_DUP(clone_xprt, req, res, size, drpp) \
577 591 (*(clone_xprt)->xp_ops->xp_dup)(req, res, size, drpp, NULL)
578 592
579 593 #define SVC_DUPDONE(clone_xprt, dr, res, size, status) \
580 594 (*(clone_xprt)->xp_ops->xp_dupdone)(dr, res, NULL, size, status)
581 595
582 596 #define SVC_CLONE_DESTROY(clone_xprt) \
583 597 (*(clone_xprt)->xp_ops->xp_clone_destroy)(clone_xprt)
584 598
585 599
586 600 #define SVC_START(xprt) \
587 601 (*(xprt)->xp_ops->xp_start)(xprt)
588 602
589 603 #else /* _KERNEL */
590 604
591 605 #define SVC_RECV(xprt, msg) \
592 606 (*(xprt)->xp_ops->xp_recv)((xprt), (msg))
593 607 #define svc_recv(xprt, msg) \
594 608 (*(xprt)->xp_ops->xp_recv)((xprt), (msg))
595 609
596 610 #define SVC_STAT(xprt) \
597 611 (*(xprt)->xp_ops->xp_stat)(xprt)
598 612 #define svc_stat(xprt) \
599 613 (*(xprt)->xp_ops->xp_stat)(xprt)
600 614
601 615 #define SVC_GETARGS(xprt, xargs, argsp) \
602 616 (*(xprt)->xp_ops->xp_getargs)((xprt), (xargs), (argsp))
603 617 #define svc_getargs(xprt, xargs, argsp) \
604 618 (*(xprt)->xp_ops->xp_getargs)((xprt), (xargs), (argsp))
605 619
606 620 #define SVC_REPLY(xprt, msg) \
607 621 (*(xprt)->xp_ops->xp_reply) ((xprt), (msg))
608 622 #define svc_reply(xprt, msg) \
609 623 (*(xprt)->xp_ops->xp_reply) ((xprt), (msg))
610 624
611 625 #define SVC_FREEARGS(xprt, xargs, argsp) \
612 626 (*(xprt)->xp_ops->xp_freeargs)((xprt), (xargs), (argsp))
613 627 #define svc_freeargs(xprt, xargs, argsp) \
614 628 (*(xprt)->xp_ops->xp_freeargs)((xprt), (xargs), (argsp))
615 629
616 630 #define SVC_GETRES(xprt, size) \
617 631 (*(xprt)->xp_ops->xp_getres)((xprt), (size))
618 632 #define svc_getres(xprt, size) \
619 633 (*(xprt)->xp_ops->xp_getres)((xprt), (size))
620 634
621 635 #define SVC_FREERES(xprt) \
622 636 (*(xprt)->xp_ops->xp_freeres)(xprt)
623 637 #define svc_freeres(xprt) \
624 638 (*(xprt)->xp_ops->xp_freeres)(xprt)
625 639
626 640 #define SVC_DESTROY(xprt) \
627 641 (*(xprt)->xp_ops->xp_destroy)(xprt)
628 642 #define svc_destroy(xprt) \
629 643 (*(xprt)->xp_ops->xp_destroy)(xprt)
630 644
631 645 /*
632 646 * PSARC 2003/523 Contract Private Interface
633 647 * SVC_CONTROL
634 648 * Changes must be reviewed by Solaris File Sharing
635 649 * Changes must be communicated to contract-2003-523@sun.com
636 650 */
637 651 #define SVC_CONTROL(xprt, rq, in) \
638 652 (*(xprt)->xp_ops->xp_control)((xprt), (rq), (in))
639 653 #endif /* _KERNEL */
640 654
641 655 /*
642 656 * Pool id's reserved for NFS, NLM, and the NFSv4 callback program.
643 657 */
644 658 #define NFS_SVCPOOL_ID 0x01
645 659 #define NLM_SVCPOOL_ID 0x02
646 660 #define NFS_CB_SVCPOOL_ID 0x03
647 661 #define RDC_SVCPOOL_ID 0x05 /* SNDR, PSARC 2001/699 */
648 662
649 663 struct svcpool_args {
650 664 uint32_t id; /* Pool id */
651 665 uint32_t maxthreads; /* Max threads in the pool */
652 666 uint32_t redline; /* `Redline' for the pool */
653 667 uint32_t qsize; /* `xprt-ready' queue size */
654 668 uint32_t timeout; /* svc_poll() timeout */
655 669 uint32_t stksize; /* svc_run() stack size */
656 670 uint32_t max_same_xprt; /* Max reqs from the same xprt */
657 671 };
658 672
659 673
660 674 #ifdef _KERNEL
661 675 /*
662 676 * Transport registration and thread pool creation.
663 677 */
664 678 extern int svc_xprt_register(SVCMASTERXPRT *, int);
665 679 extern void svc_xprt_unregister(SVCMASTERXPRT *);
666 680 extern int svc_pool_create(struct svcpool_args *);
667 681 extern int svc_wait(int);
668 682 extern int svc_do_run(int);
669 683 #define SVCPSET_SHUTDOWN_PROC 1
670 684 #define SVCPSET_UNREGISTER_PROC 2
671 685 extern int svc_pool_control(int, int, void *);
672 686 #else /* _KERNEL */
673 687 #ifdef __STDC__
674 688 extern bool_t rpc_reg(const rpcprog_t, const rpcvers_t, const rpcproc_t,
675 689 char *(*)(char *), const xdrproc_t, const xdrproc_t,
676 690 const char *);
677 691
678 692 /*
679 693 * Service registration
680 694 *
681 695 * svc_reg(xprt, prog, vers, dispatch, nconf)
682 696 * const SVCXPRT *xprt;
683 697 * const rpcprog_t prog;
684 698 * const rpcvers_t vers;
685 699 * const void (*dispatch)();
686 700 * const struct netconfig *nconf;
687 701 */
688 702 extern bool_t svc_reg(const SVCXPRT *, const rpcprog_t, const rpcvers_t,
689 703 void (*)(struct svc_req *, SVCXPRT *),
690 704 const struct netconfig *);
691 705
692 706 /*
693 707 * Service authentication registration
694 708 *
695 709 * svc_auth_reg(cred_flavor, handler)
696 710 * int cred_flavor;
697 711 * enum auth_stat (*handler)();
698 712 */
699 713 extern int svc_auth_reg(int, enum auth_stat (*)());
700 714
701 715 /*
702 716 * Service un-registration
703 717 *
704 718 * svc_unreg(prog, vers)
705 719 * const rpcprog_t prog;
706 720 * const rpcvers_t vers;
707 721 */
708 722 extern void svc_unreg(const rpcprog_t, const rpcvers_t);
709 723
710 724 /*
711 725 * Transport registration/unregistration.
712 726 *
713 727 * xprt_register(xprt)
714 728 * const SVCXPRT *xprt;
715 729 *
716 730 * xprt_unregister(xprt)
717 731 * const SVCXPRT *xprt;
718 732 */
719 733 extern void xprt_register(const SVCXPRT *);
720 734 extern void xprt_unregister(const SVCXPRT *);
|
↓ open down ↓ |
176 lines elided |
↑ open up ↑ |
721 735 #else /* __STDC__ */
722 736 extern bool_t rpc_reg();
723 737 extern bool_t svc_reg();
724 738 extern bool_t svc_auth_reg();
725 739 extern void svc_unreg();
726 740 extern void xprt_register();
727 741 extern void xprt_unregister();
728 742 #endif /* __STDC__ */
729 743 #endif /* _KERNEL */
730 744
745 +#ifdef _KERNEL
746 +/*
747 + * Transport hold and release.
748 + */
749 +extern void rpcmod_hold(queue_t *);
750 +extern void rpcmod_release(queue_t *, mblk_t *, bool_t);
751 +extern void mir_svc_hold(queue_t *);
752 +extern void mir_svc_release(queue_t *, mblk_t *, bool_t);
753 +#endif /* _KERNEL */
731 754
732 755 /*
733 756 * When the service routine is called, it must first check to see if it
734 757 * knows about the procedure; if not, it should call svcerr_noproc
735 758 * and return. If so, it should deserialize its arguments via
736 759 * SVC_GETARGS (defined above). If the deserialization does not work,
737 760 * svcerr_decode should be called followed by a return. Successful
738 761 * decoding of the arguments should be followed the execution of the
739 762 * procedure's code and a call to svc_sendreply.
740 763 *
741 764 * Also, if the service refuses to execute the procedure due to too-
742 765 * weak authentication parameters, svcerr_weakauth should be called.
743 766 * Note: do not confuse access-control failure with weak authentication!
744 767 *
745 768 * NB: In pure implementations of rpc, the caller always waits for a reply
746 769 * msg. This message is sent when svc_sendreply is called.
747 770 * Therefore pure service implementations should always call
748 771 * svc_sendreply even if the function logically returns void; use
749 772 * xdr.h - xdr_void for the xdr routine. HOWEVER, connectionful rpc allows
750 773 * for the abuse of pure rpc via batched calling or pipelining. In the
751 774 * case of a batched call, svc_sendreply should NOT be called since
752 775 * this would send a return message, which is what batching tries to avoid.
753 776 * It is the service/protocol writer's responsibility to know which calls are
754 777 * batched and which are not. Warning: responding to batch calls may
755 778 * deadlock the caller and server processes!
756 779 */
757 780 #ifdef __STDC__
758 781 extern bool_t svc_sendreply(const SVCXPRT *, const xdrproc_t, const caddr_t);
759 782 extern void svcerr_decode(const SVCXPRT *);
760 783 extern void svcerr_weakauth(const SVCXPRT *);
761 784 extern void svcerr_noproc(const SVCXPRT *);
762 785 extern void svcerr_progvers(const SVCXPRT *, const rpcvers_t,
763 786 const rpcvers_t);
764 787 extern void svcerr_auth(const SVCXPRT *, const enum auth_stat);
765 788 extern void svcerr_noprog(const SVCXPRT *);
766 789 extern void svcerr_systemerr(const SVCXPRT *);
767 790 extern void svcerr_badcred(const SVCXPRT *);
768 791 #else /* __STDC__ */
769 792 extern bool_t svc_sendreply();
770 793 extern void svcerr_decode();
771 794 extern void svcerr_weakauth();
772 795 extern void svcerr_noproc();
773 796 extern void svcerr_progvers();
774 797 extern void svcerr_auth();
775 798 extern void svcerr_noprog();
776 799 extern void svcerr_systemerr();
777 800 extern void svcerr_badcred();
778 801 #endif /* __STDC__ */
779 802
780 803 #ifdef _KERNEL
781 804 /*
782 805 * Kernel RPC functions.
783 806 */
784 807 extern void svc_init(void);
785 808 extern void svc_cots_init(void);
786 809 extern void svc_clts_init(void);
787 810 extern void mt_kstat_init(void);
788 811 extern void mt_kstat_fini(void);
789 812 extern int svc_tli_kcreate(struct file *, uint_t, char *,
790 813 struct netbuf *, SVCMASTERXPRT **,
791 814 SVC_CALLOUT_TABLE *,
792 815 void (*closeproc)(const SVCMASTERXPRT *),
793 816 int, bool_t);
794 817 extern int svc_clts_kcreate(struct file *, uint_t, struct T_info_ack *,
795 818 SVCMASTERXPRT **);
796 819 extern int svc_cots_kcreate(struct file *, uint_t, struct T_info_ack *,
797 820 SVCMASTERXPRT **);
798 821 extern bool_t svc_queuereq(queue_t *, mblk_t *, bool_t);
799 822 extern void svc_queueclean(queue_t *);
800 823 extern void svc_queueclose(queue_t *);
801 824 extern int svc_reserve_thread(SVCXPRT *);
802 825 extern void svc_unreserve_thread(SVCXPRT *);
803 826 extern callb_cpr_t *svc_detach_thread(SVCXPRT *);
804 827
805 828 /*
806 829 * For RDMA based kRPC.
807 830 * "rdma_xprt_record" is a reference to master transport handles
808 831 * in kRPC thread pools. This is an easy way of tracking and shuting
809 832 * down rdma based kRPC transports on demand.
810 833 * "rdma_xprt_group" is a list of RDMA based mster transport handles
811 834 * or records in a kRPC thread pool.
812 835 */
813 836 typedef struct rdma_xprt_record rdma_xprt_record_t;
814 837 struct rdma_xprt_record {
815 838 int rtr_type; /* Type of rdma; IB/VI/RDDP */
816 839 SVCMASTERXPRT *rtr_xprt_ptr; /* Ptr to master xprt handle */
817 840 rdma_xprt_record_t *rtr_next; /* Ptr to next record */
818 841 };
819 842
820 843 typedef struct {
821 844 int rtg_count; /* Number transport records */
822 845 int rtg_poolid; /* Pool Id for this group */
823 846 rdma_xprt_record_t *rtg_listhead; /* Head of the records list */
824 847 } rdma_xprt_group_t;
825 848
826 849 extern int svc_rdma_kcreate(char *, SVC_CALLOUT_TABLE *, int,
827 850 rdma_xprt_group_t *);
828 851 extern void svc_rdma_kstop(SVCMASTERXPRT *);
829 852 extern void svc_rdma_kdestroy(SVCMASTERXPRT *);
830 853 extern void rdma_stop(rdma_xprt_group_t *);
831 854
832 855 /*
833 856 * GSS cleanup method.
834 857 */
835 858 extern void rpc_gss_cleanup(SVCXPRT *);
836 859 #else /* _KERNEL */
837 860 /*
838 861 * Lowest level dispatching -OR- who owns this process anyway.
839 862 * Somebody has to wait for incoming requests and then call the correct
840 863 * service routine. The routine svc_run does infinite waiting; i.e.,
841 864 * svc_run never returns.
842 865 * Since another (co-existant) package may wish to selectively wait for
843 866 * incoming calls or other events outside of the rpc architecture, the
844 867 * routine svc_getreq_poll is provided. It must be passed pollfds, the
845 868 * "in-place" results of a poll call (see poll, section 2).
846 869 */
847 870
848 871 /*
849 872 * Global keeper of rpc service descriptors in use
850 873 * dynamic; must be inspected before each call to select or poll
851 874 */
852 875 extern pollfd_t *svc_pollfd;
853 876 extern int svc_max_pollfd;
854 877 extern fd_set svc_fdset;
855 878 #define svc_fds svc_fdset.fds_bits[0] /* compatibility */
856 879
857 880 /*
858 881 * A small program implemented by the svc_rpc implementation itself.
859 882 * Also see clnt.h for protocol numbers.
860 883 */
861 884 #ifdef __STDC__
862 885 extern void svc_getreq(int);
863 886 extern void svc_getreq_common(const int);
864 887 extern void svc_getreqset(fd_set *); /* takes fdset instead of int */
865 888 extern void svc_getreq_poll(struct pollfd *, const int);
866 889 extern void svc_run(void);
867 890 extern void svc_exit(void);
868 891 #else /* __STDC__ */
869 892 extern void rpctest_service();
870 893 extern void svc_getreqset();
871 894 extern void svc_getreq();
872 895 extern void svc_getreq_common();
873 896 extern void svc_getreqset(); /* takes fdset instead of int */
874 897 extern void svc_getreq_poll();
875 898 extern void svc_run();
876 899 extern void svc_exit();
877 900 #endif /* __STDC__ */
878 901
879 902 /*
880 903 * Functions used to manage user file descriptors
881 904 */
882 905 typedef int svc_input_id_t;
883 906 typedef void (*svc_callback_t)(svc_input_id_t id, int fd,
884 907 unsigned int events, void* cookie);
885 908
886 909 #ifdef __STDC__
887 910 extern svc_input_id_t svc_add_input(int fd, unsigned int events,
888 911 svc_callback_t user_callback,
889 912 void* cookie);
890 913 extern int svc_remove_input(svc_input_id_t id);
891 914 #else /* __STDC__ */
892 915 extern svc_input_id_t svc_add_input();
893 916 extern int svc_remove_input();
894 917 #endif
895 918
|
↓ open down ↓ |
155 lines elided |
↑ open up ↑ |
896 919 /*
897 920 * These are the existing service side transport implementations.
898 921 *
899 922 * Transport independent svc_create routine.
900 923 */
901 924 #ifdef __STDC__
902 925 extern int svc_create(void (*)(struct svc_req *, SVCXPRT *),
903 926 const rpcprog_t, const rpcvers_t,
904 927 const char *);
905 928 /*
906 - * void (*dispatch)(); -- dispatch routine
929 + * void (*dispatch)(); -- dispatch routine
907 930 * const rpcprog_t prognum; -- program number
908 931 * const rpcvers_t versnum; -- version number
909 932 * const char *nettype; -- network type
910 933 */
911 934
912 935 /*
913 936 * Generic server creation routine. It takes a netconfig structure
914 937 * instead of a nettype.
915 938 */
916 939 extern SVCXPRT *svc_tp_create(void (*)(struct svc_req *, SVCXPRT *),
917 940 const rpcprog_t, const rpcvers_t,
918 941 const struct netconfig *);
919 942 /*
920 943 * void (*dispatch)(); -- dispatch routine
921 944 * const rpcprog_t prognum; -- program number
922 945 * const rpcvers_t versnum; -- version number
923 946 * const struct netconfig *nconf; -- netconfig structure
924 947 */
925 948
926 949 /*
927 950 * Variant of svc_tp_create that accepts a binding address.
928 951 * If addr == NULL, this is the same as svc_tp_create().
929 952 */
930 953 extern SVCXPRT *svc_tp_create_addr(void (*)(struct svc_req *, SVCXPRT *),
931 954 const rpcprog_t, const rpcvers_t,
932 955 const struct netconfig *,
933 956 const struct netbuf *);
934 957 /*
935 958 * void (*dispatch)(); -- dispatch routine
936 959 * const rpcprog_t prognum; -- program number
937 960 * const rpcvers_t versnum; -- version number
938 961 * const struct netconfig *nconf; -- netconfig structure
939 962 * const struct netbuf *addr; -- address to bind
940 963 */
941 964
942 965 /*
943 966 * Generic TLI create routine
944 967 */
945 968 extern SVCXPRT *svc_tli_create(const int, const struct netconfig *,
946 969 const struct t_bind *, const uint_t,
947 970 const uint_t);
948 971 /*
949 972 * const int fd; -- connection end point
950 973 * const struct netconfig *nconf; -- netconfig structure
951 974 * const struct t_bind *bindaddr; -- local bind address
952 975 * const uint_t sendsz; -- max sendsize
953 976 * const uint_t recvsz; -- max recvsize
954 977 */
955 978
956 979 /*
957 980 * Connectionless and connectionful create routines.
958 981 */
959 982 extern SVCXPRT *svc_vc_create(const int, const uint_t, const uint_t);
960 983 /*
961 984 * const int fd; -- open connection end point
962 985 * const uint_t sendsize; -- max send size
963 986 * const uint_t recvsize; -- max recv size
964 987 */
965 988
966 989 extern SVCXPRT *svc_dg_create(const int, const uint_t, const uint_t);
967 990 /*
968 991 * const int fd; -- open connection
|
↓ open down ↓ |
52 lines elided |
↑ open up ↑ |
969 992 * const uint_t sendsize; -- max send size
970 993 * const uint_t recvsize; -- max recv size
971 994 */
972 995
973 996 /*
974 997 * the routine takes any *open* TLI file
975 998 * descriptor as its first input and is used for open connections.
976 999 */
977 1000 extern SVCXPRT *svc_fd_create(const int, const uint_t, const uint_t);
978 1001 /*
979 - * const int fd; -- open connection end point
980 - * const uint_t sendsize; -- max send size
981 - * const uint_t recvsize; -- max recv size
1002 + * const int fd; -- open connection end point
1003 + * const uint_t sendsize; -- max send size
1004 + * const uint_t recvsize; -- max recv size
982 1005 */
983 1006
984 1007 /*
985 1008 * Memory based rpc (for speed check and testing)
986 1009 */
987 1010 extern SVCXPRT *svc_raw_create(void);
988 1011
989 1012 /*
990 1013 * Creation of service over doors transport.
991 1014 */
992 1015 extern SVCXPRT *svc_door_create(void (*)(struct svc_req *, SVCXPRT *),
993 1016 const rpcprog_t, const rpcvers_t,
994 1017 const uint_t);
995 1018 /*
996 - * void (*dispatch)(); -- dispatch routine
1019 + * void (*dispatch)(); -- dispatch routine
997 1020 * const rpcprog_t prognum; -- program number
998 1021 * const rpcvers_t versnum; -- version number
999 1022 * const uint_t sendsize; -- send buffer size
1000 1023 */
1001 1024
1002 1025 /*
1003 1026 * Service control interface
1004 1027 */
1005 1028 extern bool_t svc_control(SVCXPRT *, const uint_t, void *);
1006 1029 /*
1007 1030 * SVCXPRT *svc; -- service to manipulate
1008 1031 * const uint_t req; -- request
1009 1032 * void *info; -- argument to request
1010 1033 */
1011 1034
1012 1035 /*
1013 1036 * svc_dg_enable_cache() enables the cache on dg transports.
1014 1037 */
1015 1038 extern int svc_dg_enablecache(SVCXPRT *, const uint_t);
1016 1039 #else /* __STDC__ */
1017 1040 extern int svc_create();
1018 1041 extern SVCXPRT *svc_tp_create();
1019 1042 extern SVCXPRT *svc_tli_create();
1020 1043 extern SVCXPRT *svc_vc_create();
1021 1044 extern SVCXPRT *svc_dg_create();
1022 1045 extern SVCXPRT *svc_fd_create();
1023 1046 extern SVCXPRT *svc_raw_create();
1024 1047 extern SVCXPRT *svc_door_create();
1025 1048 extern int svc_dg_enablecache();
1026 1049 #endif /* __STDC__ */
1027 1050
1028 1051 extern boolean_t is_multilevel(rpcprog_t);
1029 1052
1030 1053 #ifdef PORTMAP
1031 1054 /* For backward compatibility */
1032 1055 #include <rpc/svc_soc.h>
1033 1056 #endif /* PORTMAP */
1034 1057
1035 1058 /*
1036 1059 * For user level MT hot server functions
1037 1060 */
1038 1061
1039 1062 /*
1040 1063 * Different MT modes
1041 1064 */
1042 1065 #define RPC_SVC_MT_NONE 0 /* default, single-threaded */
1043 1066 #define RPC_SVC_MT_AUTO 1 /* automatic MT mode */
1044 1067 #define RPC_SVC_MT_USER 2 /* user MT mode */
1045 1068
1046 1069 #ifdef __STDC__
1047 1070 extern void svc_done(SVCXPRT *);
1048 1071 #else
1049 1072 extern void svc_done();
1050 1073 #endif /* __STDC__ */
1051 1074
1052 1075 /*
1053 1076 * Obtaining local credentials.
1054 1077 */
1055 1078 typedef struct __svc_local_cred_t {
1056 1079 uid_t euid; /* effective uid */
1057 1080 gid_t egid; /* effective gid */
1058 1081 uid_t ruid; /* real uid */
1059 1082 gid_t rgid; /* real gid */
1060 1083 pid_t pid; /* caller's pid, or -1 if not available */
1061 1084 } svc_local_cred_t;
1062 1085
1063 1086 #ifdef __STDC__
1064 1087 struct ucred_s;
1065 1088 extern void svc_fd_negotiate_ucred(int);
1066 1089 extern int svc_getcallerucred(const SVCXPRT *, struct ucred_s **);
1067 1090 extern bool_t svc_get_local_cred(SVCXPRT *, svc_local_cred_t *);
1068 1091 #else
1069 1092 extern void svc_fd_negotiate_ucred();
1070 1093 extern int svc_getcallerucred();
1071 1094 extern bool_t svc_get_local_cred();
1072 1095 #endif /* __STDC__ */
1073 1096
1074 1097 /*
1075 1098 * Private interfaces and structures for user level duplicate request caching.
1076 1099 * The interfaces and data structures are not committed and subject to
1077 1100 * change in future releases. Currently only intended for use by automountd.
1078 1101 */
1079 1102 struct dupreq {
1080 1103 uint32_t dr_xid;
1081 1104 rpcproc_t dr_proc;
1082 1105 rpcvers_t dr_vers;
1083 1106 rpcprog_t dr_prog;
1084 1107 struct netbuf dr_addr;
1085 1108 struct netbuf dr_resp;
1086 1109 int dr_status;
1087 1110 time_t dr_time;
1088 1111 uint_t dr_hash;
1089 1112 struct dupreq *dr_next;
1090 1113 struct dupreq *dr_prev;
1091 1114 struct dupreq *dr_chain;
1092 1115 struct dupreq *dr_prevchain;
1093 1116 };
1094 1117
1095 1118 /*
1096 1119 * The fixedtime state is defined if we want to expand the routines to
1097 1120 * handle and encompass fixed size caches.
1098 1121 */
1099 1122 #define DUPCACHE_FIXEDTIME 0
1100 1123
1101 1124 /*
1102 1125 * States of requests for duplicate request caching.
1103 1126 * These are the same as defined for the kernel.
1104 1127 */
1105 1128 #define DUP_NEW 0x00 /* new entry */
1106 1129 #define DUP_INPROGRESS 0x01 /* request already going */
1107 1130 #define DUP_DONE 0x02 /* request done */
1108 1131 #define DUP_DROP 0x03 /* request dropped */
1109 1132 #define DUP_ERROR 0x04 /* error in dup req cache */
1110 1133
1111 1134 #ifdef __STDC__
1112 1135 extern bool_t __svc_dupcache_init(void *, int, char **);
1113 1136 extern int __svc_dup(struct svc_req *, caddr_t *, uint_t *, char *);
1114 1137 extern int __svc_dupdone(struct svc_req *, caddr_t, uint_t, int, char *);
1115 1138 extern bool_t __svc_vc_dupcache_init(SVCXPRT *, void *, int);
1116 1139 extern int __svc_vc_dup(struct svc_req *, caddr_t *, uint_t *);
1117 1140 extern int __svc_vc_dupdone(struct svc_req *, caddr_t, uint_t, int);
1118 1141 #else
1119 1142 extern bool_t __svc_dupcache_init();
1120 1143 extern int __svc_dup();
1121 1144 extern int __svc_dupdone();
1122 1145 extern bool_t __svc_vc_dupcache_init();
1123 1146 extern int __svc_vc_dup();
1124 1147 extern int __svc_vc_dupdone();
1125 1148 #endif /* __STDC__ */
1126 1149 #endif /* _KERNEL */
1127 1150
1128 1151 #ifdef _KERNEL
1129 1152 /*
1130 1153 * Private interfaces and structures for SVCXPRT cloning.
1131 1154 * The interfaces and data structures are not committed and subject to
1132 1155 * change in future releases.
1133 1156 */
1134 1157 extern SVCXPRT *svc_clone_init(void);
1135 1158 extern void svc_clone_free(SVCXPRT *);
1136 1159 extern void svc_clone_link(SVCMASTERXPRT *, SVCXPRT *, SVCXPRT *);
1137 1160 extern void svc_clone_unlink(SVCXPRT *);
1138 1161 #endif /* _KERNEL */
1139 1162
1140 1163 #ifdef __cplusplus
1141 1164 }
1142 1165 #endif
1143 1166
1144 1167 #endif /* !_RPC_SVC_H */
|
↓ open down ↓ |
138 lines elided |
↑ open up ↑ |
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX