Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCorinna Vinschen <corinna@vinschen.de>2011-05-16 13:55:18 +0400
committerCorinna Vinschen <corinna@vinschen.de>2011-05-16 13:55:18 +0400
commit6d6cfa4840b66c2dc152e7eab915a8ac9c10ef71 (patch)
tree01dd5cde99e17518990bb4efe163a0048281f293 /winsup/cygwin/dcrt0.cc
parent943e23a49f6f2fcb15cebe37e4c2361cab8f0fe4 (diff)
* dcrt0.cc (child_info_fork::alloc_stack_hard_way): Check if the
requested stack is application-provided within the user heap or an mmapped region. If so, just use it. Add comment to explain why. * miscfuncs.cc (thread_wrapper): If an application-provided stack has been given, implement cygtls area at the stackbase. Fix comment. * mmap.cc (is_mmapped_region): New function. * winsup.h (is_mmapped_region): Declare.
Diffstat (limited to 'winsup/cygwin/dcrt0.cc')
-rw-r--r--winsup/cygwin/dcrt0.cc9
1 files changed, 9 insertions, 0 deletions
diff --git a/winsup/cygwin/dcrt0.cc b/winsup/cygwin/dcrt0.cc
index 92056c80f..a6eb2696d 100644
--- a/winsup/cygwin/dcrt0.cc
+++ b/winsup/cygwin/dcrt0.cc
@@ -398,6 +398,15 @@ child_info_fork::alloc_stack_hard_way (volatile char *b)
int newlen;
bool guard;
+ /* First check if the requested stack area is part of the user heap
+ or part of a mmaped region. If so, we have been started from a
+ pthread with an application-provided stack, and the stack has just
+ to be used as is. */
+ if ((stacktop >= cygheap->user_heap.base
+ && stackbottom <= cygheap->user_heap.max)
+ || is_mmapped_region ((caddr_t) stacktop, (caddr_t) stackbottom))
+ return;
+
if (!VirtualQuery ((LPCVOID) &b, &m, sizeof m))
api_fatal ("fork: couldn't get stack info, %E");