procfs_dbregs.c (90715) | procfs_dbregs.c (90716) |
---|---|
1/*- 2 * Copyright (c) 1999 Brian Scott Dean, brdean@unx.sas.com. 3 * All rights reserved. 4 * 5 * This code is derived from software contributed to Berkeley by 6 * Jan-Simon Pendry under the following copyrights and conditions: 7 * 8 * Copyright (c) 1993 Jan-Simon Pendry --- 26 unchanged lines hidden (view full) --- 35 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 36 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 37 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 38 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 39 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 40 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 41 * SUCH DAMAGE. 42 * | 1/*- 2 * Copyright (c) 1999 Brian Scott Dean, brdean@unx.sas.com. 3 * All rights reserved. 4 * 5 * This code is derived from software contributed to Berkeley by 6 * Jan-Simon Pendry under the following copyrights and conditions: 7 * 8 * Copyright (c) 1993 Jan-Simon Pendry --- 26 unchanged lines hidden (view full) --- 35 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 36 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 37 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 38 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 39 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 40 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 41 * SUCH DAMAGE. 42 * |
43 * $FreeBSD: head/sys/fs/procfs/procfs_dbregs.c 90715 2002-02-16 04:05:32Z bde $ | 43 * From: @(#)procfs_regs.c 8.4 (Berkeley) 6/15/94 44 * 45 * From: 46 * $Id: procfs_regs.c,v 3.2 1993/12/15 09:40:17 jsp Exp $ 47 * $FreeBSD: head/sys/fs/procfs/procfs_dbregs.c 90716 2002-02-16 05:38:07Z bde $ |
44 */ 45 46#include <sys/param.h> 47#include <sys/systm.h> 48#include <sys/lock.h> 49#include <sys/mutex.h> 50#include <sys/proc.h> 51#include <sys/ptrace.h> --- 7 unchanged lines hidden (view full) --- 59int 60procfs_doprocdbregs(PFS_FILL_ARGS) 61{ 62 int error; 63 struct dbreg r; 64 char *kv; 65 int kl; 66 | 48 */ 49 50#include <sys/param.h> 51#include <sys/systm.h> 52#include <sys/lock.h> 53#include <sys/mutex.h> 54#include <sys/proc.h> 55#include <sys/ptrace.h> --- 7 unchanged lines hidden (view full) --- 63int 64procfs_doprocdbregs(PFS_FILL_ARGS) 65{ 66 int error; 67 struct dbreg r; 68 char *kv; 69 int kl; 70 |
67 if (p_candebug(td->td_proc, p) != 0) | 71 if (p_candebug(td->td_proc, p)) |
68 return (EPERM); 69 kl = sizeof(r); 70 kv = (char *) &r; 71 72 kv += uio->uio_offset; 73 kl -= uio->uio_offset; 74 if (kl > uio->uio_resid) 75 kl = uio->uio_resid; 76 77 PHOLD(p); 78 if (kl < 0) 79 error = EINVAL; 80 else | 72 return (EPERM); 73 kl = sizeof(r); 74 kv = (char *) &r; 75 76 kv += uio->uio_offset; 77 kl -= uio->uio_offset; 78 if (kl > uio->uio_resid) 79 kl = uio->uio_resid; 80 81 PHOLD(p); 82 if (kl < 0) 83 error = EINVAL; 84 else |
81 error = proc_read_dbregs(FIRST_THREAD_IN_PROC(p), &r); /* XXXKSE */ | 85 /* XXXKSE: */ 86 error = proc_read_dbregs(FIRST_THREAD_IN_PROC(p), &r); |
82 if (error == 0) 83 error = uiomove(kv, kl, uio); 84 if (error == 0 && uio->uio_rw == UIO_WRITE) { 85 if (p->p_stat != SSTOP) 86 error = EBUSY; 87 else | 87 if (error == 0) 88 error = uiomove(kv, kl, uio); 89 if (error == 0 && uio->uio_rw == UIO_WRITE) { 90 if (p->p_stat != SSTOP) 91 error = EBUSY; 92 else |
88 error = proc_write_dbregs(FIRST_THREAD_IN_PROC(p), &r); /* XXXKSE */ | 93 /* XXXKSE: */ 94 error = proc_write_dbregs(FIRST_THREAD_IN_PROC(p), &r); |
89 } 90 PRELE(p); 91 92 uio->uio_offset = 0; 93 return (error); 94} | 95 } 96 PRELE(p); 97 98 uio->uio_offset = 0; 99 return (error); 100} |