Tweaks to make libthread tell Valgrind about its stack limits,

so that Valgrind can detect stack overflow for me.
This commit is contained in:
rsc 2004-04-21 19:29:04 +00:00
parent cdd61ab0ae
commit a3785ca2cc
7 changed files with 60 additions and 8 deletions

View file

@ -1,6 +1,12 @@
#include <lib9.h>
#include <u.h>
#include <libc.h>
#include <thread.h>
enum
{
STACK = 8192
};
int quiet;
int goal;
int buffer;
@ -19,7 +25,7 @@ primethread(void *arg)
if(!quiet)
print("%d\n", p);
nc = chancreate(sizeof(ulong), buffer);
(*fn)(primethread, nc, 8192);
(*fn)(primethread, nc, STACK);
for(;;){
i = recvul(c);
if(i%p)
@ -56,7 +62,7 @@ threadmain(int argc, char **argv)
goal = 100;
c = chancreate(sizeof(ulong), buffer);
(*fn)(primethread, c, 8192);
(*fn)(primethread, c, STACK);
for(i=2;; i++)
sendul(c, i);
}