ddread Communications PDH Entry Point

Purpose

Returns a data message to a user-mode process.

Syntax

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

int ddread (devno, uiop, chan, extptr)
dev_t  devno;
struct uio * uiop;
int  chan;
read_extension * extptr;

Parameters

Item Description
devno Specifies major and minor device numbers.
uiop Points to a uio structure. For a calling user-mode process, the uio structure specifies the location and length of the caller's data area in which to transfer information.
chan Specifies the channel number assigned by the device handler's ddmpx entry point.
extptr Indicates null or points to the read_extension structure. This structure is defined in the /usr/include/sys/comio.h file.

Description

Note: The entry point should not to be called by a kernel-mode process.

The ddread entry point returns a data message to a user-mode process. This entry point may or may not block, depending on the setting of the DNDELAY flag. If a nonblocking read is issued and no data is available, the ddread entry point returns immediately with 0 (zero) bytes.

For this entry point, the extptr parameter points to an optional user-supplied read_extension structure. This structure contains the following fields:

Field Description
status Contains additional information about the completion of the ddread entry point. Besides the status codes listed here, device-dependent codes can be returned:
CIO_OK
Indicates the operation was successful.
CIO_BUF_OVFLW
Indicates the frame was too large to fit in the receive buffer. The PDH truncates the frame and places the result in the receive buffer.
netid Specifies the network ID associated with the returned frame. If a CIO_BUF_OVFLW code was received, this field may be empty.
sessid Specifies the session ID associated with the returned frame. If a CIO_BUF_OVFLW code was received, this field may be empty.

Execution Environment

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

Return Values

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

Return Code Description
ENXIO Indicates an attempt to use an unconfigured device.
EINVAL Indicates a parameter is not valid.
EIO Indicates an error has occurred.
EACCES Indicates a call from a kernel process is not valid.
EMSGSIZE Indicates the frame was too large to fit into the receive buffer and that no extptr parameter was supplied to provide an alternate means of reporting this error with a status of CIO_BUF_OVFLW.
EINTR Indicates a locking mode sleep was interrupted.
EFAULT Indicates a supplied address is not valid.
EBIDEV Indicates the specified device does not exist.