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 _STUB_vmregion()24void _STUB_vmregion(){} 25 26 #else 27 28 #include "vmhdr.h" 29 30 /* Return the containing region of an allocated piece of memory. 31 ** Beware: this only works with Vmbest, Vmdebug and Vmprofile. 32 ** 33 ** 10/31/2009: Add handling of shared/persistent memory regions. 34 ** 35 ** Written by Kiem-Phong Vo, kpv@research.att.com, 01/16/94. 36 */ 37 #if __STD_C vmregion(Void_t * addr)38Vmalloc_t* vmregion(Void_t* addr) 39 #else 40 Vmalloc_t* vmregion(addr) 41 Void_t* addr; 42 #endif 43 { 44 Vmalloc_t *vm; 45 Vmdata_t *vd; 46 47 if(!addr) 48 return NIL(Vmalloc_t*); 49 50 vd = SEG(BLOCK(addr))->vmdt; 51 52 _vmlock(NIL(Vmalloc_t*), 1); 53 for(vm = Vmheap; vm; vm = vm->next) 54 if(vm->data == vd) 55 break; 56 _vmlock(NIL(Vmalloc_t*), 0); 57 58 return vm; 59 } 60 61 #endif 62