mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
configure.in: rb_cv_mcontext_t_ptr
* configure.in (rb_cv_mcontext_t_ptr): abstract whether mcontext_t is a pointer type. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48826 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
21a40e94ac
commit
7dc4bbc140
2 changed files with 12 additions and 2 deletions
11
configure.in
11
configure.in
|
@ -2712,6 +2712,17 @@ if test x"$enable_pthread" = xyes; then
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
if test x"$ac_cv_header_ucontext_h" = xyes; then
|
if test x"$ac_cv_header_ucontext_h" = xyes; then
|
||||||
|
AC_CACHE_CHECK([if mcontext_t is a pointer], [rb_cv_mcontext_t_ptr],
|
||||||
|
[AC_TRY_COMPILE([@%:@include <ucontext.h>
|
||||||
|
mcontext_t test(mcontext_t mc) {return mc+1;}
|
||||||
|
],
|
||||||
|
[test(0);],
|
||||||
|
[rb_cv_mcontext_t_ptr=yes], [rb_cv_mcontext_t_ptr=no])])
|
||||||
|
if test x"$rb_cv_mcontext_t_ptr" = xyes; then
|
||||||
|
AC_DEFINE_UNQUOTED(DEFINE_MCONTEXT_PTR(mc, uc), mcontext_t mc = (uc)->uc_mcontext)
|
||||||
|
else
|
||||||
|
AC_DEFINE_UNQUOTED(DEFINE_MCONTEXT_PTR(mc, uc), mcontext_t *mc = &(uc)->uc_mcontext)
|
||||||
|
fi
|
||||||
if test x"$rb_with_pthread" = xyes; then
|
if test x"$rb_with_pthread" = xyes; then
|
||||||
AC_CHECK_FUNCS(getcontext setcontext)
|
AC_CHECK_FUNCS(getcontext setcontext)
|
||||||
fi
|
fi
|
||||||
|
|
3
signal.c
3
signal.c
|
@ -742,15 +742,14 @@ NORETURN(void ruby_thread_stack_overflow(rb_thread_t *th));
|
||||||
static void
|
static void
|
||||||
check_stack_overflow(const uintptr_t addr, const ucontext_t *ctx)
|
check_stack_overflow(const uintptr_t addr, const ucontext_t *ctx)
|
||||||
{
|
{
|
||||||
|
const DEFINE_MCONTEXT_PTR(mctx, ctx);
|
||||||
# if defined __linux__
|
# if defined __linux__
|
||||||
const mcontext_t *mctx = &ctx->uc_mcontext;
|
|
||||||
# if defined REG_RSP
|
# if defined REG_RSP
|
||||||
const greg_t sp = mctx->gregs[REG_RSP];
|
const greg_t sp = mctx->gregs[REG_RSP];
|
||||||
# else
|
# else
|
||||||
const greg_t sp = mctx->gregs[REG_ESP];
|
const greg_t sp = mctx->gregs[REG_ESP];
|
||||||
# endif
|
# endif
|
||||||
# elif defined __APPLE__
|
# elif defined __APPLE__
|
||||||
const mcontext_t mctx = ctx->uc_mcontext;
|
|
||||||
# if defined(__LP64__)
|
# if defined(__LP64__)
|
||||||
const uintptr_t sp = mctx->__ss.__rsp;
|
const uintptr_t sp = mctx->__ss.__rsp;
|
||||||
# else
|
# else
|
||||||
|
|
Loading…
Add table
Reference in a new issue