Index of Section 3 Manual Pages

Interix / SUAt_alloc.3Interix / SUA

t_alloc(3)                                                   t_alloc(3)

  t_alloc()

  NAME

    t_alloc - allocate a library structure

  SYNOPSIS

    #include 

    void *t_alloc(
        int fd,
        int struct_type,
        int fields)

  DESCRIPTION

    The t_alloc(3) function dynamically allocates memory for the various
    transport function argument structures as specified below. The function
    allocates memory for the specified structure and for buffers referenced by
    the structure.

    Parameters      Before call     After call

    fd              x               /

    struct_type     x               /

    fields          x               /

    The structure to allocate, which is specified by struct_type, must be one
    of the following. Each of these structures may subsequently be used as an
    argument to one or more transport functions.

    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 the above structures, except t_info, 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 length of
    the buffer allocated will be equal to or greater than the appropriate size
    as returned in the info argument of t_open(3) or t_getinfo(3). The
    relevant fields of the info argument are described in the following list.
    The fields argument specifies which buffers to allocate, 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. Fields which are not
        supported by the transport provider specified by fd will not be
        allocated.

    For each relevant field specified in fields, t_alloc(3) will allocate
    memory for the buffer associated with the field, and initialize the len
    field to zero and the buf pointer and maxlen field accordingly. Irrelevant
    or unknown values passed in fields are ignored. Since the length of the
    buffer allocated will be based on the same size information that is
    returned to the user on a call to t_open(3) and t_getinfo(3), fd must
    refer to the transport endpoint through which the newly allocated
    structure will be passed. In the case where a t_info structure is to be
    allocated, fd may be set to any value. In this way the appropriate size
    information can be accessed. If the size value associated with any
    specified field is T_INVALID (see t_open(3) or t_getinfo(3)), t_alloc(3)
    will be unable to determine the size of the buffer to allocate and will
    fail, setting t_errno to [TSYSERR] and errno to [EINVAL]. If the size
    value associated with any specified field is T_INFINITE (see t_open(3) or
    t_getinfo(3)), then the behavior of t_alloc(3) is implementation-defined.
    For any field not specified in fields, buf will be set to the null pointer
    and len and maxlen will be set to zero.

    The pointer returned if the allocation succeeds is suitably aligned so
    that it can be assigned to a pointer to any type of object and then used
    to access such an object or array of such objects in the space allocated.

    Use of t_alloc(3) to allocate structures will help ensure the
    compatibility of user programs with future releases of the transport
    interface functions.

  VALID STATES

    ALL - apart from T_UNINIT

  ERRORS

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

    [TBADF]
        struct_type is other than T_INFO and the specified file descriptor
        does not refer to a transport endpoint.

    [TNOSTRUCTYPE]
        Unsupported struct_type requested. This can include a request for a
        structure type which is inconsistent with the transport provider type
        specified, that is, connection-mode or connectionless-mode.

    [TPROTO]
        This error indicates that a communication problem has been detected
        between XTI and the transport provider for which there is no other
        suitable XTI error (t_errno).

    [TSYSERR]
        A system error has occurred during execution of this function.

  RETURN VALUE

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

  SEE ALSO

    t_free(3)

    t_getinfo(3)

    t_open(3)

  USAGE NOTES

    The t_alloc function is not thread safe.

    The t_alloc function is not async-signal safe.


Interix / SUAHosted at SUA Community for Interix, SUA and SFUInterix / SUA