14887Schin /*********************************************************************** 24887Schin * * 34887Schin * This software is part of the ast package * 4*8462SApril.Chin@Sun.COM * Copyright (c) 1985-2008 AT&T Intellectual Property * 54887Schin * and is licensed under the * 64887Schin * Common Public License, Version 1.0 * 7*8462SApril.Chin@Sun.COM * by AT&T Intellectual Property * 84887Schin * * 94887Schin * A copy of the License is available at * 104887Schin * http://www.opensource.org/licenses/cpl1.0.txt * 114887Schin * (with md5 checksum 059e8cd6165cb4c31e351f2b69388fd9) * 124887Schin * * 134887Schin * Information and Software Systems Research * 144887Schin * AT&T Research * 154887Schin * Florham Park NJ * 164887Schin * * 174887Schin * Glenn Fowler <gsf@research.att.com> * 184887Schin * David Korn <dgk@research.att.com> * 194887Schin * Phong Vo <kpv@research.att.com> * 204887Schin * * 214887Schin ***********************************************************************/ 224887Schin #if defined(_UWIN) && defined(_BLD_ast) 234887Schin 244887Schin void _STUB_vmwalk(){} 254887Schin 264887Schin #else 274887Schin 284887Schin #include "vmhdr.h" 294887Schin 304887Schin /* Walks all segments created in region(s) 314887Schin ** 324887Schin ** Written by Kiem-Phong Vo, kpv@research.att.com (02/08/96) 334887Schin */ 344887Schin 354887Schin #if __STD_C 364887Schin int vmwalk(Vmalloc_t* vm, int(*segf)(Vmalloc_t*, Void_t*, size_t, Vmdisc_t*) ) 374887Schin #else 384887Schin int vmwalk(vm, segf) 394887Schin Vmalloc_t* vm; 404887Schin int(* segf)(/* Vmalloc_t*, Void_t*, size_t, Vmdisc_t* */); 414887Schin #endif 424887Schin { 434887Schin reg Seg_t* seg; 444887Schin reg int rv; 454887Schin 464887Schin if(!vm) 474887Schin { for(vm = Vmheap; vm; vm = vm->next) 484887Schin { if(!(vm->data->mode&VM_TRUST) && ISLOCK(vm->data,0) ) 494887Schin continue; 504887Schin 514887Schin SETLOCK(vm->data,0); 524887Schin for(seg = vm->data->seg; seg; seg = seg->next) 534887Schin { rv = (*segf)(vm, seg->addr, seg->extent, vm->disc); 544887Schin if(rv < 0) 554887Schin return rv; 564887Schin } 574887Schin CLRLOCK(vm->data,0); 584887Schin } 594887Schin } 604887Schin else 614887Schin { if(!(vm->data->mode&VM_TRUST) && ISLOCK(vm->data,0) ) 624887Schin return -1; 634887Schin 644887Schin SETLOCK(vm->data,0); 654887Schin for(seg = vm->data->seg; seg; seg = seg->next) 664887Schin { rv = (*segf)(vm, seg->addr, seg->extent, vm->disc); 674887Schin if(rv < 0) 684887Schin return rv; 694887Schin } 704887Schin CLRLOCK(vm->data,0); 714887Schin } 724887Schin 734887Schin return 0; 744887Schin } 754887Schin 764887Schin #endif 77