Deleted Added
full compact
kern_proc.c (185764) kern_proc.c (185984)
1/*-
2 * Copyright (c) 1982, 1986, 1989, 1991, 1993
3 * The Regents of the University of California. 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

--- 16 unchanged lines hidden (view full) ---

25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27 * SUCH DAMAGE.
28 *
29 * @(#)kern_proc.c 8.7 (Berkeley) 2/14/95
30 */
31
32#include <sys/cdefs.h>
1/*-
2 * Copyright (c) 1982, 1986, 1989, 1991, 1993
3 * The Regents of the University of California. 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

--- 16 unchanged lines hidden (view full) ---

25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27 * SUCH DAMAGE.
28 *
29 * @(#)kern_proc.c 8.7 (Berkeley) 2/14/95
30 */
31
32#include <sys/cdefs.h>
33__FBSDID("$FreeBSD: head/sys/kern/kern_proc.c 185764 2008-12-08 12:29:30Z kib $");
33__FBSDID("$FreeBSD: head/sys/kern/kern_proc.c 185984 2008-12-12 12:12:36Z kib $");
34
35#include "opt_compat.h"
36#include "opt_ddb.h"
37#include "opt_kdtrace.h"
38#include "opt_ktrace.h"
39#include "opt_kstack_pages.h"
40#include "opt_stack.h"
41

--- 1310 unchanged lines hidden (view full) ---

1352 char *fullpath, *freepath;
1353 struct kinfo_ovmentry *kve;
1354 struct vattr va;
1355 struct ucred *cred;
1356 int error, *name;
1357 struct vnode *vp;
1358 struct proc *p;
1359 vm_map_t map;
34
35#include "opt_compat.h"
36#include "opt_ddb.h"
37#include "opt_kdtrace.h"
38#include "opt_ktrace.h"
39#include "opt_kstack_pages.h"
40#include "opt_stack.h"
41

--- 1310 unchanged lines hidden (view full) ---

1352 char *fullpath, *freepath;
1353 struct kinfo_ovmentry *kve;
1354 struct vattr va;
1355 struct ucred *cred;
1356 int error, *name;
1357 struct vnode *vp;
1358 struct proc *p;
1359 vm_map_t map;
1360 struct vmspace *vm;
1360
1361 name = (int *)arg1;
1362 if ((p = pfind((pid_t)name[0])) == NULL)
1363 return (ESRCH);
1364 if (p->p_flag & P_WEXIT) {
1365 PROC_UNLOCK(p);
1366 return (ESRCH);
1367 }
1368 if ((error = p_candebug(curthread, p))) {
1369 PROC_UNLOCK(p);
1370 return (error);
1371 }
1372 _PHOLD(p);
1373 PROC_UNLOCK(p);
1361
1362 name = (int *)arg1;
1363 if ((p = pfind((pid_t)name[0])) == NULL)
1364 return (ESRCH);
1365 if (p->p_flag & P_WEXIT) {
1366 PROC_UNLOCK(p);
1367 return (ESRCH);
1368 }
1369 if ((error = p_candebug(curthread, p))) {
1370 PROC_UNLOCK(p);
1371 return (error);
1372 }
1373 _PHOLD(p);
1374 PROC_UNLOCK(p);
1374
1375 vm = vmspace_acquire_ref(p);
1376 if (vm == NULL) {
1377 PRELE(p);
1378 return (ESRCH);
1379 }
1375 kve = malloc(sizeof(*kve), M_TEMP, M_WAITOK);
1376
1377 map = &p->p_vmspace->vm_map; /* XXXRW: More locking required? */
1378 vm_map_lock_read(map);
1379 for (entry = map->header.next; entry != &map->header;
1380 entry = entry->next) {
1381 vm_object_t obj, tobj, lobj;
1382 vm_offset_t addr;

--- 113 unchanged lines hidden (view full) ---

1496 if (error)
1497 break;
1498 if (last_timestamp + 1 != map->timestamp) {
1499 vm_map_lookup_entry(map, addr - 1, &tmp_entry);
1500 entry = tmp_entry;
1501 }
1502 }
1503 vm_map_unlock_read(map);
1380 kve = malloc(sizeof(*kve), M_TEMP, M_WAITOK);
1381
1382 map = &p->p_vmspace->vm_map; /* XXXRW: More locking required? */
1383 vm_map_lock_read(map);
1384 for (entry = map->header.next; entry != &map->header;
1385 entry = entry->next) {
1386 vm_object_t obj, tobj, lobj;
1387 vm_offset_t addr;

--- 113 unchanged lines hidden (view full) ---

1501 if (error)
1502 break;
1503 if (last_timestamp + 1 != map->timestamp) {
1504 vm_map_lookup_entry(map, addr - 1, &tmp_entry);
1505 entry = tmp_entry;
1506 }
1507 }
1508 vm_map_unlock_read(map);
1509 vmspace_free(vm);
1504 PRELE(p);
1505 free(kve, M_TEMP);
1506 return (error);
1507}
1508#endif /* COMPAT_FREEBSD7 */
1509
1510#ifdef KINFO_VMENTRY_SIZE
1511CTASSERT(sizeof(struct kinfo_vmentry) == KINFO_VMENTRY_SIZE);

