On Sat, Jun 10, 2006 at 06:22:46PM +0200, Bruno Haible wrote: > Proposal 1: Change mincore() to behave like the one on NetBSD, Linux, > Solaris.
Please, evaluate the patch. If it does what you need, I will push it for review. Index: vm_mmap.c =================================================================== RCS file: /usr/local/arch/ncvs/src/sys/vm/vm_mmap.c,v retrieving revision 1.205 diff -u -r1.205 vm_mmap.c --- vm_mmap.c 21 Apr 2006 07:17:25 -0000 1.205 +++ vm_mmap.c 14 Jun 2006 10:32:11 -0000 @@ -907,6 +907,40 @@ ++lastvecindex; } + /* Mark unmapped areas of the queried address + * space with -1. + */ + for (addr = first_addr; addr < end; ) { + vm_offset_t saddr, eaddr; + + vm_map_lock_read(map); + if (vm_map_lookup_entry(map, addr, &entry)) { + addr = entry->end; + vm_map_unlock_read(map); + continue; + } + entry = entry->next; + if (entry->start < addr) { + /* past the last entry in the map */ + saddr = eaddr = end; + } else { + saddr = entry->start; + eaddr = entry->end; + } + vm_map_unlock_read(map); + + while (addr < saddr) { + vecindex = OFF_TO_IDX(addr - first_addr); + error = subyte(vec + vecindex, -1); + if (error) { + error = EFAULT; + goto done2; + } + addr += PAGE_SIZE; + } + addr = eaddr; + } + /* * If the map has changed, due to the subyte, the previous * output may be invalid.
pgpVKEn9XjERN.pgp
Description: PGP signature