'\" te .\" Copyright (c) 2008, Sun Microsystems, Inc. All Rights Reserved .\" Copyright 1989 AT&T .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License. .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License. .\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner] .TH AREAD 9E "Mar 28, 1997" .SH NAME aread \- asynchronous read from a device .SH SYNOPSIS .nf #include #include #include #include #include int\fIprefix\fR \fB\fR\fBaread\fR(\fBdev_t\fR \fIdev\fR, \fBstruct aio_req *\fR\fIaio_reqp\fR, \fBcred_t *\fR\fIcred_p\fR); .fi .SH INTERFACE LEVEL illumos \fBDDI \fRspecific (illumos DDI). This entry point is \fIoptional\fR. Drivers that do not support an \fBaread()\fR entry point should use .BR nodev (9F) .SH PARAMETERS .ne 2 .na \fB\fIdev\fR \fR .ad .RS 13n Device number. .RE .sp .ne 2 .na \fB\fIaio_reqp\fR \fR .ad .RS 13n Pointer to the \fBaio_req\fR(9S) structure that describes where the data is to be stored. .RE .sp .ne 2 .na \fB\fIcred_p\fR \fR .ad .RS 13n Pointer to the credential structure. .RE .SH DESCRIPTION The driver's \fBaread()\fR routine is called to perform an asynchronous read. \fBgetminor\fR(9F) can be used to access the minor number component of the \fIdev\fR argument. \fBaread()\fR may use the credential structure pointed to by \fIcred_p\fR to check for superuser access by calling \fBdrv_priv\fR(9F). The \fBaread()\fR routine may also examine the \fBuio\fR(9S) structure through the \fBaio_req\fR structure pointer, \fIaio_reqp\fR. \fBaread()\fR must call \fBaphysio\fR(9F) with the \fBaio_req\fR pointer and a pointer to the driver's \fBstrategy\fR(9E) routine. .sp .LP No fields of the \fBuio\fR(9S) structure pointed to by \fBaio_req\fR, other than \fBuio_offset\fR or \fBuio_loffset\fR, may be modified for non-seekable devices. .SH RETURN VALUES The \fBaread()\fR routine should return \fB0\fR for success, or the appropriate error number. .SH CONTEXT This function is called from user context only. .SH EXAMPLES \fBExample 1 \fRThe following is an example of an \fBaread()\fR routine: .sp .in +2 .nf static int xxaread(dev_t dev, struct aio_req *aio, cred_t *cred_p) { int instance; struct xxstate *xsp; instance = getminor(dev); xsp = ddi_get_soft_state(statep, instance); /*Verify soft state structure has been allocated */ if (xsp == NULL) return (ENXIO); return (aphysio(xxstrategy, anocancel, dev, B_READ, xxminphys, aio)); } .fi .in -2 .SH SEE ALSO .BR read (2), .BR aioread (3C), .BR awrite (9E), .BR read (9E), .BR strategy (9E), .BR write (9E), .BR anocancel (9F), .BR aphysio (9F), .BR ddi_get_soft_state (9F), .BR drv_priv (9F), .BR getminor (9F), .BR minphys (9F), .BR nodev (9F), .BR aio_req (9S), .BR cb_ops (9S), .BR uio (9S) .sp .LP \fIWriting Device Drivers\fR .SH BUGS There is no way other than calling \fBaphysio\fR(9F) to accomplish an asynchronous read.