detach Device Queue Management Routine

Purpose

Provides a means for performing device-specific processing when the detchq kernel service is called.

Syntax

#include <sys/types.h>
#include <sys/errno.h>
#include <sys/deviceq.h>

int detach( dev_parms,  path_id)
caddr_t dev_parms;
cba_id path_id;

Parameters

Item Description
dev_parms Passed to creatd service when the detach routine is defined.
path_id Specifies the path identifier for the queue that is being detached from.

Description

The detach routine is part of the Device Queue Management kernel extension. Each device queue can have a detach routine. This routine is optional and must be specified when the device queue is defined with the creatd service. The detchq service calls the detach routine each time a path to the device queue is removed.

To ensure that the detach routine is not called while a queue element from this client is still in the device queue, the kernel puts a detach control queue element at the end of the device queue. The server knows by convention that a detach control queue element signifies completion of all pending queue elements for that path. The kernel calls the detach routine after the detach control queue element is processed.

The detach routine executes under the process under which the detchq service is called. The kernel does not serialize the execution of this service with the execution of any of the other server routines.

Execution Environment

The detach routine can be called from the process environment only.

Return Values

Item Description
RC_GOOD Indicates successful completion.

A return value other than RC_GOOD indicates an irrecoverable condition causing system failure.