read(D2) read(D2)
NAME
read - read data from a device
SYNOPSIS
#include <sys/types.h>
#include <sys/errno.h>
#include <sys/uio.h>
#include <sys/cred.h>
#include <sys/ddi.h>
int prefixread(dev_t dev, uio_t *uiop, cred_t *crp);
Arguments
dev Device number.
uiop Pointer to the uio(D4) structure that describes
where the data is to be stored in user space.
crp Pointer to the user credential structure for the I/O
transaction.
DESCRIPTION
The driver read routine is called during the read(2) system
call. The read routine is responsible for transferring data
from the device to the user data area.
Return Values
The read routine should return 0 for success, or the
appropriate error number.
USAGE
This entry point is optional, and is valid for character
device drivers only.
The pointer to the user credentials, crp, is available so the
driver can check to see if the user can read privileged
information, if the driver provides access to any. The uio
structure provides the information necessary to determine how
much data should be transferred. The uiomove(D3) function
provides a convenient way to copy data using the uio
structure.
Block drivers that provide a character interface can use
physiock(D3) to perform the data transfer with the driver's
strategy(D2) routine.
Copyright 1994 Novell, Inc. Page 1
read(D2) read(D2)
Synchronization Constraints
The read routine has user context and can sleep.
REFERENCES
drv_priv(D3), errnos(D5), physiock(D3), strategy(D2), uio(D4),
uiomove(D3), ureadc(D3), write(D2)
NOTICES
Portability
All processors
Applicability
ddi: 1, 2, 3, 4, 5, 5mp, 6, 6mp, 7, 7mp
Copyright 1994 Novell, Inc. Page 2