From owner-svn-src-all@freebsd.org Mon Dec 7 22:08:13 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5409C9C1533; Mon, 7 Dec 2015 22:08:13 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 3036A1CBC; Mon, 7 Dec 2015 22:08:13 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id tB7M8Cq6002786; Mon, 7 Dec 2015 22:08:12 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tB7M8CbZ002785; Mon, 7 Dec 2015 22:08:12 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201512072208.tB7M8CbZ002785@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Mon, 7 Dec 2015 22:08:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r291968 - head/share/man/man9 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Dec 2015 22:08:13 -0000 Author: markj Date: Mon Dec 7 22:08:12 2015 New Revision: 291968 URL: https://svnweb.freebsd.org/changeset/base/291968 Log: Actually add the proc_rwmem(9) man page, missed in r291961. Added: head/share/man/man9/proc_rwmem.9 (contents, props changed) Added: head/share/man/man9/proc_rwmem.9 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/share/man/man9/proc_rwmem.9 Mon Dec 7 22:08:12 2015 (r291968) @@ -0,0 +1,104 @@ +.\" +.\" Copyright (c) 2015 Mark Johnston +.\" +.\" 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. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``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 DEVELOPERS 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. +.\" +.\" $FreeBSD$ +.\" +.Dd December 7, 2015 +.Dt PROC_RWMEM 9 +.Os +.Sh NAME +.Nm proc_rwmem , +.Nm proc_readmem , +.Nm proc_writemem +.Nd read from or write to a process address space +.Sh SYNOPSIS +.In sys/types.h +.In sys/ptrace.h +.Ft int +.Fn proc_rwmem "struct proc *p" "struct uio *uio" +.Ft ssize_t +.Fn proc_readmem "struct thread *td" "struct proc *p" "vm_offset_t va" "void *buf" "size_t len" +.Ft ssize_t +.Fn proc_writemem "struct thread *td" "struct proc *p" "vm_offset_t va" "void *buf" "size_t len" +.Sh DESCRIPTION +These functions are used to read to or write from the address space of the +process +.Fa p . +The +.Fn proc_rwmem +function requires the caller to specify the I/O parameters using a +.Vt "struct uio" , +described in +.Xr uio 9 . +The +.Fn proc_readmem +and +.Fn proc_writemem +functions provide a simpler, less general interface which allows the caller to +read into or write the kernel buffer +.Fa buf +of size +.Fa len +from or to the memory at offset +.Fa va +in the address space of +.Fa p . +The operation is performed on behalf of thread +.Fa td , +which will most often be the current thread. +.Pp +These functions may sleep and thus may not be called with any non-sleepable +locks held. +The process +.Fa p +must be held by the caller using +.Xr PHOLD 9 . +.Sh RETURN VALUES +The +.Fn proc_rwmem +function returns +.Dv 0 +on success. +.Dv EFAULT +is returned if the specified user address is invalid, and +.Dv ENOMEM +is returned if the target pages could not be faulted in due to a resource +shortage. +.Pp +The +.Fn proc_readmem +and +.Fn proc_writemem +functions return the number of bytes read or written, respectively. +This may be smaller than the number of bytes requested, for example if the +request spans multiple pages in the process address space and one of them after +the first is not mapped. +Otherwise, -1 is returned. +.Sh SEE ALSO +.Xr copyin 9 , +.Xr locking 9 , +.Xr PHOLD 9 , +.Xr uio 9 +.Sh AUTHORS +This manual page was written by +.An Mark Johnston Aq Mt markj@FreeBSD.org .