t_alloc(3N) t_alloc(3N)
NAME
talloc - allocate a library structure
SYNOPSIS
#include <sys/tiuser.h>
char *talloc(int fd, int structtype, int fields);
DESCRIPTION
The talloc function dynamically allocates memory for the various
transport function argument structures as specified below. This func-
tion will allocate memory for the specified structure, and will also
allocate memory for buffers referenced by the structure.
The structure to allocate is specified by structtype, and can be one
of the following:
TBIND struct tbind
TCALL struct tcall
TOPTMGMT struct toptmgmt
TDIS struct tdiscon
TUNITDATA struct tunitdata
TUDERROR struct tuderr
TINFO struct tinfo
where each of these structures may subsequently be used as an argument
to one or more transport functions.
Each of the above structures, except TINFO, contains at least one
field of type struct netbuf. For each field of this type, the user may
specify that the buffer for that field should be allocated as well.
The fields argument specifies this option, where the argument is the
bitwise-OR of any of the following:
TADDR The addr field of the tbind, tcall, tunitdata, or tuderr
structures.
TOPT The opt field of the toptmgmt, tcall, tunitdata, or
tuderr structures.
TUDATA The udata field of the tcall, tdiscon, or tunitdata
structures.
TALL All relevant fields of the given structure.
Page 1 Reliant UNIX 5.44 Printed 11/98
t_alloc(3N) t_alloc(3N)
For each field specified in fields, talloc will allocate memory for
the buffer associated with the field, and initialize the buf pointer
and maxlen field accordingly. The length of the buffer allocated will
be based on the same size information that is returned to the user on
topen and tgetinfo. Thus, fd must refer to the transport endpoint
through which the newly allocated structure will be passed, so that
the appropriate size information can be accessed. If the size value
associated with any specified field is -1 or -2 (see topen or
tgetinfo), talloc will be unable to determine the size of the buffer
to allocate and will fail, setting terrno 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 talloc to allocate structures will help ensure the compatibil-
ity of user programs with future releases of the transport interface.
On failure, terrno may be set to one of the following:
TBADF The specified file descriptor does not refer to a
transport endpoint.
TSYSERR A system error has occurred during execution of this
function.
DIAGNOSTICS
On successful completion, talloc returns a pointer to the newly allo-
cated structure. On failure, NULL is returned.
SEE ALSO
tfree(3N), tgetinfo(3N), topen(3N).
Page 2 Reliant UNIX 5.44 Printed 11/98