GCC Code Coverage Report
Directory: ./ Exec Total Coverage
File: usr.sbin/rpc.statd/sm_inter_svc.c Lines: 0 28 0.0 %
Date: 2017-11-07 Branches: 0 16 0.0 %

Line Branch Exec Source
1
/*
2
 * Please do not edit this file.
3
 * It was generated using rpcgen.
4
 */
5
6
#include "sm_inter.h"
7
#include <unistd.h>
8
#include <stdio.h>
9
#include <stdlib.h>/* getenv, exit */
10
#include <rpc/pmap_clnt.h> /* for pmap_unset */
11
#include <string.h> /* strcmp */
12
#include <netdb.h>
13
#include <signal.h>
14
#include <sys/ttycom.h>/* TIOCNOTTY */
15
#ifdef __cplusplus
16
#include <sysent.h> /* getdtablesize, open */
17
#endif /* __cplusplus */
18
#include <memory.h>
19
#include <sys/socket.h>
20
#include <netinet/in.h>
21
#include <syslog.h>
22
#include <errno.h>
23
24
#ifdef __STDC__
25
#define SIG_PF void(*)(int)
26
#endif
27
28
#ifdef DEBUG
29
#define RPC_SVC_FG
30
#endif
31
32
#define _RPCSVC_CLOSEDOWN 120
33
extern int _rpcpmstart;		/* Started by a port monitor ? */
34
extern int _rpcfdtype;		/* Whether Stream or Datagram ? */
35
extern int _rpcsvcdirty;	/* Still serving ? */
36
37
void	sm_prog_1(struct svc_req *rqstp, SVCXPRT *transp);
38
39
void
40
sm_prog_1(struct svc_req *rqstp, SVCXPRT *transp)
41
{
42
	union {
43
		struct sm_name sm_stat_1_arg;
44
		struct mon sm_mon_1_arg;
45
		struct mon_id sm_unmon_1_arg;
46
		struct my_id sm_unmon_all_1_arg;
47
		struct stat_chge sm_notify_1_arg;
48
	} argument;
49
	char *result;
50
	xdrproc_t xdr_argument, xdr_result;
51
	char *(*local)(char *, struct svc_req *);
52
53
	_rpcsvcdirty = 1;
54
	switch (rqstp->rq_proc) {
55
	case NULLPROC:
56
		(void) svc_sendreply(transp, (xdrproc_t) xdr_void, (char *)NULL);
57
		_rpcsvcdirty = 0;
58
		return;
59
60
	case SM_STAT:
61
		xdr_argument = (xdrproc_t) xdr_sm_name;
62
		xdr_result = (xdrproc_t) xdr_sm_stat_res;
63
		local = (char *(*)(char *, struct svc_req *)) sm_stat_1_svc;
64
		break;
65
66
	case SM_MON:
67
		xdr_argument = (xdrproc_t) xdr_mon;
68
		xdr_result = (xdrproc_t) xdr_sm_stat_res;
69
		local = (char *(*)(char *, struct svc_req *)) sm_mon_1_svc;
70
		break;
71
72
	case SM_UNMON:
73
		xdr_argument = (xdrproc_t) xdr_mon_id;
74
		xdr_result = (xdrproc_t) xdr_sm_stat;
75
		local = (char *(*)(char *, struct svc_req *)) sm_unmon_1_svc;
76
		break;
77
78
	case SM_UNMON_ALL:
79
		xdr_argument = (xdrproc_t) xdr_my_id;
80
		xdr_result = (xdrproc_t) xdr_sm_stat;
81
		local = (char *(*)(char *, struct svc_req *)) sm_unmon_all_1_svc;
82
		break;
83
84
	case SM_SIMU_CRASH:
85
		xdr_argument = (xdrproc_t) xdr_void;
86
		xdr_result = (xdrproc_t) xdr_void;
87
		local = (char *(*)(char *, struct svc_req *)) sm_simu_crash_1_svc;
88
		break;
89
90
	case SM_NOTIFY:
91
		xdr_argument = (xdrproc_t) xdr_stat_chge;
92
		xdr_result = (xdrproc_t) xdr_void;
93
		local = (char *(*)(char *, struct svc_req *)) sm_notify_1_svc;
94
		break;
95
96
	default:
97
		svcerr_noproc(transp);
98
		_rpcsvcdirty = 0;
99
		return;
100
	}
101
	(void) memset((char *)&argument, 0, sizeof (argument));
102
	if (!svc_getargs(transp, xdr_argument, (caddr_t) &argument)) {
103
		svcerr_decode(transp);
104
		_rpcsvcdirty = 0;
105
		return;
106
	}
107
	result = (*local)((char *)&argument, rqstp);
108
	if (result != NULL && !svc_sendreply(transp, xdr_result, result)) {
109
		svcerr_systemerr(transp);
110
	}
111
	if (!svc_freeargs(transp, xdr_argument, (caddr_t) &argument)) {
112
		syslog(LOG_ERR, "%s", "unable to free arguments");
113
		exit(1);
114
	}
115
	_rpcsvcdirty = 0;
116
	return;
117
}