[ Previous | Next | Table of Contents | Index | Library Home | Legal | Search ]

Technical Reference: Communications, Volume 2

t_free Subroutine for X/Open Transport Interface


Free a library structure.


X/Open Transport Interface Library (libxti.a)


#include <xti.h>
int t_free (
    void *ptr;
    int struct_type)


The t_free subroutine frees memory previously allocated by the t_alloc subroutine. This subroutine frees memory for the specified structure and buffers referenced by the structure.

The t_free subroutine checks the addr, opt, and udata fields of the given structure, as appropriate, and frees the buffers pointed to by the buf field of the netbuf structure. If buf is a null pointer, the t_free subroutine does not attempt to free memory. After all buffers are free, the t_free subroutine frees the memory associated with the structure pointed to by the ptr parameter.

Undefined results occur if the ptr parameter or any of the buf pointers points to a block of memory that was not previously allocated by the t_alloc subroutine.


ptr Points to one of the seven structure types described for the t_alloc subroutine.
struct_type Identifies the type of the structure specified by the ptr parameter. The type can be one of the following:

struct t_bind

struct t_call

struct t_optmgmt

struct t_discon

struct t_unitdata

struct t_uderr

struct t_info

Each of these structures may subsequently be used as a parameter to one or more transport functions.

Valid States

ALL - apart from T_UNINIT.

Return Values

0 Successful completion.
-1 t_errno is set to indicate an error.

Error Codes

On failure, t_errno is set to one of the following:

TSYSERR A system error has occurred during execution of this function.
TNOSTRUCTYPE Unsupported struct_type parameter value requested.
TPROTO This error indicates that a communication problem has been detected between the X/Open Transport Interface and the transport provider for which there is no other suitable X/Open Transport Interface (t_errno).

Related Information

The t_alloc subroutine.

[ Previous | Next | Table of Contents | Index | Library Home | Legal | Search ]