[0001] [0002] [0003] [0004] [0005] [0006] [0007] [0008] [0009] [0010] [0011] [0012] [0013] [0014] [0015] [0016] [0017] [0018] [0019] [0020] [0021] [0022] [0023] [0024] [0025] [0026] [0027] [0028] [0029] [0030] [0031] [0032] [0033] [0034] [0035] [0036] [0037] [0038] [0039] [0040] [0041] [0042] [0043] [0044] [0045] [0046] [0047] [0048] [0049] [0050] [0051] [0052] [0053] [0054] [0055] [0056] [0057] [0058] [0059] [0060] [0061] [0062] [0063] [0064] [0065] [0066] [0067] [0068] [0069] [0070] [0071] [0072] [0073] [0074] [0075] [0076] [0077] [0078] [0079] [0080] [0081] [0082] [0083] [0084] [0085] [0086] [0087] [0088] [0089] [0090] [0091] [0092] [0093] [0094] [0095] [0096] [0097] [0098] [0099] [0100] [0101] [0102] [0103] [0104] [0105] [0106] [0107] [0108] [0109] [0110] [0111] [0112] [0113] [0114] [0115] [0116] [0117] [0118] [0119] [0120] [0121] [0122] [0123] [0124] [0125] [0126] [0127] [0128] [0129] [0130] [0131] [0132] [0133] [0134] [0135] [0136] [0137] [0138] [0139] [0140] [0141] [0142] [0143] [0144] [0145] [0146] [0147] [0148] [0149] [0150] [0151] [0152] [0153] [0154] [0155] [0156] [0157] [0158] [0159] [0160] [0161] [0162] [0163] [0164] [0165] [0166] [0167] [0168] [0169] [0170] [0171] [0172] [0173] [0174] [0175] [0176] [0177] [0178] [0179] [0180] [0181] [0182] [0183] [0184] [0185] [0186] [0187] [0188] [0189] [0190] [0191] [0192] [0193] [0194] [0195] [0196] [0197] [0198] [0199] [0200] [0201] [0202] [0203] [0204] [0205] [0206] [0207] [0208] [0209] [0210] [0211] [0212] [0213] [0214] [0215]
/*****************************************************************************/ /* Vm.h */ /*****************************************************************************/ #ifndef VM_H_LOADED #define VM_H_LOADED 1 #include "wasd.h" /*~~~~~~~~~~~~~~~~~~~~~~~~~~~*/ #define VM_BACKPORT_FOR_DTAG 0 /*~~~~~~~~~~~~~~~~~~~~~~~~~~~*/ /**********/ /* macros */ /**********/ /* more intended for development and troubleshooting than production */ #define VM_DECC 0 /* intercept DECC calls */ #define VM_EXPAT 1 /* use this module to manage EXPAT memory */ #define VM_OPENSSL 1 /* use this module to manage OpenSSL memory */ #define VM_STATS_ONLY 0 /* do not create zones just collect stats */ #ifndef VM_DECC # define VM_DECC 0 #endif #ifndef VM_EXPAT # define VM_EXPAT 0 #endif #ifndef VM_OPENSSL # define VM_OPENSSL 0 #endif #ifndef VM_STATS_ONLY # define VM_STATS_ONLY 0 #endif #define VM_MAGIC_CACHE 0xBADCAFE1 /* cache */ #define VM_MAGIC_DECC 0xBADCAFE2 /* DECC interception */ #define VM_MAGIC_EXPAT 0xBADCAFE3 /* expat */ #define VM_MAGIC_GENERAL 0xBADCAFE4 /* general */ #define VM_MAGIC_HTTP2 0xBADCAFE5 /* HTTP/2 */ #define VM_MAGIC_OPENSSL 0xBADCAFE6 /* OpenSSL */ #define VM_MAGIC_PERMCACHE 0xBADCAFE7 /* permanent cache */ #define VM_MAGIC_REQUEST 0xBADCAFE8 /* request */ #define VM_GUARD 0x2C0FFEE5 /* integrity checking */ /* page file can grow to this percentage then the server spits */ #define VM_DEFAULT_PGFL_LIMIT 95 /**************/ /* structures */ /**************/ #pragma member_alignment __save #pragma nomember_alignment typedef struct VmStruct VM_STRUCT; /* 24 bytes overhead in total */ struct VmStruct { ulong size, magic; /* fill to quadword */ uchar fill [7]; /* inbuilt HTTP/2 header fields (also see HTTP2.H) */ union vm_header2 { uchar h2header [9]; struct { uchar h2length [3]; uchar h2type [1]; uchar h2flags [1]; uchar h2ident [4]; }; }; uchar h2payload []; }; #pragma member_alignment __restore typedef struct vm_zone_struct VM_ZONE; struct vm_zone_struct { ulong CallocCount, ExtendPages, FreeCount, InitialPages, MagicValue, MallocCount, MaxPages, MinPages, ReallocCount, StatExtend, StatInitial, TuneSample, TunePeriod, ZoneId; uint64 AllocBytes, DeallocBytes, FreeBeforeBytes, InUseBytes, InUseMaxBytes, LastLookBytes, LastLookTime64, StatCount, StatPages; char *LogicalName, *ReportTitle; }; /***********************/ /* function prototypes */ /***********************/ /* general memory */ void VmlInit (); void VmGeneralInit (); void VmCheckPgFlLimit (); uchar* VmGet (ulong); void VmFree (uchar*, char*, int); uchar* VmRealloc (uchar*, ulong, char*, int); ulong VmZoneCurrentPages (ulong); int VmZoneCurrentSize (struct dsc$descriptor*, ulong*); void VmSetPages (struct vm_zone_struct*); void* VmGenericCalloc (struct vm_zone_struct*, int, int, char*, int); void* VmGenericRealloc (struct vm_zone_struct*, uchar*, int, char*, int); void VmGenericFree (struct vm_zone_struct*, uchar*, char*, int); #if VM_DECC void* VmDeccCalloc (int, int); void* DECC$CALLOC (int, int); void VmDeccInit (); void* VmDeccMalloc (int); void* DECC$MALLOC (int); void* VmDeccRealloc (uchar*, int); void* DECC$REALLOC (uchar*, int); void VmDeccFree (uchar*); void DECC$FREE (uchar*); #endif VM_DECC /* these are not conditional to allow SESOLA.C build for either case */ void VmOpenSslFree (uchar*); BOOL VmOpenSslInit (); void* VmOpenSslMalloc (int); void* VmOpenSslRealloc (uchar*, int); /* these are not conditional to allow DAVXML.C build for either case */ void VmExpatFree (uchar*); BOOL VmExpatInit (); void* VmExpatMalloc (int); void* VmExpatRealloc (uchar*, int); /* HTTP/2 memory */ void VmHttp2Init (); HTTP2_STRUCT* VmHttp2Get (int); void VmHttp2Free (HTTP2_STRUCT*, char*, int); void VmFree2Heap (HTTP2_STRUCT*, char*, int); void VmFreeFrom2Heap (HTTP2_STRUCT*, uchar*, char*, int); uchar* VmRealloc2Heap (HTTP2_STRUCT*, uchar*, ulong, char*, int); /* request memory */ void VmRequestInit (); REQUEST_STRUCT* VmGetRequest (int); void VmFreeRequest (REQUEST_STRUCT*, char*, int); uchar* VmGetHeap (REQUEST_STRUCT*, ulong); void VmFreeHeap (REQUEST_STRUCT*, char*, int); int VmFreeHeapStat (struct dsc$descriptor*, REQUEST_STRUCT*); void VmFreeFromHeap (REQUEST_STRUCT*, uchar*, char*, int); uchar* VmReallocHeap (REQUEST_STRUCT*, uchar*, ulong, char*, int); /* cache memory */ void VmCacheInit (int); uchar* VmGetCache (ulong); void VmFreeCache (uchar*, char*, int); void VmPermCacheInit (int); uchar* VmGetPermCache (ulong); void VmFreePermCache (uchar*, char*, int); /* memory report */ #if VM_BACKPORT_FOR_DTAG void VmReport (REQUEST_STRUCT*, REQUEST_AST); #else void VmReport (REQUEST_STRUCT*); #endif void VmReportZone (REQUEST_STRUCT*, struct vm_zone_struct*); int VmWrite (struct dsc$descriptor*, REQUEST_STRUCT*); /* inline debug */ void VmDebugOpenSslZone (char *module, int lnumber); #endif /* VM_H_LOADED */ /*****************************************************************************/