t_sync(3xti)


t_sync -- synchronize transport library

Synopsis

cc [options] file -lnsl
#include <xti.h>

int t_sync(int fd);

Description

This function is a TLI/XTI local management routine used to synchronize TLI/XTI data structures and protocol specific information. For the transport endpoint specified by fd, t_sync synchronizes the data structures managed by the transport library with information from the underlying transport provider. In doing so, it can convert a raw file descriptor (obtained via open(2), dup(2), or as a result of a fork(2) and exec(2)) to an initialized transport endpoint, assuming that the file descriptor referenced a transport provider.

This function also allows two cooperating processes to synchronize their interaction with a transport provider. For example, if a process forks a new process and issues an exec, the new process must issue a t_sync to build the private library data structure associated with a transport endpoint and to synchronize the data structure with the relevant provider information.

On successful completion, t_sync returns the current state of the transport provider to the user, thereby enabling the user to verify the state before taking further action. This coordination is only valid among cooperating processes; it is possible that a process or an incoming event could change the provider's state after a t_sync is issued.

Parameters


fd
the file descriptor for the transport endpoint for which data structures will be synchronized.

State transitions

t_sync may be issued from any valid state except T_UNINIT and has no effect on the entry state at exit.

Files


/usr/lib/libxti.so
X/Open® Transport Interface Library (shared object)

/usr/lib/libnsl.so
Network Services Library (shared object)

Usage

It is important to remember that the transport provider treats all users of a transport endpoint as a single user. If multiple processes are using the same endpoint, those activities should be coordinated so as not to violate the state of the provider.

Return values

t_sync returns the state of the transport provider (the endpoint specified by fd) on successful completion. On failure, -1 is returned and t_errno is set to indicate the error.

The state returned may be one of the following:


T_UNBND
unbound

T_IDLE
idle

T_OUTCON
outgoing connection pending (connection mode only)

T_INCON
incoming connection pending (connection mode only)

T_DATAXFER
data transfer (connection mode only)

T_OUTREL
outgoing orderly release (waiting for an orderly release indication) (connection mode only)

T_INREL
incoming orderly release (waiting for an orderly release request) (connection mode only)

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.

TSTATECHNG
The transport provider is undergoing a state change.

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

TPROTO
A communication problem has been detected with the transport provider and there is no other value of t_errno to describe the error condition.

Warnings

If the transport endpoint specified by fd is undergoing a state transition when t_sync is called, the function will fail.

References

dup(2), exec(2), fork(2), open(2), t_getstate(3xti)
© 2004 The SCO Group, Inc. All rights reserved.
UnixWare 7 Release 7.1.4 - 25 April 2004