devswqry Kernel Service
Purpose
Checks the status of a device switch entry in the device switch table.
Syntax
#include <sys/types.h>
#include <sys/errno.h>
#include <sys/device.h>
int devswqry ( devno, status, dsdptr)
dev_t devno;
uint *status;
caddr_t *dsdptr;
Parameters
| Item | Description |
|---|---|
| devno | Specifies the major and minor device numbers of the device to be queried. |
| status | Points to the status of the specified device entry in the device switch table. This parameter is passed by reference. |
| dsdptr | Points to device-dependent information for the specified device entry in the device switch table. This parameter is passed by reference. |
Description
The devswqry kernel service returns the status of a specified device entry in the device switch table. The entry in the table to query is determined by the major portion of the device number that is specified in the devno parameter. The status of the entry is returned in the status parameter that is passed by reference on the call. If this pointer is null on entry to the devswqry service, then the status is not returned to the caller.
The devswqry service also returns the address of
device-dependent information for the specified device entry in the device switch table. This address
is taken from the d_dsdptr field for the entry and returned in the
dsdptr parameter, which is passed by reference. If this pointer is null on entry
to the devswqry service, then the service does not return the address from the
d_dsdptr field to the caller.
- Status Parameter Flags
-
The status parameter comprises a set of flags that can indicate the following conditions:
Table 2. Status Parameter Flags Item Description DSW_BLOCKDevice switch entry is defined by a block device driver. This flag is set when the device driver has a ddstrategyentry point.DSW_CONFIGThe device driver in this device switch entry provides an entry point for configuration. DSW_COND_UPDATEOne or more of the device switch entry points support conditional update when you use the devswchg kernel service. DSW_CREADThe device driver in this device switch entry is providing a routine for character reads or raw input. This flag is set when the device driver has a ddreadentry point.DSW_CWRITEDevice driver in this device switch entry is providing a routine for character writes or raw output. This flag is set when the device driver has a ddwriteentry point.DSW_DEFINEDDevice switch entry is defined. DSW_DUMPDevice driver that is defined by this device switch entry provides the capability to support one or more of its devices as targets for a kernel dump. This flag is set when the device driver has provided a dddumpentry point.DSW_MPXDevice switch entry is defined by a multiplexed device driver. This flag is set when the device driver has a ddmpxentry point.DSW_OPENEDDevice switch entry is in use and the device has outstanding opens. This flag is set when the device driver has at least one outstanding open. DSW_SELECTThe device driver in this device switch entry provides a routine for handling the selectorpollsubroutines. This flag is set when the device driver has provided addselectentry point.DSW_TCPATHDevice driver in this device switch entry supports devices that are considered to be in the trusted computing path and provide support for the revoke function. This flag is set when the device driver has provided a ddrevokeentry point.DSW_TTYDevice switch entry is in use by a tty device driver. This flag is set when the pointer to the d_ttysstructure is not a null character.DSW_UNDEFINEDDevice switch entry is not defined. The status parameter is set to the
DSW_UNDEFINEDflag when a device switch entry is not in use. This is the case if either of the following are true:- The entry has never been used. (No previous call to the
devswaddservice was made.) - The entry has been used but was later deleted. (A call to the
devswaddservice was issued, followed by a call to thedevswdelservice.)
No other flags are set when the
DSW_UNDEFINEDflag is set.Note: The status parameter must be a null character if called from the interrupt environment. - The entry has never been used. (No previous call to the
Execution Environment
The devswqry kernel service can be called from either the process or interrupt environment.
Return Values
| Item | Description |
|---|---|
| 0 | Indicates a successful operation. |
| EINVAL | Indicates that the major device number portion of the devno parameter exceeds the maximum permitted number of device switch entries. |