Specifications

Device Driver Entry Points
Cancel-I/O Routine
R8 Reason for cancellation, one of the following:
CAN$C_CANCEL Called by $CANCEL system
service
CAN$C_DASSGN Called by $DASSGN or
$DALLOC system service
Exit
The cancel-I/O routine issues an RSB instruction to return to its caller.
Description
A driver’s cancel-I/O routine must perform the following tasks:
1. Confirm that the device is busy by examining the device-busy bit in the UCB
status longword (UCB$V_BSY in UCB$L_STS).
2. Confirm that the PID of the request the device is servicing (IRP$L_PID)
matches that of the process requesting the cancellation (PCB$L_PID).
3. Confirm that the channel-index number of the request the device is servicing
(IRP$W_CHAN) matches that specified in the cancel-I/O request.
4. Cause to be completed (canceled) as quickly as possible all active I/O requests
on the specified channel that were made by the process that has requested
the cancellation. The cancel-I/O routine usually accomplishes this by setting
UCB$V_CANCEL in the UCB$L_STS. When the next interrupt or timeout
occurs for the device, the driver’s start-I/O routine detects the presence of
an active but canceled I/O request by testing this bit and takes appropriate
action, such as completing the request without initiating any further device
activity. Other driver routines, such as the timeout handling routine, check
the cancel-I/O bit to determine whether to retry the I/O operation or abort it.
4–5