svc_exit Subroutine

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

svc_exit Subroutine Exported from the libc Library

Purpose

Causes the svc_run service loop to terminate and return.

Library

Network Services Library (libnsl.a)

Syntax

#include <rpc/rpc.h>

void svc_exit (void);

Description

The svc_exit subroutine causes the svc_run loop to terminate and return to the caller. This subroutine can be called by a service procedure. The call causes all service threads to exit and destroys all server services. Callers must reestablish all services if they wish to resume server activity.

Related Information

The svc_run Subroutine.

svc_exit Subroutine Exported from the libnsl Library

Purpose

Destroys all remote procedure call services registered by the server.

Library

Network Services Library (libnsl.a)

Syntax

#include <rpc/rpc.h>

void svc_exit (void);

Description

The svc_exit subroutine destroys all RPC services registered by server program and forces the svc_run subroutine to return. This subroutine has a global scope and thus all server activities are stopped. To restart the RPC server activities, you must reregister RPC services.

Examples

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

static void sample_dispatch();

main()
{
  
    SVCXPRT *svc_handle;
    struct netconfig *nconf;

    /* Create svc_handle using server handle creation routines and get transport type */

    /* Register dispatch routine for program number and version number with RPCBIND service */

    svc_run();
    fprintf(stdout,"\nAfter svc_run()!\n");
   
     return 0;
}

/* following is the sample dispatch routine*/
static void sample_dispatch(struct svc_req *request, SVCXPRT *xprt)
{
    
    /*  code for dispatch routine */
    svc_exit(); 
   
}