From f44411aa46784064651a1d0c8578e8534ce12f71 Mon Sep 17 00:00:00 2001 From: apio Date: Wed, 12 Oct 2022 11:54:29 +0200 Subject: [PATCH] libc: Document the functions in luna.h --- libs/libc/include/luna.h | 7 ++++++- libs/libc/src/luna.cpp | 4 +--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/libs/libc/include/luna.h b/libs/libc/include/luna.h index ba49d87c..648398f7 100644 --- a/libs/libc/include/luna.h +++ b/libs/libc/include/luna.h @@ -9,8 +9,13 @@ extern "C" { #endif + /* Returns the current program's thread identifier. */ pid_t gettid(); - unsigned int msleep(unsigned int); + + /* Sleeps for ms milliseconds. */ + unsigned int msleep(unsigned int ms); + + /* Prints a message to standard error and aborts the program. */ noreturn void __luna_abort(const char* message); #ifdef __cplusplus diff --git a/libs/libc/src/luna.cpp b/libs/libc/src/luna.cpp index 7d031cdb..6f760571 100644 --- a/libs/libc/src/luna.cpp +++ b/libs/libc/src/luna.cpp @@ -5,8 +5,6 @@ #include #include -#define noreturn __attribute__((noreturn)) - extern "C" { pid_t gettid() @@ -21,7 +19,7 @@ extern "C" noreturn void __luna_abort(const char* message) { - fwrite(message, strlen(message), 1, stdout); + fputs(message, stderr); abort(); } } \ No newline at end of file