aboutsummaryrefslogtreecommitdiffstats
path: root/include/alloc.h
diff options
context:
space:
mode:
authorDouglas B. Rumbaugh <doug@douglasrumbaugh.com>2025-11-02 13:23:50 -0500
committerDouglas B. Rumbaugh <doug@douglasrumbaugh.com>2025-11-02 13:23:50 -0500
commitdb7277df5ed4a0951698697b62afa823c3ba0d72 (patch)
tree99d9a004146ec383ea63c395b51740616ee8d1f8 /include/alloc.h
downloadliballoc-db7277df5ed4a0951698697b62afa823c3ba0d72.tar.gz
Intial commit: No free list management yet
Diffstat (limited to 'include/alloc.h')
-rw-r--r--include/alloc.h38
1 files changed, 38 insertions, 0 deletions
diff --git a/include/alloc.h b/include/alloc.h
new file mode 100644
index 0000000..cdbdb37
--- /dev/null
+++ b/include/alloc.h
@@ -0,0 +1,38 @@
+/*
+ * include/alloc.h
+ *
+ * Primary header for liballoc API
+ * CISC 301 -- Operating Systems, Project 3
+ *
+ * Copyright (C) 2025 Douglas B. Rumbaugh <dbrumbaugh@harrisburgu.edu>
+ *
+ * Distributed under the Modified BSD License
+ *
+ */
+#ifndef H_LIBALLOC
+#define H_LIBALLOC
+
+#include <assert.h>
+#include <stdio.h>
+#include <unistd.h>
+
+#include "constants.h"
+#include "free_list.h"
+
+/*
+ * Returns a pointer to a new region of memory of the specified
+ * size, or NULL if no memory is available.
+ */
+void *allocate(size_t);
+
+/*
+ * Release a block of memory previous allocated using allocate(). If the
+ * input pointer was not returned by allocate(), then the behavior of
+ * this function is undefined.
+ *
+ * Accessing a pointer that has been previous passed to this function is
+ * undefined behavior.
+ */
+void release(void *);
+
+#endif