libthread: add proper sysfatal
diff --git a/src/libthread/thread.c b/src/libthread/thread.c
index 78c538a..42081e9 100644
--- a/src/libthread/thread.c
+++ b/src/libthread/thread.c
@@ -281,6 +281,19 @@
 	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 @@
 	threadmain(threadargc, threadargv);
 }
 
+extern void (*_sysfatal)(char*, ...);
+
 int
 main(int argc, char **argv)
 {
@@ -715,6 +730,7 @@
 	_notejmpbuf = threadnotejmp;
 	_pin = threadpin;
 	_unpin = threadunpin;
+	_sysfatal = threadsysfatal;
 
 	_pthreadinit();
 	p = procalloc();