[ Previous | Next | Contents | Home | Search ]
AIX Version 4.3 Kernel and Subsystems Technical Reference, Volume 2

SCIOEVENT (Event) SCSI Adapter Device Driver ioctl Operation

Purpose

Registers the selected SCSI device instance to receive asynchronous event notification.

Description

The SCIOEVENT operation registers the selected initiator or target-mode device for receiving asynchronous event notification. Only kernel mode processes or device drivers can call this function. If a user-mode process attempts an SCIOEVENT operation, the ioctl command is unsuccessful and the errno global value is set to EPERM.

The arg parameter to the SCIOEVENT operation should be set to the address of an sc_event_struct structure, which is in the /usr/include/sys/scsi.h file. If this is a target-mode instance, the SCIOSTARTTGT operation was used to open the device session; the caller then fills in the ID field with the SCSI ID of the SCSI initiator and sets the logical unit number (LUN ) field to a value of 0. If this is an initiator-mode instance, the SCIOSTART operation was used to open the device session; the ID field is then set to the SCSI ID of the SCSI target, and the LUN is set to the LUN ID of the SCSI target. The device must have been previously opened using one of the start ioctls for this operation to succeed. If the device session is not opened, the ioctl command is unsuccessful and the returned errno global value is set to EINVAL.

The event registration performed by this ioctl is only allowed once per device session; only the first SCIOEVENT operation is accepted after the device is opened. Succeeding SCIOEVENT operations are unsuccessful, and the errno global value is set to EINVAL. The event registration is cancelled automatically when the device session is closed.

The caller fills in the mode field with one of the following values, which are defined in the /usr/include/sys/scsi.h file:

#define SC_IM_MODE   /* this is an initiator mode device */
#define SC_TM_MODE   /* this is a target mode device     */

The async_func field is filled in with the address of a pinned routine (in the calling program) that should be called by the SCSI adapter device driver whenever asynchronous event status is available for a registered device. The struct sc_event_info structure, defined in the /usr/include/sys/scsi.h file, is passed by address to the caller's async_func routine.

The async_correlator field can optionally be used by the caller to provide an efficient means of associating event information with the appropriate device. This field is saved by the SCSI adapter device driver and is returned, unchanged, with information passed back to the caller's async_func routine.

Reserved fields must be set to 0 by the caller.

Return Values

When completed successfully, this operation returns a value of 0. Otherwise, a value of -1 is returned and the errno global variable is set to one of the following values:

EFAULT Indicates that a bad copy between kernel and user space occurred.
EINVAL Either an SCIOSTART or SCIOSTARTTGT operator has not been issued to this device instance, or this device is already registered for async events.
EPERM Indicates the caller is not running in kernel mode, which is the only mode allowed to execute this operation.

Files

/dev/scsi0, /dev/scsi1,..., /dev/scsin Provide an interface to allow SCSI device drivers to access SCSI devices or adapters.
/dev/vscsi0, /dev/vscsi1,..., /dev/vscsin Provide an interface to allow SCSI-2 Fast/Wide Adapter/A and SCSI-2 Differential Fast/Wide Adapter/A device drivers to access SCSI devices or adapters.

Related Information

The rmt SCSI device driver, scdisk SCSI device driver, SCSI Adapter device driver, tmscsi SCSI device driver.


[ Previous | Next | Contents | Home | Search ]