-#define FAILURE(mesg) { printf("failed in the API: %s with errno relative message: %s\n", mesg, strerror( errno ) ); exit( -1 ); }
+#define FAILURE(mesg) { printf("failed in the API: %s with errno relative message: %s\n", mesg, strerror( errno ) ); exit(EXIT_FAILURE); }
#if USE_MPROTECT_SNAPSHOT
struct SnapShot * snapshotrecord = NULL;
struct Snapshot_t * sTheRecord = NULL;
#if USE_MPROTECT_SNAPSHOT
struct SnapShot * snapshotrecord = NULL;
struct Snapshot_t * sTheRecord = NULL;
sa.sa_sigaction = HandlePF;
if( sigaction( SIGSEGV, &sa, NULL ) == -1 ){
printf("SIGACTION CANNOT BE INSTALLED\n");
sa.sa_sigaction = HandlePF;
if( sigaction( SIGSEGV, &sa, NULL ) == -1 ){
printf("SIGACTION CANNOT BE INSTALLED\n");
unsigned int memoryregion=snapshotrecord->lastRegion++;
if (memoryregion==snapshotrecord->maxRegions) {
printf("Exceeded supported number of memory regions!\n");
unsigned int memoryregion=snapshotrecord->lastRegion++;
if (memoryregion==snapshotrecord->maxRegions) {
printf("Exceeded supported number of memory regions!\n");
if( mprotect(snapshotrecord->regionsToSnapShot[region].basePtr, snapshotrecord->regionsToSnapShot[region].sizeInPages*sizeof(struct SnapShotPage), PROT_READ ) == -1 ){
perror("mprotect");
printf("Failed to mprotect inside of takeSnapShot\n");
if( mprotect(snapshotrecord->regionsToSnapShot[region].basePtr, snapshotrecord->regionsToSnapShot[region].sizeInPages*sizeof(struct SnapShotPage), PROT_READ ) == -1 ){
perror("mprotect");
printf("Failed to mprotect inside of takeSnapShot\n");
}
}
unsigned int snapshot=snapshotrecord->lastSnapShot++;
if (snapshot==snapshotrecord->maxSnapShots) {
printf("Out of snapshots\n");
}
}
unsigned int snapshot=snapshotrecord->lastSnapShot++;
if (snapshot==snapshotrecord->maxSnapShots) {
printf("Out of snapshots\n");
if( mprotect(snapshotrecord->regionsToSnapShot[region].basePtr, snapshotrecord->regionsToSnapShot[region].sizeInPages*sizeof(struct SnapShotPage), PROT_READ | PROT_WRITE ) == -1 ){
perror("mprotect");
printf("Failed to mprotect inside of takeSnapShot\n");
if( mprotect(snapshotrecord->regionsToSnapShot[region].basePtr, snapshotrecord->regionsToSnapShot[region].sizeInPages*sizeof(struct SnapShotPage), PROT_READ | PROT_WRITE ) == -1 ){
perror("mprotect");
printf("Failed to mprotect inside of takeSnapShot\n");