Blob
1 #include "threadimpl.h"3 static long totalmalloc;5 void*6 _threadmalloc(long size, int z)7 {8 void *m;10 m = malloc(size);11 if (m == nil)12 sysfatal("Malloc of size %ld failed: %r\n", size);13 setmalloctag(m, getcallerpc(&size));14 totalmalloc += size;15 if (size > 1000000) {16 fprint(2, "Malloc of size %ld, total %ld\n", size, totalmalloc);17 abort();18 }19 if (z)20 _threadmemset(m, 0, size);21 return m;22 }24 void25 _threadsysfatal(char *fmt, va_list arg)26 {27 char buf[1024]; /* size doesn't matter; we're about to exit */29 vseprint(buf, buf+sizeof(buf), fmt, arg);30 if(argv0)31 fprint(2, "%s: %s\n", argv0, buf);32 else33 fprint(2, "%s\n", buf);34 threadexitsall(buf);35 }