blob: 594ef67680c802d36ab693a251ebc85d657af75c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
|
/*
* 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. Requests for 0 bytes of
* memory will also return NULL.
*/
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 *);
/*
* Return a pointer to the head of the free list. I can't recall
* precisely what I wanted this function called in the assignment,
* so this name may change when I get the chance to check.
*/
free_nd *free_list_head();
#endif
|