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