summaryrefslogtreecommitdiff
path: root/main.c
diff options
context:
space:
mode:
authorMatthew Sotoudeh <matthew@masot.net>2024-05-16 14:03:57 -0700
committerMatthew Sotoudeh <matthew@masot.net>2024-05-16 14:03:57 -0700
commit54c09d54c0c170f1369751f8bf5a8a0b771a167c (patch)
treee73ab0e8b25602f8c7233ea7794020224fae92aa /main.c
parent940716fa2fa134a75d2ef34b41991c1c1c14735a (diff)
reorganize
Diffstat (limited to 'main.c')
-rw-r--r--main.c32
1 files changed, 0 insertions, 32 deletions
diff --git a/main.c b/main.c
deleted file mode 100644
index a288f1c..0000000
--- a/main.c
+++ /dev/null
@@ -1,32 +0,0 @@
-#include "buddy.h"
-#include <stdlib.h>
-#include <string.h>
-#include <fcntl.h>
-#include <assert.h>
-#include <unistd.h>
-#include <stdio.h>
-
-void get_random(uint8_t *dst, size_t count) {
- int fd = open("/dev/urandom", O_RDONLY);
- assert(count == read(fd, dst, count));
- close(fd);
-}
-
-void main() {
- struct buddy buddy;
-
- size_t region_size = 1024 * 1024;
-
- uint8_t magic[MAGIC_COOKIE_BYTES];
- get_random(magic, MAGIC_COOKIE_BYTES);
- init_buddy(malloc(region_size), region_size, magic, &buddy);
- memset(magic, 0, sizeof(magic));
-
- void *x = allocate(1024, &buddy);
- printf("Just allocated %p...\n", x);
- debug_buddy(&buddy);
-
- printf("Now liberating %p...\n", x);
- liberate(x, 1024, &buddy);
- debug_buddy(&buddy);
-}
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback