Current File : //usr/share/man/man9f/ldi_read.9f
'\" te
.\"  Copyright (c) 2003, Sun Microsystems, Inc.,  All Rights Reserved
.TH ldi_read 9F "3 June 2003" "SunOS 5.11" "Kernel Functions for Drivers"
.SH NAME
ldi_read, ldi_write \- Read and write from a device
.SH SYNOPSIS
.LP
.nf
#include <sys/sunldi.h>

\fB\fR\fBint\fR ldi_read(\fBldi_handle_t\fR \fIlh\fR, \fBstruct uio *\fR\fIuiop\fR, \fBcred_t *\fR\fIcr\fR);
.fi

.LP
.nf
\fBint\fR \fB ldi_write\fR(\fBldi_handle_t\fR \fIlh\fR, \fBstruct uio *\fR\fIuiop\fR, \fBcred_t *\fR\fIcr\fR);
.fi

.SH PARAMETERS
.sp
.ne 2
.mk
.na
\fB\fIlh\fR \fR
.ad
.RS 9n
.rt  
Layered handle.
.RE

.sp
.ne 2
.mk
.na
\fB\fIcr\fR \fR
.ad
.RS 9n
.rt  
Pointer to a credential structure used to open a device.
.RE

.sp
.ne 2
.mk
.na
\fB\fIuiop\fR \fR
.ad
.RS 9n
.rt  
Pointer to the \fBuio(9S)\fR structure. \fBuio(9S)\fR specifies  the location of the read or write data.  (Either userland or kernel.)
.RE

.SH DESCRIPTION
.sp
.LP
The \fBldi_read()\fR function passes a read request to the device entry point for the device specified by the layered handle. This operation is supported  for  block,  character, and streams devices.
.sp
.LP
The \fBldi_write()\fR function passes a write request to the device entry  point for a device specified by the layered handle. This operation is supported for block,  character, and streams devices.
.SH RETURN VALUES
.sp
.LP
The \fBldi_read()\fR and \fBldi_write()\fR functions return \fB0\fR upon success. If  a  failure occurs before the request is passed to the device, the possible return values are shown below. Otherwise any other error number may be returned by the device.
.sp
.ne 2
.mk
.na
\fBEINVAL\fR
.ad
.RS 11n
.rt  
Invalid input parameters.
.RE

.sp
.ne 2
.mk
.na
\fBENOTSUP\fR
.ad
.RS 11n
.rt  
Operation is not supported for this device.
.RE

.SH CONTEXT
.sp
.LP
These functions may be called from user or kernel context.