aboutsummaryrefslogtreecommitdiff
path: root/sys/libn/error.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/libn/error.c')
-rw-r--r--sys/libn/error.c43
1 files changed, 7 insertions, 36 deletions
diff --git a/sys/libn/error.c b/sys/libn/error.c
index e0bb4d2..95a534a 100644
--- a/sys/libn/error.c
+++ b/sys/libn/error.c
@@ -25,53 +25,24 @@ verrorf(byte* fmt, va_list args)
void
panicf(byte* fmt, ...)
{
- int n;
va_list args;
- static byte buf[4*1024];
-
va_start(args, fmt);
- buf[0] = 'p';
- buf[1] = 'a';
- buf[2] = 'n';
- buf[3] = 'i';
- buf[4] = 'c';
- buf[5] = ':';
- buf[6] = ' ';
- n = vsnprintf(buf+7, arrlen(buf)-8, fmt, args);
- if (n < 0)
- return;
- buf[n+7] = 0;
- perror(buf);
+ printf("panic: ");
+ vprintf(fmt, args);
+ printf("\n");
+
va_end(args);
- /* TODO: portable stack unwinding */
exit(1);
}
void
vpanicf(byte* fmt, va_list args)
{
- int n;
- va_list nargs;
- static byte buf[4*1024];
- va_copy(nargs, args);
-
- buf[0] = 'p';
- buf[1] = 'a';
- buf[2] = 'n';
- buf[3] = 'i';
- buf[4] = 'c';
- buf[5] = ':';
- buf[6] = ' ';
- n = vsnprintf(buf+7, arrlen(buf)-8, fmt, args);
- if (n < 0)
- return;
- buf[n] = 0;
-
- perror(buf);
- va_end(nargs);
+ printf("panic: ");
+ vprintf(fmt, args);
+ printf("\n");
- /* TODO: portable stack unwinding */
exit(1);
}