diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-05-07 23:14:07 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-05-07 23:14:07 +0000 |
commit | cd36bea5684b065827060e07cc3d6e33987d61c1 (patch) | |
tree | c06ac368eafc6516075e75d9532a5a692083ad24 /cont.c | |
parent | 6c62356e5a7a48aea74b06573ba56c5c3e333d80 (diff) |
cont.c: refined error message
* cont.c (fiber_machine_stack_alloc): refined the error message on
failure at setting a guard page.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63351 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'cont.c')
-rw-r--r-- | cont.c | 6 |
1 files changed, 4 insertions, 2 deletions
@@ -769,6 +769,8 @@ fiber_entry(void *arg) #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) 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); } } |