This is one of the first syscall used by go binaries. The kernel syscall have some custom layout that must be convert forth and back to and from libc. Do it.
Signed-off-by: Benoît Canet <[email protected]> --- linux.cc | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/linux.cc b/linux.cc index 843d131..08341f9 100644 --- a/linux.cc +++ b/linux.cc @@ -17,6 +17,7 @@ #include <syscall.h> #include <stdarg.h> #include <errno.h> +#include <signal.h> #include <time.h> #include <sys/epoll.h> #include <sys/eventfd.h> @@ -26,6 +27,8 @@ #include <unordered_map> +#include <musl/src/internal/ksigaction.h> + extern "C" long gettid() { return sched::thread::current()->id(); @@ -263,6 +266,31 @@ long long_mmap(void *addr, size_t length, int prot, int flags, int fd, off_t off return fn(arg1, arg2, arg3, arg4, arg5, arg6); \ } while (0) +int rt_sigaction(int sig, const struct k_sigaction * act, struct k_sigaction * oact, size_t sigsetsize) +{ + struct sigaction libc_act, libc_oact, *libc_act_p = nullptr; + memset(&libc_act, 0, sizeof(libc_act)); + memset(&libc_oact, 0, sizeof(libc_act)); + + if (act) { + libc_act.sa_handler = act->handler; + libc_act.sa_flags = act->flags & ~SA_RESTORER; + libc_act.sa_restorer = nullptr; + memcpy(&libc_act.sa_mask, &act->mask, sizeof(libc_act.sa_mask)); + libc_act_p = &libc_act; + } + + int ret = sigaction(sig, libc_act_p, &libc_oact); + + if (oact) { + oact->handler = libc_oact.sa_handler; + oact->flags = libc_oact.sa_flags; + oact->restorer = nullptr; + memcpy(oact->mask, &libc_oact.sa_mask, sizeof(oact->mask)); + } + + return ret; +} long syscall(long number, ...) { @@ -284,6 +312,7 @@ long syscall(long number, ...) SYSCALL3(sched_getaffinity_syscall, pid_t, unsigned, unsigned long *); SYSCALL6(long_mmap, void *, size_t, int, int, int, off_t); SYSCALL2(munmap, void *, size_t); + SYSCALL4(rt_sigaction, int, const struct k_sigaction *, struct k_sigaction *, size_t); } debug_always("syscall(): unimplemented system call %d\n", number); -- 2.7.4 -- You received this message because you are subscribed to the Google Groups "OSv Development" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
