svc_getreqset Subroutine

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

svc_getreqset Subroutine Exported from the libc Library

Purpose

Services a Remote Procedure Call (RPC) request.

Library

C Library (libc.a)

Syntax

#include <sys/types.h>
#include <sys/select.h>
#include <rpc/rpc.h>

void svc_getreqset ( rdfds)
fd_set *rdfds;

Description

The svc_getreqset subroutine is only used if a service implementor does not call the svc_run subroutine, but instead implements custom asynchronous event processing. The subroutine is called when the select subroutine has determined that an RPC request has arrived on any RPC sockets. The svc_getreqset subroutine returns when all sockets associated with the value specified by the rdfds parameter have been serviced.

Parameters

Item Description
rdfds Specifies the resultant read-file descriptor bit mask.

Restrictions

In AIX® 5.2, the maximum number of open file descriptors that an RPC server can use has been set to 32767 so that compatibility can be maintained with RPC-server applications built on earlier releases of AIX.

The fd_set type passed into the svc_getreqset subroutine must be compiled with FD_SETSIZE set to 32767 or larger. Passing in a smaller fd_set argument can cause the svc_getreqset subroutine to overrun the passed-in buffer.

svc_getreqset Subroutine Exported from the libnsl Library

Purpose

Services a Remote Procedure Call (RPC) request.

Library

Network Services Library (libnsl.a)

Syntax

#include <rpc/rpc.h>
void svc_getreqset ( rdfds)
fd_set *rdfds;

Description

The svc_getreqset subroutine is used only when RPC service requests are handled asynchronously (the svc_run subroutine is not used). The subroutine is called after a call to the select subroutine that determines that an RPC request has arrived on RPC file descriptors. The svc_getreqset subroutine returns when all file descriptors specified by the rdfds parameter have been serviced.

Parameters

Item Description
rdfds Specifies the resultant read-file descriptor bit mask.

Examples

#include <stdlib.h>
#include <rpc/rpc.h>
#include <sys/types.h>
#include <sys/select.h>

main()
{
  fd_set rfds;
  
  /* Register RPC Service */

  /* serve client's requests asynchronously */
  while(1)
  {
  rfds = svc_fdset;
  
  /* get max value that newly created file descriptor can have in "tb_size" */

    switch (select(tb_size, &rfds, NULL,NULL,NULL))
    {
      case -1:   
      case 0 :
         break;
      default: 
         /* Handle RPC request on each file descriptor */
         svc_getreqset(&rfds);
    }
  }
}

In the example, the svc_run subroutine is replaced by a while loop that handles RPC requests asynchronously.