[PATCH 2/4] Initialize tunable list with the GLIBC_TUNABLES environment variable
Florian Weimer
fweimer@redhat.com
Fri Dec 30 09:50:00 GMT 2016
On 12/30/2016 05:08 AM, Siddhesh Poyarekar wrote:
> + /* Bare mmap system call to avoid setting errno which may not be available
> + yet. */
> + INTERNAL_SYSCALL_DECL (err);
> + char *out = (char *) INTERNAL_SYSCALL_CALL (mmap, err, NULL, i, PROT_READ | PROT_WRITE,
> + MAP_ANONYMOUS | MAP_PRIVATE, -1, 0);
> + if (INTERNAL_SYSCALL_ERROR_P (out, err))
> + return NULL;
INTERNAL_SYSCALL is not available in generic code.
You should use sbrk (like the TCB allocation in the startup code; it
would also reduce wasted memory), or mmap with a comment indicating that
this will crash if mmap updates errno. (I believe the comment in the
startup code about mmap is wrong.)
Thanks,
Florian
More information about the Libc-alpha
mailing list