Warning: Attempt to read property "date" on null in /usr/local/www/websvn.planix.org/blame.php on line 247

Warning: Attempt to read property "msg" on null in /usr/local/www/websvn.planix.org/blame.php on line 247
WebSVN – planix.SVN – Blame – /os/branches/planix-v0/sys/src/libthread/lib.c – Rev 2

Subversion Repositories planix.SVN

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
2 - 1
#include <u.h>
2
#include <libc.h>
3
#include <thread.h>
4
#include "threadimpl.h"
5
 
6
static long totalmalloc;
7
 
8
void*
9
_threadmalloc(long size, int z)
10
{
11
	void *m;
12
 
13
	m = malloc(size);
14
	if (m == nil)
15
		sysfatal("Malloc of size %ld failed: %r", size);
16
	setmalloctag(m, getcallerpc(&size));
17
	totalmalloc += size;
18
	if (size > 100000000) {
19
		fprint(2, "Malloc of size %ld, total %ld\n", size, totalmalloc);
20
		abort();
21
	}
22
	if (z)
23
		memset(m, 0, size);
24
	return m;
25
}
26
 
27
void
28
_threadsysfatal(char *fmt, va_list arg)
29
{
30
	char buf[1024];	/* size doesn't matter; we're about to exit */
31
 
32
	vseprint(buf, buf+sizeof(buf), fmt, arg);
33
	if(argv0)
34
		fprint(2, "%s: %s\n", argv0, buf);
35
	else
36
		fprint(2, "%s\n", buf);
37
	threadexitsall(buf);
38
}