summaryrefslogtreecommitdiff
path: root/cont.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-06-16 00:12:55 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-06-16 00:12:55 +0000
commit685444569cb747b399e0ab087e5876fad08a71bb (patch)
treed17ed2397c1e4bdfb18c4439c4369f0ef61b5e6e /cont.c
parentef38cb7a05e1b45b074959f12999136518cadcbd (diff)
* fix for build on solaris 10.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32113 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'cont.c')
-rw-r--r--cont.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/cont.c b/cont.c
index 15f33e85a9..3506b6d917 100644
--- a/cont.c
+++ b/cont.c
@@ -537,13 +537,14 @@ fiber_machine_stack_alloc(size_t size)
}
}
else {
+ void *page;
STACK_GROW_DIR_DETECTION;
ptr = (VALUE*)mmap(NULL, size, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANON, -1, 0);
if (ptr == (VALUE*)(SIGNED_VALUE)-1) {
rb_raise(rb_eFiberError, "can't alloc machine stack to fiber");
}
- if (mprotect(ptr + STACK_DIR_UPPER((size - RB_PAGE_SIZE) / sizeof(VALUE), 0),
- RB_PAGE_SIZE, PROT_READ | PROT_WRITE) < 0) {
+ page = ptr + STACK_DIR_UPPER((size - RB_PAGE_SIZE) / sizeof(VALUE), 0);
+ if (mprotect(page, RB_PAGE_SIZE, PROT_READ | PROT_WRITE) < 0) {
rb_raise(rb_eFiberError, "mprotect failed");
}
}