Driver Entry Points aread(9E)
NAME
aread - asynchronous read from a device
SYNOPSIS
#include
#include
#include
#include
#include
intprefix
aread(devt dev, struct aioreq *aioreqp, credt *credp);
INTERFACE LEVEL
Solaris DI specific (Solaris DI). This entry point is
optional. Drivers that do not support an aread() entry point
should use nodev(9F)
PARAMETERS
dev Device number.
aioreqp Pointer to the aioreq(9S) structure that
describes where the data is to be stored.
credp Pointer to the credential structure.
DESCRIPTION
The driver's aread() routine is called to perform an asyn-
chronous read. getminor(9F) can be used to access the minor
number component of the dev argument. aread() may use the
credential structure pointed to by credp to check for
superuser access by calling drvpriv(9F). The aread() rou-
tine may also examine the uio(9S) structure through the
aioreq structure pointer, aioreqp. aread() must call
aphysio(9F) with the aioreq pointer and a pointer to the
driver's strategy(9E) routine.
No fields of the uio(9S) structure pointed to by aioreq,
other than uiooffset or uioloffset, may be modified for
non-seekable devices.
RETURN VALUES
The aread() routine should return 0 for success, or the
appropriate error number.
CONTEXT
SunOS 5.11 Last change: 28 Mar 1997 1
Driver Entry Points aread(9E)
This function is called from user context only.
EXAMPLES
Example 1 The following is an example of an aread() routine:
static int
xxaread(devt dev, struct aioreq *aio, credt *credp)
{
int instance;
struct xxstate *xsp;
instance = getminor(dev);
xsp = ddigetsoftstate(statep, instance);
/*Verify soft state structure has been allocated */
if (xsp == NUL)
return (ENXIO);
return (aphysio(xxstrategy, anocancel,
dev, BREAD, xxminphys, aio));
}
SEE ALSO
read(2), aioread(3C), awrite(9E), read(9E), strategy(9E),
write(9E), anocancel(9F), aphysio(9F),
ddigetsoftstate(9F), drvpriv(9F), getminor(9F),
minphys(9F), nodev(9F), aioreq(9S), cbops(9S), uio(9S)
Writing Device Drivers
BUGS
There is no way other than calling aphysio(9F) to accomplish
an asynchronous read.
SunOS 5.11 Last change: 28 Mar 1997 2
|