-/* (This function once tried to grow the chunk by asking os_validate
- * whether the space was available, but that really only works under
- * Mach.) */
-os_vm_address_t
-os_reallocate(os_vm_address_t addr, os_vm_size_t old_len, os_vm_size_t len)
-{
- addr=os_trunc_to_page(addr);
- len=os_round_up_size_to_page(len);
- old_len=os_round_up_size_to_page(old_len);
-
- if(addr==NULL)
- return os_allocate(len);
- else{
- long len_diff=len-old_len;
-
- if(len_diff<0)
- os_invalidate(addr+len,-len_diff);
- else{
- if(len_diff!=0){
- os_vm_address_t new=os_allocate(len);
-
- if(new!=NULL){
- bcopy(addr,new,old_len);
- os_invalidate(addr,old_len);
- }
-
- addr=new;
- }
- }
- return addr;
- }
-}
-