1
0
Files
irix-657m-src/eoe/man/manD/read.d2
2022-09-29 17:59:04 +03:00

70 lines
1.8 KiB
Plaintext

.if n .pH ddi.rm/d2/gen/read @(#)read 43.9 of 11/25/92
.\" Copyright 1992, 1991 UNIX System Laboratories, Inc.
.TH read D2
.IX "\f4read\fP(D2)"
.SH "NAME"
\f4read\fP \- read data from a device
.SH "SYNOPSIS"
.nf
.na
.ft 4
#include <sys/types.h>
#include <sys/errno.h>
#include <sys/uio.h>
#include <sys/cred.h>
#include <sys/ddi.h>
.sp 0.4
int \f2prefix\fPread(dev_t \f2dev\fP, uio_t *\f2uiop\fP, cred_t *\f2crp\fP);
.ft 1
.ad
.fi
.SS Arguments
.RS 0
.TP 10
\f2dev\fP
Device number.
.TP
\f2uiop\fP
Pointer to the \f4uio\fP(D4) structure that describes where the data
is to be stored in user space.
.TP
\f2crp\fP
Pointer to the user credential structure for the I/O
transaction.
.RE
.SH "DESCRIPTION"
The driver \f4read\fP routine is called during
the \f4read\fP(2) system call.
The \f4read\fP routine is responsible for transferring data from the device
to the user data area.
.SS "Return Values"
The \f4read\fP routine should return 0 for success,
or the appropriate error number.
.SH USAGE
This entry point is optional,
and is valid for character device drivers only.
.P
The pointer to the user credentials, \f2crp\fP, is available
so the driver can check to see if the user can read privileged
information, if the driver provides access to any.
The \f4uio\fP structure provides the information necessary to determine
how much data should be transferred.
The \f4uiomove\fP(D3) function provides
a convenient way to copy data using the \f4uio\fP structure.
.P
Block drivers that provide a character interface can use \f4physiock\fP(D3) to
perform the data transfer with the driver's \f4strategy\fP(D2) routine.
.SS "Synchronization Constraints"
The \f4read\fP routine has user context and can sleep.
.SH REFERENCES
.na
\f4drv_priv\fP(D3),
\f4errnos\fP(D5),
\f4physiock\fP(D3),
\f4strategy\fP(D2),
\f4uio\fP(D4),
\f4uiomove\fP(D3),
\f4ureadc\fP(D3),
\f4write\fP(D2)
.ad