This commit is contained in:
2025-09-27 15:16:26 +02:00
parent 5af7c5276a
commit 3b1bb9d531
63 changed files with 1087 additions and 407 deletions

View File

@ -8,6 +8,7 @@
#include <string/string.h>
#include <sysdefs/mman.h>
#include <system/system.h>
#include <write/write.h>
#define USE_DL_PREFIX 1
#define LACKS_SYS_TYPES_H 1
@ -23,7 +24,7 @@
#define LACKS_SCHED_H 1
#define HAVE_MMAP 1
#define HAVE_MORECORE 0
#define ABORT uprintf("dlmalloc: Aborting...\n")
#define ABORT writefmt("dlmalloc: Aborting...\n")
#define MALLOC_FAILURE_ACTION
#define USE_LOCKS 2
#define malloc_getpagesize 0x1000
@ -61,8 +62,9 @@ static size_t _roundpage(size_t sz) {
#define O_RDWR 0
#define EMUL_DEV_ZERO_FD 123
#define EMUL_MAP_FAILED ((void *)-1)
int open(char *path, int flags) {
int open(const char *path, int flags, ...) {
return EMUL_DEV_ZERO_FD;
}
@ -73,7 +75,7 @@ void *mmap(void *addr, size_t len, int prot, int flags, int fd, int off) {
int32_t err = mman_map(NULL, need, MMAN_MAP_PF_RW, 0, &outaddr);
if (err != E_OK || outaddr == NULL) {
return NULL;
return EMUL_MAP_FAILED;
}
if (fd == EMUL_DEV_ZERO_FD) {