#include <assert.h>
#include <stdio.h>
-#include <stdlib.h>
#include <stdint.h>
+#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include "shalloc.h"
-#define SHMNAME "/winnie.shm"
-
-#define POOL_SIZE 16777216
#define BLOCK_SIZE 512
#define NUM_BLOCKS (POOL_SIZE / BLOCK_SIZE)
fprintf(stderr, "Failed to map shared memory: %s\n", strerror(errno));
}
- shm_unlink(SHMNAME);
-
for(int i=0; i<BITMAP_SIZE; i++) {
bitmap[i] = 0;
}
if(munmap(pool, POOL_SIZE) == -1) {
fprintf(stderr, "Failed to unmap shared memory: %s\n", strerror(errno));
}
+ shm_unlink(SHMNAME);
}
void *sh_malloc(size_t bytes)