clnt_freeres()--Free Data Allocated by the RPC or XDR System


  Syntax

 #include <rpc/rpc.h>

 bool_t clnt_freeres(CLIENT *clnt,
                              const xdrproc_t inproc,
                              caddr_t in);

  Service Program Name: QZNFTRPC

  Default Public Authority: *USE

  Threadsafe: No

The clnt_freeres() function frees any data allocated by the RPC or XDR system when it decoded the results of an RPC call.


Parameters

clnt  (Input) 
A pointer to the client handle.

inproc  (Input) 
XDR routine describing the results.

in  (Input) 
(Input) The address of the results.

Authorities

No authorization is required.


Return Value

TRUE (1) Successful
FALSE (0) Unsuccessful


Error Conditions

This function returns FALSE when the in parameter is NULL or an exception has occurred. In case of an exception, clnt_freeres() tries to set RPC_INTR in the client handle. This status can be retrieved by a call to clnt_geterr().


Error Messages

Message ID Error Message Text
CPF9872 E Program or service program &1 in library &2 ended. Reason code &3.


Example

See Code disclaimer information for information pertaining to code examples.

The following example shows how clnt_freeres() is used:

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

 ...

u_long procnum;
CLIENT *clnt;
enum clnt_stat stat;
struct rpc_err client_error;
struct timeval timeout;

struct array_args{
   unsigned int size;
   char *data;
};

struct array_args args;    /* Arg with buffer to send */
struct array_args result;  /* Arg with buffer to receive */

 ...

/* Call the remote procedure that is associated with client */

 ...

stat = clnt_call(clnt, procnum, (xdrproc_t)xdr_array,
                          (char *)&args, (xdrproc_t)xdr_array,
                          (char *)&result, timeout);
if (stat != RPC_SUCCESS){
  /* Failure on call */
  if (result.data != (char *) NULL){
    if(!clnt_freeres(clnt, (xdrproc_t)xdr_array,
                              (char *)&result))
      /* clnt_freeres() failed */

      ...

  }
  ...
}



API introduced: V4R2
Top | Remote Procedure Call (RPC) APIs | APIs by category