252 lines
6.4 KiB
HTML
252 lines
6.4 KiB
HTML
|
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
||
|
<html>
|
||
|
<head>
|
||
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||
|
<meta name="Copyright" content="Copyright (c) 2006 by IBM Corporation">
|
||
|
<title>svcerr_systemerr()--Send Information to Client for System Error</title>
|
||
|
<!-- All rights reserved. Licensed Materials Property of IBM -->
|
||
|
<!-- US Government Users Restricted Rights -->
|
||
|
<!-- Use, duplication or disclosure restricted by -->
|
||
|
<!-- GSA ADP Schedule Contract with IBM Corp. -->
|
||
|
<!-- Begin Header Records ========================================== -->
|
||
|
<!-- RPCMST SCRIPT A converted by B2H R4.1 (346) (CMS) by PMHALL at -->
|
||
|
<!-- RCHVMW2 on 7 Oct 1998 at 23:43:14 -->
|
||
|
<!-- Edited by Kersten Feb 02 -->
|
||
|
<!--End Header Records -->
|
||
|
<link rel="stylesheet" type="text/css" href="../rzahg/ic.css">
|
||
|
</head>
|
||
|
<body>
|
||
|
<a name="Top_Of_Page"></a>
|
||
|
<!-- Java sync-link -->
|
||
|
<script language="Javascript" src="../rzahg/synch.js" type="text/javascript">
|
||
|
</script>
|
||
|
|
||
|
<h2>svcerr_systemerr()--Send Information to Client for System Error</h2>
|
||
|
|
||
|
<div class="box" style="width: 60%;">
|
||
|
<br>
|
||
|
Syntax<br>
|
||
|
<!-- iddvc RMBR -->
|
||
|
<br>
|
||
|
<pre>
|
||
|
#include <rpc/rpc.h>
|
||
|
void svcerr_systemerr(const SVCXPRT *<em>xprt</em>);
|
||
|
</pre>
|
||
|
|
||
|
<br>
|
||
|
Service Program Name: QZNFTRPC<br>
|
||
|
<!-- iddvc RMBR -->
|
||
|
<br>
|
||
|
Default Public Authority: *USE<br>
|
||
|
<!-- iddvc RMBR -->
|
||
|
<br>
|
||
|
Threadsafe: No<br>
|
||
|
<!-- iddvc RMBR -->
|
||
|
<br>
|
||
|
</div>
|
||
|
|
||
|
<p>The <strong>svcerr_systemerr()</strong> function sends information to the
|
||
|
remote client that the service dispatch routine detected a system error not
|
||
|
covered by any particular protocol.</p>
|
||
|
|
||
|
<br>
|
||
|
|
||
|
|
||
|
<h3>Parameters</h3>
|
||
|
|
||
|
<dl>
|
||
|
<dt><strong>xprt</strong> (Input) </dt>
|
||
|
|
||
|
<dd>A pointer to the RPC service transport handle.</dd>
|
||
|
</dl>
|
||
|
|
||
|
<br>
|
||
|
|
||
|
|
||
|
<h3>Authorities</h3>
|
||
|
|
||
|
<p>No authorization is required.</p>
|
||
|
|
||
|
<br>
|
||
|
|
||
|
|
||
|
<h3>Return Value</h3>
|
||
|
|
||
|
<p>None.</p>
|
||
|
|
||
|
<br>
|
||
|
|
||
|
|
||
|
<h3>Error Conditions</h3>
|
||
|
|
||
|
<p>In case of an exception, the <em>errno</em> global variable is set to
|
||
|
EUNKNOWN.</p>
|
||
|
|
||
|
<br>
|
||
|
|
||
|
|
||
|
<h3>Error Messages</h3>
|
||
|
|
||
|
<table width="100%" cellpadding="5">
|
||
|
<tr>
|
||
|
<th align="left" valign="top">Message ID</th>
|
||
|
<th align="left" valign="top">Error Message Text</th>
|
||
|
</tr>
|
||
|
|
||
|
<tr>
|
||
|
<td width="15%" valign="top">CPF3CF2 E</td>
|
||
|
<td width="85%" valign="top">Error(s) occurred during running of &1
|
||
|
API.</td>
|
||
|
</tr>
|
||
|
|
||
|
<tr>
|
||
|
<td align="left" valign="top">CPF9872 E</td>
|
||
|
<td align="left" valign="top">Program or service program &1 in library &2 ended.
|
||
|
Reason code &3.</td>
|
||
|
</tr>
|
||
|
</table>
|
||
|
|
||
|
<br>
|
||
|
<br>
|
||
|
|
||
|
|
||
|
<h3>Example</h3>
|
||
|
|
||
|
<p>See <a href="../apiref/aboutapis.htm#codedisclaimer">Code disclaimer information</a>
|
||
|
for information pertaining to code examples.</p>
|
||
|
|
||
|
<p>The following example shows how <strong>svcerr_systemerr()</strong> is
|
||
|
used:</p>
|
||
|
|
||
|
<pre>
|
||
|
#include <stdio.h>
|
||
|
#include <stdlib.h> /* getenv, exit */
|
||
|
#include <rpc/rpc.h>
|
||
|
|
||
|
#define MESSAGEPROG ((unsigned long)(0x20000001))
|
||
|
#define PRINTMESSAGEVERS ((unsigned long)(1))
|
||
|
#define PRINTMESSAGE ((unsigned long)(1))
|
||
|
|
||
|
/* This procedure is called by dispatcher routine */
|
||
|
int *printmessage_l(char **msg, struct svc_req *req)
|
||
|
{
|
||
|
static int result;
|
||
|
char stffl30";
|
||
|
int fd;
|
||
|
|
||
|
/* Do something with *msg contents */
|
||
|
...
|
||
|
|
||
|
result = 1;
|
||
|
return(&result);
|
||
|
}
|
||
|
|
||
|
/* This is the server dispatcher routine.
|
||
|
It is called when a request arrives from client
|
||
|
and it applies to MESSAGEPROG program number and PRINTMESSAGEVERS
|
||
|
version number */
|
||
|
|
||
|
static void
|
||
|
messageprog_l(struct svc_req *rqstp, SVCXPRT *transp)
|
||
|
{
|
||
|
union u_argument{
|
||
|
char *printmessage_l_arg;
|
||
|
}argument;
|
||
|
char *result;
|
||
|
bool_t (*_xdr_argument)(), (*_xdr_result)();
|
||
|
char *(*local)(union u_argument *, struct svc_req *);
|
||
|
|
||
|
_rpcsvccount++;
|
||
|
switch(rqstp->rq_proc)
|
||
|
{
|
||
|
/* rqstp->rq_proc contains the procedure number
|
||
|
of procedure that should be called */
|
||
|
|
||
|
case NULLPROC: /* empty procedure, do nothing, just send the ack */
|
||
|
<strong>svc_sendreply</strong>(transp, (xdrproc_t)xdr_void, (char *)NULL);
|
||
|
return;
|
||
|
case PRINTMESSAGE: /* printmessage_l() */
|
||
|
if (rqstp->rq_cred.oa_flavor != AUTH_SYS) {
|
||
|
/* AUTH_SYS is required by this procedure */
|
||
|
svcerr_weakauth(transp);
|
||
|
return;
|
||
|
}
|
||
|
_xdr_argument = (bool_t(*)())xdr_wrapstring;
|
||
|
_xdr_result = (bool_t(*)())xdr_int;
|
||
|
local = (char *(*)(u_argument *, struct svc_req *))
|
||
|
printmessage_l;
|
||
|
break;
|
||
|
default: /* no other procedures available */
|
||
|
<strong>svcerr_noproc</strong>(transp);
|
||
|
return;
|
||
|
}
|
||
|
memset((char *)&argument, 0, sizeof(argument));
|
||
|
|
||
|
/* decode arguments for the procedure */
|
||
|
if (!<strong>svc_getargs</strong>(transp, (xdrproc_t)_xdr_argument,
|
||
|
(char *)&argument)){
|
||
|
<strong>svcerr_decode</strong>(transp);
|
||
|
return;
|
||
|
}
|
||
|
|
||
|
/* Invoke the procedure */
|
||
|
result = (*local)(&argument, rqstp);
|
||
|
|
||
|
/* Send reply to the client containing results of the invocation */
|
||
|
if (result != NULL && !<strong>svc_sendreply</strong>(transp,
|
||
|
(xdrproc_t)_xdr_result, result)){
|
||
|
<strong>svcerr_systemerr</strong>(transp);
|
||
|
}
|
||
|
|
||
|
if (!<strong>svc_freeargs</strong>(transp, (xdrproc_t)_xdr_argument,
|
||
|
(char *)&argument)){
|
||
|
printf("unable to free arguments");
|
||
|
exit(1);
|
||
|
}
|
||
|
return;
|
||
|
}
|
||
|
|
||
|
main()
|
||
|
{
|
||
|
pid_t pid;
|
||
|
int i;
|
||
|
|
||
|
printf("Start..");
|
||
|
|
||
|
printf("Try to create..");
|
||
|
/* Create a new RPC server instance which will use messageprog_l()
|
||
|
as a dispatcher function associated with MESSAGEPROG program
|
||
|
number and PRINTMESSAGEVERS version number.
|
||
|
Since "VISIBLE" nettype is selected, a number of server instances
|
||
|
will be actually created: one for each "VISIBLE" entry in
|
||
|
/etc/netconfig */
|
||
|
if(!<strong>svc_create</strong>(messageprog_l, MESSAGEPROG, PRINTMESSAGEVERS,
|
||
|
"VISIBLE")){
|
||
|
printf("Unable to create service.");
|
||
|
return 1;
|
||
|
}
|
||
|
|
||
|
/* Enter the main loop of RPC */
|
||
|
<strong>svc_run</strong>();
|
||
|
|
||
|
return 0;
|
||
|
}
|
||
|
|
||
|
</pre>
|
||
|
|
||
|
<br>
|
||
|
<hr>
|
||
|
API introduced: V4R2
|
||
|
|
||
|
<hr>
|
||
|
<table cellpadding="2" cellspacing="2" align="center">
|
||
|
<tr align="center">
|
||
|
<td valign="middle" align="center"><a href="#Top_Of_Page">Top</a> | <a href=
|
||
|
"rpc1.htm">Remote Procedure Call (RPC) APIs</a> | <a href="aplist.htm">APIs by
|
||
|
category</a></td>
|
||
|
</tr>
|
||
|
</table>
|
||
|
</body>
|
||
|
</html>
|
||
|
|