Legacy Documentclose button

Important: The information in this document is obsolete and should not be used for new development.

Previous Book Contents Book Index Next

Inside Macintosh: Devices /
Chapter 1 - Device Manager / Device Manager Reference
Device Manager Functions / Controlling and Monitoring Device Drivers


PBStatus

You can use the PBStatus function to obtain status information from a device driver.

pascal OSErr PBStatus(ParmBlkPtr paramBlock, Boolean async); 
paramBlock
A pointer to a CntrlParam structure of the Device Manager parameter block.
async
A Boolean value that indicates whether the request is asynchronous.
-->ioCompletionProcPtrA pointer to a completion routine.
<--ioResultOSErrThe device driver's result code.
-->ioVRefNumshortThe drive number.
-->ioCRefNumshortThe driver reference number.
-->csCodeshortThe type of status call.
<--csParamshort[11]The status information.

DESCRIPTION
The PBStatus function returns information about the device driver specified by the ioCRefNum field. The value you pass in the csCode field and the type of information received in the csParam field are defined by the driver you are calling. For more information, see the appropriate chapters for the standard device drivers in this book and other books in the Inside Macintosh series.

Note
The Device Manager interprets a csCode value of 1 as a special case. When the Device Manager receives a status request with a csCode value of 1, it returns a handle to the driver's device control entry.
This type of status request is not passed to the device driver.
SPECIAL CONSIDERATIONS
Do not call the PBStatus function synchronously at interrupt time. Synchronous requests at interrupt time may block other pending I/O requests and cause the Device Manager to loop indefinitely while it waits for the device driver to complete the interrupted requests.

ASSEMBLY-LANGUAGE INFORMATION
The trap macro for the PBStatus function is _Status (0xA005). Set bit 10 of the trap word to execute this function asynchronously. Set bit 9 to execute it immediately.

You must set up register A0 with the address of the parameter block. When _Status returns, register D0 contains the result code. Register D0 is the only register affected by this function.
Registers on entry
A0Address of the parameter block
Registers on exit
D0Result code

RESULT CODES
noErr0No error
statusErr-18Driver does not respond to this status request
badUnitErr-21Driver reference number does not match unit table
unitEmptyErr-22Driver reference number specifies a nil handle in unit table
abortErr-27Request aborted by KillIO
notOpenErr-28Driver not open
SEE ALSO
For information about the high-level function for monitoring device drivers, see the description of the Status function on page 1-77. For an example of how to request status information from a device driver using the PBStatus function, see Listing 1-5 on page 1-23.


Previous Book Contents Book Index Next

© Apple Computer, Inc.
3 JUL 1996