Skip to content

Commit

Permalink
Improve error message
Browse files Browse the repository at this point in the history
  • Loading branch information
gadmm committed Oct 16, 2023
1 parent 58ab175 commit 8d54ff7
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions runtime/platform.c
Original file line number Diff line number Diff line change
Expand Up @@ -140,9 +140,9 @@ static int madvise_os(char *block, asize_t size, int madvice)
/* Note: there is no evidence that one should retry on EAGAIN */
if (err == -1) {
char * str = "(unknown)";
/* There is not simple way, but the message is useful as there is
no other way to know that an error happens in the cases where
our result is ignored. */
/* There is no simpler way to convert to a string, but the message
is useful as there is no other way to know that an error
happens in the cases where our result is ignored. */
if (madvice == MADV_DODUMP) str = "MADV_DODUMP";
if (madvice == MADV_CORE) str = "MADV_CORE";
if (madvice == MADV_FREE) str = "MADV_FREE";
Expand All @@ -153,6 +153,7 @@ static int madvise_os(char *block, asize_t size, int madvice)
if (madvice == MADV_DONTDUMP) str = "MADV_DONTDUMP";
if (madvice == MADV_NOCORE) str = "MADV_NOCORE";
if (madvice == MADV_POPULATE_WRITE) str = "MADV_POPULATE_WRITE";
if (madvice == UNDEFINED) str = "-1";
caml_gc_message(0x1000,
"madvise failed (block=%p, "
"size=%" ARCH_SIZET_PRINTF_FORMAT "u, advice=%s) "
Expand Down

0 comments on commit 8d54ff7

Please sign in to comment.