Museum

Home

Lab Overview

Retrotechnology Articles

⇒ Online Manual

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

intro(3)

t_free(3)

t_getinfo(3)

t_open(3)



  t_alloc(3)                          CLIX                          t_alloc(3)



  NAME

    t_alloc - Allocates a library structure

  LIBRARY

    The Transport Layer Interface (TLI) Library (libnsl_s.a)

  SYNOPSIS

    #include <tiuser.h>

    char *t_alloc(
      int fd ,
      int struct_type ,
      int fields );

  DESCRIPTION

    The t_alloc() function dynamically allocates memory for the various
    transport function argument structures as specified herein.  This function
    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 struct_type, and can be one of
    the following:

    T_BIND struct t_bind

    T_CALL struct t_call

    T_OPTMGMT
           struct t_optmgmt

    T_DIS  struct t_discon

    T_UNITDATA
           struct t_unitdata

    T_UDERROR
           struct t_uderr

    T_INFO struct t_info

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

    Each of the previous structures, except T_INFO, contains at least one
    field of type struct netbuf.  The field netbuf is described in intro.  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



  2/94 - Intergraph Corporation                                              1






  t_alloc(3)                          CLIX                          t_alloc(3)



    option, where the argument is the bitwise-OR of any of the following:

    T_ADDR    The addr field of the t_bind, t_call, t_unitdata, or t_uderr
              structures.

    T_OPT     The opt field of the t_optmgmt, t_call, t_unitdata, or t_uderr
              structures.

    T_UDATA   The udata field of the t_call, t_discon, or t_unitdata
              structures.

    T_ALL     All relevant fields of the given structure.

    For each field specified in fields, t_alloc() will allocate memory for the
    buffer associated with the field, and initialize the buf pointer and
    maxlen field accordingly (see netbuf in intro for a description of buf and
    maxlen).  The length of the buffer allocated will be based on the same
    size information that is returned to the user on t_open() and t_getinfo().
    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 t_open or t_getinfo), t_alloc() 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 t_alloc() to allocate structures will help ensure compatibility of
    user programs with future releases of the transport interface.

  RETURN VALUES

    On successful completion, t_alloc() returns a pointer to the newly
    allocated structure.  On failure, NULL is returned.

  ERRORS

    On failure, t_errno 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.

  RELATED INFORMATION

    Functions:  intro(3), t_free(3), t_getinfo(3), t_open(3)

    AT&T UNIX System V Network Programmer's Guide





  2                                              Intergraph Corporation - 2/94




Typewritten Software • bear@typewritten.org • Edmonds, WA 98026