mirror of
https://sourceware.org/git/glibc.git
synced 2025-08-05 19:35:52 +03:00
Update.
2000-12-31 Ulrich Drepper <drepper@redhat.com> * manager.c (pthread_alloca_stack): Remove MAP_FIXED from mmap calls. (pthread_free): Always unmap the stack. It's safe now that we don't use MAP_FIXED to allocate stacks.
This commit is contained in:
@@ -1,6 +1,8 @@
|
|||||||
2000-12-31 H.J. Lu <hjl@gnu.org>
|
2000-12-31 Ulrich Drepper <drepper@redhat.com>
|
||||||
|
|
||||||
* manager.c (pthread_allocate_stack): Fix a typo.
|
* manager.c (pthread_alloca_stack): Remove MAP_FIXED from mmap calls.
|
||||||
|
(pthread_free): Always unmap the stack. It's safe now that we don't
|
||||||
|
use MAP_FIXED to allocate stacks.
|
||||||
|
|
||||||
2000-12-31 Ulrich Drepper <drepper@redhat.com>
|
2000-12-31 Ulrich Drepper <drepper@redhat.com>
|
||||||
|
|
||||||
|
@@ -376,7 +376,7 @@ static int pthread_allocate_stack(const pthread_attr_t *attr,
|
|||||||
map_addr = (caddr_t)((char *)(new_thread + 1) - stacksize / 2);
|
map_addr = (caddr_t)((char *)(new_thread + 1) - stacksize / 2);
|
||||||
res_addr = mmap(map_addr, stacksize / 2,
|
res_addr = mmap(map_addr, stacksize / 2,
|
||||||
PROT_READ | PROT_WRITE | PROT_EXEC,
|
PROT_READ | PROT_WRITE | PROT_EXEC,
|
||||||
MAP_PRIVATE | MAP_ANONYMOUS | MAP_FIXED, -1, 0);
|
MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
|
||||||
if (res_addr != map_addr)
|
if (res_addr != map_addr)
|
||||||
{
|
{
|
||||||
/* Bad luck, this segment is already mapped. */
|
/* Bad luck, this segment is already mapped. */
|
||||||
@@ -388,7 +388,7 @@ static int pthread_allocate_stack(const pthread_attr_t *attr,
|
|||||||
map_addr = (caddr_t)new_thread_bottom;
|
map_addr = (caddr_t)new_thread_bottom;
|
||||||
res_addr = mmap(map_addr, stacksize/2,
|
res_addr = mmap(map_addr, stacksize/2,
|
||||||
PROT_READ | PROT_WRITE | PROT_EXEC,
|
PROT_READ | PROT_WRITE | PROT_EXEC,
|
||||||
MAP_PRIVATE | MAP_ANONYMOUS | MAP_FIXED, -1, 0);
|
MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
|
||||||
if (res_addr != map_addr)
|
if (res_addr != map_addr)
|
||||||
{
|
{
|
||||||
if (res_addr != MAP_FAILED)
|
if (res_addr != MAP_FAILED)
|
||||||
@@ -449,7 +449,7 @@ static int pthread_allocate_stack(const pthread_attr_t *attr,
|
|||||||
map_addr = new_thread_bottom - guardsize;
|
map_addr = new_thread_bottom - guardsize;
|
||||||
res_addr = mmap(map_addr, stacksize + guardsize,
|
res_addr = mmap(map_addr, stacksize + guardsize,
|
||||||
PROT_READ | PROT_WRITE | PROT_EXEC,
|
PROT_READ | PROT_WRITE | PROT_EXEC,
|
||||||
MAP_PRIVATE | MAP_ANONYMOUS | MAP_FIXED, -1, 0);
|
MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
|
||||||
if (res_addr != map_addr)
|
if (res_addr != map_addr)
|
||||||
{
|
{
|
||||||
/* Bad luck, this segment is already mapped. */
|
/* Bad luck, this segment is already mapped. */
|
||||||
@@ -721,16 +721,8 @@ static void pthread_free(pthread_descr th)
|
|||||||
guardaddr -= stacksize;
|
guardaddr -= stacksize;
|
||||||
stacksize *= 2;
|
stacksize *= 2;
|
||||||
#endif
|
#endif
|
||||||
#if FLOATING_STACKS
|
/* Unmap the stack. */
|
||||||
/* Can unmap safely. */
|
|
||||||
munmap(guardaddr, stacksize + guardsize);
|
munmap(guardaddr, stacksize + guardsize);
|
||||||
#else
|
|
||||||
/* Only remap to PROT_NONE, so that the region is reserved in
|
|
||||||
case we map the stack again later. Avoid collision with
|
|
||||||
other mmap()s, in particular by malloc(). */
|
|
||||||
mmap(guardaddr, stacksize + guardsize, PROT_NONE,
|
|
||||||
MAP_PRIVATE | MAP_ANONYMOUS | MAP_FIXED, -1, 0);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user