Mercurial > cgi-bin > hgwebdir.cgi > VMS > VMS_Implementations > VMS_impls > VMS__MC_shared_impl
comparison 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 |
comparison
equal
deleted
inserted
replaced
| -1:000000000000 | 23:61d5cd425e16 |
|---|---|
| 1 /* | |
| 2 * Copyright 2009 OpenSourceCodeStewardshipFoundation.org | |
| 3 * Licensed under GNU General Public License version 2 | |
| 4 * | |
| 5 * Author: seanhalle@yahoo.com | |
| 6 * | |
| 7 * Created on November 14, 2009, 9:07 PM | |
| 8 */ | |
| 9 | |
| 10 #ifndef _VMALLOC_H | |
| 11 #define _VMALLOC_H | |
| 12 | |
| 13 #include <malloc.h> | |
| 14 #include <inttypes.h> | |
| 15 #include "VMS_primitive_data_types.h" | |
| 16 | |
| 17 typedef struct _MallocProlog MallocProlog; | |
| 18 | |
| 19 struct _MallocProlog | |
| 20 { | |
| 21 MallocProlog *nextChunkInFreeList; | |
| 22 MallocProlog *prevChunkInFreeList; | |
| 23 MallocProlog *nextHigherInMem; | |
| 24 MallocProlog *nextLowerInMem; | |
| 25 }; | |
| 26 //MallocProlog | |
| 27 | |
| 28 typedef struct | |
| 29 { | |
| 30 MallocProlog *firstChunkInFreeList; | |
| 31 int32 numInList; //TODO not used | |
| 32 } | |
| 33 FreeListHead; | |
| 34 | |
| 35 void * | |
| 36 VMS_int__malloc( size_t sizeRequested ); | |
| 37 | |
| 38 void * | |
| 39 VMS_int__malloc_aligned( size_t sizeRequested ); | |
| 40 | |
| 41 void | |
| 42 VMS_int__free( void *ptrToFree ); | |
| 43 | |
| 44 #define VMS_PI__malloc VMS_int__malloc | |
| 45 #define VMS_PI__malloc_aligned VMS_int__malloc_aligned | |
| 46 #define VMS_PI__free VMS_int__free | |
| 47 /* For now, the PI is protected by master lock, so int malloc fine | |
| 48 void * | |
| 49 VMS_PI__malloc( size_t sizeRequested ); | |
| 50 | |
| 51 void * | |
| 52 VMS_PI__malloc_aligned( size_t sizeRequested ); | |
| 53 | |
| 54 void | |
| 55 VMS_PI__free( void *ptrToFree ); | |
| 56 */ | |
| 57 | |
| 58 //TODO: protect WL malloc from concurrency!! shared freelist can be corrupted | |
| 59 #define VMS_WL__malloc VMS_int__malloc | |
| 60 #define VMS_WL__malloc_aligned VMS_int__malloc_aligned | |
| 61 #define VMS_WL__free VMS_int__free | |
| 62 /* | |
| 63 void * | |
| 64 VMS_WL__malloc( size_t sizeRequested ); | |
| 65 | |
| 66 void * | |
| 67 VMS_WL__malloc_aligned( size_t sizeRequested ); | |
| 68 | |
| 69 void | |
| 70 VMS_WL__free( void *ptrToFree ); | |
| 71 */ | |
| 72 | |
| 73 /*Allocates memory from the external system -- higher overhead | |
| 74 */ | |
| 75 void * | |
| 76 VMS__malloc_in_ext( size_t sizeRequested ); | |
| 77 | |
| 78 /*Frees memory that was allocated in the external system -- higher overhead | |
| 79 */ | |
| 80 void | |
| 81 VMS__free_in_ext( void *ptrToFree ); | |
| 82 | |
| 83 | |
| 84 MallocProlog * | |
| 85 VMS_ext__create_free_list(); | |
| 86 | |
| 87 void | |
| 88 VMS_ext__free_free_list( MallocProlog *freeListHead ); | |
| 89 | |
| 90 #endif |
