summaryrefslogtreecommitdiff
path: root/usr/src/lib/libast/common/vmalloc
diff options
context:
space:
mode:
authorApril Chin <April.Chin@Sun.COM>2008-12-27 14:59:38 -0800
committerApril Chin <April.Chin@Sun.COM>2008-12-27 14:59:38 -0800
commit7c2fbfb345896881c631598ee3852ce9ce33fb07 (patch)
tree4b173b5657508562dfc0aa05f7d056d1e9add505 /usr/src/lib/libast/common/vmalloc
parent6071ac1de68fed78e1e10052045bbb5f1732a263 (diff)
downloadillumos-gate-7c2fbfb345896881c631598ee3852ce9ce33fb07.tar.gz
PSARC/2008/094 ksh93 Update 1
PSARC/2008/344 ksh93 Integration Update 1 Amendments 1 PSARC/2008/589 Remove /usr/bin/printf from PSARC case 2008 094 6619428 *ksh93* RFE: Update ksh93 in Solaris to ast-ksh.2008-11-04 6788659 RFE: Update libpp in Solaris to ast-open.2008-07-25 6561901 RFE: Add "shcomp" (shell script compiler) + kernel module to exec binary sh code 6599668 RFE: Move consumers of alias.sh over to ksh93 6595183 *ksh93* RFE: Update ksh93-integration demo code 6775901 *ksh93* no C message catalogs are generated for ksh93 6451262 *sleep* RFE: /usr/bin/sleep should support floating-point values 6687139 *ksh93* command substitution, exec, and stdout redirection cause allocation loop 6703761 *ksh93* crashes in script containing uncommon output redirections 6715496 *ksh93* SEGVs on array reinitialization 6713682 *ksh93* Creating a compound variable in a subshell "bleeds through" to the calling subshell 6672350 *ksh93* causes parent shell to die when child shell is suspended 6745015 *ksh93* VARIABLE=`command substitution` assignment is not reliable on OpenSolaris 6710205 *ksh93* problem with command substitution (within back quotes) containing \$' 6737600 *ksh93* exits debugger when user presses ctrl-c 6748645 *ksh93* fc -l -e - is mis-parsed, outputs wrong error message "-e - requires single argument" 6754020 *ksh93* does weird '[' expansion 6753538 *ksh93* umask modification leaks out of a ksh93 subshell 6766246 *ksh93* bug in pattern matching 6763594 *ksh93* executes command after "command" builtin twice on failure 6762665 *ksh93* Difficult-to-reproduce SIGSEGV in ksh93
Diffstat (limited to 'usr/src/lib/libast/common/vmalloc')
-rw-r--r--usr/src/lib/libast/common/vmalloc/malloc.c4
-rw-r--r--usr/src/lib/libast/common/vmalloc/vmbest.c113
-rw-r--r--usr/src/lib/libast/common/vmalloc/vmclear.c9
-rw-r--r--usr/src/lib/libast/common/vmalloc/vmclose.c4
-rw-r--r--usr/src/lib/libast/common/vmalloc/vmdcheap.c4
-rw-r--r--usr/src/lib/libast/common/vmalloc/vmdebug.c39
-rw-r--r--usr/src/lib/libast/common/vmalloc/vmdisc.c4
-rw-r--r--usr/src/lib/libast/common/vmalloc/vmexit.c4
-rw-r--r--usr/src/lib/libast/common/vmalloc/vmgetmem.c6
-rw-r--r--usr/src/lib/libast/common/vmalloc/vmhdr.h14
-rw-r--r--usr/src/lib/libast/common/vmalloc/vmlast.c37
-rw-r--r--usr/src/lib/libast/common/vmalloc/vmmopen.c4
-rw-r--r--usr/src/lib/libast/common/vmalloc/vmopen.c4
-rw-r--r--usr/src/lib/libast/common/vmalloc/vmpool.c37
-rw-r--r--usr/src/lib/libast/common/vmalloc/vmprivate.c6
-rw-r--r--usr/src/lib/libast/common/vmalloc/vmprofile.c31
-rw-r--r--usr/src/lib/libast/common/vmalloc/vmregion.c4
-rw-r--r--usr/src/lib/libast/common/vmalloc/vmsegment.c9
-rw-r--r--usr/src/lib/libast/common/vmalloc/vmset.c10
-rw-r--r--usr/src/lib/libast/common/vmalloc/vmstat.c17
-rw-r--r--usr/src/lib/libast/common/vmalloc/vmstrdup.c4
-rw-r--r--usr/src/lib/libast/common/vmalloc/vmtrace.c4
-rw-r--r--usr/src/lib/libast/common/vmalloc/vmwalk.c4
23 files changed, 251 insertions, 121 deletions
diff --git a/usr/src/lib/libast/common/vmalloc/malloc.c b/usr/src/lib/libast/common/vmalloc/malloc.c
index 24241d7b46..abe71cbf8b 100644
--- a/usr/src/lib/libast/common/vmalloc/malloc.c
+++ b/usr/src/lib/libast/common/vmalloc/malloc.c
@@ -1,10 +1,10 @@
/***********************************************************************
* *
* This software is part of the ast package *
-* Copyright (c) 1985-2007 AT&T Knowledge Ventures *
+* Copyright (c) 1985-2008 AT&T Intellectual Property *
* and is licensed under the *
* Common Public License, Version 1.0 *
-* by AT&T Knowledge Ventures *
+* by AT&T Intellectual Property *
* *
* A copy of the License is available at *
* http://www.opensource.org/licenses/cpl1.0.txt *
diff --git a/usr/src/lib/libast/common/vmalloc/vmbest.c b/usr/src/lib/libast/common/vmalloc/vmbest.c
index a84e3dfe0c..8e9ef32436 100644
--- a/usr/src/lib/libast/common/vmalloc/vmbest.c
+++ b/usr/src/lib/libast/common/vmalloc/vmbest.c
@@ -1,10 +1,10 @@
/***********************************************************************
* *
* This software is part of the ast package *
-* Copyright (c) 1985-2007 AT&T Knowledge Ventures *
+* Copyright (c) 1985-2008 AT&T Intellectual Property *
* and is licensed under the *
* Common Public License, Version 1.0 *
-* by AT&T Knowledge Ventures *
+* by AT&T Intellectual Property *
* *
* A copy of the License is available at *
* http://www.opensource.org/licenses/cpl1.0.txt *
@@ -543,13 +543,17 @@ Vmalloc_t* vm;
reg Seg_t *seg, *next;
reg Block_t *bp, *t;
reg size_t size, segsize, round;
- reg int local;
+ reg int local, inuse;
reg Vmdata_t* vd = vm->data;
+ SETINUSE(vd, inuse);
+
if(!(local = vd->mode&VM_TRUST) )
{ GETLOCAL(vd,local);
if(ISLOCK(vd,local))
+ { CLRINUSE(vd, inuse);
return -1;
+ }
SETLOCK(vd,local);
}
@@ -618,6 +622,7 @@ Vmalloc_t* vm;
CLRLOCK(vd,local); /**/ASSERT(_vmbestcheck(vd, NIL(Block_t*)) == 0);
+ CLRINUSE(vd, inuse);
return 0;
}
@@ -633,12 +638,12 @@ reg size_t size; /* desired block size */
reg size_t s;
reg int n;
reg Block_t *tp, *np;
- reg int local;
+ reg int local, inuse;
size_t orgsize = 0;
if(!(_Vmassert & VM_init))
{ char *chk = getenv("VMCHECK");
- _Vmassert = VM_init|VM_primary|VM_secondary;
+ _Vmassert = VM_init;
if(chk)
{ int set = 1;
for(;; set ? (_Vmassert |= n) : (_Vmassert &= ~n))
@@ -673,18 +678,16 @@ reg size_t size; /* desired block size */
case 'C':
n = VM_check;
continue;
- case 'p':
- case 'P':
- n = VM_primary;
+#if _mem_mmap_anon || _mem_mmap_zero
+ case 'm':
+ case 'M':
+ n = VM_mmap;
+#endif
continue;
case 'r':
case 'R':
n = VM_region;
continue;
- case 's':
- case 'S':
- n = VM_secondary;
- continue;
default:
n = 0;
continue;
@@ -695,10 +698,14 @@ reg size_t size; /* desired block size */
}
/**/COUNT(N_alloc);
+ SETINUSE(vd, inuse);
+
if(!(local = vd->mode&VM_TRUST))
{ GETLOCAL(vd,local); /**/ASSERT(!ISLOCK(vd,local));
if(ISLOCK(vd,local) )
+ { CLRINUSE(vd, inuse);
return NIL(Void_t*);
+ }
SETLOCK(vd,local);
orgsize = size;
}
@@ -759,6 +766,7 @@ reg size_t size; /* desired block size */
vd->mode &= ~VM_AGAIN;
else
{ CLRLOCK(vd,local);
+ CLRINUSE(vd, inuse);
return NIL(Void_t*);
}
}
@@ -798,6 +806,7 @@ done:
CLRLOCK(vd,local);
ANNOUNCE(local, vm, VM_ALLOC, DATA(tp), vm->disc);
+ CLRINUSE(vd, inuse);
return DATA(tp);
}
@@ -813,12 +822,16 @@ Void_t* addr; /* address to check */
reg Block_t *b, *endb;
reg long offset;
reg Vmdata_t* vd = vm->data;
- reg int local;
+ reg int local, inuse;
+
+ SETINUSE(vd, inuse);
if(!(local = vd->mode&VM_TRUST) )
{ GETLOCAL(vd,local); /**/ASSERT(!ISLOCK(vd,local));
if(ISLOCK(vd,local))
+ { CLRINUSE(vd, inuse);
return -1L;
+ }
SETLOCK(vd,local);
}
@@ -856,6 +869,7 @@ Void_t* addr; /* address to check */
done:
CLRLOCK(vd,local);
+ CLRINUSE(vd, inuse);
return offset;
}
@@ -870,7 +884,7 @@ Void_t* data;
reg Vmdata_t* vd = vm->data;
reg Block_t *bp;
reg size_t s;
- reg int local;
+ reg int local, inuse;
#ifdef DEBUG
if((local = (int)data) >= 0 && local <= 0xf)
@@ -887,12 +901,14 @@ Void_t* data;
/**/COUNT(N_free);
+ SETINUSE(vd, inuse);
+
if(!(local = vd->mode&VM_TRUST) )
{ GETLOCAL(vd,local); /**/ASSERT(!ISLOCK(vd,local));
- if(ISLOCK(vd,local) )
- return -1;
- if(KPVADDR(vm,data,bestaddr) != 0 )
+ if(ISLOCK(vd,local) || KPVADDR(vm,data,bestaddr) != 0 )
+ { CLRINUSE(vd, inuse);
return -1;
+ }
SETLOCK(vd,local);
}
@@ -935,6 +951,7 @@ Void_t* data;
CLRLOCK(vd,local);
ANNOUNCE(local, vm, VM_FREE, data, vm->disc);
+ CLRINUSE(vd, inuse);
return 0;
}
@@ -949,13 +966,15 @@ int type; /* !=0 to move, <0 for not copy */
#endif
{
reg Block_t *rp, *np, *t;
- int local;
+ int local, inuse;
size_t s, bs, oldsize = 0, orgsize = 0;
Void_t *oldd, *orgdata = NIL(Void_t*);
Vmdata_t *vd = vm->data;
/**/COUNT(N_resize);
+ SETINUSE(vd, inuse);
+
if(!data)
{ if((data = bestalloc(vm,size)) )
{ oldsize = 0;
@@ -965,15 +984,16 @@ int type; /* !=0 to move, <0 for not copy */
}
if(size == 0)
{ (void)bestfree(vm,data);
+ CLRINUSE(vd, inuse);
return NIL(Void_t*);
}
if(!(local = vd->mode&VM_TRUST) )
{ GETLOCAL(vd,local); /**/ASSERT(!ISLOCK(vd,local));
- if(ISLOCK(vd,local) )
- return NIL(Void_t*);
- if(!local && KPVADDR(vm,data,bestaddr) != 0 )
+ if(ISLOCK(vd,local) || (!local && KPVADDR(vm,data,bestaddr) != 0 ) )
+ { CLRINUSE(vd, inuse);
return NIL(Void_t*);
+ }
SETLOCK(vd,local);
orgdata = data; /* for tracing */
@@ -1065,6 +1085,7 @@ int type; /* !=0 to move, <0 for not copy */
done: if(data && (type&VM_RSZERO) && (size = SIZE(BLOCK(data))&~BITS) > oldsize )
memset((Void_t*)((Vmuchar_t*)data + oldsize), 0, size-oldsize);
+ CLRINUSE(vd, inuse);
return data;
}
@@ -1080,10 +1101,15 @@ Void_t* addr; /* address to check */
reg Block_t *b, *endb;
reg long size;
reg Vmdata_t* vd = vm->data;
+ reg int inuse;
+
+ SETINUSE(vd, inuse);
if(!(vd->mode&VM_TRUST) )
{ if(ISLOCK(vd,0))
+ { CLRINUSE(vd, inuse);
return -1L;
+ }
SETLOCK(vd,0);
}
@@ -1110,6 +1136,7 @@ Void_t* addr; /* address to check */
done:
CLRLOCK(vd,0);
+ CLRINUSE(vd, inuse);
return size;
}
@@ -1125,17 +1152,21 @@ size_t align;
reg Vmuchar_t *data;
reg Block_t *tp, *np;
reg Seg_t* seg;
- reg int local;
+ reg int local, inuse;
reg size_t s, extra, orgsize = 0, orgalign = 0;
reg Vmdata_t* vd = vm->data;
if(size <= 0 || align <= 0)
return NIL(Void_t*);
+ SETINUSE(vd, inuse);
+
if(!(local = vd->mode&VM_TRUST) )
{ GETLOCAL(vd,local); /**/ASSERT(!ISLOCK(vd,local));
if(ISLOCK(vd,local) )
+ { CLRINUSE(vd, inuse);
return NIL(Void_t*);
+ }
SETLOCK(vd,local);
orgsize = size;
orgalign = align;
@@ -1207,6 +1238,7 @@ done:
CLRLOCK(vd,local);
ANNOUNCE(local, vm, VM_ALLOC, (Void_t*)data, vm->disc);
+ CLRINUSE(vd, inuse);
return (Void_t*)data;
}
@@ -1285,15 +1317,9 @@ Vmdisc_t* disc; /* discipline structure */
if(csize == 0) /* allocating new memory */
{
-#if ( _mem_sbrk || _mem_mmap_anon || _mem_mmap_zero )
-#define ALTERNATES VM_primary
-#endif
+
#if _mem_sbrk /* try using sbrk() and brk() */
-#if ALTERNATES
- if (_Vmassert & ALTERNATES)
-#undef ALTERNATES
-#define ALTERNATES VM_secondary
-#endif
+ if(!(_Vmassert & VM_mmap))
{
addr = (Vmuchar_t*)sbrk(0); /* old break value */
if(addr && addr != (Vmuchar_t*)BRK_FAILED )
@@ -1303,11 +1329,6 @@ Vmdisc_t* disc; /* discipline structure */
#endif /* _mem_sbrk */
#if _mem_mmap_anon /* anonymous mmap */
-#if ALTERNATES
- if (_Vmassert & ALTERNATES)
-#undef ALTERNATES
-#define ALTERNATES VM_secondary
-#endif
{
addr = (Vmuchar_t*)mmap(0, nsize, PROT_READ|PROT_WRITE,
MAP_ANON|MAP_PRIVATE, -1, 0);
@@ -1317,11 +1338,6 @@ Vmdisc_t* disc; /* discipline structure */
#endif /* _mem_mmap_anon */
#if _mem_mmap_zero /* mmap from /dev/zero */
-#if ALTERNATES
- if (_Vmassert & ALTERNATES)
-#undef ALTERNATES
-#define ALTERNATES VM_secondary
-#endif
{
if(mmdc->fd < 0)
{ int fd;
@@ -1351,16 +1367,8 @@ Vmdisc_t* disc; /* discipline structure */
}
else
{ addr = caddr; /* in case !_mem_sbrk */
-#if ( _mem_sbrk || _mem_mmap_anon || _mem_mmap_zero )
-#undef ALTERNATES
-#define ALTERNATES VM_primary
-#endif
+
#if _mem_sbrk
-#if ALTERNATES
- if (_Vmassert & ALTERNATES)
-#undef ALTERNATES
-#define ALTERNATES VM_secondary
-#endif
{
addr = (Vmuchar_t*)sbrk(0);
if(!addr || addr == (Vmuchar_t*)BRK_FAILED)
@@ -1375,11 +1383,6 @@ Vmdisc_t* disc; /* discipline structure */
#endif /* _mem_sbrk */
#if _mem_mmap_zero || _mem_mmap_anon
-#if ALTERNATES
- if (_Vmassert & ALTERNATES)
-#undef ALTERNATES
-#define ALTERNATES VM_secondary
-#endif
{
if(((Vmuchar_t*)caddr+csize) > addr) /* in mmap-space */
if(nsize == 0 && munmap(caddr,csize) == 0)
@@ -1391,7 +1394,7 @@ Vmdisc_t* disc; /* discipline structure */
}
#endif /*_done_sbrkmem*/
-#if !_done_sbrkmem /* use native malloc/free as a last resource */
+#if !_done_sbrkmem /* use native malloc/free as a last resort */
/**/ASSERT(_std_malloc); /* _std_malloc should be well-defined */
NOTUSED(vm);
NOTUSED(disc);
diff --git a/usr/src/lib/libast/common/vmalloc/vmclear.c b/usr/src/lib/libast/common/vmalloc/vmclear.c
index 3aaee44694..d80a396628 100644
--- a/usr/src/lib/libast/common/vmalloc/vmclear.c
+++ b/usr/src/lib/libast/common/vmalloc/vmclear.c
@@ -1,10 +1,10 @@
/***********************************************************************
* *
* This software is part of the ast package *
-* Copyright (c) 1985-2007 AT&T Knowledge Ventures *
+* Copyright (c) 1985-2008 AT&T Intellectual Property *
* and is licensed under the *
* Common Public License, Version 1.0 *
-* by AT&T Knowledge Ventures *
+* by AT&T Intellectual Property *
* *
* A copy of the License is available at *
* http://www.opensource.org/licenses/cpl1.0.txt *
@@ -43,10 +43,14 @@ Vmalloc_t* vm;
reg Block_t* tp;
reg size_t size, s;
reg Vmdata_t* vd = vm->data;
+ reg int inuse;
+ SETINUSE(vd, inuse);
if(!(vd->mode&VM_TRUST) )
{ if(ISLOCK(vd,0))
+ { CLRINUSE(vd, inuse);
return -1;
+ }
SETLOCK(vd,0);
}
@@ -83,6 +87,7 @@ Vmalloc_t* vm;
}
CLRLOCK(vd,0);
+ CLRINUSE(vd, inuse);
return 0;
}
diff --git a/usr/src/lib/libast/common/vmalloc/vmclose.c b/usr/src/lib/libast/common/vmalloc/vmclose.c
index 9ad1a0719d..3ada670748 100644
--- a/usr/src/lib/libast/common/vmalloc/vmclose.c
+++ b/usr/src/lib/libast/common/vmalloc/vmclose.c
@@ -1,10 +1,10 @@
/***********************************************************************
* *
* This software is part of the ast package *
-* Copyright (c) 1985-2007 AT&T Knowledge Ventures *
+* Copyright (c) 1985-2008 AT&T Intellectual Property *
* and is licensed under the *
* Common Public License, Version 1.0 *
-* by AT&T Knowledge Ventures *
+* by AT&T Intellectual Property *
* *
* A copy of the License is available at *
* http://www.opensource.org/licenses/cpl1.0.txt *
diff --git a/usr/src/lib/libast/common/vmalloc/vmdcheap.c b/usr/src/lib/libast/common/vmalloc/vmdcheap.c
index c4697c7536..7c985ee68c 100644
--- a/usr/src/lib/libast/common/vmalloc/vmdcheap.c
+++ b/usr/src/lib/libast/common/vmalloc/vmdcheap.c
@@ -1,10 +1,10 @@
/***********************************************************************
* *
* This software is part of the ast package *
-* Copyright (c) 1985-2007 AT&T Knowledge Ventures *
+* Copyright (c) 1985-2008 AT&T Intellectual Property *
* and is licensed under the *
* Common Public License, Version 1.0 *
-* by AT&T Knowledge Ventures *
+* by AT&T Intellectual Property *
* *
* A copy of the License is available at *
* http://www.opensource.org/licenses/cpl1.0.txt *
diff --git a/usr/src/lib/libast/common/vmalloc/vmdebug.c b/usr/src/lib/libast/common/vmalloc/vmdebug.c
index 61eb8fedb0..f04c527e19 100644
--- a/usr/src/lib/libast/common/vmalloc/vmdebug.c
+++ b/usr/src/lib/libast/common/vmalloc/vmdebug.c
@@ -1,10 +1,10 @@
/***********************************************************************
* *
* This software is part of the ast package *
-* Copyright (c) 1985-2007 AT&T Knowledge Ventures *
+* Copyright (c) 1985-2008 AT&T Intellectual Property *
* and is licensed under the *
* Common Public License, Version 1.0 *
-* by AT&T Knowledge Ventures *
+* by AT&T Intellectual Property *
* *
* A copy of the License is available at *
* http://www.opensource.org/licenses/cpl1.0.txt *
@@ -274,11 +274,14 @@ Void_t* addr;
reg Vmuchar_t* data;
reg long offset = -1L;
reg Vmdata_t* vd = vm->data;
- reg int local;
+ reg int local, inuse;
+ SETINUSE(vd, inuse);
GETLOCAL(vd,local);
if(ISLOCK(vd,local) || !addr)
+ { CLRINUSE(vd, inuse);
return -1L;
+ }
SETLOCK(vd,local);
b = endb = NIL(Block_t*);
@@ -319,6 +322,7 @@ Void_t* addr;
done:
CLRLOCK(vd,local);
+ CLRINUSE(vd, inuse);
return offset;
}
@@ -335,9 +339,13 @@ Void_t* addr;
reg Seg_t* seg;
reg long size;
reg Vmdata_t* vd = vm->data;
+ reg int inuse;
+ SETINUSE(vd, inuse);
if(ISLOCK(vd,0))
+ { CLRINUSE(vd, inuse);
return -1L;
+ }
SETLOCK(vd,0);
size = -1L;
@@ -359,6 +367,7 @@ Void_t* addr;
}
done:
CLRLOCK(vd,0);
+ CLRINUSE(vd, inuse);
return size;
}
@@ -376,11 +385,14 @@ size_t size;
reg int line;
reg Void_t* func;
reg Vmdata_t* vd = vm->data;
+ reg int inuse;
+ SETINUSE(vd, inuse);
VMFLF(vm,file,line,func);
if(ISLOCK(vd,0) )
{ dbwarn(vm,NIL(Vmuchar_t*),0,file,line,func,DB_ALLOC);
+ CLRINUSE(vd, inuse);
return NIL(Void_t*);
}
SETLOCK(vd,0);
@@ -411,6 +423,7 @@ size_t size;
done:
CLRLOCK(vd,0);
ANNOUNCE(0, vm, VM_ALLOC, (Void_t*)data, vm->disc);
+ CLRINUSE(vd, inuse);
return (Void_t*)data;
}
@@ -429,14 +442,19 @@ Void_t* data;
reg long offset;
reg int rv, *ip, *endip;
reg Vmdata_t* vd = vm->data;
+ reg int inuse;
+ SETINUSE(vd, inuse);
VMFLF(vm,file,line,func);
if(!data)
+ { CLRINUSE(vd, inuse);
return 0;
+ }
if(ISLOCK(vd,0) )
{ dbwarn(vm,NIL(Vmuchar_t*),0,file,line,func,DB_FREE);
+ CLRINUSE(vd, inuse);
return -1;
}
SETLOCK(vd,0);
@@ -449,6 +467,7 @@ Void_t* data;
(void)(*vm->disc->exceptf)(vm,VM_BADADDR,data,vm->disc);
dbwarn(vm,(Vmuchar_t*)data,offset == -1L ? 0 : 1,file,line,func,DB_FREE);
CLRLOCK(vd,0);
+ CLRINUSE(vd, inuse);
return -1;
}
@@ -469,6 +488,7 @@ Void_t* data;
rv = KPVFREE((vm), (Void_t*)DB2BEST(data), (*Vmbest->freef));
CLRLOCK(vd,0);
ANNOUNCE(0, vm, VM_FREE, data, vm->disc);
+ CLRINUSE(vd, inuse);
return rv;
}
@@ -490,7 +510,9 @@ int type; /* !=0 for movable, >0 for copy */
int line, oldline;
Void_t* func;
reg Vmdata_t* vd = vm->data;
+ reg int inuse;
+ SETINUSE(vd, inuse);
if(!addr)
{ oldsize = 0;
data = (Vmuchar_t*)dballoc(vm,size);
@@ -498,6 +520,7 @@ int type; /* !=0 for movable, >0 for copy */
}
if(size == 0)
{ (void)dbfree(vm,addr);
+ CLRINUSE(vd, inuse);
return NIL(Void_t*);
}
@@ -505,6 +528,7 @@ int type; /* !=0 for movable, >0 for copy */
if(ISLOCK(vd,0) )
{ dbwarn(vm,NIL(Vmuchar_t*),0,file,line,func,DB_RESIZE);
+ CLRINUSE(vd, inuse);
return NIL(Void_t*);
}
SETLOCK(vd,0);
@@ -517,6 +541,7 @@ int type; /* !=0 for movable, >0 for copy */
(void)(*vm->disc->exceptf)(vm,VM_BADADDR,addr,vm->disc);
dbwarn(vm,(Vmuchar_t*)addr,offset == -1L ? 0 : 1,file,line,func,DB_RESIZE);
CLRLOCK(vd,0);
+ CLRINUSE(vd, inuse);
return NIL(Void_t*);
}
@@ -558,6 +583,7 @@ done: if(data && (type&VM_RSZERO) && size > oldsize)
{ reg Vmuchar_t *d = data+oldsize, *ed = data+size;
do { *d++ = 0; } while(d < ed);
}
+ CLRINUSE(vd, inuse);
return (Void_t*)data;
}
@@ -681,14 +707,20 @@ size_t align;
reg int line;
reg Void_t* func;
reg Vmdata_t* vd = vm->data;
+ reg int inuse;
+ SETINUSE(vd, inuse);
VMFLF(vm,file,line,func);
if(size <= 0 || align <= 0)
+ { CLRINUSE(vd, inuse);
return NIL(Void_t*);
+ }
if(ISLOCK(vd,0) )
+ { CLRINUSE(vd, inuse);
return NIL(Void_t*);
+ }
SETLOCK(vd,0);
if((s = ROUND(size,ALIGN) + DB_EXTRA) < sizeof(Body_t))
@@ -708,6 +740,7 @@ size_t align;
done:
CLRLOCK(vd,0);
ANNOUNCE(0, vm, VM_ALLOC, (Void_t*)data, vm->disc);
+ CLRINUSE(vd, inuse);
return (Void_t*)data;
}
diff --git a/usr/src/lib/libast/common/vmalloc/vmdisc.c b/usr/src/lib/libast/common/vmalloc/vmdisc.c
index 78393c3136..89fd04b318 100644
--- a/usr/src/lib/libast/common/vmalloc/vmdisc.c
+++ b/usr/src/lib/libast/common/vmalloc/vmdisc.c
@@ -1,10 +1,10 @@
/***********************************************************************
* *
* This software is part of the ast package *
-* Copyright (c) 1985-2007 AT&T Knowledge Ventures *
+* Copyright (c) 1985-2008 AT&T Intellectual Property *
* and is licensed under the *
* Common Public License, Version 1.0 *
-* by AT&T Knowledge Ventures *
+* by AT&T Intellectual Property *
* *
* A copy of the License is available at *
* http://www.opensource.org/licenses/cpl1.0.txt *
diff --git a/usr/src/lib/libast/common/vmalloc/vmexit.c b/usr/src/lib/libast/common/vmalloc/vmexit.c
index 29a169393b..b381567070 100644
--- a/usr/src/lib/libast/common/vmalloc/vmexit.c
+++ b/usr/src/lib/libast/common/vmalloc/vmexit.c
@@ -1,10 +1,10 @@
/***********************************************************************
* *
* This software is part of the ast package *
-* Copyright (c) 1985-2007 AT&T Knowledge Ventures *
+* Copyright (c) 1985-2008 AT&T Intellectual Property *
* and is licensed under the *
* Common Public License, Version 1.0 *
-* by AT&T Knowledge Ventures *
+* by AT&T Intellectual Property *
* *
* A copy of the License is available at *
* http://www.opensource.org/licenses/cpl1.0.txt *
diff --git a/usr/src/lib/libast/common/vmalloc/vmgetmem.c b/usr/src/lib/libast/common/vmalloc/vmgetmem.c
index 2ed647f732..b919155140 100644
--- a/usr/src/lib/libast/common/vmalloc/vmgetmem.c
+++ b/usr/src/lib/libast/common/vmalloc/vmgetmem.c
@@ -1,10 +1,10 @@
/***********************************************************************
* *
* This software is part of the ast package *
-* Copyright (c) 1985-2007 AT&T Knowledge Ventures *
+* Copyright (c) 1985-2008 AT&T Intellectual Property *
* and is licensed under the *
* Common Public License, Version 1.0 *
-* by AT&T Knowledge Ventures *
+* by AT&T Intellectual Property *
* *
* A copy of the License is available at *
* http://www.opensource.org/licenses/cpl1.0.txt *
@@ -35,6 +35,8 @@ void _STUB_vmgetmem(){}
* vmgetmem(r,0,n) allocate n bytes initialized to 0
* vmgetmem(r,p,0) free p
* vmgetmem(r,p,n) realloc p to n bytes
+ *
+ * Written by Glenn S. Fowler.
*/
#if __STD_C
diff --git a/usr/src/lib/libast/common/vmalloc/vmhdr.h b/usr/src/lib/libast/common/vmalloc/vmhdr.h
index ac322a93a6..8a33270f69 100644
--- a/usr/src/lib/libast/common/vmalloc/vmhdr.h
+++ b/usr/src/lib/libast/common/vmalloc/vmhdr.h
@@ -1,10 +1,10 @@
/***********************************************************************
* *
* This software is part of the ast package *
-* Copyright (c) 1985-2007 AT&T Knowledge Ventures *
+* Copyright (c) 1985-2008 AT&T Intellectual Property *
* and is licensed under the *
* Common Public License, Version 1.0 *
-* by AT&T Knowledge Ventures *
+* by AT&T Intellectual Property *
* *
* A copy of the License is available at *
* http://www.opensource.org/licenses/cpl1.0.txt *
@@ -128,9 +128,8 @@ typedef int ssize_t;
#define VM_check 0x0001 /* enable detailed checks */
#define VM_abort 0x0002 /* abort() on assertion failure */
-#define VM_primary 0x0004 /* enable primary native allocation */
-#define VM_region 0x0008 /* enable region segment checks */
-#define VM_secondary 0x0010 /* enable secondary native allocation */
+#define VM_region 0x0004 /* enable region segment checks */
+#define VM_mmap 0x0010 /* favor mmap allocation */
#define VM_init 0x8000 /* VMCHECK env var checked */
#if _UWIN
@@ -200,10 +199,13 @@ extern void _vmmessage _ARG_((const char*, long, const char*, long));
#define VM_AGAIN 0010000 /* research the arena for space */
#define VM_LOCK 0020000 /* region is locked */
#define VM_LOCAL 0040000 /* local call, bypass lock */
-#define VM_UNUSED 0104060
+#define VM_INUSE 0004000 /* some operation is running */
+#define VM_UNUSED 0100060
#define VMETHOD(vd) ((vd)->mode&VM_METHODS)
/* test/set/clear lock state */
+#define SETINUSE(vd,iu) (((iu) = (vd)->mode&VM_INUSE), ((vd)->mode |= VM_INUSE) )
+#define CLRINUSE(vd,iu) ((iu) ? 0 : ((vd)->mode &= ~VM_INUSE) )
#define SETLOCAL(vd) ((vd)->mode |= VM_LOCAL)
#define GETLOCAL(vd,l) (((l) = (vd)->mode&VM_LOCAL), ((vd)->mode &= ~VM_LOCAL) )
#define ISLOCK(vd,l) ((l) ? 0 : ((vd)->mode & VM_LOCK) )
diff --git a/usr/src/lib/libast/common/vmalloc/vmlast.c b/usr/src/lib/libast/common/vmalloc/vmlast.c
index 056e30ce59..9a723b0ee4 100644
--- a/usr/src/lib/libast/common/vmalloc/vmlast.c
+++ b/usr/src/lib/libast/common/vmalloc/vmlast.c
@@ -1,10 +1,10 @@
/***********************************************************************
* *
* This software is part of the ast package *
-* Copyright (c) 1985-2007 AT&T Knowledge Ventures *
+* Copyright (c) 1985-2008 AT&T Intellectual Property *
* and is licensed under the *
* Common Public License, Version 1.0 *
-* by AT&T Knowledge Ventures *
+* by AT&T Intellectual Property *
* *
* A copy of the License is available at *
* http://www.opensource.org/licenses/cpl1.0.txt *
@@ -44,13 +44,16 @@ size_t size;
reg Seg_t *seg, *last;
reg size_t s;
reg Vmdata_t* vd = vm->data;
- reg int local;
+ reg int local, inuse;
size_t orgsize = 0;
+ SETINUSE(vd, inuse);
if(!(local = vd->mode&VM_TRUST))
{ GETLOCAL(vd,local);
if(ISLOCK(vd,local))
+ { CLRINUSE(vd, inuse);
return NIL(Void_t*);
+ }
SETLOCK(vd,local);
orgsize = size;
}
@@ -95,6 +98,7 @@ got_block:
done:
CLRLOCK(vd,local);
ANNOUNCE(local, vm, VM_ALLOC, (Void_t*)tp, vm->disc);
+ CLRINUSE(vd, inuse);
return (Void_t*)tp;
}
@@ -110,20 +114,25 @@ reg Void_t* data;
reg Block_t* fp;
reg size_t s;
reg Vmdata_t* vd = vm->data;
- reg int local;
+ reg int local, inuse;
if(!data)
return 0;
+
+ SETINUSE(vd, inuse);
if(!(local = vd->mode&VM_TRUST) )
{ GETLOCAL(vd, local);
if(ISLOCK(vd, local))
+ { CLRINUSE(vd, inuse);
return -1;
+ }
SETLOCK(vd, local);
}
if(data != (Void_t*)vd->free)
{ if(!local && vm->disc->exceptf)
(void)(*vm->disc->exceptf)(vm,VM_BADADDR,data,vm->disc);
CLRLOCK(vd, local);
+ CLRINUSE(vd, inuse);
return -1;
}
@@ -144,6 +153,7 @@ reg Void_t* data;
CLRLOCK(vd, local);
ANNOUNCE(local, vm, VM_FREE, data, vm->disc);
+ CLRINUSE(vd, inuse);
return 0;
}
@@ -162,11 +172,12 @@ int type;
reg size_t oldsize;
reg ssize_t s, ds;
reg Vmdata_t* vd = vm->data;
- reg int local;
+ reg int local, inuse;
reg Void_t* addr;
Void_t* orgdata = NIL(Void_t*);
size_t orgsize = 0;
+ SETINUSE(vd, inuse);
if(!data)
{ oldsize = 0;
data = lastalloc(vm,size);
@@ -174,13 +185,16 @@ int type;
}
if(size <= 0)
{ (void)lastfree(vm,data);
+ CLRINUSE(vd, inuse);
return NIL(Void_t*);
}
if(!(local = vd->mode&VM_TRUST))
{ GETLOCAL(vd, local);
if(ISLOCK(vd, local))
+ { CLRINUSE(vd, inuse);
return NIL(Void_t*);
+ }
SETLOCK(vd, local);
orgdata = data;
orgsize = size;
@@ -196,6 +210,7 @@ int type;
if(!seg || (VLONG(data)%ALIGN) != 0 ||
(seg->last && (Vmuchar_t*)data > (Vmuchar_t*)seg->last) )
{ CLRLOCK(vd,0);
+ CLRINUSE(vd, inuse);
return NIL(Void_t*);
}
}
@@ -286,6 +301,7 @@ int type;
done: if(data && (type&VM_RSZERO) && size > oldsize)
memset((Void_t*)((Vmuchar_t*)data + oldsize), 0, size-oldsize);
+ CLRINUSE(vd, inuse);
return data;
}
@@ -337,10 +353,14 @@ Vmalloc_t* vm;
reg Seg_t *seg, *next;
reg size_t s;
reg Vmdata_t* vd = vm->data;
+ reg int inuse;
+ SETINUSE(vd, inuse);
if(!(vd->mode&VM_TRUST))
{ if(ISLOCK(vd,0))
+ { CLRINUSE(vd, inuse);
return -1;
+ }
SETLOCK(vd,0);
}
@@ -363,6 +383,7 @@ Vmalloc_t* vm;
(*_Vmtrace)(vm,(Vmuchar_t*)0,(Vmuchar_t*)0,0,0);
CLRLOCK(vd,0);
+ CLRINUSE(vd, inuse);
return 0;
}
@@ -378,17 +399,20 @@ size_t align;
reg Vmuchar_t* data;
reg Seg_t* seg;
reg Block_t* next;
- reg int local;
+ reg int local, inuse;
reg size_t s, orgsize = 0, orgalign = 0;
reg Vmdata_t* vd = vm->data;
if(size <= 0 || align <= 0)
return NIL(Void_t*);
+ SETINUSE(vd, inuse);
if(!(local = vd->mode&VM_TRUST) )
{ GETLOCAL(vd,local);
if(ISLOCK(vd,local) )
+ { CLRINUSE(vd, inuse);
return NIL(Void_t*);
+ }
SETLOCK(vd,local);
orgsize = size;
orgalign = align;
@@ -428,6 +452,7 @@ done:
CLRLOCK(vd,local);
ANNOUNCE(local, vm, VM_ALLOC, (Void_t*)data, vm->disc);
+ CLRINUSE(vd, inuse);
return (Void_t*)data;
}
diff --git a/usr/src/lib/libast/common/vmalloc/vmmopen.c b/usr/src/lib/libast/common/vmalloc/vmmopen.c
index 90692ae744..4586895fbb 100644
--- a/usr/src/lib/libast/common/vmalloc/vmmopen.c
+++ b/usr/src/lib/libast/common/vmalloc/vmmopen.c
@@ -1,10 +1,10 @@
/***********************************************************************
* *
* This software is part of the ast package *
-* Copyright (c) 1985-2007 AT&T Knowledge Ventures *
+* Copyright (c) 1985-2008 AT&T Intellectual Property *
* and is licensed under the *
* Common Public License, Version 1.0 *
-* by AT&T Knowledge Ventures *
+* by AT&T Intellectual Property *
* *
* A copy of the License is available at *
* http://www.opensource.org/licenses/cpl1.0.txt *
diff --git a/usr/src/lib/libast/common/vmalloc/vmopen.c b/usr/src/lib/libast/common/vmalloc/vmopen.c
index d441410906..0f85550396 100644
--- a/usr/src/lib/libast/common/vmalloc/vmopen.c
+++ b/usr/src/lib/libast/common/vmalloc/vmopen.c
@@ -1,10 +1,10 @@
/***********************************************************************
* *
* This software is part of the ast package *
-* Copyright (c) 1985-2007 AT&T Knowledge Ventures *
+* Copyright (c) 1985-2008 AT&T Intellectual Property *
* and is licensed under the *
* Common Public License, Version 1.0 *
-* by AT&T Knowledge Ventures *
+* by AT&T Intellectual Property *
* *
* A copy of the License is available at *
* http://www.opensource.org/licenses/cpl1.0.txt *
diff --git a/usr/src/lib/libast/common/vmalloc/vmpool.c b/usr/src/lib/libast/common/vmalloc/vmpool.c
index 62ffb17cff..a318cb9150 100644
--- a/usr/src/lib/libast/common/vmalloc/vmpool.c
+++ b/usr/src/lib/libast/common/vmalloc/vmpool.c
@@ -1,10 +1,10 @@
/***********************************************************************
* *
* This software is part of the ast package *
-* Copyright (c) 1985-2007 AT&T Knowledge Ventures *
+* Copyright (c) 1985-2008 AT&T Intellectual Property *
* and is licensed under the *
* Common Public License, Version 1.0 *
-* by AT&T Knowledge Ventures *
+* by AT&T Intellectual Property *
* *
* A copy of the License is available at *
* http://www.opensource.org/licenses/cpl1.0.txt *
@@ -50,7 +50,7 @@ reg size_t size;
reg Block_t *tp, *next;
reg size_t s;
reg Seg_t* seg;
- reg int local;
+ reg int local, inuse;
if(size <= 0)
return NIL(Void_t*);
@@ -60,10 +60,13 @@ reg size_t size;
else return NIL(Void_t*);
}
+ SETINUSE(vd, inuse);
if(!(local = vd->mode&VM_TRUST) )
{ GETLOCAL(vd,local);
if(ISLOCK(vd, local))
+ { CLRINUSE(vd, inuse);
return NIL(Void_t*);
+ }
SETLOCK(vd, local);
}
@@ -115,6 +118,7 @@ done:
CLRLOCK(vd, local);
ANNOUNCE(local, vm, VM_ALLOC, (Void_t*)tp, vm->disc);
+ CLRINUSE(vd, inuse);
return (Void_t*)tp;
}
@@ -132,12 +136,15 @@ reg Void_t* addr;
reg Seg_t* seg;
reg long offset;
reg Vmdata_t* vd = vm->data;
- reg int local;
+ reg int local, inuse;
+ SETINUSE(vd, inuse);
if(!(local = vd->mode&VM_TRUST))
{ GETLOCAL(vd,local);
if(ISLOCK(vd,local))
+ { CLRINUSE(vd, inuse);
return -1L;
+ }
SETLOCK(vd,local);
}
@@ -164,6 +171,7 @@ reg Void_t* addr;
done :
CLRLOCK(vd,local);
+ CLRINUSE(vd, inuse);
return offset;
}
@@ -177,20 +185,24 @@ reg Void_t* data;
{
reg Block_t* bp;
reg Vmdata_t* vd = vm->data;
- reg int local;
+ reg int local, inuse;
if(!data)
return 0;
+ SETINUSE(vd, inuse);
if(!(local = vd->mode&VM_TRUST))
{ GETLOCAL(vd, local);
if(ISLOCK(vd, local) || vd->pool <= 0)
+ { CLRINUSE(vd, inuse);
return -1;
+ }
if(KPVADDR(vm,data,pooladdr) != 0)
{ if(vm->disc->exceptf)
(void)(*vm->disc->exceptf)(vm,VM_BADADDR,data,vm->disc);
+ CLRINUSE(vd, inuse);
return -1;
}
@@ -207,6 +219,7 @@ reg Void_t* data;
CLRLOCK(vd,local);
ANNOUNCE(local, vm, VM_FREE, data, vm->disc);
+ CLRINUSE(vd, inuse);
return 0;
}
@@ -220,20 +233,23 @@ size_t size;
int type;
#endif
{
- int local;
+ int local, inuse;
reg Vmdata_t* vd = vm->data;
NOTUSED(type);
+ SETINUSE(vd, inuse);
if(!data)
{ if((data = poolalloc(vm,size)) && (type&VM_RSZERO) )
{ reg int *d = (int*)data, *ed = (int*)((char*)data+size);
do { *d++ = 0;} while(d < ed);
}
+ CLRINUSE(vd, inuse);
return data;
}
if(size == 0)
{ (void)poolfree(vm,data);
+ CLRINUSE(vd, inuse);
return NIL(Void_t*);
}
@@ -241,11 +257,14 @@ int type;
{ GETLOCAL(vd, local);
if(ISLOCK(vd, local) )
+ { CLRINUSE(vd, inuse);
return NIL(Void_t*);
+ }
if(size != vd->pool || KPVADDR(vm,data,pooladdr) != 0)
{ if(vm->disc->exceptf)
(void)(*vm->disc->exceptf)(vm,VM_BADADDR,data,vm->disc);
+ CLRINUSE(vd, inuse);
return NIL(Void_t*);
}
@@ -254,6 +273,7 @@ int type;
}
ANNOUNCE(local, vm, VM_RESIZE, data, vm->disc);
+ CLRINUSE(vd, inuse);
return data;
}
@@ -279,10 +299,14 @@ Vmalloc_t* vm;
reg Seg_t *seg, *next;
reg size_t s;
reg Vmdata_t* vd = vm->data;
+ reg int inuse;
+ SETINUSE(vd, inuse);
if(!(vd->mode&VM_TRUST))
{ if(ISLOCK(vd,0))
+ { CLRINUSE(vd, inuse);
return -1;
+ }
SETLOCK(vd,0);
}
@@ -305,6 +329,7 @@ Vmalloc_t* vm;
(*_Vmtrace)(vm, (Vmuchar_t*)0, (Vmuchar_t*)0, 0, 0);
CLRLOCK(vd,0);
+ CLRINUSE(vd, inuse);
return 0;
}
diff --git a/usr/src/lib/libast/common/vmalloc/vmprivate.c b/usr/src/lib/libast/common/vmalloc/vmprivate.c
index 74e9dcf565..a16e2dc92c 100644
--- a/usr/src/lib/libast/common/vmalloc/vmprivate.c
+++ b/usr/src/lib/libast/common/vmalloc/vmprivate.c
@@ -1,10 +1,10 @@
/***********************************************************************
* *
* This software is part of the ast package *
-* Copyright (c) 1985-2007 AT&T Knowledge Ventures *
+* Copyright (c) 1985-2008 AT&T Intellectual Property *
* and is licensed under the *
* Common Public License, Version 1.0 *
-* by AT&T Knowledge Ventures *
+* by AT&T Intellectual Property *
* *
* A copy of the License is available at *
* http://www.opensource.org/licenses/cpl1.0.txt *
@@ -27,7 +27,7 @@ void _STUB_vmprivate(){}
#include "vmhdr.h"
-static char* Version = "\n@(#)$Id: Vmalloc (AT&T Research) 2005-09-28 $\0\n";
+static char* Version = "\n@(#)$Id: Vmalloc (AT&T Research) 2007-09-11 $\0\n";
#if _sys_stat
#include <sys/stat.h>
diff --git a/usr/src/lib/libast/common/vmalloc/vmprofile.c b/usr/src/lib/libast/common/vmalloc/vmprofile.c
index bead2b5be2..a9e620468e 100644
--- a/usr/src/lib/libast/common/vmalloc/vmprofile.c
+++ b/usr/src/lib/libast/common/vmalloc/vmprofile.c
@@ -1,10 +1,10 @@
/***********************************************************************
* *
* This software is part of the ast package *
-* Copyright (c) 1985-2007 AT&T Knowledge Ventures *
+* Copyright (c) 1985-2008 AT&T Intellectual Property *
* and is licensed under the *
* Common Public License, Version 1.0 *
-* by AT&T Knowledge Ventures *
+* by AT&T Intellectual Property *
* *
* A copy of the License is available at *
* http://www.opensource.org/licenses/cpl1.0.txt *
@@ -471,15 +471,18 @@ size_t size;
reg size_t s;
reg Void_t* data;
reg char* file;
- reg int line, local;
+ reg int line, local, inuse;
reg Void_t* func;
reg Vmdata_t* vd = vm->data;
VMFLF(vm,file,line,func);
+ SETINUSE(vd, inuse);
if(!(local = vd->mode&VM_TRUST) )
{ GETLOCAL(vd, local);
if(ISLOCK(vd, local))
+ { CLRINUSE(vd, inuse);
return NIL(Void_t*);
+ }
SETLOCK(vd, local);
}
@@ -496,6 +499,7 @@ size_t size;
done:
CLRLOCK(vd, local);
ANNOUNCE(local, vm, VM_ALLOC, (Void_t*)data, vm->disc);
+ CLRINUSE(vd, inuse);
return data;
}
@@ -510,7 +514,7 @@ Void_t* data;
reg Pfobj_t* pf;
reg size_t s;
reg char* file;
- reg int line, rv, local;
+ reg int line, rv, local, inuse;
reg Void_t* func;
reg Vmdata_t* vd = vm->data;
@@ -519,10 +523,13 @@ Void_t* data;
if(!data)
return 0;
+ SETINUSE(vd, inuse);
if(!(local = vd->mode&VM_TRUST) )
{ GETLOCAL(vd,local);
if(ISLOCK(vd,local))
+ { CLRINUSE(vd, inuse);
return -1;
+ }
SETLOCK(vd,local);
}
@@ -530,6 +537,7 @@ Void_t* data;
{ if(vm->disc->exceptf)
(void)(*vm->disc->exceptf)(vm,VM_BADADDR,data,vm->disc);
CLRLOCK(vd,0);
+ CLRINUSE(vd, inuse);
return -1;
}
@@ -551,6 +559,7 @@ Void_t* data;
rv = KPVFREE((vm), (Void_t*)data, (*Vmbest->freef));
CLRLOCK(vd,local);
ANNOUNCE(local, vm, VM_FREE, data, vm->disc);
+ CLRINUSE(vd, inuse);
return rv;
}
@@ -569,11 +578,12 @@ int type;
reg size_t news;
reg Void_t* addr;
reg char* file;
- reg int line, local;
+ reg int line, local, inuse;
reg Void_t* func;
reg size_t oldsize;
reg Vmdata_t* vd = vm->data;
+ SETINUSE(vd, inuse);
if(!data)
{ oldsize = 0;
addr = pfalloc(vm,size);
@@ -581,6 +591,7 @@ int type;
}
if(size == 0)
{ (void)pffree(vm,data);
+ CLRINUSE(vd, inuse);
return NIL(Void_t*);
}
@@ -588,7 +599,9 @@ int type;
if(!(local = vd->mode&VM_TRUST))
{ GETLOCAL(vd, local);
if(ISLOCK(vd, local))
+ { CLRINUSE(vd, inuse);
return NIL(Void_t*);
+ }
SETLOCK(vd, local);
}
@@ -596,6 +609,7 @@ int type;
{ if(vm->disc->exceptf)
(void)(*vm->disc->exceptf)(vm,VM_BADADDR,data,vm->disc);
CLRLOCK(vd, local);
+ CLRINUSE(vd, inuse);
return NIL(Void_t*);
}
@@ -637,6 +651,7 @@ done: if(addr && (type&VM_RSZERO) && oldsize < size)
do { *d++ = 0; } while(d < ed);
}
+ CLRINUSE(vd, inuse);
return addr;
}
@@ -684,16 +699,19 @@ size_t align;
reg size_t s;
reg Void_t* data;
reg char* file;
- reg int line, local;
+ reg int line, local, inuse;
reg Void_t* func;
reg Vmdata_t* vd = vm->data;
VMFLF(vm,file,line,func);
+ SETINUSE(vd, inuse);
if(!(local = vd->mode&VM_TRUST) )
{ GETLOCAL(vd,local);
if(ISLOCK(vd, local))
+ { CLRINUSE(vd, inuse);
return NIL(Void_t*);
+ }
SETLOCK(vd, local);
}
@@ -710,6 +728,7 @@ size_t align;
done:
CLRLOCK(vd, local);
ANNOUNCE(local, vm, VM_ALLOC, data, vm->disc);
+ CLRINUSE(vd, inuse);
return data;
}
diff --git a/usr/src/lib/libast/common/vmalloc/vmregion.c b/usr/src/lib/libast/common/vmalloc/vmregion.c
index 43ba0785f8..61a59562d5 100644
--- a/usr/src/lib/libast/common/vmalloc/vmregion.c
+++ b/usr/src/lib/libast/common/vmalloc/vmregion.c
@@ -1,10 +1,10 @@
/***********************************************************************
* *
* This software is part of the ast package *
-* Copyright (c) 1985-2007 AT&T Knowledge Ventures *
+* Copyright (c) 1985-2008 AT&T Intellectual Property *
* and is licensed under the *
* Common Public License, Version 1.0 *
-* by AT&T Knowledge Ventures *
+* by AT&T Intellectual Property *
* *
* A copy of the License is available at *
* http://www.opensource.org/licenses/cpl1.0.txt *
diff --git a/usr/src/lib/libast/common/vmalloc/vmsegment.c b/usr/src/lib/libast/common/vmalloc/vmsegment.c
index 8e2453e50a..2eb4ae35e3 100644
--- a/usr/src/lib/libast/common/vmalloc/vmsegment.c
+++ b/usr/src/lib/libast/common/vmalloc/vmsegment.c
@@ -1,10 +1,10 @@
/***********************************************************************
* *
* This software is part of the ast package *
-* Copyright (c) 1985-2007 AT&T Knowledge Ventures *
+* Copyright (c) 1985-2008 AT&T Intellectual Property *
* and is licensed under the *
* Common Public License, Version 1.0 *
-* by AT&T Knowledge Ventures *
+* by AT&T Intellectual Property *
* *
* A copy of the License is available at *
* http://www.opensource.org/licenses/cpl1.0.txt *
@@ -42,10 +42,14 @@ Void_t* addr; /* address */
{
reg Seg_t* seg;
reg Vmdata_t* vd = vm->data;
+ reg int inuse;
+ SETINUSE(vd, inuse);
if(!(vd->mode&VM_TRUST))
{ if(ISLOCK(vd,0))
+ { CLRINUSE(vd, inuse);
return NIL(Void_t*);
+ }
SETLOCK(vd,0);
}
@@ -55,6 +59,7 @@ Void_t* addr; /* address */
break;
CLRLOCK(vd,0);
+ CLRINUSE(vd, inuse);
return seg ? (Void_t*)seg->addr : NIL(Void_t*);
}
diff --git a/usr/src/lib/libast/common/vmalloc/vmset.c b/usr/src/lib/libast/common/vmalloc/vmset.c
index 0a6a1a5efd..3fbc354464 100644
--- a/usr/src/lib/libast/common/vmalloc/vmset.c
+++ b/usr/src/lib/libast/common/vmalloc/vmset.c
@@ -1,10 +1,10 @@
/***********************************************************************
* *
* This software is part of the ast package *
-* Copyright (c) 1985-2007 AT&T Knowledge Ventures *
+* Copyright (c) 1985-2008 AT&T Intellectual Property *
* and is licensed under the *
* Common Public License, Version 1.0 *
-* by AT&T Knowledge Ventures *
+* by AT&T Intellectual Property *
* *
* A copy of the License is available at *
* http://www.opensource.org/licenses/cpl1.0.txt *
@@ -41,15 +41,18 @@ int flags; /* flags must be in VM_FLAGS */
int on; /* !=0 if turning on, else turning off */
#endif
{
- reg int mode;
+ reg int mode, inuse;
reg Vmdata_t* vd = vm->data;
if(flags == 0 && on == 0)
return vd->mode;
+ SETINUSE(vd, inuse);
if(!(vd->mode&VM_TRUST) )
{ if(ISLOCK(vd,0))
+ { CLRINUSE(vd, inuse);
return 0;
+ }
SETLOCK(vd,0);
}
@@ -63,6 +66,7 @@ int on; /* !=0 if turning on, else turning off */
vd->mode &= ~VM_TRUST;
CLRLOCK(vd,0);
+ CLRINUSE(vd, inuse);
return mode;
}
diff --git a/usr/src/lib/libast/common/vmalloc/vmstat.c b/usr/src/lib/libast/common/vmalloc/vmstat.c
index 21a3f2b5a1..dc2c1097c2 100644
--- a/usr/src/lib/libast/common/vmalloc/vmstat.c
+++ b/usr/src/lib/libast/common/vmalloc/vmstat.c
@@ -1,10 +1,10 @@
/***********************************************************************
* *
* This software is part of the ast package *
-* Copyright (c) 1985-2007 AT&T Knowledge Ventures *
+* Copyright (c) 1985-2008 AT&T Intellectual Property *
* and is licensed under the *
* Common Public License, Version 1.0 *
-* by AT&T Knowledge Ventures *
+* by AT&T Intellectual Property *
* *
* A copy of the License is available at *
* http://www.opensource.org/licenses/cpl1.0.txt *
@@ -43,13 +43,19 @@ Vmstat_t* st;
reg Seg_t* seg;
reg Block_t *b, *endb;
reg size_t s = 0;
- reg Vmdata_t* vd = vm->data;
+ reg Vmdata_t* vd = vm ? vm->data : Vmregion->data;
+ reg int inuse;
+ SETINUSE(vd, inuse);
if(!st)
- return -1;
+ { CLRINUSE(vd, inuse);
+ return inuse ? 1 : 0;
+ }
if(!(vd->mode&VM_TRUST))
{ if(ISLOCK(vd,0))
+ { CLRINUSE(vd, inuse);
return -1;
+ }
SETLOCK(vd,0);
}
@@ -122,7 +128,8 @@ Vmstat_t* st;
}
CLRLOCK(vd,0);
- return 0;
+ CLRINUSE(vd, inuse);
+ return inuse ? 1 : 0;
}
#endif
diff --git a/usr/src/lib/libast/common/vmalloc/vmstrdup.c b/usr/src/lib/libast/common/vmalloc/vmstrdup.c
index 3d4f77a551..8bbe524fb3 100644
--- a/usr/src/lib/libast/common/vmalloc/vmstrdup.c
+++ b/usr/src/lib/libast/common/vmalloc/vmstrdup.c
@@ -1,10 +1,10 @@
/***********************************************************************
* *
* This software is part of the ast package *
-* Copyright (c) 1985-2007 AT&T Knowledge Ventures *
+* Copyright (c) 1985-2008 AT&T Intellectual Property *
* and is licensed under the *
* Common Public License, Version 1.0 *
-* by AT&T Knowledge Ventures *
+* by AT&T Intellectual Property *
* *
* A copy of the License is available at *
* http://www.opensource.org/licenses/cpl1.0.txt *
diff --git a/usr/src/lib/libast/common/vmalloc/vmtrace.c b/usr/src/lib/libast/common/vmalloc/vmtrace.c
index e6f46abb44..7111d229ea 100644
--- a/usr/src/lib/libast/common/vmalloc/vmtrace.c
+++ b/usr/src/lib/libast/common/vmalloc/vmtrace.c
@@ -1,10 +1,10 @@
/***********************************************************************
* *
* This software is part of the ast package *
-* Copyright (c) 1985-2007 AT&T Knowledge Ventures *
+* Copyright (c) 1985-2008 AT&T Intellectual Property *
* and is licensed under the *
* Common Public License, Version 1.0 *
-* by AT&T Knowledge Ventures *
+* by AT&T Intellectual Property *
* *
* A copy of the License is available at *
* http://www.opensource.org/licenses/cpl1.0.txt *
diff --git a/usr/src/lib/libast/common/vmalloc/vmwalk.c b/usr/src/lib/libast/common/vmalloc/vmwalk.c
index b401d79902..6597870d79 100644
--- a/usr/src/lib/libast/common/vmalloc/vmwalk.c
+++ b/usr/src/lib/libast/common/vmalloc/vmwalk.c
@@ -1,10 +1,10 @@
/***********************************************************************
* *
* This software is part of the ast package *
-* Copyright (c) 1985-2007 AT&T Knowledge Ventures *
+* Copyright (c) 1985-2008 AT&T Intellectual Property *
* and is licensed under the *
* Common Public License, Version 1.0 *
-* by AT&T Knowledge Ventures *
+* by AT&T Intellectual Property *
* *
* A copy of the License is available at *
* http://www.opensource.org/licenses/cpl1.0.txt *