aboutsummaryrefslogtreecommitdiff
path: root/src/libthread/thread.c
diff options
context:
space:
mode:
authorTim Wiess <devnull@localhost>2008-07-20 03:11:05 -0400
committerTim Wiess <devnull@localhost>2008-07-20 03:11:05 -0400
commit69d1259cf9af6d288b34c4452db4c418e739f750 (patch)
tree17f28fd63a30b277ef790074370ce0f153acb81d /src/libthread/thread.c
parent64851eee5f6ba5fc9441074b9a11b9baaf064a90 (diff)
downloadplan9port-69d1259cf9af6d288b34c4452db4c418e739f750.tar.gz
plan9port-69d1259cf9af6d288b34c4452db4c418e739f750.tar.bz2
plan9port-69d1259cf9af6d288b34c4452db4c418e739f750.zip
libthread: add proper sysfatal
Diffstat (limited to 'src/libthread/thread.c')
-rw-r--r--src/libthread/thread.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/libthread/thread.c b/src/libthread/thread.c
index 78c538ac..42081e92 100644
--- a/src/libthread/thread.c
+++ b/src/libthread/thread.c
@@ -281,6 +281,19 @@ threadunpin(void)
p->pinthread = nil;
}
+void
+threadsysfatal(char *fmt, ...)
+{
+ char buf[256];
+ va_list arg;
+
+ va_start(arg, fmt);
+ vseprint(buf, buf+sizeof(buf), fmt, arg);
+ __fixargv0();
+ fprint(2, "%s: %s\n", argv0 ? argv0 : "<prog>", buf);
+ threadexitsall(buf);
+}
+
static void
contextswitch(Context *from, Context *to)
{
@@ -686,6 +699,8 @@ threadmainstart(void *v)
threadmain(threadargc, threadargv);
}
+extern void (*_sysfatal)(char*, ...);
+
int
main(int argc, char **argv)
{
@@ -715,6 +730,7 @@ main(int argc, char **argv)
_notejmpbuf = threadnotejmp;
_pin = threadpin;
_unpin = threadunpin;
+ _sysfatal = threadsysfatal;
_pthreadinit();
p = procalloc();