--- 6 unchanged lines hidden (view full) ---

1518 unsigned int last_timestamp;
1519 char *fullpath, *freepath;
1520 struct kinfo_vmentry *kve;
1521 struct vattr va;
1522 struct ucred *cred;
1523 int error, *name;
1524 struct vnode *vp;
1525 struct proc *p;
1510 PRELE(p);
1511 free(kve, M_TEMP);
1512 return (error);
1513}
1514#endif /* COMPAT_FREEBSD7 */
1515
1516#ifdef KINFO_VMENTRY_SIZE
1517CTASSERT(sizeof(struct kinfo_vmentry) == KINFO_VMENTRY_SIZE);

--- 6 unchanged lines hidden (view full) ---

1524 unsigned int last_timestamp;
1525 char *fullpath, *freepath;
1526 struct kinfo_vmentry *kve;
1527 struct vattr va;
1528 struct ucred *cred;
1529 int error, *name;
1530 struct vnode *vp;
1531 struct proc *p;
1532 struct vmspace *vm;
1526 vm_map_t map;
1527
1528 name = (int *)arg1;
1529 if ((p = pfind((pid_t)name[0])) == NULL)
1530 return (ESRCH);
1531 if (p->p_flag & P_WEXIT) {
1532 PROC_UNLOCK(p);
1533 return (ESRCH);
1534 }
1535 if ((error = p_candebug(curthread, p))) {
1536 PROC_UNLOCK(p);
1537 return (error);
1538 }
1539 _PHOLD(p);
1540 PROC_UNLOCK(p);
1533 vm_map_t map;
1534
1535 name = (int *)arg1;
1536 if ((p = pfind((pid_t)name[0])) == NULL)
1537 return (ESRCH);
1538 if (p->p_flag & P_WEXIT) {
1539 PROC_UNLOCK(p);
1540 return (ESRCH);
1541 }
1542 if ((error = p_candebug(curthread, p))) {
1543 PROC_UNLOCK(p);
1544 return (error);
1545 }
1546 _PHOLD(p);
1547 PROC_UNLOCK(p);
1541
1548 vm = vmspace_acquire_ref(p);
1549 if (vm == NULL) {
1550 PRELE(p);
1551 return (ESRCH);
1552 }
1542 kve = malloc(sizeof(*kve), M_TEMP, M_WAITOK);
1543
1553 kve = malloc(sizeof(*kve), M_TEMP, M_WAITOK);
1554
1544 map = &p->p_vmspace->vm_map; /* XXXRW: More locking required? */
1555 map = &vm->vm_map; /* XXXRW: More locking required? */
1545 vm_map_lock_read(map);
1546 for (entry = map->header.next; entry != &map->header;
1547 entry = entry->next) {
1548 vm_object_t obj, tobj, lobj;
1549 vm_offset_t addr;
1550 int vfslocked;
1551
1552 if (entry->eflags & MAP_ENTRY_IS_SUB_MAP)

--- 114 unchanged lines hidden (view full) ---

1667 if (error)
1668 break;
1669 if (last_timestamp + 1 != map->timestamp) {
1670 vm_map_lookup_entry(map, addr - 1, &tmp_entry);
1671 entry = tmp_entry;
1672 }
1673 }
1674 vm_map_unlock_read(map);
1556 vm_map_lock_read(map);
1557 for (entry = map->header.next; entry != &map->header;
1558 entry = entry->next) {
1559 vm_object_t obj, tobj, lobj;
1560 vm_offset_t addr;
1561 int vfslocked;
1562
1563 if (entry->eflags & MAP_ENTRY_IS_SUB_MAP)

--- 114 unchanged lines hidden (view full) ---

1678 if (error)
1679 break;
1680 if (last_timestamp + 1 != map->timestamp) {
1681 vm_map_lookup_entry(map, addr - 1, &tmp_entry);
1682 entry = tmp_entry;
1683 }
1684 }
1685 vm_map_unlock_read(map);
1686 vmspace_free(vm);
1675 PRELE(p);
1676 free(kve, M_TEMP);
1677 return (error);
1678}
1679
1680#if defined(STACK) || defined(DDB)
1681static int
1682sysctl_kern_proc_kstack(SYSCTL_HANDLER_ARGS)

--- 180 unchanged lines hidden ---
1687 PRELE(p);
1688 free(kve, M_TEMP);
1689 return (error);
1690}
1691
1692#if defined(STACK) || defined(DDB)
1693static int
1694sysctl_kern_proc_kstack(SYSCTL_HANDLER_ARGS)

--- 180 unchanged lines hidden ---