svcerr_systemerr Subroutine

Important: The subroutine is exported from both the libc and the libnsl libraries.

svcerr_systemerr Subroutine Exported from the libc Library

Purpose

Indicates that the service dispatch routine cannot complete the remote procedure call due to an error that is not covered by a protocol.

Library

C Library (libc.a)

Syntax

#include <rpc/rpc.h>

void svcerr_systemerr ( xprt)
SVCXPRT *xprt;

Description

The svcerr_systemerr subroutine is called by a service dispatch subroutine that detects a system error not covered by a protocol. For example, a service dispatch subroutine calls the svcerr_systemerr subroutine if the first subroutine can no longer allocate storage. The routine sets the status of the Remote Procedure Call (RPC) reply message to the SYSTEM_ERR condition.

Parameters

Item Description
xprt Points to the RPC service transport handle.

svcerr_systemerr Subroutine Exported from the libnsl Library

Purpose

Indicates that the service dispatch routine cannot complete the remote procedure call due to an error that is not covered by a protocol.

Library

Network Services Library (libnsl.a)

Syntax

#include <rpc/rpc.h>
void svcerr_systemerr ( xprt)
const SVCXPRT *xprt;

Description

The svcerr_systemerr subroutine is called by a service dispatch subroutine when a system error occurs that can not be covered by any particular protocol. The subroutine sets the status of the remote procedure call (RPC) reply message to the RPC_SYSTEMERROR condition.

Parameters

Item Description
xprt Points to the RPC service transport handle.

Examples

#include <rpc/rpc.h>
#include <stdlib.h>

#define PROG 0x3fffffffL
#define VERS 0x1L

static void sample_dispatch();
main()
{
  char *nettype;
  int no_of_handles;
      
  nettype = "tcp";
  /* Create RPC service handle and register with RPCBIND service */
  if((no_of_handles = svc_create(sample_dispatch, PROG, VERS,nettype)) == 0)
  {
    fprintf(stdout,"Error in svc_create!");
    exit(EXIT_FAILURE);
  }
  svc_run();
  return 0;
} 

/* following is the sample dispatch routine*/
static void sample_dispatch(struct svc_req *request, SVCXPRT *xprt)
{
  int result;

  /*  Some code to call appropriate service procedure.
    Procedure will return its result. 
  */
  if(!svc_sendreply(xprt,(xdrproc_t)xdr_int,(caddr_t)&result))
  {
    fprintf(stdout,"Error in svc_sendreply!");
    svcerr_systemerr(xprt);
  }
}