1
0

thesis: Complete 2.2

This commit is contained in:
2025-07-14 17:26:24 +02:00
parent 2b384aeecc
commit 846a0c49c4
6 changed files with 150 additions and 43 deletions

15
thesis/listings/preload.c Normal file
View File

@@ -0,0 +1,15 @@
#include <stdlib.h>
#include <dlfcn.h>
#include <errno.h>
void *malloc(size_t size) {
// before call to malloc
void *(*_malloc)(size_t);
if ((_malloc = dlsym(RTLD_NEXT, "malloc")) == NULL) {
errno = ENOSYS;
return NULL;
}
void *ret = _malloc(size);
// after call to malloc
return ret;
}