1/*
2 * Copyright (c) 2002-2004 Apple Computer, Inc.  All rights reserved.
3 *
4 * @APPLE_LICENSE_HEADER_START@
5 *
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. Please obtain a copy of the License at
10 * http://www.opensource.apple.com/apsl/ and read it before using this
11 * file.
12 *
13 * The Original Code and all software distributed under the License are
14 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
15 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
16 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
18 * Please see the License for the specific language governing rights and
19 * limitations under the License.
20 *
21 * @APPLE_LICENSE_HEADER_END@
22 */
23/*
24 * Please do not edit this file.
25 * It was generated using rpcgen.
26 * (and subsequently cleaned up by hand)
27 */
28
29#include "nlm_prot.h"
30#include <sys/ioctl.h>
31#include <fcntl.h>
32#include <stdio.h>
33#include <stdlib.h>
34#include <unistd.h>
35#include <oncrpc/pmap_clnt.h>
36#include <string.h>
37#include <netdb.h>
38#include <signal.h>
39#include <sys/ttycom.h>
40#ifdef __cplusplus
41#include <sysent.h>
42#endif /* __cplusplus */
43#include <memory.h>
44#include <sys/socket.h>
45#include <netinet/in.h>
46#include <syslog.h>
47
48#ifdef __STDC__
49#define SIG_PF void(*)(int)
50#endif
51
52#ifdef DEBUG
53#define RPC_SVC_FG
54#endif
55
56// XXX
57void retry_blockingfilelocklist(netobj *fh);
58extern int need_retry_blocked_locks; /* need to call retry_blockingfilelocklist() */
59
60#define _RPCSVC_CLOSEDOWN 120
61#ifndef lint
62/*static char sccsid[] = "from: @(#)nlm_prot.x 1.8 87/09/21 Copyr 1987 Sun Micro";*/
63/*static char sccsid[] = "from: * @(#)nlm_prot.x	2.1 88/08/01 4.0 RPCSRC";*/
64__unused static char rcsid[] = "$Id: nlm_prot_svc.c,v 1.6 2006/02/07 06:22:32 lindak Exp $";
65#endif /* not lint */
66extern int _rpcpmstart;		/* Started by a port monitor ? */
67extern int _rpcfdtype;		/* Whether Stream or Datagram ? */
68extern int _rpcsvcdirty;	/* Still serving ? */
69
70void nlm_prog_0(struct svc_req *rqstp, SVCXPRT *transp);
71
72void
73nlm_prog_0(struct svc_req *rqstp, SVCXPRT *transp)
74{
75	union {
76		struct nlm_sm_status nlm_sm_notify_0_arg;
77	} argument;
78	char *result;
79	xdrproc_t xdr_argument, xdr_result;
80	char *(*local)(char *, struct svc_req *);
81
82	_rpcsvcdirty = 1;
83	switch (rqstp->rq_proc) {
84	case NULLPROC:
85		(void) svc_sendreply(transp, (xdrproc_t) xdr_void, (char *)NULL);
86		_rpcsvcdirty = 0;
87		return;
88
89	case NLM_SM_NOTIFY:
90		xdr_argument = (xdrproc_t) xdr_nlm_sm_status;
91		xdr_result = (xdrproc_t) xdr_void;
92		local = (char *(*)(char *, struct svc_req *)) nlm_sm_notify_0_svc;
93		break;
94
95	default:
96		svcerr_noproc(transp);
97		_rpcsvcdirty = 0;
98		return;
99	}
100	(void) memset((char *)&argument, 0, sizeof (argument));
101	if (!svc_getargs(transp, xdr_argument, (caddr_t) &argument)) {
102		svcerr_decode(transp);
103		_rpcsvcdirty = 0;
104		return;
105	}
106	result = (*local)((char *)&argument, rqstp);
107	if (result != NULL && !svc_sendreply(transp, xdr_result, result)) {
108		svcerr_systemerr(transp);
109	}
110	if (!svc_freeargs(transp, xdr_argument, (caddr_t) &argument)) {
111		syslog(LOG_ERR, "unable to free arguments");
112		exit(1);
113	}
114	_rpcsvcdirty = 0;
115	return;
116}
117
118void nlm_prog_1(struct svc_req *rqstp, SVCXPRT *transp);
119
120void
121nlm_prog_1(struct svc_req *rqstp, SVCXPRT *transp)
122{
123	union {
124		struct nlm_testargs nlm_test_1_arg;
125		struct nlm_lockargs nlm_lock_1_arg;
126		struct nlm_cancargs nlm_cancel_1_arg;
127		struct nlm_unlockargs nlm_unlock_1_arg;
128		struct nlm_testargs nlm_granted_1_arg;
129		struct nlm_testargs nlm_test_msg_1_arg;
130		struct nlm_lockargs nlm_lock_msg_1_arg;
131		struct nlm_cancargs nlm_cancel_msg_1_arg;
132		struct nlm_unlockargs nlm_unlock_msg_1_arg;
133		struct nlm_testargs nlm_granted_msg_1_arg;
134		nlm_testres nlm_test_res_1_arg;
135		nlm_res nlm_lock_res_1_arg;
136		nlm_res nlm_cancel_res_1_arg;
137		nlm_res nlm_unlock_res_1_arg;
138		nlm_res nlm_granted_res_1_arg;
139	} argument;
140	char *result;
141	xdrproc_t xdr_argument, xdr_result;
142	char *(*local)(char *, struct svc_req *);
143
144	_rpcsvcdirty = 1;
145	switch (rqstp->rq_proc) {
146	case NULLPROC:
147		(void) svc_sendreply(transp, (xdrproc_t) xdr_void, (char *)NULL);
148		_rpcsvcdirty = 0;
149		return;
150
151	case NLM_TEST:
152		xdr_argument = (xdrproc_t) xdr_nlm_testargs;
153		xdr_result = (xdrproc_t) xdr_nlm_testres;
154		local = (char *(*)(char *, struct svc_req *)) nlm_test_1_svc;
155		break;
156
157	case NLM_LOCK:
158		xdr_argument = (xdrproc_t) xdr_nlm_lockargs;
159		xdr_result = (xdrproc_t) xdr_nlm_res;
160		local = (char *(*)(char *, struct svc_req *)) nlm_lock_1_svc;
161		break;
162
163	case NLM_CANCEL:
164		xdr_argument = (xdrproc_t) xdr_nlm_cancargs;
165		xdr_result = (xdrproc_t) xdr_nlm_res;
166		local = (char *(*)(char *, struct svc_req *)) nlm_cancel_1_svc;
167		break;
168
169	case NLM_UNLOCK:
170		xdr_argument = (xdrproc_t) xdr_nlm_unlockargs;
171		xdr_result = (xdrproc_t) xdr_nlm_res;
172		local = (char *(*)(char *, struct svc_req *)) nlm_unlock_1_svc;
173		break;
174
175	case NLM_GRANTED:
176		xdr_argument = (xdrproc_t) xdr_nlm_testargs;
177		xdr_result = (xdrproc_t) xdr_nlm_res;
178		local = (char *(*)(char *, struct svc_req *)) nlm_granted_1_svc;
179		break;
180
181	case NLM_TEST_MSG:
182		xdr_argument = (xdrproc_t) xdr_nlm_testargs;
183		xdr_result = (xdrproc_t) xdr_void;
184		local = (char *(*)(char *, struct svc_req *)) nlm_test_msg_1_svc;
185		break;
186
187	case NLM_LOCK_MSG:
188		xdr_argument = (xdrproc_t) xdr_nlm_lockargs;
189		xdr_result = (xdrproc_t) xdr_void;
190		local = (char *(*)(char *, struct svc_req *)) nlm_lock_msg_1_svc;
191		break;
192
193	case NLM_CANCEL_MSG:
194		xdr_argument = (xdrproc_t) xdr_nlm_cancargs;
195		xdr_result = (xdrproc_t) xdr_void;
196		local = (char *(*)(char *, struct svc_req *)) nlm_cancel_msg_1_svc;
197		break;
198
199	case NLM_UNLOCK_MSG:
200		xdr_argument = (xdrproc_t) xdr_nlm_unlockargs;
201		xdr_result = (xdrproc_t) xdr_void;
202		local = (char *(*)(char *, struct svc_req *)) nlm_unlock_msg_1_svc;
203		break;
204
205	case NLM_GRANTED_MSG:
206		xdr_argument = (xdrproc_t) xdr_nlm_testargs;
207		xdr_result = (xdrproc_t) xdr_void;
208		local = (char *(*)(char *, struct svc_req *)) nlm_granted_msg_1_svc;
209		break;
210
211	case NLM_TEST_RES:
212		xdr_argument = (xdrproc_t) xdr_nlm_testres;
213		xdr_result = (xdrproc_t) xdr_void;
214		local = (char *(*)(char *, struct svc_req *)) nlm_test_res_1_svc;
215		break;
216
217	case NLM_LOCK_RES:
218		xdr_argument = (xdrproc_t) xdr_nlm_res;
219		xdr_result = (xdrproc_t) xdr_void;
220		local = (char *(*)(char *, struct svc_req *)) nlm_lock_res_1_svc;
221		break;
222
223	case NLM_CANCEL_RES:
224		xdr_argument = (xdrproc_t) xdr_nlm_res;
225		xdr_result = (xdrproc_t) xdr_void;
226		local = (char *(*)(char *, struct svc_req *)) nlm_cancel_res_1_svc;
227		break;
228
229	case NLM_UNLOCK_RES:
230		xdr_argument = (xdrproc_t) xdr_nlm_res;
231		xdr_result = (xdrproc_t) xdr_void;
232		local = (char *(*)(char *, struct svc_req *)) nlm_unlock_res_1_svc;
233		break;
234
235	case NLM_GRANTED_RES:
236		xdr_argument = (xdrproc_t) xdr_nlm_res;
237		xdr_result = (xdrproc_t) xdr_void;
238		local = (char *(*)(char *, struct svc_req *)) nlm_granted_res_1_svc;
239		break;
240
241	default:
242		svcerr_noproc(transp);
243		_rpcsvcdirty = 0;
244		return;
245	}
246	(void) memset((char *)&argument, 0, sizeof (argument));
247	if (!svc_getargs(transp, xdr_argument, (caddr_t) &argument)) {
248		svcerr_decode(transp);
249		_rpcsvcdirty = 0;
250		return;
251	}
252	result = (*local)((char *)&argument, rqstp);
253	if (result != NULL && !svc_sendreply(transp, xdr_result, result)) {
254		svcerr_systemerr(transp);
255	}
256	if (need_retry_blocked_locks) {
257		// XXX sending granted messages before unlock response
258		// XXX causes unlock response to be corrupted?
259		// XXX so do this after we send any response
260		netobj *fh = NULL;
261		if ((local == (char *(*)(char *, struct svc_req *)) nlm_unlock_1_svc) ||
262		    (local == (char *(*)(char *, struct svc_req *)) nlm_unlock_msg_1_svc))
263			fh = &argument.nlm_unlock_1_arg.alock.fh;
264		retry_blockingfilelocklist(fh);
265	}
266	if (!svc_freeargs(transp, xdr_argument, (caddr_t) &argument)) {
267		syslog(LOG_ERR, "unable to free arguments");
268		exit(1);
269	}
270	_rpcsvcdirty = 0;
271	return;
272}
273
274void nlm_prog_3(struct svc_req *rqstp, SVCXPRT *transp);
275
276void
277nlm_prog_3(struct svc_req *rqstp, SVCXPRT *transp)
278{
279	union {
280		struct nlm_testargs nlm_test_3_arg;
281		struct nlm_lockargs nlm_lock_3_arg;
282		struct nlm_cancargs nlm_cancel_3_arg;
283		struct nlm_unlockargs nlm_unlock_3_arg;
284		struct nlm_testargs nlm_granted_3_arg;
285		struct nlm_testargs nlm_test_msg_3_arg;
286		struct nlm_lockargs nlm_lock_msg_3_arg;
287		struct nlm_cancargs nlm_cancel_msg_3_arg;
288		struct nlm_unlockargs nlm_unlock_msg_3_arg;
289		struct nlm_testargs nlm_granted_msg_3_arg;
290		nlm_testres nlm_test_res_3_arg;
291		nlm_res nlm_lock_res_3_arg;
292		nlm_res nlm_cancel_res_3_arg;
293		nlm_res nlm_unlock_res_3_arg;
294		nlm_res nlm_granted_res_3_arg;
295		nlm_shareargs nlm_share_3_arg;
296		nlm_shareargs nlm_unshare_3_arg;
297		nlm_lockargs nlm_nm_lock_3_arg;
298		nlm_notify nlm_free_all_3_arg;
299	} argument;
300	char *result;
301 	xdrproc_t xdr_argument, xdr_result;
302 	char *(*local)(char *, struct svc_req *);
303
304	_rpcsvcdirty = 1;
305	switch (rqstp->rq_proc) {
306	case NULLPROC:
307 		(void) svc_sendreply(transp, (xdrproc_t) xdr_void, (char *)NULL);
308		_rpcsvcdirty = 0;
309		return;
310
311	case NLM_TEST:
312		xdr_argument = (xdrproc_t) xdr_nlm_testargs;
313		xdr_result = (xdrproc_t) xdr_nlm_testres;
314		local = (char *(*)(char *, struct svc_req *)) nlm_test_1_svc;
315		break;
316
317	case NLM_LOCK:
318		xdr_argument = (xdrproc_t) xdr_nlm_lockargs;
319		xdr_result = (xdrproc_t) xdr_nlm_res;
320		local = (char *(*)(char *, struct svc_req *)) nlm_lock_1_svc;
321		break;
322
323	case NLM_CANCEL:
324		xdr_argument = (xdrproc_t) xdr_nlm_cancargs;
325		xdr_result = (xdrproc_t) xdr_nlm_res;
326		local = (char *(*)(char *, struct svc_req *)) nlm_cancel_1_svc;
327		break;
328
329	case NLM_UNLOCK:
330		xdr_argument = (xdrproc_t) xdr_nlm_unlockargs;
331		xdr_result = (xdrproc_t) xdr_nlm_res;
332		local = (char *(*)(char *, struct svc_req *)) nlm_unlock_1_svc;
333		break;
334
335	case NLM_GRANTED:
336		xdr_argument = (xdrproc_t) xdr_nlm_testargs;
337		xdr_result = (xdrproc_t) xdr_nlm_res;
338		local = (char *(*)(char *, struct svc_req *)) nlm_granted_1_svc;
339		break;
340
341	case NLM_TEST_MSG:
342		xdr_argument = (xdrproc_t) xdr_nlm_testargs;
343		xdr_result = (xdrproc_t) xdr_void;
344		local = (char *(*)(char *, struct svc_req *)) nlm_test_msg_1_svc;
345		break;
346
347	case NLM_LOCK_MSG:
348		xdr_argument = (xdrproc_t) xdr_nlm_lockargs;
349		xdr_result = (xdrproc_t) xdr_void;
350		local = (char *(*)(char *, struct svc_req *)) nlm_lock_msg_1_svc;
351		break;
352
353	case NLM_CANCEL_MSG:
354		xdr_argument = (xdrproc_t) xdr_nlm_cancargs;
355		xdr_result = (xdrproc_t) xdr_void;
356		local = (char *(*)(char *, struct svc_req *)) nlm_cancel_msg_1_svc;
357		break;
358
359	case NLM_UNLOCK_MSG:
360		xdr_argument = (xdrproc_t) xdr_nlm_unlockargs;
361		xdr_result = (xdrproc_t) xdr_void;
362		local = (char *(*)(char *, struct svc_req *)) nlm_unlock_msg_1_svc;
363		break;
364
365	case NLM_GRANTED_MSG:
366		xdr_argument = (xdrproc_t) xdr_nlm_testargs;
367		xdr_result = (xdrproc_t) xdr_void;
368		local = (char *(*)(char *, struct svc_req *)) nlm_granted_msg_1_svc;
369		break;
370
371	case NLM_TEST_RES:
372		xdr_argument = (xdrproc_t) xdr_nlm_testres;
373		xdr_result = (xdrproc_t) xdr_void;
374		local = (char *(*)(char *, struct svc_req *)) nlm_test_res_1_svc;
375		break;
376
377	case NLM_LOCK_RES:
378		xdr_argument = (xdrproc_t) xdr_nlm_res;
379		xdr_result = (xdrproc_t) xdr_void;
380		local = (char *(*)(char *, struct svc_req *)) nlm_lock_res_1_svc;
381		break;
382
383	case NLM_CANCEL_RES:
384		xdr_argument = (xdrproc_t) xdr_nlm_res;
385		xdr_result = (xdrproc_t) xdr_void;
386		local = (char *(*)(char *, struct svc_req *)) nlm_cancel_res_1_svc;
387		break;
388
389	case NLM_UNLOCK_RES:
390		xdr_argument = (xdrproc_t) xdr_nlm_res;
391		xdr_result = (xdrproc_t) xdr_void;
392		local = (char *(*)(char *, struct svc_req *)) nlm_unlock_res_1_svc;
393		break;
394
395	case NLM_GRANTED_RES:
396		xdr_argument = (xdrproc_t) xdr_nlm_res;
397		xdr_result = (xdrproc_t) xdr_void;
398		local = (char *(*)(char *, struct svc_req *)) nlm_granted_res_1_svc;
399		break;
400
401	case NLM_SHARE:
402 		xdr_argument = (xdrproc_t) xdr_nlm_shareargs;
403 		xdr_result = (xdrproc_t) xdr_nlm_shareres;
404 		local = (char *(*)(char *, struct svc_req *)) nlm_share_3_svc;
405		break;
406
407	case NLM_UNSHARE:
408		xdr_argument = (xdrproc_t) xdr_nlm_shareargs;
409		xdr_result = (xdrproc_t) xdr_nlm_shareres;
410		local = (char *(*)(char *, struct svc_req *)) nlm_unshare_3_svc;
411		break;
412
413	case NLM_NM_LOCK:
414		xdr_argument = (xdrproc_t) xdr_nlm_lockargs;
415		xdr_result = (xdrproc_t) xdr_nlm_res;
416		local = (char *(*)(char *, struct svc_req *)) nlm_nm_lock_3_svc;
417		break;
418
419	case NLM_FREE_ALL:
420		xdr_argument = (xdrproc_t) xdr_nlm_notify;
421		xdr_result = (xdrproc_t) xdr_void;
422		local = (char *(*)(char *, struct svc_req *)) nlm_free_all_3_svc;
423		break;
424
425	default:
426		svcerr_noproc(transp);
427		_rpcsvcdirty = 0;
428		return;
429	}
430	(void) memset((char *)&argument, 0, sizeof (argument));
431	if (!svc_getargs(transp, xdr_argument, (caddr_t) &argument)) {
432		svcerr_decode(transp);
433		_rpcsvcdirty = 0;
434		return;
435	}
436	result = (*local)((char *)&argument, rqstp);
437	if (result != NULL && !svc_sendreply(transp, xdr_result, result)) {
438		svcerr_systemerr(transp);
439	}
440	if (need_retry_blocked_locks) {
441		// XXX sending granted messages before unlock response
442		// XXX causes unlock response to be corrupted?
443		// XXX so do this after we send any response
444		netobj *fh = NULL;
445		if ((local == (char *(*)(char *, struct svc_req *)) nlm_unlock_1_svc) ||
446		    (local == (char *(*)(char *, struct svc_req *)) nlm_unlock_msg_1_svc))
447			fh = &argument.nlm_unlock_3_arg.alock.fh;
448		retry_blockingfilelocklist(fh);
449	}
450	if (!svc_freeargs(transp, xdr_argument, (caddr_t) &argument)) {
451		syslog(LOG_ERR, "unable to free arguments");
452		exit(1);
453	}
454	_rpcsvcdirty = 0;
455	return;
456}
457
458void nlm_prog_4(struct svc_req *rqstp, SVCXPRT *transp);
459
460void
461nlm_prog_4(struct svc_req *rqstp, SVCXPRT *transp)
462{
463	union {
464		nlm4_testargs nlm4_test_4_arg;
465		nlm4_lockargs nlm4_lock_4_arg;
466		nlm4_cancargs nlm4_cancel_4_arg;
467		nlm4_unlockargs nlm4_unlock_4_arg;
468		nlm4_testargs nlm4_granted_4_arg;
469		nlm4_testargs nlm4_test_msg_4_arg;
470		nlm4_lockargs nlm4_lock_msg_4_arg;
471		nlm4_cancargs nlm4_cancel_msg_4_arg;
472		nlm4_unlockargs nlm4_unlock_msg_4_arg;
473		nlm4_testargs nlm4_granted_msg_4_arg;
474		nlm4_testres nlm4_test_res_4_arg;
475		nlm4_res nlm4_lock_res_4_arg;
476		nlm4_res nlm4_cancel_res_4_arg;
477		nlm4_res nlm4_unlock_res_4_arg;
478		nlm4_res nlm4_granted_res_4_arg;
479		nlm4_shareargs nlm4_share_4_arg;
480		nlm4_shareargs nlm4_unshare_4_arg;
481		nlm4_lockargs nlm4_nm_lock_4_arg;
482		nlm4_notify nlm4_free_all_4_arg;
483	} argument;
484	char *result;
485	xdrproc_t xdr_argument, xdr_result;
486	char *(*local)(char *, struct svc_req *);
487
488	_rpcsvcdirty = 1;
489	switch (rqstp->rq_proc) {
490	case NULLPROC:
491		(void) svc_sendreply(transp, (xdrproc_t) xdr_void, (char *)NULL);
492		_rpcsvcdirty = 0;
493		return;
494
495	case NLM4_TEST:
496		xdr_argument = (xdrproc_t) xdr_nlm4_testargs;
497		xdr_result = (xdrproc_t) xdr_nlm4_testres;
498		local = (char *(*)(char *, struct svc_req *)) nlm4_test_4_svc;
499		break;
500
501	case NLM4_LOCK:
502		xdr_argument = (xdrproc_t) xdr_nlm4_lockargs;
503		xdr_result = (xdrproc_t) xdr_nlm4_res;
504		local = (char *(*)(char *, struct svc_req *)) nlm4_lock_4_svc;
505		break;
506
507	case NLM4_CANCEL:
508		xdr_argument = (xdrproc_t) xdr_nlm4_cancargs;
509		xdr_result = (xdrproc_t) xdr_nlm4_res;
510		local = (char *(*)(char *, struct svc_req *)) nlm4_cancel_4_svc;
511		break;
512
513	case NLM4_UNLOCK:
514		xdr_argument = (xdrproc_t) xdr_nlm4_unlockargs;
515		xdr_result = (xdrproc_t) xdr_nlm4_res;
516		local = (char *(*)(char *, struct svc_req *)) nlm4_unlock_4_svc;
517		break;
518
519	case NLM4_GRANTED:
520		xdr_argument = (xdrproc_t) xdr_nlm4_testargs;
521		xdr_result = (xdrproc_t) xdr_nlm4_res;
522		local = (char *(*)(char *, struct svc_req *)) nlm4_granted_4_svc;
523		break;
524
525	case NLM4_TEST_MSG:
526		xdr_argument = (xdrproc_t) xdr_nlm4_testargs;
527		xdr_result = (xdrproc_t) xdr_void;
528		local = (char *(*)(char *, struct svc_req *)) nlm4_test_msg_4_svc;
529		break;
530
531	case NLM4_LOCK_MSG:
532		xdr_argument = (xdrproc_t) xdr_nlm4_lockargs;
533		xdr_result = (xdrproc_t) xdr_void;
534		local = (char *(*)(char *, struct svc_req *)) nlm4_lock_msg_4_svc;
535		break;
536
537	case NLM4_CANCEL_MSG:
538		xdr_argument = (xdrproc_t) xdr_nlm4_cancargs;
539		xdr_result = (xdrproc_t) xdr_void;
540		local = (char *(*)(char *, struct svc_req *)) nlm4_cancel_msg_4_svc;
541		break;
542
543	case NLM4_UNLOCK_MSG:
544		xdr_argument = (xdrproc_t) xdr_nlm4_unlockargs;
545		xdr_result = (xdrproc_t) xdr_void;
546		local = (char *(*)(char *, struct svc_req *)) nlm4_unlock_msg_4_svc;
547		break;
548
549	case NLM4_GRANTED_MSG:
550		xdr_argument = (xdrproc_t) xdr_nlm4_testargs;
551		xdr_result = (xdrproc_t) xdr_void;
552		local = (char *(*)(char *, struct svc_req *)) nlm4_granted_msg_4_svc;
553		break;
554
555	case NLM4_TEST_RES:
556		xdr_argument = (xdrproc_t) xdr_nlm4_testres;
557		xdr_result = (xdrproc_t) xdr_void;
558		local = (char *(*)(char *, struct svc_req *)) nlm4_test_res_4_svc;
559		break;
560
561	case NLM4_LOCK_RES:
562		xdr_argument = (xdrproc_t) xdr_nlm4_res;
563		xdr_result = (xdrproc_t) xdr_void;
564		local = (char *(*)(char *, struct svc_req *)) nlm4_lock_res_4_svc;
565		break;
566
567	case NLM4_CANCEL_RES:
568		xdr_argument = (xdrproc_t) xdr_nlm4_res;
569		xdr_result = (xdrproc_t) xdr_void;
570		local = (char *(*)(char *, struct svc_req *)) nlm4_cancel_res_4_svc;
571		break;
572
573	case NLM4_UNLOCK_RES:
574		xdr_argument = (xdrproc_t) xdr_nlm4_res;
575		xdr_result = (xdrproc_t) xdr_void;
576		local = (char *(*)(char *, struct svc_req *)) nlm4_unlock_res_4_svc;
577		break;
578
579	case NLM4_GRANTED_RES:
580		xdr_argument = (xdrproc_t) xdr_nlm4_res;
581		xdr_result = (xdrproc_t) xdr_void;
582		local = (char *(*)(char *, struct svc_req *)) nlm4_granted_res_4_svc;
583		break;
584
585	case NLM4_SHARE:
586		xdr_argument = (xdrproc_t) xdr_nlm4_shareargs;
587		xdr_result = (xdrproc_t) xdr_nlm4_shareres;
588		local = (char *(*)(char *, struct svc_req *)) nlm4_share_4_svc;
589		break;
590
591	case NLM4_UNSHARE:
592		xdr_argument = (xdrproc_t) xdr_nlm4_shareargs;
593		xdr_result = (xdrproc_t) xdr_nlm4_shareres;
594		local = (char *(*)(char *, struct svc_req *)) nlm4_unshare_4_svc;
595		break;
596
597	case NLM4_NM_LOCK:
598		xdr_argument = (xdrproc_t) xdr_nlm4_lockargs;
599		xdr_result = (xdrproc_t) xdr_nlm4_res;
600		local = (char *(*)(char *, struct svc_req *)) nlm4_nm_lock_4_svc;
601		break;
602
603	case NLM4_FREE_ALL:
604		xdr_argument = (xdrproc_t) xdr_nlm4_notify;
605		xdr_result = (xdrproc_t) xdr_void;
606		local = (char *(*)(char *, struct svc_req *)) nlm4_free_all_4_svc;
607		break;
608
609	default:
610		svcerr_noproc(transp);
611		_rpcsvcdirty = 0;
612		return;
613	}
614	(void) memset((char *)&argument, 0, sizeof (argument));
615	if (!svc_getargs(transp, xdr_argument, (caddr_t) &argument)) {
616		svcerr_decode(transp);
617		_rpcsvcdirty = 0;
618		return;
619	}
620	result = (*local)((char *)&argument, rqstp);
621	if (result != NULL && !svc_sendreply(transp, xdr_result, result)) {
622		svcerr_systemerr(transp);
623	}
624	if (need_retry_blocked_locks) {
625		// XXX sending granted messages before unlock response
626		// XXX causes unlock response to be corrupted?
627		// XXX so do this after we send any response
628		netobj *fh = NULL;
629		if ((local == (char *(*)(char *, struct svc_req *)) nlm4_unlock_4_svc) ||
630		    (local == (char *(*)(char *, struct svc_req *)) nlm4_unlock_msg_4_svc))
631			fh = &argument.nlm4_unlock_4_arg.alock.fh;
632		retry_blockingfilelocklist(fh);
633	}
634	if (!svc_freeargs(transp, xdr_argument, (caddr_t) &argument)) {
635		syslog(LOG_ERR, "unable to free arguments");
636		exit(1);
637	}
638	_rpcsvcdirty = 0;
639	return;
640}
641