|
|
HP-UX Reference > Xxdr_create(3N)HP-UX 11i Version 2: December 2007 Update |
|
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 xdrrec_create() function can be detected by first initializing the x_ops field in the XDR structure (xdrs -> x_ops) to NULL before calling the xdrrec_create() function. After the return from the xdrrec_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. The failure can not be detected in case of xdrmem_create() and xdrstdio_create() functions. 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). |
|