#include "NVArray.h"#include "Error.h"#include <fcntl.h>#include <sys/stat.h>#include <sys/types.h>#include <signal.h>#include <stdio.h>Go to the source code of this file.
Functions | |
| ASSERT (nvoff_t NVArray::nvalloc(size_t rsz){nvoff_t r=NVcontainer::nvalloc(rsz);if(!arrtab) return r;if((const char *)(arrtab+(arrlst-arrfst))<=mem_p+r) return r;if(mem_p+(r+rsz)<=(const char *) arrtab) return r;VERB(char buf[256];sprintf(buf,"allocated illegal memory block[%lu,%lu[\n", r, r+rsz);slog.p(Logger::Error)<< buf);kill(getpid(), SIGABRT);exit(100);}void NVArray::nvfree(nvoff_t p){if(!arrtab){NVcontainer::nvfree(p);return;}if((const char *)(arrtab+(arrlst-arrfst))<=mem_p+p){NVcontainer::nvfree(p);return;}int psz=*(unsigned long *)(mem_p+(p-sizeof(unsigned long)));if(mem_p+(p+psz)<=(const char *) arrtab){NVcontainer::nvfree(p);return;}kill(getpid(), SIGABRT);}) void NVArray | |
|
|
Definition at line 120 of file NVArray.cc.
00120 {
00121 nvoff_t r = NVcontainer::nvalloc(rsz);
00122 if (!arrtab) return r;
00123 if ((const char *) (arrtab + (arrlst - arrfst)) <=
00124 mem_p + r) return r;
00125 if (mem_p + (r + rsz) <= (const char *) arrtab) return r;
00126 VERB(char buf[256];
00127 sprintf(buf, "allocated illegal memory block [%lu,%lu[\n", r,
00128 r + rsz); slog.p(Logger::Error) << buf);
00129 kill(getpid(), SIGABRT); exit(100);}
00130
00131 void NVArray::nvfree(nvoff_t p) {
00132 if (!arrtab) {
00133 NVcontainer::nvfree(p); return;}
00134 if ((const char *) (arrtab + (arrlst - arrfst)) <= mem_p + p) {
00135 NVcontainer::nvfree(p); return;}
00136 int psz = *(unsigned long *) (mem_p + (p - sizeof(unsigned long)));
00137 if (mem_p + (p + psz) <= (const char *) arrtab) {
00138 NVcontainer::nvfree(p); return;}
00139 kill(getpid(), SIGABRT);}
00140
00141 )
00142
00143 void NVArray::open(const char *dbname, int flags) {
00144 NVcontainer::open(dbname, flags);
00145 }
|
1.3.6-20040222