So, MySQL calls sigwait() in a loop from a signal handling thread. Standard
practice except that our sigwait is a stub, and thus mysqld wanders off
into busy-loop-land.

Any objections to something like the following to replace the
STUB(____sigtimedwait50)?

diff --git a/platform/xen/lib/emul.c b/platform/xen/lib/emul.c
index 7b3fdc1..16313e5 100644
--- a/platform/xen/lib/emul.c
+++ b/platform/xen/lib/emul.c
@@ -14,7 +14,9 @@
 
 #include <errno.h>
 #include <fcntl.h>
+#include <signal.h>
 #include <stdlib.h>
+#include <time.h>
 #include <unistd.h>
 
 #include <mini-os/os.h> /* for PAGE_SIZE */
@@ -108,3 +110,13 @@ _exit(int eval)
        minios_stop_kernel();
        minios_do_halt(MINIOS_HALT_POWEROFF);
 }
+
+int ____sigtimedwait50(const sigset_t *set, siginfo_t *info,
+               const struct timespec *timeout)
+{
+       int rc;
+       rc = ___lwp_park60(CLOCK_MONOTONIC, 0, timeout, NULL, NULL, NULL);
+       if (rc == -1 && errno == ETIMEDOUT)
+               errno = EAGAIN;
+       return -1;
+}




Reply via email to