Switch to SpeakEasy.net DSL

The Modular Manual Browser

Home Page
Manual: (SunOS-4.1.3)
Apropos / Subsearch:
optional field

T_ALLOC(3N)                                                        T_ALLOC(3N)

       t_alloc - allocate a library structure

       #include <&lt;tiuser.h>&gt;

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

       t_alloc()  dynamically allocates memory for the various transport func-
       tion argument structures as specified below.  t_alloc() allocates  mem-
       ory  for  the  specified  structure  and  for buffers referenced by the

       The structure to allocate is specified by struct_type, and can  be  one
       of  the  following (each of of these structures may be used as an argu-
       ment 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'.  The maxlen, len, and buf members of the
       netbuf structure are described in t_accept(3N).  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:

              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
              T_ALL     All relevant fields of the given structure.

       For each field specified in fields, t_alloc() allocates memory for  the
       buffer  associated  with the field, and initializes the buf pointer and
       maxlen field accordingly.  The length of the buffer allocated is  based
       on  the  same  size  information returned to the user on t_open(3N) and
       t_getinfo(3N).  Thus, fd must refer to the transport  endpoint  through
       which  the newly allocated structure is 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(3N) or t_getinfo(3N)),
       t_alloc() is unable to determine the size of the buffer to allocate and
       fails,  setting t_errno to TSYSERR and errno to EINVAL .  For any field
       not specified in fields, buf is set to NULL and maxlen is set to zero.

       Use of t_alloc() to allocate structures helps ensure the  compatibility
       of user programs with future releases of the transport interface.

       On success, t_alloc() returns a pointer to the type of structure speci-
       fied by struct_type.  On failure, it returns NULL and sets  t_errno  to
       indicate the error.

       TBADF          The specified file descriptor does not refer to a trans-
                      port endpoint.

       TSYSERR        The function failed due to a system error and set  errno
                      to indicate the error.

       intro(3), t_free(3N), t_getinfo(3N), t_open(3N)

                                21 January 1990                    T_ALLOC(3N)