procfs_map.c (139776) | procfs_map.c (147692) |
---|---|
1/*- 2 * Copyright (c) 1993 Jan-Simon Pendry 3 * Copyright (c) 1993 4 * The Regents of the University of California. All rights reserved. 5 * 6 * This code is derived from software contributed to Berkeley by 7 * Jan-Simon Pendry. 8 * --- 18 unchanged lines hidden (view full) --- 27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 31 * SUCH DAMAGE. 32 * 33 * @(#)procfs_status.c 8.3 (Berkeley) 2/17/94 34 * | 1/*- 2 * Copyright (c) 1993 Jan-Simon Pendry 3 * Copyright (c) 1993 4 * The Regents of the University of California. All rights reserved. 5 * 6 * This code is derived from software contributed to Berkeley by 7 * Jan-Simon Pendry. 8 * --- 18 unchanged lines hidden (view full) --- 27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 31 * SUCH DAMAGE. 32 * 33 * @(#)procfs_status.c 8.3 (Berkeley) 2/17/94 34 * |
35 * $FreeBSD: head/sys/fs/procfs/procfs_map.c 139776 2005-01-06 18:10:42Z imp $ | 35 * $FreeBSD: head/sys/fs/procfs/procfs_map.c 147692 2005-06-30 07:49:22Z peter $ |
36 */ 37 | 36 */ 37 |
38#include "opt_compat.h" 39 |
|
38#include <sys/param.h> 39#include <sys/systm.h> 40#include <sys/lock.h> 41#include <sys/filedesc.h> 42#include <sys/malloc.h> 43#include <sys/mutex.h> 44#include <sys/proc.h> 45#include <sys/uio.h> 46#include <sys/vnode.h> 47 48#include <fs/pseudofs/pseudofs.h> 49#include <fs/procfs/procfs.h> 50 51#include <vm/vm.h> 52#include <vm/pmap.h> 53#include <vm/vm_map.h> 54#include <vm/vm_page.h> 55#include <vm/vm_object.h> 56 | 40#include <sys/param.h> 41#include <sys/systm.h> 42#include <sys/lock.h> 43#include <sys/filedesc.h> 44#include <sys/malloc.h> 45#include <sys/mutex.h> 46#include <sys/proc.h> 47#include <sys/uio.h> 48#include <sys/vnode.h> 49 50#include <fs/pseudofs/pseudofs.h> 51#include <fs/procfs/procfs.h> 52 53#include <vm/vm.h> 54#include <vm/pmap.h> 55#include <vm/vm_map.h> 56#include <vm/vm_page.h> 57#include <vm/vm_object.h> 58 |
59#ifdef COMPAT_IA32 60#include <sys/procfs.h> 61#include <machine/fpu.h> 62#include <compat/ia32/ia32_reg.h> |
|
57 | 63 |
64extern struct sysentvec ia32_freebsd_sysvec; 65#endif 66 67 |
|
58#define MEBUFFERSIZE 256 59 60/* 61 * The map entries can *almost* be read with programs like cat. However, 62 * large maps need special programs to read. It is not easy to implement 63 * a program that can sense the required size of the buffer, and then 64 * subsequently do a read with the appropriate size. This operation cannot 65 * be atomic. The best that we can do is to allow the program to do a read --- 6 unchanged lines hidden (view full) --- 72{ 73 int len; 74 int error; 75 vm_map_t map = &p->p_vmspace->vm_map; 76 pmap_t pmap = vmspace_pmap(p->p_vmspace); 77 vm_map_entry_t entry; 78 char mebuffer[MEBUFFERSIZE]; 79 char *fullpath, *freepath; | 68#define MEBUFFERSIZE 256 69 70/* 71 * The map entries can *almost* be read with programs like cat. However, 72 * large maps need special programs to read. It is not easy to implement 73 * a program that can sense the required size of the buffer, and then 74 * subsequently do a read with the appropriate size. This operation cannot 75 * be atomic. The best that we can do is to allow the program to do a read --- 6 unchanged lines hidden (view full) --- 82{ 83 int len; 84 int error; 85 vm_map_t map = &p->p_vmspace->vm_map; 86 pmap_t pmap = vmspace_pmap(p->p_vmspace); 87 vm_map_entry_t entry; 88 char mebuffer[MEBUFFERSIZE]; 89 char *fullpath, *freepath; |
90#ifdef COMPAT_IA32 91 int wrap32 = 0; 92#endif |
|
80 81 GIANT_REQUIRED; 82 83 PROC_LOCK(p); 84 error = p_candebug(td, p); 85 PROC_UNLOCK(p); 86 if (error) 87 return (error); 88 89 if (uio->uio_rw != UIO_READ) 90 return (EOPNOTSUPP); 91 92 if (uio->uio_offset != 0) 93 return (0); 94 | 93 94 GIANT_REQUIRED; 95 96 PROC_LOCK(p); 97 error = p_candebug(td, p); 98 PROC_UNLOCK(p); 99 if (error) 100 return (error); 101 102 if (uio->uio_rw != UIO_READ) 103 return (EOPNOTSUPP); 104 105 if (uio->uio_offset != 0) 106 return (0); 107 |
108#ifdef COMPAT_IA32 109 if (curthread->td_proc->p_sysent == &ia32_freebsd_sysvec) { 110 if (p->p_sysent != &ia32_freebsd_sysvec) 111 return (EOPNOTSUPP); 112 wrap32 = 1; 113 } 114#endif |
|
95 error = 0; 96 if (map != &curthread->td_proc->p_vmspace->vm_map) 97 vm_map_lock_read(map); 98 for (entry = map->header.next; 99 ((uio->uio_resid > 0) && (entry != &map->header)); 100 entry = entry->next) { 101 vm_object_t obj, tobj, lobj; 102 int ref_count, shadow_count, flags; --- 56 unchanged lines hidden (view full) --- 159 160 /* 161 * format: 162 * start, end, resident, private resident, cow, access, type. 163 */ 164 snprintf(mebuffer, sizeof mebuffer, 165 "0x%lx 0x%lx %d %d %p %s%s%s %d %d 0x%x %s %s %s %s\n", 166 (u_long)entry->start, (u_long)entry->end, | 115 error = 0; 116 if (map != &curthread->td_proc->p_vmspace->vm_map) 117 vm_map_lock_read(map); 118 for (entry = map->header.next; 119 ((uio->uio_resid > 0) && (entry != &map->header)); 120 entry = entry->next) { 121 vm_object_t obj, tobj, lobj; 122 int ref_count, shadow_count, flags; --- 56 unchanged lines hidden (view full) --- 179 180 /* 181 * format: 182 * start, end, resident, private resident, cow, access, type. 183 */ 184 snprintf(mebuffer, sizeof mebuffer, 185 "0x%lx 0x%lx %d %d %p %s%s%s %d %d 0x%x %s %s %s %s\n", 186 (u_long)entry->start, (u_long)entry->end, |
167 resident, privateresident, obj, | 187 resident, privateresident, 188#ifdef COMPAT_IA32 189 wrap32 ? NULL : obj, /* Hide 64 bit value */ 190#else 191 obj, 192#endif |
168 (entry->protection & VM_PROT_READ)?"r":"-", 169 (entry->protection & VM_PROT_WRITE)?"w":"-", 170 (entry->protection & VM_PROT_EXECUTE)?"x":"-", 171 ref_count, shadow_count, flags, 172 (entry->eflags & MAP_ENTRY_COW)?"COW":"NCOW", 173 (entry->eflags & MAP_ENTRY_NEEDS_COPY)?"NC":"NNC", 174 type, fullpath); 175 --- 17 unchanged lines hidden --- | 193 (entry->protection & VM_PROT_READ)?"r":"-", 194 (entry->protection & VM_PROT_WRITE)?"w":"-", 195 (entry->protection & VM_PROT_EXECUTE)?"x":"-", 196 ref_count, shadow_count, flags, 197 (entry->eflags & MAP_ENTRY_COW)?"COW":"NCOW", 198 (entry->eflags & MAP_ENTRY_NEEDS_COPY)?"NC":"NNC", 199 type, fullpath); 200 --- 17 unchanged lines hidden --- |