Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
att
GitHub Repository: att/ast
Path: blob/master/src/cmd/tests/vmalloc/tregion.c
1810 views
1
/***********************************************************************
2
* *
3
* This software is part of the ast package *
4
* Copyright (c) 1999-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 <[email protected]> *
18
* *
19
***********************************************************************/
20
#include "vmtest.h"
21
22
tmain()
23
{
24
Void_t *addr[10];
25
Vmalloc_t *vm, *tv;
26
int i;
27
28
Vmdcheap->round = 127;
29
if(!(vm = vmopen(Vmdcheap,Vmbest,0)) )
30
terror("Can't open a region");
31
32
for(i = 0; i < 10; i += 2)
33
{ addr[i] = vmalloc(vm,88);
34
if((((Vmulong_t)addr[i])%ALIGN) != 0)
35
terror("Unaligned addr");
36
37
addr[i+1] = vmalloc(Vmheap,128);
38
if((((Vmulong_t)addr[i+1])%ALIGN) != 0)
39
terror("Unaligned addr");
40
}
41
42
for(i = 0; i < 10; i += 2)
43
{ if((tv = vmregion(addr[i])) != vm)
44
terror("Wrong region");
45
if((tv = vmregion(addr[i+1])) != Vmheap)
46
terror("Wrong region");
47
}
48
49
vmclose(vm);
50
51
texit(0);
52
}
53
54