Sends a Test Unit Ready command to the selected SCSI device.
The SCIOTUR operation allows the caller to issue a SCSI Test Unit Read (SCIOSTUNIT) command to a selected SCSI adapter. This command is used by system management routines to help configure SCSI devices.
The sc_ready structure allows the caller to specify the SCSI and the logical unit number (LUN) ID of the device on the SCSI adapter that is to receive the SCIOTUR operation. The SC_ASYNC flag (in the flag byte of the arg parameter block) must not be set during the initial attempt of this command. The sc_ready structure provides two output fields: status_validity and scsi_status . Using these two fields, the SCIOTUR operation returns the status to the caller. The arg parameter for the SCIOTUR operation specifies the address of the sc_ready structure, defined in the /usr/include/sys/scsi.h file.
When an errno value of EIO is received, the caller should evaluate the returned status in the status_validity and scsi_status fields. The status_validity field is set to the value SC_SCSI_ERROR to indicate that the scsi_status field has a valid SCSI bus status in it. The /usr/include/sys/scsi.h file contains typical values for the scsi_status field.
Following an SCIOSTUNIT operation, a calling program can tell by the SCSI bus status whether the device is ready. If an errno value of EIO is returned and the status_validity field is set to 0, an unrecovered error has occurred. If, on retry, the same result is obtained, the device should be skipped. If the status_validity field is set to SC_SCSI_ERROR and the scsi_status field indicates a Check Condition status, then another SCIOTUR command should be sent after a delay of several seconds.
After one or more attempts, the SCIOTUR operation should return a successful completion, indicating that the device was successfully started. If, after several seconds, the SCIOTUR operation still returns a scsi_status field set to a Check Condition status, the device should be skipped.
Note: The SCSI adapter device driver performs normal error-recovery procedures during execution of this command.
When completed successfully, this operation returns a value of 0. For the SCIOTUR operation, this means the target device has been successfully started and is ready for data access. If unsuccessful, this operation returns a value of -1 and the errno global variable is set to one of the following values:
The rmt SCSI device driver, scdisk SCSI device driver, SCSI Adapter device driver.