STIOCMD

This IOCTL command issues the SCSI Pass-through command. It is used by the diagnostic and service aid routines. The structure for this command is in the /usr/include/sys/scsi.h file.

This IOCTL is supported on both SCSI adapter attached devices and FCP adapter attached devices. For FCP adapter devices, the returned adapter_status field is converted from the FCP codes that are defined in /usr/include/sys/scsi_buf.h to the SCSI codes defined in /usr/include/sys/scsi.h, if possible. This action is to provide downward compatibility with existing applications that use the STIOCMD IOCTL for SCSI attached devices.

Note: There is no interaction by the device driver with this command. The error handling and logging functions are disabled. If the command results in a check condition, the application must issue a Request Sense command to clear any contingent allegiance with the device.
An example of the STIOCMD command is
struct sc_iocmd sciocmd;
struct inquiry_data inqdata;

  bzero(&sciocmd, sizeof(struct sc_iocmd));
  bzero(&inqdata, sizeof(struct inquiry_data));

  /* issue inquiry */
  sciocmd.scsi_cdb[0]=0x12;
  sciocmd.timeout_value=200;         /* SECONDS */
  sciocmd.command_length=6;
  sciocmd.buffer=(char *)&inqdata;
  sciocmd.data_length=sizeof(struct inquiry_data);
  sciocmd.scsi_cdb[4]=sizeof(struct inquiry_data);
  sciocmd.flags=B_READ;

  if (!ioctl (sffd, STIOCMD, &sciocmd))
    {
        printf ("The STIOCMD ioctl for Inquiry Data succeeded\n");
        printf ("\nThe inquiry data is:\n");
        dump_bytes (&inqdata, sizeof(struct inquiry_data),"Inquiry Data");
    }
    else
    {
        perror ("The STIOCMD ioctl for Inquiry Data failed");
    }