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> * sysdeps/powerpc/pspinlock.c: Don't include pt-machine.h here. * manager.c (pthread_allocate_stack): Prepare for removal of MAP_FIXED.
This commit is contained in:
@@ -1,3 +1,9 @@
|
|||||||
|
2000-12-31 Ulrich Drepper <drepper@redhat.com>
|
||||||
|
|
||||||
|
* sysdeps/powerpc/pspinlock.c: Don't include pt-machine.h here.
|
||||||
|
|
||||||
|
* manager.c (pthread_allocate_stack): Prepare for removal of MAP_FIXED.
|
||||||
|
|
||||||
2000-11-15 Wolfram Gloger <wg@malloc.de>
|
2000-11-15 Wolfram Gloger <wg@malloc.de>
|
||||||
|
|
||||||
* manager.c (pthread_free): [!FLOATING_STACKS]: Only remap the
|
* manager.c (pthread_free): [!FLOATING_STACKS]: Only remap the
|
||||||
|
@@ -345,6 +345,8 @@ static int pthread_allocate_stack(const pthread_attr_t *attr,
|
|||||||
|
|
||||||
/* Allocate space for stack and thread descriptor at default address */
|
/* Allocate space for stack and thread descriptor at default address */
|
||||||
#ifdef NEED_SEPARATE_REGISTER_STACK
|
#ifdef NEED_SEPARATE_REGISTER_STACK
|
||||||
|
void *res_addr;
|
||||||
|
|
||||||
if (attr != NULL)
|
if (attr != NULL)
|
||||||
{
|
{
|
||||||
guardsize = page_roundup (attr->__guardsize, granularity);
|
guardsize = page_roundup (attr->__guardsize, granularity);
|
||||||
@@ -371,18 +373,26 @@ static int pthread_allocate_stack(const pthread_attr_t *attr,
|
|||||||
/* XXX Fix for floating stacks with variable sizes. */
|
/* XXX Fix for floating stacks with variable sizes. */
|
||||||
|
|
||||||
/* First the main stack: */
|
/* First the main stack: */
|
||||||
if (mmap((caddr_t)((char *)(new_thread + 1) - stacksize / 2),
|
map_addr = (caddr_t)((char *)(new_thread + 1) - stacksize / 2);
|
||||||
stacksize / 2, PROT_READ | PROT_WRITE | PROT_EXEC,
|
res_addr = mmap(map_addr, stacksize / 2,
|
||||||
MAP_PRIVATE | MAP_ANONYMOUS | MAP_FIXED, -1, 0)
|
PROT_READ | PROT_WRITE | PROT_EXEC,
|
||||||
== MAP_FAILED)
|
MAP_PRIVATE | MAP_ANONYMOUS | MAP_FIXED, -1, 0);
|
||||||
/* Bad luck, this segment is already mapped. */
|
if (res_addr != map_addr)
|
||||||
return -1;
|
|
||||||
/* Then the register stack: */
|
|
||||||
if (mmap((caddr_t)new_thread_bottom, stacksize/2,
|
|
||||||
PROT_READ | PROT_WRITE | PROT_EXEC,
|
|
||||||
MAP_PRIVATE | MAP_ANONYMOUS | MAP_FIXED, -1, 0)
|
|
||||||
== MAP_FAILED)
|
|
||||||
{
|
{
|
||||||
|
/* Bad luck, this segment is already mapped. */
|
||||||
|
if (res_addr != MAP_FAILED)
|
||||||
|
munmap(res_addr, stacksize / 2);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
/* Then the register stack: */
|
||||||
|
map_addr = (caddr_t)new_thread_bottom;
|
||||||
|
res_addr = mmap(map_addr, stacksize/2,
|
||||||
|
PROT_READ | PROT_WRITE | PROT_EXEC,
|
||||||
|
MAP_PRIVATE | MAP_ANONYMOUS | MAP_FIXES, -1, 0);
|
||||||
|
if (res_addr != map_addr)
|
||||||
|
{
|
||||||
|
if (res_addr != MAP_FAILED)
|
||||||
|
munmap(res_addr, stacksize / 2);
|
||||||
munmap((caddr_t)((char *)(new_thread + 1) - stacksize/2),
|
munmap((caddr_t)((char *)(new_thread + 1) - stacksize/2),
|
||||||
stacksize/2);
|
stacksize/2);
|
||||||
return -1;
|
return -1;
|
||||||
@@ -419,6 +429,8 @@ static int pthread_allocate_stack(const pthread_attr_t *attr,
|
|||||||
new_thread_bottom = (char *) map_addr + guardsize;
|
new_thread_bottom = (char *) map_addr + guardsize;
|
||||||
new_thread = ((pthread_descr) (new_thread_bottom + stacksize)) - 1;
|
new_thread = ((pthread_descr) (new_thread_bottom + stacksize)) - 1;
|
||||||
# else /* !FLOATING_STACKS */
|
# else /* !FLOATING_STACKS */
|
||||||
|
void *res_addr;
|
||||||
|
|
||||||
if (attr != NULL)
|
if (attr != NULL)
|
||||||
{
|
{
|
||||||
guardsize = page_roundup (attr->__guardsize, granularity);
|
guardsize = page_roundup (attr->__guardsize, granularity);
|
||||||
@@ -434,13 +446,17 @@ static int pthread_allocate_stack(const pthread_attr_t *attr,
|
|||||||
|
|
||||||
new_thread = default_new_thread;
|
new_thread = default_new_thread;
|
||||||
new_thread_bottom = (char *) (new_thread + 1) - stacksize;
|
new_thread_bottom = (char *) (new_thread + 1) - stacksize;
|
||||||
map_addr = mmap((caddr_t)((char *)(new_thread + 1) - stacksize - guardsize),
|
map_addr = new_thread_bottom - guardsize;
|
||||||
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 | MAP_FIXED, -1, 0);
|
||||||
if (map_addr == MAP_FAILED)
|
if (res_addr != map_addr)
|
||||||
/* Bad luck, this segment is already mapped. */
|
{
|
||||||
return -1;
|
/* Bad luck, this segment is already mapped. */
|
||||||
|
if (res_addr != MAP_FAILED)
|
||||||
|
munmap (res_addr, stacksize + guardsize);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
/* We manage to get a stack. Protect the guard area pages if
|
/* We manage to get a stack. Protect the guard area pages if
|
||||||
necessary. */
|
necessary. */
|
||||||
|
@@ -19,7 +19,6 @@
|
|||||||
|
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <pthread.h>
|
#include <pthread.h>
|
||||||
#include <pt-machine.h>
|
|
||||||
#include "internals.h"
|
#include "internals.h"
|
||||||
|
|
||||||
int
|
int
|
||||||
|
Reference in New Issue
Block a user