From ebeae9d4233d00ee02e38a1866e59e9bdc4154f6 Mon Sep 17 00:00:00 2001 From: Max Wash Date: Tue, 31 May 2022 15:17:00 +0100 Subject: [PATCH] Added some error messages to heap management code --- photon/libc/sys/horizon/heap.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/photon/libc/sys/horizon/heap.c b/photon/libc/sys/horizon/heap.c index 33a3fd4..c7b0090 100644 --- a/photon/libc/sys/horizon/heap.c +++ b/photon/libc/sys/horizon/heap.c @@ -30,6 +30,7 @@ void __crt_heap_init(size_t sz) MX_VM_CAN_MAP_READ | MX_VM_CAN_MAP_WRITE | MX_VM_CAN_MAP_SPECIFIC, 0, HEAP_REGION_SZ, &heap_vmar, &heap); if (status != MX_OK) { + fprintf(stderr, "fatal: cannot allocate heap virtual region (%s)\n", mx_status_to_string(status)); abort(); } @@ -38,6 +39,7 @@ void __crt_heap_init(size_t sz) MX_VM_CAN_MAP_READ | MX_VM_CAN_MAP_WRITE | MX_VM_CAN_MAP_SPECIFIC, &heap_vmo); if (status != MX_OK) { + fprintf(stderr, "fatal: cannot allocate heap (%s)\n", mx_status_to_string(status)); abort(); } @@ -46,6 +48,7 @@ void __crt_heap_init(size_t sz) 0, heap_vmo, 0, sz, &heap); if (status != MX_OK) { + fprintf(stderr, "fatal: cannot map heap (%s)\n", mx_status_to_string(status)); abort(); } @@ -84,7 +87,7 @@ void *__crt_heap_extend(size_t sz) offset, heap_vmo, heap_sz, sz, &alloc_base); if (err != MX_OK) { - printf("cannot map extended heap: %s\n", mx_status_to_string(err)); + fprintf(stderr, "fatal: cannot map extended heap (%s)\n", mx_status_to_string(err)); abort(); }