From ce2914490b7b98aa2eb1ec340ef01dc2fd4dba5b Mon Sep 17 00:00:00 2001 From: skv Date: Wed, 13 Feb 2008 18:58:47 +0000 Subject: Unbreak build on 7.x PR: ports/119704 Submitted by: pluknet --- sysutils/pmap/Makefile | 7 +++- sysutils/pmap/files/patch-pmap_helper.c | 70 +++++++++++++++++++++++++++++++++ 2 files changed, 76 insertions(+), 1 deletion(-) create mode 100644 sysutils/pmap/files/patch-pmap_helper.c (limited to 'sysutils') diff --git a/sysutils/pmap/Makefile b/sysutils/pmap/Makefile index ac92071cd200..ccd3a5977a03 100644 --- a/sysutils/pmap/Makefile +++ b/sysutils/pmap/Makefile @@ -7,6 +7,7 @@ PORTNAME= pmap PORTVERSION= 20060622 +PORTREVISION= 1 CATEGORIES= sysutils kld MASTER_SITES= ${MASTER_SITE_LOCAL:S!$!skv/!} \ ftp://ftp.wuppy.net.ru/pub/FreeBSD/local/pmap/ @@ -16,15 +17,19 @@ COMMENT= Detailed process memory display NO_PACKAGE= Depends on kernel +KMODDIR= /boot/modules + PLIST_SUB= KMODDIR=${KMODDIR} WRKSRC= ${WRKDIR}/${PORTNAME} +MAKE_ENV+= KMODDIR=${KMODDIR} + MAN8= pmap.8 MANCOMPRESSED= maybe .include -.if ${OSVERSION} >= 700000 +.if ${OSVERSION} >= 800000 BROKEN= Currently does not support -CURRENT .endif diff --git a/sysutils/pmap/files/patch-pmap_helper.c b/sysutils/pmap/files/patch-pmap_helper.c new file mode 100644 index 000000000000..167c68ca4147 --- /dev/null +++ b/sysutils/pmap/files/patch-pmap_helper.c @@ -0,0 +1,70 @@ +--- pmap_helper/pmap_helper.c.orig 2006-06-22 15:55:17.000000000 +0400 ++++ pmap_helper/pmap_helper.c 2008-01-16 04:00:46.000000000 +0300 +@@ -43,6 +43,7 @@ + #include + #include + #include ++#include + + #include + #include +@@ -77,7 +78,6 @@ + struct proc *p; + static struct vm_map *map; + struct vm_map_entry *entry; +- pmap_t pmap; + int nmaps = 0; + int error; + struct pmh pmh; +@@ -91,17 +91,16 @@ + return EINVAL; + + p = pfind(pmh.pid); /* XXX Locks p! */ ++ PROC_UNLOCK(p); /* locked by pfind(9) */ ++ + if (p == NULL) + return ESRCH; + + /* map points to description of MI virtual address space */ + map = &p->p_vmspace->vm_map; + +- if (map != &curthread->td_proc->p_vmspace->vm_map) +- vm_map_lock_read(map); ++ vm_map_lock_read(map); + +- /* pmap points to private physiscal map for whole process space */ +- pmap = vmspace_pmap(p->p_vmspace); + error = 0; + + for (entry = map->header.next; entry != &map->header; +@@ -129,7 +128,7 @@ + addr = entry->start; + /* estimate number of phys. resident pages in map */ + while (addr < entry->end) { +- if (pmap_extract(pmap, addr)) ++ if (pmap_extract(map->pmap, addr)) + resident++; + addr += PAGE_SIZE; + } +@@ -163,7 +162,9 @@ + free(freepath, M_TEMP); + } + } ++ vm_map_unlock_read(map); + error = copyout(&pmhm, &pmh.maps[nmaps], sizeof pmh.maps[nmaps]); ++ vm_map_lock_read(map); + if (error) + break; + nmaps++; +@@ -171,10 +172,7 @@ + break; + } + +- if (map != &curthread->td_proc->p_vmspace->vm_map) +- vm_map_unlock_read(map); +- +- PROC_UNLOCK(p); /* locked by pfind(9) */ ++ vm_map_unlock_read(map); + + if (error == 0) + error = copyout(&nmaps, &uap->pmh->nmaps, sizeof uap->pmh->nmaps); -- cgit