t_alloc(3xti)t_alloc(3xti)Namet_alloc - allocate a library structure
Syntax
#include <xti.h>
char *t_alloc(fd, struct_type, fields)
int fd;
int struct_type;
int fields;
Arguments
fd Refers to the transport endpoint through which the newly
allocated structure is passed.
struct_type
Specifies the allocated structure where each structure can
subsequently be used as an argument to one or more transport
functions.
The struct_type argument must specify one of the following:
T_BIND_STR struct t_bind
T_CALL_STR struct t_call
T_OPTMGMT_STR struct t_optmgmt
T_DIS_STR struct t_discon
T_UNITDATA_STR struct t_unitdata
T_UDERROR_STR struct t_uderr
T_INFO_STR struct t_info
fields Specifies which buffers to allocate, where the argument is
the bitwise-OR of any of the following:
T_ADDR The addr field of the or t_uderr structures (size
obtained from info_addr).
T_OPT The opt field of the t_optmgmt, t_call, t_unit‐
data, or t_uderr structures (size obtained from
info_options).
T_UDATA The udata field of the t_call, t_discon, or
t_uderr structures (for T_CALL_STR, size is the
maximum value of info_connect and info_discon;
for T_DIS_STR, size is the value of info_discon;
for T_UNITDATA_STR, size is the value of
info_tsdu).
T_ALL All relevant fields of the given structure.
Description
The function dynamically allocates memory for the various transport
function argument structures as listed under the ARGUMENTS section.
This function allocates memory for the specified structure and also
allocates memory for buffers referenced by the structure.
Each of the accepted structures, except contains at least one field of
type struct netbuf. For each field of this type, the user can specify
that the buffer for that field should be allocated as well. The length
of the buffer allocated is based on the size information returned in
the or
For each field specified in fields, allocates memory for the buffer
associated with the field and initializes the len field to zero and the
buf pointer and maxlen field accordingly. Because the length of the
buffer allocated is based on the same size information that is returned
to the user on and fd must refer to the transport endpoint through
which the newly allocated structure will be passed. In this way, the
appropriate size information can be accessed. If the size value associ‐
ated with any specified field is -1 or -2, will be unable to determine
the size of the buffer to allocate and will fail, setting t_errno to
[TSYSERR] and errno to [EINVAL]. For any field not specified in fields,
buf will be set to NULL and maxlen will be set to zero.
Use of to allocate structures helps to ensure the compatibility of user
programs with future releases of the transport interface functions.
───────────────────────────────────────
Parameters Before Call After Call
───────────────────────────────────────
fd x /
struct_type x /
fields x /
───────────────────────────────────────
Return Values
Upon successful completion, returns a pointer to the newly allocated
structure. On failure, NULL is returned.
Diagnostics
On failure, t_errno is set to one of the following:
[TBADF] The specified file descriptor does not refer to a
transport endpoint.
[TNOTSUPPORT] This function is not supported by the current
implementation of XTI.
[TSYSERR] A system error has occurred during execution of
this function.
[TNOSTRUCTYPE] An unsupported struct_type has been requested.
See Alsot_free(3xti), t_getinfo(3xti), t_open(3xti)t_alloc(3xti)