import less(1)
[unleashed/tickless.git] / usr / src / lib / libast / common / vmalloc / vmregion.c
blobcfdbb6701622898160e4221699853790744e1635
1 /***********************************************************************
2 * *
3 * This software is part of the ast package *
4 * Copyright (c) 1985-2010 AT&T Intellectual Property *
5 * and is licensed under the *
6 * Common Public License, Version 1.0 *
7 * by AT&T Intellectual Property *
8 * *
9 * A copy of the License is available at *
10 * http://www.opensource.org/licenses/cpl1.0.txt *
11 * (with md5 checksum 059e8cd6165cb4c31e351f2b69388fd9) *
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)
24 void _STUB_vmregion(){}
26 #else
28 #include "vmhdr.h"
30 /* Return the containing region of an allocated piece of memory.
31 ** Beware: this only works with Vmbest, Vmdebug and Vmprofile.
33 ** 10/31/2009: Add handling of shared/persistent memory regions.
35 ** Written by Kiem-Phong Vo, kpv@research.att.com, 01/16/94.
37 #if __STD_C
38 Vmalloc_t* vmregion(Void_t* addr)
39 #else
40 Vmalloc_t* vmregion(addr)
41 Void_t* addr;
42 #endif
44 Vmalloc_t *vm;
45 Vmdata_t *vd;
47 if(!addr)
48 return NIL(Vmalloc_t*);
50 vd = SEG(BLOCK(addr))->vmdt;
51 for(vm = Vmheap; vm; vm = vm->next)
52 if(vm->data == vd)
53 break;
55 return vm;
58 #endif