Changeset View
Changeset View
Standalone View
Standalone View
head/sys/compat/linprocfs/linprocfs.c
Show First 20 Lines • Show All 1,140 Lines • ▼ Show 20 Lines | |||||
static int | static int | ||||
linprocfs_doprocmaps(PFS_FILL_ARGS) | linprocfs_doprocmaps(PFS_FILL_ARGS) | ||||
{ | { | ||||
struct vmspace *vm; | struct vmspace *vm; | ||||
vm_map_t map; | vm_map_t map; | ||||
vm_map_entry_t entry, tmp_entry; | vm_map_entry_t entry, tmp_entry; | ||||
vm_object_t obj, tobj, lobj; | vm_object_t obj, tobj, lobj; | ||||
vm_offset_t e_start, e_end; | vm_offset_t e_start, e_end; | ||||
vm_ooffset_t off = 0; | vm_ooffset_t off; | ||||
vm_prot_t e_prot; | vm_prot_t e_prot; | ||||
unsigned int last_timestamp; | unsigned int last_timestamp; | ||||
char *name = "", *freename = NULL; | char *name = "", *freename = NULL; | ||||
const char *l_map_str; | const char *l_map_str; | ||||
ino_t ino; | ino_t ino; | ||||
int ref_count, shadow_count, flags; | int ref_count, shadow_count, flags; | ||||
int error; | int error; | ||||
struct vnode *vp; | struct vnode *vp; | ||||
struct vattr vat; | struct vattr vat; | ||||
bool private; | |||||
PROC_LOCK(p); | PROC_LOCK(p); | ||||
error = p_candebug(td, p); | error = p_candebug(td, p); | ||||
PROC_UNLOCK(p); | PROC_UNLOCK(p); | ||||
if (error) | if (error) | ||||
return (error); | return (error); | ||||
if (uio->uio_rw != UIO_READ) | if (uio->uio_rw != UIO_READ) | ||||
Show All 14 Lines | VM_MAP_ENTRY_FOREACH(entry, map) { | ||||
name = ""; | name = ""; | ||||
freename = NULL; | freename = NULL; | ||||
if (entry->eflags & MAP_ENTRY_IS_SUB_MAP) | if (entry->eflags & MAP_ENTRY_IS_SUB_MAP) | ||||
continue; | continue; | ||||
e_prot = entry->protection; | e_prot = entry->protection; | ||||
e_start = entry->start; | e_start = entry->start; | ||||
e_end = entry->end; | e_end = entry->end; | ||||
obj = entry->object.vm_object; | obj = entry->object.vm_object; | ||||
for (lobj = tobj = obj; tobj; tobj = tobj->backing_object) { | off = entry->offset; | ||||
for (lobj = tobj = obj; tobj != NULL; | |||||
lobj = tobj, tobj = tobj->backing_object) { | |||||
VM_OBJECT_RLOCK(tobj); | VM_OBJECT_RLOCK(tobj); | ||||
off += lobj->backing_object_offset; | |||||
if (lobj != obj) | if (lobj != obj) | ||||
VM_OBJECT_RUNLOCK(lobj); | VM_OBJECT_RUNLOCK(lobj); | ||||
lobj = tobj; | |||||
} | } | ||||
private = (entry->eflags & MAP_ENTRY_COW) != 0 || obj == NULL || | |||||
(obj->flags & OBJ_ANON) != 0; | |||||
last_timestamp = map->timestamp; | last_timestamp = map->timestamp; | ||||
vm_map_unlock_read(map); | vm_map_unlock_read(map); | ||||
ino = 0; | ino = 0; | ||||
if (lobj) { | if (lobj) { | ||||
off = IDX_TO_OFF(lobj->size); | |||||
vp = vm_object_vnode(lobj); | vp = vm_object_vnode(lobj); | ||||
if (vp != NULL) | if (vp != NULL) | ||||
vref(vp); | vref(vp); | ||||
if (lobj != obj) | if (lobj != obj) | ||||
VM_OBJECT_RUNLOCK(lobj); | VM_OBJECT_RUNLOCK(lobj); | ||||
flags = obj->flags; | flags = obj->flags; | ||||
ref_count = obj->ref_count; | ref_count = obj->ref_count; | ||||
shadow_count = obj->shadow_count; | shadow_count = obj->shadow_count; | ||||
Show All 20 Lines | VM_MAP_ENTRY_FOREACH(entry, map) { | ||||
* format: | * format: | ||||
* start, end, access, offset, major, minor, inode, name. | * start, end, access, offset, major, minor, inode, name. | ||||
*/ | */ | ||||
error = sbuf_printf(sb, l_map_str, | error = sbuf_printf(sb, l_map_str, | ||||
(u_long)e_start, (u_long)e_end, | (u_long)e_start, (u_long)e_end, | ||||
(e_prot & VM_PROT_READ)?"r":"-", | (e_prot & VM_PROT_READ)?"r":"-", | ||||
(e_prot & VM_PROT_WRITE)?"w":"-", | (e_prot & VM_PROT_WRITE)?"w":"-", | ||||
(e_prot & VM_PROT_EXECUTE)?"x":"-", | (e_prot & VM_PROT_EXECUTE)?"x":"-", | ||||
"p", | private ? "p" : "s", | ||||
(u_long)off, | (u_long)off, | ||||
0, | 0, | ||||
0, | 0, | ||||
(u_long)ino, | (u_long)ino, | ||||
*name ? " " : "", | *name ? " " : "", | ||||
name | name | ||||
); | ); | ||||
if (freename) | if (freename) | ||||
▲ Show 20 Lines • Show All 583 Lines • Show Last 20 Lines |