tokwrite Token-Ring Device Handler Entry Point

Purpose

Note: This function is supported in AIX® 5.1 and earlier only.

Provides a means of transmitting data to the token-ring device handler.

Syntax

#include <sys/device.h> #include <sys/uio.h> #include <sys/comio.h> #include <sys/tokuser.h> int tokwrite (devno, uiop, chan, arg) dev_t devno; struct uio * uiop; int chan; struct write_extension * arg;

Parameters

Item Description
devno Specifies major and minor device numbers.
uiop Points to a uio structure specifying the location and length of the caller's data.
chan Specifies the channel number assigned by the tokmpx entry point.
arg Points to a write_extension structure. If the arg parameter is null, then default values are assumed.

Description

The tokwrite entry point provides the means for transmitting data to the token-ring device handler. The kernel calls it when a user-mode caller issues a write, writex, writev, or a writevx subroutine.

For a user-mode process, the kernel fills in the uio structure with the appropriate values. A kernel-mode process must fill in the uio structure as described by the ddwrite communications entry point.

For the tokwrite entry point, the arg parameter may point to a write_extension structure. This structure is defined in the /usr/include/sys/comio.h file and contains the following fields:

Field Description
status Indicates the status condition that occurred. Possible values for the returned status field are:
flag Consists of a possible bitwise OR one of the following:
CIO_NOFREE_MBUF
Requests that the token-ring device handler not free the mbuf structure after transmission is complete. The default is bit clear (free the buffer). For a user-mode process, the token-ring device handler always frees the mbuf structure.
CIO_ACK_TX_DONE
Requests that, when done with this operation, the token-ring device handler acknowledges completion by building a CIO_TX_DONE status block. In addition, requests the token-ring device handler either call the kernel status function or (for a user-mode process) place the status block in the status/exception queue. The default is bit clear (do not acknowledge transmit completion).
write_id For a user-mode caller, the write_id field is returned to the caller by the CIO_GET_STAT operation (if the CIO_ACK_TX_DONE option is selected). For a kernel-mode caller, the write_id field is returned to the caller by the stat_fn function that was provided at open time.

The tokwrite entry point functions with a Token-Ring High Performance Network Adapter that has been correctly configured for use on a qualified network. Consult adapter specifications for more information on configuring the adapter and network qualifications.

Execution Environment

The tokwrite entry point can be called from the process environment only.

Return Values

Item Description
EAGAIN Indicates the transmit queue is full.
EFAULT Indicates an invalid address was supplied.
EINTR Indicates a system call was interrupted.
EINVAL Indicates the specified parameter is not valid.
ENETDOWN Indicates the network is down. The device is unable to process the write.
ENETUNREACH Indicates the device is in network Recovery mode and unable to process the entry point.
ENOCONNECT Indicates the device has not been started.
ENOMEM Indicates the device handler was unable to allocate the required memory.
ENXIO Indicates the specified minor number is not valid.