diff options
author | Ulrich Drepper <drepper@redhat.com> | 2008-08-15 22:35:53 +0000 |
---|---|---|
committer | Ulrich Drepper <drepper@redhat.com> | 2008-08-15 22:35:53 +0000 |
commit | 965805e888b25d24cd5ca74b81ffdc61de6e0869 (patch) | |
tree | e785c580b64969498f3257d77d8b9956350107e3 /nptl/allocatestack.c | |
parent | 62a1ffc6faa2ff0d39b19e78fdef6f52bacb9d86 (diff) | |
download | glibc-965805e888b25d24cd5ca74b81ffdc61de6e0869.tar.gz glibc-965805e888b25d24cd5ca74b81ffdc61de6e0869.tar.xz glibc-965805e888b25d24cd5ca74b81ffdc61de6e0869.zip |
* sysdeps/unix/sysv/linux/x86_64/bits/mman.h: Define MAP_STACK.
* sysdeps/unix/sysv/linux/i386/bits/mman.h: Likewise.
Diffstat (limited to 'nptl/allocatestack.c')
-rw-r--r-- | nptl/allocatestack.c | 22 |
1 files changed, 8 insertions, 14 deletions
diff --git a/nptl/allocatestack.c b/nptl/allocatestack.c index 66128e455b..9ab4d6281c 100644 --- a/nptl/allocatestack.c +++ b/nptl/allocatestack.c @@ -84,10 +84,10 @@ #endif -/* Let the architecture add some flags to the mmap() call used to - allocate stacks. */ -#ifndef ARCH_MAP_FLAGS -# define ARCH_MAP_FLAGS 0 +/* Newer kernels have the MAP_STACK flag to indicate a mapping is used for + a stack. Use it when possible. */ +#ifndef MAP_STACK +# define MAP_STACK 0 #endif /* This yields the pointer that TLS support code calls the thread pointer. */ @@ -454,20 +454,14 @@ allocate_stack (const struct pthread_attr *attr, struct pthread **pdp, #endif mem = mmap (NULL, size, prot, - MAP_PRIVATE | MAP_ANONYMOUS | ARCH_MAP_FLAGS, -1, 0); + MAP_PRIVATE | MAP_ANONYMOUS | MAP_STACK, -1, 0); if (__builtin_expect (mem == MAP_FAILED, 0)) { -#ifdef ARCH_RETRY_MMAP - mem = ARCH_RETRY_MMAP (size, prot); - if (__builtin_expect (mem == MAP_FAILED, 0)) -#endif - { - if (errno == ENOMEM) - errno = EAGAIN; + if (errno == ENOMEM) + __set_errno (EAGAIN); - return errno; - } + return errno; } /* SIZE is guaranteed to be greater than zero. |