liballoc - a memory allocator for hobbyist operating systems
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.
 
 
 
Bryce Lanham 92e63f3d45
Added more recent versions of liballoc.(c|h)
11 years ago
test Added all contents of liballoc 11 years ago
HOWTO Added all contents of liballoc 11 years ago
LICENSE Added all contents of liballoc 11 years ago
Makefile Added all contents of liballoc 11 years ago
README Added all contents of liballoc 11 years ago
liballoc.c Added all contents of liballoc 11 years ago
liballoc.h Added all contents of liballoc 11 years ago
liballoc_1_1.c Added more recent versions of liballoc.(c|h) 11 years ago
liballoc_1_1.h Added more recent versions of liballoc.(c|h) 11 years ago
linux.c Added all contents of liballoc 11 years ago

README




There are 4 functions which you need to implement on your system:

int liballoc_lock();
int liballoc_unlock();
void* liballoc_alloc(int);
int liballoc_free(void*,int);

1) Have a look at liballoc.h for information about what each function is
supposed to do.


2) Have a look at linux.c for an example of how to implement the library
on linux.


NOTE: There are two ways to build the library.

1) Compile the library with a new system file. For example, I've
left linux.c with the default distribution. It gets compiled
directly into the liballoc_linux.so file.

2) Implement the functions in your application and then just
link against the default liballoc.so library when you compile
your app.


QUICK START
-------------

You can simply type: "make linux" to build the linux shared
library. Thereafter, you can link it directly into your applications
during build or afterwards by export the LD_PRELOAD environment
variable.


To run bash with the library, for example:

LD_PRELOAD=/full/path/to/liballoc.so bash


The above command will pre-link the library into the application,
essentially replacing the default malloc/free calls at runtime. It's
quite cool.



Durand Miller

clutter@djm.co.za