sioc_io.7 (2010 09)

s
sioc_io(7) sioc_io(7)
The data_xfer field indicates the number of data bytes actually transferred during the data phase of
the cdb command. This field is valid only when the cdb_status field contains one of the following values:
S_GOOD or S_CHECK_CONDITION
. The sense_xfer field indicates the number of valid sense data bytes.
This field is valid only when the cdb_status field contains the value
S_CHECK_CONDITION
and the
sense_status field contains the value
S_GOOD.
Security Restrictions
Use of the
SIOC_IO ioctl requires the superuser or
DEVOPS privilege, or device write permissions. See
privileges (5) for more information about privileged access on systems that support fine-grained privileges.
EXAMPLES
Assume that fildes is a valid file descriptor for a persistent device file of a SCSI device, and leg_fildes is a
valid file descriptor for a legacy device file of a SCSI device, and lpt_hwp contains a valid hardware path
of a LUN path to the device. The first example attempts a SCSI
INQUIRY command:
#include <sys/scsi.h>
esctl_io_t esctl_io;
#define MAX_LEN 255
unsigned char inquiry_data[MAX_LEN];
memset(&esctl_io, 0, sizeof(esctl_io)); /* clear reserved fields */
esctl_io.flags = SCTL_READ; /* input data expected */
esctl_io.cdb[0] = CMDinquiry;
esctl_io.cdb[1] = 0x00;
esctl_io.cdb[2] = 0x00;
esctl_io.cdb[3] = 0x00;
esctl_io.cdb[4] = MAX_LEN; /* allocation length */
esctl_io.cdb[5] = 0x00;
esctl_io.cdb_length = 6; /* 6 byte command */
esctl_io.data = &inquiry_data[0]; /* data buffer location */
esctl_io.data_length = MAX_LEN; /* maximum transfer length */
esctl_io.max_msecs = 10000; /* allow 10 seconds for cmd */
if (ioctl(fildes, SIOC_IO_EXT, &esctl_io) < 0) {
/* request is invalid */
} else {
if ( esctl_io.cdb_status == S_GOOD) {
/* success. display inquiry data */
else {
/* failure. process depending on cdb_status */
}
}
The second example attempts a SCSI
INQUIRY command via a specific LUN path.
#include <sys/scsi.h>
esctl_io_t esctl_io;
#define MAX_LEN 255
unsigned char inquiry_data[MAX_LEN];
memset(&esctl_io, 0, sizeof(esctl_io)); /* clear reserved fields */
esctl_io.flags = SCTL_READ | SCTL_IO_LPT; /* input data
* expected and command
* to be sent on given
* LUN path
*/
memcpy(&esctl_io.lpt_hwp, lpt_hwp, sizeof(lpt_hwp); /* specify
* the hardware path of
* LUN path through which
* command must be sent
*/
esctl_io.cdb[0] = CMDinquiry;
esctl_io.cdb[1] = 0x00;
esctl_io.cdb[2] = 0x00;
HP-UX 11i Version 3: September 2010 3 Hewlett-Packard Company 3