procfs_ioctl.c (147676) | procfs_ioctl.c (147692) |
---|---|
1/*- 2 * Copyright (c) 2001 Dag-Erling Co�dan Sm�rgrav 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 11 unchanged lines hidden (view full) --- 20 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 21 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 22 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 * | 1/*- 2 * Copyright (c) 2001 Dag-Erling Co�dan Sm�rgrav 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 11 unchanged lines hidden (view full) --- 20 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 21 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 22 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 * |
28 * $FreeBSD: head/sys/fs/procfs/procfs_ioctl.c 147676 2005-06-30 00:19:08Z peter $ | 28 * $FreeBSD: head/sys/fs/procfs/procfs_ioctl.c 147692 2005-06-30 07:49:22Z peter $ |
29 */ 30 31#include "opt_compat.h" 32 33#include <sys/param.h> 34#include <sys/lock.h> 35#include <sys/mutex.h> 36#include <sys/pioctl.h> 37#include <sys/proc.h> 38#include <sys/signalvar.h> 39#include <sys/systm.h> 40 41#include <fs/pseudofs/pseudofs.h> 42#include <fs/procfs/procfs.h> 43 | 29 */ 30 31#include "opt_compat.h" 32 33#include <sys/param.h> 34#include <sys/lock.h> 35#include <sys/mutex.h> 36#include <sys/pioctl.h> 37#include <sys/proc.h> 38#include <sys/signalvar.h> 39#include <sys/systm.h> 40 41#include <fs/pseudofs/pseudofs.h> 42#include <fs/procfs/procfs.h> 43 |
44#ifdef COMPAT_IA32 45struct procfs_status32 { 46 int state; /* Running, stopped, something else? */ 47 int flags; /* Any flags */ 48 unsigned int events; /* Events to stop on */ 49 int why; /* What event, if any, proc stopped on */ 50 unsigned int val; /* Any extra data */ 51}; 52 53#define PIOCWAIT32 _IOR('p', 4, struct procfs_status32) 54#define PIOCSTATUS32 _IOR('p', 6, struct procfs_status32) 55#endif 56 |
|
44/* 45 * Process ioctls 46 */ 47int 48procfs_ioctl(PFS_IOCTL_ARGS) 49{ 50 struct procfs_status *ps; | 57/* 58 * Process ioctls 59 */ 60int 61procfs_ioctl(PFS_IOCTL_ARGS) 62{ 63 struct procfs_status *ps; |
64#ifdef COMPAT_IA32 65 struct procfs_status32 *ps32; 66#endif |
|
51 int error, flags, sig; 52 53 PROC_LOCK(p); 54 error = 0; 55 switch (cmd) { 56#if defined(COMPAT_FREEBSD5) || defined(COMPAT_FREEBSD4) || defined(COMPAT_43) 57 case _IOC(IOC_IN, 'p', 1, 0): 58#endif --- 30 unchanged lines hidden (view full) --- 89 case PIOCSTATUS: 90 ps = (struct procfs_status *)data; 91 ps->state = (p->p_step == 0); 92 ps->flags = 0; /* nope */ 93 ps->events = p->p_stops; 94 ps->why = p->p_step ? p->p_stype : 0; 95 ps->val = p->p_step ? p->p_xstat : 0; 96 break; | 67 int error, flags, sig; 68 69 PROC_LOCK(p); 70 error = 0; 71 switch (cmd) { 72#if defined(COMPAT_FREEBSD5) || defined(COMPAT_FREEBSD4) || defined(COMPAT_43) 73 case _IOC(IOC_IN, 'p', 1, 0): 74#endif --- 30 unchanged lines hidden (view full) --- 105 case PIOCSTATUS: 106 ps = (struct procfs_status *)data; 107 ps->state = (p->p_step == 0); 108 ps->flags = 0; /* nope */ 109 ps->events = p->p_stops; 110 ps->why = p->p_step ? p->p_stype : 0; 111 ps->val = p->p_step ? p->p_xstat : 0; 112 break; |
113#ifdef COMPAT_IA32 114 case PIOCWAIT32: 115 while (p->p_step == 0) { 116 /* sleep until p stops */ 117 error = msleep(&p->p_stype, &p->p_mtx, 118 PWAIT|PCATCH, "pioctl", 0); 119 if (error != 0) 120 break; 121 } 122 /* fall through to PIOCSTATUS32 */ 123 case PIOCSTATUS32: 124 ps32 = (struct procfs_status32 *)data; 125 ps32->state = (p->p_step == 0); 126 ps32->flags = 0; /* nope */ 127 ps32->events = p->p_stops; 128 ps32->why = p->p_step ? p->p_stype : 0; 129 ps32->val = p->p_step ? p->p_xstat : 0; 130 break; 131#endif |
|
97#if defined(COMPAT_FREEBSD5) || defined(COMPAT_FREEBSD4) || defined(COMPAT_43) 98 case _IOC(IOC_IN, 'p', 5, 0): 99#endif 100 case PIOCCONT: 101 if (p->p_step == 0) 102 break; 103 sig = *(uintptr_t *)data; 104 if (sig != 0 && !_SIG_VALID(sig)) { --- 43 unchanged lines hidden --- | 132#if defined(COMPAT_FREEBSD5) || defined(COMPAT_FREEBSD4) || defined(COMPAT_43) 133 case _IOC(IOC_IN, 'p', 5, 0): 134#endif 135 case PIOCCONT: 136 if (p->p_step == 0) 137 break; 138 sig = *(uintptr_t *)data; 139 if (sig != 0 && !_SIG_VALID(sig)) { --- 43 unchanged lines hidden --- |