Blob


1 #include <u.h>
2 #include <sys/mman.h>
3 #include "threadimpl.h"
5 #ifndef MAP_STACK
6 #define MAP_STACK 0
7 #endif
9 void*
10 _threadstkalloc(int n)
11 {
12 void *p;
14 p = mmap(nil, n, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANON|MAP_STACK, -1, 0);
15 if(p == (void*)-1)
16 return nil;
17 return p;
18 }
20 void
21 _threadstkfree(void *v, int n)
22 {
23 if(n > 0)
24 munmap(v, n);
25 }