DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH
 
(TLI/XTI)

t_free(NET)


t_free -- free a library structure

Syntax

TLI syntax

cc . . . -lnsl

#include <sys/tiuser.h>

int t_free (ptr, struct_type) char *ptr; int struct_type;

XTI syntax

cc . . . -lxti

#include <xti.h>

int t_free (ptr, struct_type) char *ptr; int struct_type;

Description

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

ptr points to one of the six structure types described for t_alloc, and struct_type identifies the type of that structure which can be one of the following, where each of these structures is used as an argument to one or more transport functions.

struct_type struct  
T_BIND T_BIND_STR t_bind
T_CALL T_CALL_STR t_call
T_DIS T_DIS_STR t_discon
T_INFO T_INFO_STR t_info
T_OPTMGMT T_OPTMGMT_STR t_optmgmt
T_UDERROR T_UDERROR_STR t_uderr
T_UNITDATA T_UNITDATA_STR t_unitdata

 +------------+----------------+------------+
 |struct_type | struct         |            |
 +------------+----------------+------------+
 |T_BIND      | T_BIND_STR     | t_bind     |
 +------------+----------------+------------+
 |T_CALL      | T_CALL_STR     | t_call     |
 +------------+----------------+------------+
 |T_DIS       | T_DIS_STR      | t_discon   |
 +------------+----------------+------------+
 |T_INFO      | T_INFO_STR     | t_info     |
 +------------+----------------+------------+
 |T_OPTMGMT   | T_OPTMGMT_STR  | t_optmgmt  |
 +------------+----------------+------------+
 |T_UDERROR   | T_UDERROR_STR  | t_uderr    |
 +------------+----------------+------------+
 |T_UNITDATA  | T_UNITDATA_STR | t_unitdata |
 +------------+----------------+------------+

The t_free function 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 (see netbuf(FP)) structure. If buf is NULL, t_free does not attempt to free memory. After all buffers are freed, t_free frees the memory associated with the structure pointed to by ptr.

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

Return values

t_free returns 0 on success and -1 on failure, and t_errno is set to indicate the error.

Diagnostics

On failure, t_errno may be set to the following:

[TNOSTRUCTYPE]
struct_type is out of the range. This error code only occurs with XTI.

[TSYSERR]
A system error has occurred during execution of this function. For TLI, this error code is also returned when struct_type is out of range; when this error occurs, errno is set to EINVAL.

See also

Intro(NET), netbuf(FP), t_alloc(NET)

Standards conformance

t_free is conformant with:

AT&T SVID Issue 3 ;
X/Open CAE Specification, Networking Services, Issue 4, 1994. ;
and Intel386 Binary Compatibility Specification, Edition 2 (iBCSe2) .


© 2003 Caldera International, Inc. All rights reserved.
SCO OpenServer Release 5.0.7 -- 11 February 2003