t_alloc.3xti
来自「<B>Digital的Unix操作系统VAX 4.2源码</B>」· 3XTI 代码 · 共 145 行
3XTI
145 行
.TH t_alloc 3xti.SH Namet_alloc \- allocate a library structure .SH Syntax.B #include <xti.h>.br.sp 1.B char *t_alloc(\fIfd, struct_type, fields\fB).br.B int \fIfd\fB;.br.B int \fIstruct_type\fB;.br.B int \fIfields\fB;.SH Arguments.IP \fIfd\fR 10Refers to the transport endpoint through which the newly allocatedstructure is passed..IP \fIstruct_type\fR 10Specifies the allocated structure where each structure can subsequentlybe used as an argument to one or more transport functions..IPThe \fIstruct_type\fR argument must specify one of the following:.EXT_BIND_STR \fIstruct\fP t_bindT_CALL_STR \fIstruct\fP t_callT_OPTMGMT_STR \fIstruct\fP t_optmgmtT_DIS_STR \fIstruct\fP t_disconT_UNITDATA_STR \fIstruct\fP t_unitdataT_UDERROR_STR \fIstruct\fP t_uderrT_INFO_STR \fIstruct\fR t_info.EE.IP \fIfields\fR 10Specifies which buffers to allocate, where the argument is thebitwise-OR of any of the following: .RS 10.IP T_ADDR 12The \fIaddr\fP field of the .PN t_bind\fR,\fR .PN t_call\fR,\fR .PN t_unitdata\fR,\fR or \fBt_uderr\fR structures (size obtained from \fIinfo_addr\fP)..IP T_OPT 12The \fIopt\fP field of the \fBt_optmgmt\fR, \fBt_call\fR, \fBt_unitdata\fR, or \fBt_uderr\fR structures (size obtained from \fIinfo_options\fP)..IP T_UDATA 12The \fIudata\fP field of the \fBt_call\fR, \fBt_discon\fR, or \fBt_uderr\fR structures (for T_CALL_STR, size is the maximum value of \fIinfo_connect\fP and \fIinfo_discon\fP; for T_DIS_STR, size is the value of \fIinfo_discon\fP; for T_UNITDATA_STR, size is the value of \fIinfo_tsdu\fP). .IP T_ALL 12All relevant fields of the given structure. .RE.SH DescriptionThe .PN t_alloc()function dynamically allocates memory for the varioustransport function argument structures as listed under the ARGUMENTSsection. This function allocates memory for the specified structureand also allocates memory for buffers referenced by the structure..NXR "t_alloc system call".NXR "memory" "allocating".PPEach of the accepted structures, except .PN t_info()\fR,\fR contains at leastone field of type \fIstruct netbuf\fR. For each field of this type, theuser can specify that the buffer for that field should be allocated aswell. The length of the buffer allocated is based on the sizeinformation returned in the .PN t_open()or.PN t_getinfo()\fR.\fR .PPFor each field specified in \fIfields\fR, .PN t_alloc() allocatesmemory for the buffer associated with the field and initializes the\fIlen\fR field to zero and the \fIbuf\fR pointer and \fImaxlen\fR fieldaccordingly. Because the length of the buffer allocated is based onthe same size information that is returned to the user on.PN t_open() and .PN t_getinfo()\fR,\fR \fIfd\fR must refer to thetransport endpoint through which the newly allocated structure will bepassed. In this way, the appropriate size information can be accessed. Ifthe size value associated with any specified field is \-1 or \-2, .PN t_alloc() will be unableto determine the size of the buffer to allocate and will fail, setting\fBt_errno\fR to [TSYSERR] and \fBerrno\fR to [EINVAL]. Forany field not specified in \fIfields\fR, \fIbuf\fR will be set to NULLand \fImaxlen\fR will be set to zero..PPUse of .PN t_alloc() to allocate structures helps to ensure thecompatibility of user programs with future releases of the transportinterface functions..PP.TStab(@);lfHB lfHB lfHBlfR lfR lfR ._.sp 4pParameters@Before Call@After Call.sp 4p_.sp 6pfd@x@/struct_type@x@/fields@x@/.sp 6p_.TE.PP.sp 12p.SH Return ValuesUpon successful completion, .PN t_alloc() returns a pointer to the newlyallocated structure. On failure, NULL is returned..SH DiagnosticsOn failure, \fBt_errno\fR is set to one of the following:.TP 20[TBADF]The specified file descriptor does not refer to a transport endpoint..TP 20[TNOTSUPPORT]This function is not supported by the current implementation of XTI. .TP 20[TSYSERR]A system error has occurred during execution of this function..TP 20[TNOSTRUCTYPE]An unsupported \fIstruct_type\fR has been requested..SH See Alsot_free(3xti), t_getinfo(3xti), t_open(3xti)
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?