Mercurial > cgi-bin > hgwebdir.cgi > VMS > VMS_Implementations > VMS_impls > VMS__MC_shared_impl
diff vmalloc.h @ 208:eaf7e4c58c9e
Create common_ancestor brch -- all branches will be closed, then new ones
created with this as the common ancestor of all branches -- it is incomplete!
only code that is common to all HW and Feat and FeatDev branches is in here
| author | Some Random Person <seanhalle@yahoo.com> |
|---|---|
| date | Wed, 22 Feb 2012 11:39:12 -0800 |
| parents | |
| children | 0c83ea8adefc |
line diff
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/vmalloc.h Wed Feb 22 11:39:12 2012 -0800 1.3 @@ -0,0 +1,90 @@ 1.4 +/* 1.5 + * Copyright 2009 OpenSourceCodeStewardshipFoundation.org 1.6 + * Licensed under GNU General Public License version 2 1.7 + * 1.8 + * Author: seanhalle@yahoo.com 1.9 + * 1.10 + * Created on November 14, 2009, 9:07 PM 1.11 + */ 1.12 + 1.13 +#ifndef _VMALLOC_H 1.14 +#define _VMALLOC_H 1.15 + 1.16 +#include <malloc.h> 1.17 +#include <inttypes.h> 1.18 +#include "VMS_primitive_data_types.h" 1.19 + 1.20 +typedef struct _MallocProlog MallocProlog; 1.21 + 1.22 +struct _MallocProlog 1.23 + { 1.24 + MallocProlog *nextChunkInFreeList; 1.25 + MallocProlog *prevChunkInFreeList; 1.26 + MallocProlog *nextHigherInMem; 1.27 + MallocProlog *nextLowerInMem; 1.28 + }; 1.29 +//MallocProlog 1.30 + 1.31 +typedef struct 1.32 + { 1.33 + MallocProlog *firstChunkInFreeList; 1.34 + int32 numInList; //TODO not used 1.35 + } 1.36 +FreeListHead; 1.37 + 1.38 +void * 1.39 +VMS_int__malloc( size_t sizeRequested ); 1.40 + 1.41 +void * 1.42 +VMS_int__malloc_aligned( size_t sizeRequested ); 1.43 + 1.44 +void 1.45 +VMS_int__free( void *ptrToFree ); 1.46 + 1.47 +#define VMS_PI__malloc VMS_int__malloc 1.48 +#define VMS_PI__malloc_aligned VMS_int__malloc_aligned 1.49 +#define VMS_PI__free VMS_int__free 1.50 +/* For now, the PI is protected by master lock, so int malloc fine 1.51 +void * 1.52 +VMS_PI__malloc( size_t sizeRequested ); 1.53 + 1.54 +void * 1.55 +VMS_PI__malloc_aligned( size_t sizeRequested ); 1.56 + 1.57 +void 1.58 +VMS_PI__free( void *ptrToFree ); 1.59 +*/ 1.60 + 1.61 +//TODO: protect WL malloc from concurrency!! shared freelist can be corrupted 1.62 +#define VMS_WL__malloc VMS_int__malloc 1.63 +#define VMS_WL__malloc_aligned VMS_int__malloc_aligned 1.64 +#define VMS_WL__free VMS_int__free 1.65 +/* 1.66 +void * 1.67 +VMS_WL__malloc( size_t sizeRequested ); 1.68 + 1.69 +void * 1.70 +VMS_WL__malloc_aligned( size_t sizeRequested ); 1.71 + 1.72 +void 1.73 +VMS_WL__free( void *ptrToFree ); 1.74 +*/ 1.75 + 1.76 +/*Allocates memory from the external system -- higher overhead 1.77 + */ 1.78 +void * 1.79 +VMS__malloc_in_ext( size_t sizeRequested ); 1.80 + 1.81 +/*Frees memory that was allocated in the external system -- higher overhead 1.82 + */ 1.83 +void 1.84 +VMS__free_in_ext( void *ptrToFree ); 1.85 + 1.86 + 1.87 +MallocProlog * 1.88 +VMS_ext__create_free_list(); 1.89 + 1.90 +void 1.91 +VMS_ext__free_free_list( MallocProlog *freeListHead ); 1.92 + 1.93 +#endif 1.94 \ No newline at end of file
