|
|
HP-UX Reference Volume 4 of 5 > xxdr_create(3N) |
|
NAMExdr_create, xdr_destroy, xdrmem_create, xdrrec_create, xdrstdio_create — library routines for external data representation stream creation SYNOPSIS#include <rpc/xdr.h> void xdr_destroy(XDR *xdrs); void xdrmem_create(XDR *xdrs, const caddr_t addr, const u_int size, const enum xdr_op op); void xdrrec_create(XDR *xdrs, const u_int sendsz, const u_int recvsz, const caddr_t handle, const int (*readit)(const void *read_handle, char *buf, const int len), const int (*writeit)(const void *write_handle, const char *buf, const int len)); void xdrstdio_create(XDR *xdrs, FILE *file, const enum xdr_op op); DESCRIPTIONXDR library routines allow C programmers to describe arbitrary data structures in a machine-independent fashion. Protocols such as remote procedure calls (RPC) use these routines to describe the format of the data. These routines deal with the creation of XDR streams. XDR streams have to be created before any data can be translated into XDR format. RoutinesSee rpc(3N) for the definition of the XDR, CLIENT, and SVCXPRT data structures. Note that any buffers passed to the XDR routines must be properly aligned. It is suggested that malloc(3C) be used to allocate these buffers or that the programmer insure that the buffer address is divisible evenly by four.
Failure of any of these functions can be detected by first initializing the x_ops field in the XDR structure (xdrs -> x_ops) to NULL before calling the xdr*_create() function. After the return from the xdr*_create() function, if the x_ops field is still NULL, the call has failed. If the x_ops field contains some other value, the call can be assumed to have succeeded. MULTITHREAD USAGE
These functions can be called safely in a multithreaded environment. They may be cancellation points in that they call functions that are cancel points. In a multithreaded environment, these functions are not safe to be called by a child process after fork() and before exec(). These functions should not be called by a multithreaded application that support asynchronous cancellation or asynchronous signals. SEE ALSOread(2), write(2), malloc(3C), rpc(3N), xdr_admin(3N), xdr_complex(3N), xdr_simple(3N), fclose(3S). |
|