/*-1* SPDX-License-Identifier: BSD-3-Clause2*3* Copyright (c) 1993 Jan-Simon Pendry4* Copyright (c) 1993 Sean Eric Fagan5* Copyright (c) 19936* The Regents of the University of California. All rights reserved.7*8* This code is derived from software contributed to Berkeley by9* Jan-Simon Pendry and Sean Eric Fagan.10*11* Redistribution and use in source and binary forms, with or without12* modification, are permitted provided that the following conditions13* are met:14* 1. Redistributions of source code must retain the above copyright15* notice, this list of conditions and the following disclaimer.16* 2. Redistributions in binary form must reproduce the above copyright17* notice, this list of conditions and the following disclaimer in the18* documentation and/or other materials provided with the distribution.19* 3. Neither the name of the University nor the names of its contributors20* may be used to endorse or promote products derived from this software21* without specific prior written permission.22*23* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND24* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE25* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE26* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE27* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL28* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS29* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)30* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT31* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY32* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF33* SUCH DAMAGE.34*/3536#include <sys/param.h>37#include <sys/lock.h>38#include <sys/mutex.h>39#include <sys/proc.h>40#include <sys/ptrace.h>41#include <sys/systm.h>42#include <sys/uio.h>43#include <sys/priv.h>4445#include <fs/pseudofs/pseudofs.h>46#include <fs/procfs/procfs.h>4748/*49* Copy data in and out of the target process.50* We do this by mapping the process's page into51* the kernel and then doing a uiomove direct52* from the kernel address space.53*/54int55procfs_doprocmem(PFS_FILL_ARGS)56{57int error;5859if (uio->uio_resid == 0)60return (0);6162PROC_LOCK(p);63error = p_candebug(td, p);64PROC_UNLOCK(p);65if (error == 0)66error = proc_rwmem(p, uio);6768return (error);69}707172