[ Next Article | Previous Article | Book Contents | Library Home | Legal | Search ]
Communications Technical Reference, Volume 2

t_sync Subroutine for Transport Layer Interface

Purpose

Synchronizes transport library.

Library

Transport Layer Interface Library (libtli.a)

Syntax

#include <tiuser.h>
int t_sync(fd)
int fd;

Description

The t_sync subroutine synchronizes the data structures managed by the transport library with information from the underlying transport provider. In doing so, this subroutine can convert a raw file descriptor (obtained using the open or dup subroutine, or as a result of a fork operation and an exec operation) to an initialized transport endpoint, assuming that the file descriptor referenced a transport provider. This subroutine also allows two cooperating processes to synchronize their interaction with a transport provider.

For example, a process creates a new process with the fork subroutine and issues an exec subroutine call. The new process must issue a t_sync subroutine call to build the private library data structure associated with a transport endpoint and to synchronize the data structure with the relevant provider information.

Note: 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. The t_sync subroutine 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; a process or an incoming event may change the provider's state after a t_sync subroutine call is issued.

If the provider is undergoing a state transition when the t_sync subroutine is called, the subroutine will be unsuccessful.

Parameters

fd Specifies the transport end point.

Return Values

On successful completion, the t_sync subroutine returns the state of the transport provider. Otherwise, it returns a value of -1 and sets the t_errno variable to indicate the error. The state returned can be one of the following:

T_UNBIND Unbound
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)

Error Codes

If unsuccessful, the t_errno variable is set to one of the following:

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 A system error has occurred during execution of this function.

Implementation Specifics

This subroutine is part of Base Operating System (BOS) Runtime.

Related Information

The dup subroutine, exec subroutine, fork subroutine, open subroutine.

List of Streams Programming References and STREAMS Overview in AIX Version 4.3 Communications Programming Concepts.


[ Next Article | Previous Article | Book Contents | Library Home | Legal | Search ]