Our own headers are including several of the wrong headers in the wrong
places. Move a few to place them more closely to their actual usage
location, and remove some others that are unused (e.g., <iostream>,
<cassert>, <csignal>).
-#include "mymemory.h"
-#include "snapshot.h"
-#include "snapshotimp.h"
+#include <stdlib.h>
#include <stdio.h>
#include <dlfcn.h>
#include <unistd.h>
-#include <cstring>
+#include <string.h>
+#include <new>
+
+#include "mymemory.h"
+#include "snapshot.h"
+#include "snapshotimp.h"
#include "common.h"
+
#define REQUESTS_BEFORE_ALLOC 1024
+
size_t allocatedReqs[ REQUESTS_BEFORE_ALLOC ] = { 0 };
int nextRequest = 0;
int howManyFreed = 0;
return tmp;
} else {
void *tmp = HandleEarlyAllocationRequest(size * num);
- std::memset(tmp, 0, size * num);
+ memset(tmp, 0, size * num);
return tmp;
}
}
#ifndef _MY_MEMORY_H
#define _MY_MEMORY_H
-#include <stdlib.h>
#include <limits>
+#include <stddef.h>
#include "config.h"
-#include "snapshot-interface.h"
-#include "snapshot.h"
-#include <iostream>
-#include <fstream>
+#include <stdlib.h>
#include <unistd.h>
-#include <sstream>
#include <cstring>
-#include <string>
-#include <cassert>
-#include <vector>
-#include <utility>
#include <inttypes.h>
+
+#include "snapshot-interface.h"
+#include "snapshot.h"
#include "common.h"
/* MYBINARYNAME only works because our pathname usually includes 'model' (e.g.,
#include <unistd.h>
#include <signal.h>
#include <stdlib.h>
-#include "hashtable.h"
-#include <cstring>
-#include <cstdio>
-#include "snapshot.h"
-#include "snapshotimp.h"
-#include "mymemory.h"
-#include <fcntl.h>
-#include <assert.h>
-#include <pthread.h>
-#include <semaphore.h>
+#include <string.h>
#include <errno.h>
#include <sys/wait.h>
#include <ucontext.h>
+#include "hashtable.h"
+#include "snapshot.h"
+#include "snapshotimp.h"
+#include "mymemory.h"
#include "common.h"
#define FAILURE(mesg) { model_print("failed in the API: %s with errno relative message: %s\n", mesg, strerror( errno ) ); exit(EXIT_FAILURE); }
* @brief Snapshotting implementation header file..
*/
-#ifndef _SNAPSHOTIMP_H
-#define _SNAPSHOTIMP_H
+#ifndef __SNAPSHOTIMP_H__
+#define __SNAPSHOTIMP_H__
+
+#include <stddef.h>
+
#include "snapshot.h"
-#include <iostream>
-#include <inttypes.h>
-#include <fcntl.h>
-#include <sys/mman.h>
-#include <csignal>
+
#define SHARED_MEMORY_DEFAULT (100 * ((size_t)1 << 20)) // 100mb for the shared memory
#define STACK_SIZE_DEFAULT (((size_t)1 << 20) * 20) // 20 mb out of the above 100 mb for my stack
};
#else
+
+#include <ucontext.h>
+
struct SnapShot {
void *mSharedMemoryBase;
void *mStackBase;
//Global reference to snapshot data structure
extern struct SnapShot * snapshotrecord;
-#endif
+
+#endif /* __SNAPSHOTIMP_H__ */