1997-03-22 21:31:29 +00:00
|
|
|
.\" $NetBSD: physio.9,v 1.2 1996/11/11 00:05:12 lukem Exp $
|
|
|
|
.\"
|
|
|
|
.\" Copyright (c) 1996 The NetBSD Foundation, Inc.
|
|
|
|
.\" All rights reserved.
|
|
|
|
.\"
|
|
|
|
.\" This code is derived from software contributed to The NetBSD Foundation
|
|
|
|
.\" by Paul Kranenburg.
|
|
|
|
.\"
|
|
|
|
.\" Redistribution and use in source and binary forms, with or without
|
|
|
|
.\" modification, are permitted provided that the following conditions
|
|
|
|
.\" are met:
|
|
|
|
.\" 1. Redistributions of source code must retain the above copyright
|
|
|
|
.\" notice, this list of conditions and the following disclaimer.
|
|
|
|
.\" 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
.\" notice, this list of conditions and the following disclaimer in the
|
|
|
|
.\" documentation and/or other materials provided with the distribution.
|
|
|
|
.\" 3. All advertising materials mentioning features or use of this software
|
|
|
|
.\" must display the following acknowledgement:
|
|
|
|
.\" This product includes software developed by the NetBSD
|
|
|
|
.\" Foundation, Inc. and its contributors.
|
|
|
|
.\" 4. Neither the name of The NetBSD Foundation nor the names of its
|
|
|
|
.\" contributors may be used to endorse or promote products derived
|
|
|
|
.\" from this software without specific prior written permission.
|
|
|
|
.\"
|
|
|
|
.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
|
|
|
|
.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
|
|
|
.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
|
|
|
.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE
|
|
|
|
.\" LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
|
|
|
.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
|
|
|
.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
|
|
|
.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
|
|
|
.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
|
|
|
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
|
|
.\" POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
.\"
|
1999-08-28 00:22:10 +00:00
|
|
|
.\" $FreeBSD$
|
1999-07-12 21:02:10 +00:00
|
|
|
.\"
|
1997-03-22 21:31:29 +00:00
|
|
|
.Dd June 15, 1996
|
|
|
|
.Dt PHYSIO 9
|
2001-07-10 15:31:11 +00:00
|
|
|
.Os
|
1997-03-22 21:31:29 +00:00
|
|
|
.Sh NAME
|
|
|
|
.Nm physio
|
|
|
|
.Nd initiate I/O on raw devices
|
|
|
|
.Sh SYNOPSIS
|
2001-10-01 16:09:29 +00:00
|
|
|
.In sys/param.h
|
|
|
|
.In sys/systm.h
|
2001-12-26 23:14:04 +00:00
|
|
|
.In sys/bio.h
|
2001-10-01 16:09:29 +00:00
|
|
|
.In sys/buf.h
|
1997-03-22 21:31:29 +00:00
|
|
|
.Ft int
|
1999-12-23 17:22:58 +00:00
|
|
|
.Fn physio "dev_t dev" "struct uio *uio" "int ioflag"
|
1997-03-22 21:31:29 +00:00
|
|
|
.Sh DESCRIPTION
|
|
|
|
The
|
|
|
|
.Fn physio
|
2002-03-18 10:59:58 +00:00
|
|
|
is a helper function typically called from character device
|
|
|
|
.Fn read
|
|
|
|
and
|
|
|
|
.Fn write
|
2000-03-03 14:05:08 +00:00
|
|
|
routines to start I/O on a user process buffer.
|
2002-03-18 10:59:58 +00:00
|
|
|
The maximum amount of data to transfer with each call
|
|
|
|
is determined by
|
|
|
|
.Fa dev->si_iosize_max .
|
2002-02-05 21:32:57 +00:00
|
|
|
.Pp
|
2000-03-03 14:05:08 +00:00
|
|
|
Since
|
1997-03-22 21:31:29 +00:00
|
|
|
.Fa uio
|
|
|
|
normally describes user space addresses,
|
|
|
|
.Fn physio
|
2002-03-18 10:59:58 +00:00
|
|
|
needs to lock the process into memory.
|
|
|
|
This is done by setting the
|
1997-03-22 21:31:29 +00:00
|
|
|
.Dv P_PHYSIO
|
|
|
|
flag on the process.
|
|
|
|
.Fn physio
|
|
|
|
always awaits the completion of the entire requested transfer before
|
2000-03-03 14:05:08 +00:00
|
|
|
returning, unless an error condition is detected earlier.
|
1997-03-22 21:31:29 +00:00
|
|
|
.Pp
|
|
|
|
A break-down of the arguments follows:
|
|
|
|
.Bl -tag -width indent
|
|
|
|
.It Fa dev
|
|
|
|
The device number identifying the device to interact with.
|
|
|
|
.It Fa uio
|
|
|
|
The description of the entire transfer as requested by the user process.
|
|
|
|
Currently, the results of passing a
|
|
|
|
.Fa uio
|
|
|
|
structure with the
|
2002-03-18 10:59:58 +00:00
|
|
|
.Va uio_segflg
|
1997-03-22 21:31:29 +00:00
|
|
|
set to anything other than
|
2002-03-18 10:59:58 +00:00
|
|
|
.Dv UIO_USERSPACE
|
1997-03-22 21:31:29 +00:00
|
|
|
are undefined.
|
|
|
|
.El
|
|
|
|
.Sh RETURN VALUES
|
|
|
|
If successful
|
|
|
|
.Fn physio
|
|
|
|
returns 0.
|
|
|
|
.Er EFAULT
|
|
|
|
is returned if the address range described by
|
|
|
|
.Fa uio
|
|
|
|
is not accessible by the requesting process.
|
|
|
|
.Fn physio
|
|
|
|
will return any error resulting from calls to the device strategy routine,
|
|
|
|
by examining the
|
|
|
|
.Dv B_ERROR
|
|
|
|
buffer flag and the
|
|
|
|
.Va b_error
|
2000-03-03 14:05:08 +00:00
|
|
|
field.
|
|
|
|
Note that the actual transfer size may be less than requested by
|
1997-03-22 21:31:29 +00:00
|
|
|
.Fa uio
|
|
|
|
if the device signals an
|
2002-03-18 10:59:58 +00:00
|
|
|
.Dq "end of file"
|
1997-03-22 21:31:29 +00:00
|
|
|
condition.
|
|
|
|
.Sh SEE ALSO
|
|
|
|
.Xr read 2 ,
|
|
|
|
.Xr write 2
|
2002-02-05 21:32:57 +00:00
|
|
|
.Sh HISTORY
|
2002-03-18 10:59:58 +00:00
|
|
|
The
|
|
|
|
.Nm
|
|
|
|
manual page is originally from
|
|
|
|
.Nx
|
|
|
|
with minor changes for applicability with
|
|
|
|
.Fx .
|
2002-02-05 21:32:57 +00:00
|
|
|
.Pp
|
2002-03-18 10:59:58 +00:00
|
|
|
The
|
|
|
|
.Nm
|
|
|
|
call has been completely re-written for providing higher
|
2002-02-05 21:32:57 +00:00
|
|
|
I/O performance, and better paging performance.
|