1 /*********************************************************************** 2 * * 3 * This software is part of the ast package * 4 * Copyright (c) 1985-2011 AT&T Intellectual Property * 5 * and is licensed under the * 6 * Eclipse Public License, Version 1.0 * 7 * by AT&T Intellectual Property * 8 * * 9 * A copy of the License is available at * 10 * http://www.eclipse.org/org/documents/epl-v10.html * 11 * (with md5 checksum b35adb5213ca9657e911e9befb180842) * 12 * * 13 * Information and Software Systems Research * 14 * AT&T Research * 15 * Florham Park NJ * 16 * * 17 * Glenn Fowler <gsf@research.att.com> * 18 * David Korn <dgk@research.att.com> * 19 * Phong Vo <kpv@research.att.com> * 20 * * 21 ***********************************************************************/ 22 #if defined(_UWIN) && defined(_BLD_ast) 23 24 void _STUB_vmwalk(){} 25 26 #else 27 28 #include "vmhdr.h" 29 30 /* Walks all segments created in region(s) 31 ** 32 ** Written by Kiem-Phong Vo, kpv@research.att.com (02/08/96) 33 */ 34 35 #if __STD_C 36 int vmwalk(Vmalloc_t* vm, int(*segf)(Vmalloc_t*, Void_t*, size_t, Vmdisc_t*, Void_t*), Void_t* handle ) 37 #else 38 int vmwalk(vm, segf, handle) 39 Vmalloc_t* vm; 40 int(* segf)(/* Vmalloc_t*, Void_t*, size_t, Vmdisc_t*, Void_t* */); 41 Void_t* handle; 42 #endif 43 { 44 reg Seg_t *seg; 45 reg int rv = 0; 46 47 if(!vm) 48 { _vmlock(NIL(Vmalloc_t*), 1); 49 for(vm = Vmheap; vm; vm = vm->next) 50 { SETLOCK(vm, 0); 51 for(seg = vm->data->seg; seg; seg = seg->next) 52 if((rv = (*segf)(vm, seg->addr, seg->extent, vm->disc, handle)) < 0 ) 53 break; 54 CLRLOCK(vm, 0); 55 } 56 _vmlock(NIL(Vmalloc_t*), 0); 57 } 58 else 59 { SETLOCK(vm, 0); 60 for(seg = vm->data->seg; seg; seg = seg->next) 61 if((rv = (*segf)(vm, seg->addr, seg->extent, vm->disc, handle)) < 0 ) 62 break; 63 CLRLOCK(vm, 0); 64 } 65 66 return rv; 67 } 68 69 #endif 70