ruby-changes:51144
From: nobu <ko1@a...>
Date: Tue, 8 May 2018 08:14:12 +0900 (JST)
Subject: [ruby-changes:51144] nobu:r63351 (trunk): cont.c: refined error message
nobu 2018-05-08 08:14:07 +0900 (Tue, 08 May 2018) New Revision: 63351 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=63351 Log: cont.c: refined error message * cont.c (fiber_machine_stack_alloc): refined the error message on failure at setting a guard page. Modified files: trunk/cont.c Index: cont.c =================================================================== --- cont.c (revision 63350) +++ cont.c (revision 63351) @@ -769,6 +769,8 @@ fiber_entry(void *arg) https://github.com/ruby/ruby/blob/trunk/cont.c#L769 #define FIBER_STACK_FLAGS (MAP_PRIVATE | MAP_ANON) #endif +#define ERRNOMSG strerror(errno) + static char* fiber_machine_stack_alloc(size_t size) { @@ -793,13 +795,13 @@ fiber_machine_stack_alloc(size_t size) https://github.com/ruby/ruby/blob/trunk/cont.c#L795 errno = 0; ptr = mmap(NULL, size, PROT_READ | PROT_WRITE, FIBER_STACK_FLAGS, -1, 0); if (ptr == MAP_FAILED) { - rb_raise(rb_eFiberError, "can't alloc machine stack to fiber: %s", strerror(errno)); + rb_raise(rb_eFiberError, "can't alloc machine stack to fiber: %s", ERRNOMSG); } /* guard page setup */ page = ptr + STACK_DIR_UPPER(size - RB_PAGE_SIZE, 0); if (mprotect(page, RB_PAGE_SIZE, PROT_NONE) < 0) { - rb_raise(rb_eFiberError, "mprotect failed"); + rb_raise(rb_eFiberError, "can't set a guard page: %s", ERRNOMSG); } } -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/