CIO_QUERY ddioctl Communications PDH Operation

Purpose

Returns device statistics.

Syntax

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

int ddioctl
(
devno, op, parmptr,
devflag
, chan, ext)
dev_t  devno;
int  op;
struct query_parms * parmptr;
ulong  devflag;
int  chan,  ext;

Parameters

Item Description
devno Specifies major and minor device numbers.
op Indicates the entry point of the CIO_QUERY operation.
parmptr Points to a query_parms structure. This structure is defined in the /usr/include/sys/comio.h file.
devflag Specifies the DKERNEL flag. This flag is set by calling kernel-mode processes and cleared by calling user-mode processes.
chan Specifies channel number assigned by the device handler's ddmpx entry point.
ext Indicates device-dependent.

Description

The CIO_QUERY operation returns various statistics from the device. Counters are zeroed by the physical device handler when the device is configured. The data returned consists of two contiguous portions. The first portion contains counters to be collected and maintained by all device handlers in the communication I/O subsystem. The second portion consists of device-dependent counters and parameters.

query_parms Parameter Block

For the CIO_QUERY operation, the paramptr parameter points to a query_parms structure. This structure is located in the /usr/include/sys/comio.h file and contains the following fields:

Field Description
status Contains additional information about the completion of the status block. Besides the status codes listed here, the following device-dependent codes can be returned:
CIO_OK
Indicates the operation was successful.
CIO_INV_CMD
Indicates a command was issued that is not valid.
bufptr Points to the buffer where the statistic counters are to be copied.
buflen Indicates the length of the buffer pointed to by the bufptr field.
clearall When set to CIO_QUERY_CLEAR, the statistics counters are set to 0 upon return.

Execution Environment

A CIO_QUERY operation 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 may return device-specific codes. The common return codes for the CIO_QUERY operation are the following:

Return Code Description
ENXIO Indicates an attempt to use unconfigured device.
EFAULT Indicates an address was specified that is not valid.
EINVAL Indicates a parameter is not valid.
EIO Indicates an error has occurred.
ENOMEM Indicates the operation was unable to allocate the required memory.
EBUSY Indicates the maximum number of opens was exceeded.
ENODEV Indicates the device does not exist.