Geen omschrijving
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

main.c 548B

123456789101112131415161718192021222324252627282930
  1. #include <stdio.h>
  2. #include <stdint.h>
  3. #include <stddef.h>
  4. #include <unistd.h>
  5. #include <sys/mman.h>
  6. #include "alloc_api.h"
  7. void *get_new_region(uintptr_t size) {
  8. void *m = mmap(NULL, size, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
  9. if (m == MAP_FAILED) {
  10. return 0;
  11. }
  12. return m;
  13. }
  14. void error(char *msg) {
  15. printf("=== ALLOCATOR ERROR ===\n%s\n====== END ERROR ======\n", msg);
  16. }
  17. int main() {
  18. printf("Hello, World!\n");
  19. struct Arena arena = {
  20. NULL,
  21. NULL,
  22. get_new_region,
  23. error,
  24. };
  25. return 0;
  26. }