|
|
Most of the XTI functions return a value of -1 if they encounter an error. In that case the global variable t_errno is set to one of errors defined for the function. These errors are all defined in the header file xti.h. The manual page for each function also lists the errors that the function can return.
One of the special errors defined is TLOOK. When a function returns this ``error'', an asynchronous event has occurred that the process should investigate and respond to. An asynchronous event occurs when the transport provider has detected something that is unrelated to what the process is doing at the moment. The process can determine what event has occurred by calling the t_look function. This function returns one of the events listed at the end of this section.
For example, assume a process attempts to read data over an established connection with the t_rcv call. Normally, this call returns with data sent by a remote process. However, instead of data, the transport provider may have received a signal from the remote process to disconnect. In this case, the t_rcv call returns with a value of -1. The process should now examine the variable t_errno, which contains the value TLOOK. The process can then call the function t_look, which returns the name of the event that occurred, namely T_DISCONNECT. At this point, the process can perform actions appropriate to this event (such as calling t_rcvdis to acknowledge the disconnect request).
One other error to note is TSYSERR. This means that a UNIX system error has occurred. In this case, the process should examine the global variable errno for the precise error.
The events defined in XTI are: