T_SYNC(3N) — NETWORK FUNCTIONS
NAME
t_sync − synchronize transport library
SYNOPSIS
#include <tiuser.h>
int t_sync(fd)
int fd;
DESCRIPTION
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 using open(2V), dup(2V), or as a result of a fork(2V) and execve(2V)) to an initialized transport endpoint, assuming that file descriptor referenced a transport provider. t_sync() 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.
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, they should coordinate their activities so as not to violate the state of the provider. t_sync() returns the current state of the 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.
If the provider is undergoing a state transition when t_sync() is called, the function will fail.
RETURN VALUES
t_sync() returns −1 on failure. Upon success, the state of the transport provider is returned; it may be one of the following:
T_IDLE idle
T_OUTCON outgoing connection pending
T_INCON incoming connection pending
T_DATAXFER
data transfer
T_OUTREL outgoing orderly release (waiting for an orderly release indication)
T_INREL incoming orderly release (waiting for an orderly release request)
T_UNBND unbound
ERRORS
TBADF The specified file descriptor is a valid open file descriptor but does not refer to a transport endpoint.
TSTATECHNG The transport provider is undergoing a state change.
TSYSERR The function failed due to a system error and set errno to indicate the error.
SEE ALSO
dup(2V), execve(2V), fork(2V), open(2V)
Network Programming
Solbourne Computer, Inc. — 13 Dec 1990