ddwrite Communications PDH Entry Point

Purpose

Queues a message for transmission or blocks until the message can be queued.

Syntax

#include <sys/device.h>
#include <sys/comio.h>

int ddwrite (devno, uiop, chan, extptr)
dev_t  devno;
struct uio * uiop;
int  chan;
struct write_extension * extptr;

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 device handler's ddmpx entry point.
extptr Points to a write_extension structure. If the extptr parameter is null, then default values are assumed.

Description

The ddwrite entry point either queues a message for transmission or blocks until the message can be queued, depending upon the setting of the DNDELAY flag.

The ddwrite communications PDH entry point determines whether the data is in user or system space by looking at the uiop->uio_segflg field. If the data is in system space, then the uiop->uio_iov->iov_base field contains an mbuf pointer. The mbuf chain contains the data for transmission. The uiop->uio_resid field has a value of 4. If the data is in user space, the data is located in the same manner as for the ddwrite device driver entry point.

write_extension Parameter Block

For this entry point, the extptr parameter can 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 of the port. This field may contain additional information about the completion of the ddwrite entry point. Besides the status codes listed here, device-dependent codes can be returned:
CIO_OK
Indicates that the operation was successful.
CIO_NOMBUF
Indicates that the operation was unable to allocate mbuf structures.
flag Contains a bitwise OR of one or more of the following:
CIO_NOFREE_MBUF
Requests that the physical device handler (PDH) not free the mbuf structure after transmission is complete. The default is bit clear (free the buffer). For a user-mode process, the PDH always frees the mbuf structure.
CIO_ACK_TX_DONE
Requests that, when done with this operation, the PDH acknowledge completion by building a CIO_TX_DONE status block. In addition, requests that the PDH either call the kernel status function or (for a user-mode process) place the status block in the status or exception queue. The default is bit clear (do not acknowledge transmit completion).
writid Contains the write ID to be returned in the CIO_TX_DONE status block. This field is ignored if the user did not request transmit acknowledgment by setting CIO_ACK_TX_DONE status block in the flag field.
netid Contains the network ID.

Execution Environment

A ddwrite entry point can be called from the process environment only.

Return Values

In general, communication device handlers use the common return codes defined for an entry point. However, device handlers for specific communication devices can return device-specific codes. The common return codes for the ddwrite entry point are the following:

Return Code Description
ENXIO Indicates an attempt to use an unconfigured device.
EINVAL Indicates a parameter that is not valid.
EAGAIN Indicates the transmit queue is full and the DNDELAY flag is set. The command was not accepted.
EFAULT Indicates a specified address is not valid.
EINTR Indicates a blocking mode sleep was interrupted.
ENOMEM Indicates the operation was unable to allocate the needed mbuf space.
ENOCONNECT Indicates a connection was not established.
EBUSY Indicates the maximum number of opens was exceeded.
ENODEV Indicates the device does not exist.