1aread(9E) Driver Entry Points aread(9E)
2
3
4
6 aread - asynchronous read from a device
7
9 #include <sys/uio.h>
10 #include <sys/aio_req.h>
11 #include <sys/cred.h>
12 #include <sys/ddi.h>
13 #include <sys/sunddi.h>
14 intprefix
15
16 aread(dev_t dev, struct aio_req *aio_reqp, cred_t *cred_p);
17
18
20 Solaris DDI specific (Solaris DDI). This entry point is optional. Driv‐
21 ers that do not support an aread() entry point should use nodev(9F)
22
24 dev Device number.
25
26
27 aio_reqp Pointer to the aio_req(9S) structure that describes where
28 the data is to be stored.
29
30
31 cred_p Pointer to the credential structure.
32
33
35 The driver's aread() routine is called to perform an asynchronous read.
36 getminor(9F) can be used to access the minor number component of the
37 dev argument. aread() may use the credential structure pointed to by
38 cred_p to check for superuser access by calling drv_priv(9F). The
39 aread() routine may also examine the uio(9S) structure through the
40 aio_req structure pointer, aio_reqp. aread() must call aphysio(9F) with
41 the aio_req pointer and a pointer to the driver's strategy(9E) routine.
42
43
44 No fields of the uio(9S) structure pointed to by aio_req, other than
45 uio_offset or uio_loffset, may be modified for non-seekable devices.
46
48 The aread() routine should return 0 for success, or the appropriate
49 error number.
50
52 This function is called from user context only.
53
55 Example 1 The following is an example of an aread() routine:
56
57 static int
58 xxaread(dev_t dev, struct aio_req *aio, cred_t *cred_p)
59 {
60 int instance;
61 struct xxstate *xsp;
62 instance = getminor(dev);
63 xsp = ddi_get_soft_state(statep, instance);
64 /*Verify soft state structure has been allocated */
65 if (xsp == NULL)
66 return (ENXIO);
67 return (aphysio(xxstrategy, anocancel,
68 dev, B_READ, xxminphys, aio));
69 }
70
71
73 read(2), aioread(3C), awrite(9E), read(9E), strategy(9E), write(9E),
74 anocancel(9F), aphysio(9F), ddi_get_soft_state(9F), drv_priv(9F), get‐
75 minor(9F), minphys(9F), nodev(9F), aio_req(9S), cb_ops(9S), uio(9S)
76
77
78 Writing Device Drivers
79
81 There is no way other than calling aphysio(9F) to accomplish an asyn‐
82 chronous read.
83
84
85
86SunOS 5.11 28 Mar 1997 aread(9E)