svcerr_noproc Subroutine

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

svcerr_noproc Subroutine Exported from the libc Library

Purpose

Indicates that the service dispatch routine cannot complete a remote procedure call because the program cannot support the requested procedure.

Library

C Library (libc.a)

Syntax

#include <rpc/rpc.h>

void svcerr_noproc ( xprt)
SVCXPRT *xprt;

Description

The svcerr_noproc subroutine is called by a service dispatch routine that does not implement the procedure number the caller has requested. This subroutine sets the status of the Remote Procedure Call (RPC) reply message to the PROC_UNAVAIL condition, which indicates that the program cannot support the requested procedure.

Note: Service implementors do not usually need this subroutine.

Parameters

Item Description
xprt Points to the RPC service transport handle.

svcerr_noproc Subroutine Exported from the libnsl Library

Purpose

Indicates that the service dispatch routine cannot complete a remote procedure call because the program cannot support the requested procedure.

Library

Network Services Library (libnsl.a)

Syntax

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

Description

The svcerr_noproc subroutine is called by a service dispatch subroutine when the procedure number that is requested by a caller is not implemented. This subroutine sets the status of the remote procedure call (RPC) reply message to the RPC_PROCUNAVAIL condition, which indicates that the program cannot support the requested procedure.

Parameters

Item Description
xprt Points to the RPC service transport handle.

Examples

In the following example, the svcerr_noproc subroutine is called from a dispatch subroutine when a requested procedure is not supported.

#include <rpc/rpc.h>
#include <stdlib.h>
#define PROG 0x3fffffffL
#define VERS 0x1L

static void sample_dispatch();
main()
{
  char *nettype = "tcp";
 int no_of_handles;
   
  /* 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 args;
      
switch(request->rq_proc)
{
  case 0:
  svc_sendreply(xprt, (xdrproc_t) xdr_void, (caddr_t) NULL);
  return;
  case 1: 
  case 2:
  . . .
  case n:
  /* Call appropriate procedure */
  default:
  svcerr_noproc(xprt);
  return;
  }
}