This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Other format: | [Raw text] |
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
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |