2 .\" Copyright 1989 AT&T
3 .\" Copyright (c) 1997, Sun Microsystems, Inc. All Rights Reserved
4 .\" 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.
5 .\" 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.
6 .\" 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]
7 .TH READ 9E "Nov 19, 1997"
9 read \- read data from a device
13 #include <sys/types.h>
14 #include <sys/errno.h>
19 #include <sys/sunddi.h>
23 \fBint prefix\fR\fBread\fR(\fBdev_t\fR \fIdev\fR, \fBstruct uio *\fR\fIuio_p\fR, \fBcred_t *\fR\fIcred_p\fR);
29 Architecture independent level 1 (DDI/DKI). This entry point is \fIoptional\fR.
46 Pointer to the \fBuio\fR(9S) structure that describes where the data is to be
56 Pointer to the user credential structure for the \fBI/O \fRtransaction.
62 The driver \fBread()\fR routine is called indirectly through \fBcb_ops\fR(9S)
63 by the \fBread\fR(2) system call. The \fBread()\fR routine should check the
64 validity of the minor number component of \fIdev\fR and the user credential
65 structure pointed to by \fIcred_p\fR (if pertinent). The \fBread()\fR routine
66 should supervise the data transfer into the user space described by the
67 \fBuio\fR(9S) structure.
71 The \fBread()\fR routine should return \fB0\fR for success, or the
72 appropriate error number.
75 \fBExample 1 \fR\fBread()\fR routine using \fBphysio()\fR
78 The following is an example of a \fBread()\fR routine using \fBphysio\fR(9F) to
79 perform reads from a non-seekable device:
85 xxread(dev_t dev, struct uio *uiop, cred_t *credp)
92 instance = getminor(dev);
93 xx = ddi_get_soft_state(xxstate, instance);
96 off = uiop->uio_loffset;
97 rval = physio(xxstrategy, NULL, dev, B_READ,
99 uiop->uio_loffset = off;
108 \fBread\fR(2), \fBwrite\fR(9E), \fBphysio\fR(9F), \fBcb_ops\fR(9S),
112 \fIWriting Device Drivers\fR