summaryrefslogtreecommitdiff
blob: 64a1576f08941fafb31eb53e01d1d847356339ad (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
diff -ruN lwp-2.0/src/lwp.c lwp-2.0-fixed/src/lwp.c
--- lwp-2.0/src/lwp.c	2005-03-25 17:50:56.000000000 +0100
+++ lwp-2.0-fixed/src/lwp.c	2005-05-05 14:32:56.580753096 +0200
@@ -463,6 +463,16 @@
 #ifndef MMAP_LWP_STACKS
     stackptr = (char *) malloc(stacksize);
 #else
+    pagesize = getpagesize();
+
+#if defined(__x86_64__)
+    /* [gb] Ensure minimal stack size. Heuristically determined
+       through tdb test that 2048 is too small when printf() et al. come
+       into action.  */
+    if (stacksize < pagesize)
+	stacksize = pagesize;
+#endif
+
 #ifdef MAP_ANON
     stackptr = mmap(lwp_stackbase, stacksize, PROT_READ | PROT_WRITE,
 		    MAP_PRIVATE | MAP_ANON, -1, 0);
@@ -483,7 +493,6 @@
 	perror("stack: ");
 	assert(0);
     }
-    pagesize = getpagesize();
     lwp_stackbase += ((stacksize/pagesize) + 2) * pagesize;
 #endif
     if (!stackptr)