diff --git a/src/include/signals.h b/src/include/signals.h index ef72f401a..353b70547 100644 --- a/src/include/signals.h +++ b/src/include/signals.h @@ -14,6 +14,18 @@ typedef struct x64_sigaction_s { void (*sa_restorer)(void); } x64_sigaction_t; +#ifdef ANDROID +typedef struct android_sigaction_s { + union { + sighandler_t _sa_handler; + void (*_sa_sigaction)(int, siginfo_t *, void *); + } _u; + sigset_t sa_mask; + uint32_t sa_flags; + void (*sa_restorer)(void); +} android_sigaction_t; +#endif + typedef struct x64_sigaction_restorer_s { union { sighandler_t _sa_handler; diff --git a/src/libtools/signals.c b/src/libtools/signals.c index 4abf8a4f8..81250766b 100644 --- a/src/libtools/signals.c +++ b/src/libtools/signals.c @@ -2064,7 +2064,11 @@ EXPORT sighandler_t my_signal(x64emu_t* emu, int signum, sighandler_t handler) EXPORT sighandler_t my___sysv_signal(x64emu_t* emu, int signum, sighandler_t handler) __attribute__((alias("my_signal"))); EXPORT sighandler_t my_sysv_signal(x64emu_t* emu, int signum, sighandler_t handler) __attribute__((alias("my_signal"))); // not completely exact +#ifdef ANDROID +int EXPORT my_sigaction(x64emu_t* emu, int signum, const android_sigaction_t *act, android_sigaction_t *oldact) +#else int EXPORT my_sigaction(x64emu_t* emu, int signum, const x64_sigaction_t *act, x64_sigaction_t *oldact) +#endif { printf_log(LOG_DEBUG, "Sigaction(signum=%d, act=%p(f=%p, flags=0x%x), old=%p)\n", signum, act, act?act->_u._sa_handler:NULL, act?act->sa_flags:0, oldact); if(signum<0 || signum>MAX_SIGNAL) { @@ -2118,10 +2122,18 @@ int EXPORT my_sigaction(x64emu_t* emu, int signum, const x64_sigaction_t *act, x } return ret; } +#ifdef ANDROID +int EXPORT my___sigaction(x64emu_t* emu, int signum, const android_sigaction_t *act, android_sigaction_t *oldact) +#else int EXPORT my___sigaction(x64emu_t* emu, int signum, const x64_sigaction_t *act, x64_sigaction_t *oldact) +#endif __attribute__((alias("my_sigaction"))); +#ifdef ANDROID +int EXPORT my_syscall_rt_sigaction(x64emu_t* emu, int signum, const android_sigaction_restorer_t *act, android_sigaction_restorer_t *oldact, int sigsetsize) +#else int EXPORT my_syscall_rt_sigaction(x64emu_t* emu, int signum, const x64_sigaction_restorer_t *act, x64_sigaction_restorer_t *oldact, int sigsetsize) +#endif { printf_log(LOG_DEBUG, "Syscall/Sigaction(signum=%d, act=%p, old=%p, size=%d)\n", signum, act, oldact, sigsetsize); if(signum<0 || signum>MAX_SIGNAL) {