1 /* 2 * Please do not edit this file. 3 * It was generated using rpcgen. 4 */ 5 6 #include "smed.h" 7 #include <stdio.h> 8 #include <stdlib.h> /* getenv, exit */ 9 #include <signal.h> 10 #include <sys/types.h> 11 #include <memory.h> 12 #include <stropts.h> 13 #include <sys/resource.h> /* rlimit */ 14 #include <syslog.h> 15 16 #ifdef DEBUG 17 #define RPC_SVC_FG 18 #endif 19 20 #define _RPCSVC_CLOSEDOWN 120 21 /* 22 * Copyright 2005 Sun Microsystems, Inc. All rights reserved. 23 * Use is subject to license terms. 24 * 25 * CDDL HEADER START 26 * 27 * The contents of this file are subject to the terms of the 28 * Common Development and Distribution License, Version 1.0 only 29 * (the "License"). You may not use this file except in compliance 30 * with the License. 31 * 32 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 33 * or http://www.opensolaris.org/os/licensing. 34 * See the License for the specific language governing permissions 35 * and limitations under the License. 36 * 37 * When distributing Covered Code, include this CDDL HEADER in each 38 * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 39 * If applicable, add the following below this CDDL HEADER, with the 40 * fields enclosed by brackets "[]" replaced with your own identifying 41 * information: Portions Copyright [yyyy] [name of copyright owner] 42 * 43 * CDDL HEADER END 44 */ 45 /* from smed.x */ 46 extern int _rpcpmstart; /* Started by a port monitor ? */ 47 48 /* States a server can be in wrt request */ 49 50 #define _IDLE 0 51 #define _SERVED 1 52 53 /* LINTED static unused if no main */ 54 static int _rpcsvcstate = _IDLE; /* Set when a request is serviced */ 55 static int _rpcsvccount = 0; /* Number of requests being serviced */ 56 57 #if defined(RPC_MSGOUT) 58 extern void RPC_MSGOUT(); 59 #else /* defined(RPC_MSGOUT) */ 60 static void 61 RPC_MSGOUT(fmt, msg) 62 char *fmt; 63 char *msg; 64 { 65 #ifdef RPC_SVC_FG 66 if (_rpcpmstart) 67 syslog(LOG_ERR, fmt, msg); 68 else { 69 (void) fprintf(stderr, fmt, msg); 70 (void) putc('\n', stderr); 71 } 72 #else 73 syslog(LOG_ERR, fmt, msg); 74 #endif 75 } 76 #endif /* defined(RPC_MSGOUT) */ 77 78 void 79 smserverprog_1(rqstp, transp) 80 struct svc_req *rqstp; 81 register SVCXPRT *transp; 82 { 83 union { 84 int fill; 85 } argument; 86 char *result; 87 bool_t (*_xdr_argument)(), (*_xdr_result)(); 88 char *(*local)(); 89 90 _rpcsvccount++; 91 switch (rqstp->rq_proc) { 92 case NULLPROC: 93 (void) svc_sendreply(transp, xdr_void, 94 NULL); 95 _rpcsvccount--; 96 _rpcsvcstate = _SERVED; 97 return; /* CSTYLED */ 98 99 case SMSERVERPROC_GET_SERVERINFO: 100 _xdr_argument = xdr_void; 101 _xdr_result = xdr_smserver_info; 102 local = (char *(*)()) 103 smserverproc_get_serverinfo_1; 104 break; 105 106 default: 107 svcerr_noproc(transp); 108 _rpcsvccount--; 109 _rpcsvcstate = _SERVED; 110 return; /* CSTYLED */ 111 } 112 (void) memset((char *)&argument, 0, sizeof (argument)); 113 if (!svc_getargs(transp, _xdr_argument, (caddr_t)&argument)) { 114 svcerr_decode(transp); 115 _rpcsvccount--; 116 _rpcsvcstate = _SERVED; 117 return; /* CSTYLED */ 118 } 119 result = (*local)(&argument, rqstp); 120 if (_xdr_result && result != NULL && 121 !svc_sendreply(transp, _xdr_result, result)) { 122 svcerr_systemerr(transp); 123 } 124 if (!svc_freeargs(transp, _xdr_argument, (caddr_t)&argument)) { 125 RPC_MSGOUT("%s", 126 "unable to free arguments"); 127 exit(1); 128 } 129 _rpcsvccount--; 130 _rpcsvcstate = _SERVED; 131 return; /* CSTYLED */ 132 } 133