fixed lots of not-thread-safe things
Most of the things I fixed here were using libc functions that are
fundamentally not thread-safe.
diff --git a/aos/common/libc/aos_strsignal.cc b/aos/common/libc/aos_strsignal.cc
new file mode 100644
index 0000000..5fae327
--- /dev/null
+++ b/aos/common/libc/aos_strsignal.cc
@@ -0,0 +1,23 @@
+#include "aos/common/libc/aos_strsignal.h"
+
+#include <signal.h>
+
+#include "aos/linux_code/thread_local.h"
+#include "aos/common/logging/logging.h"
+
+const char *aos_strsignal(int signal) {
+ static AOS_THREAD_LOCAL char buffer[512];
+
+ if (signal >= SIGRTMIN && signal <= SIGRTMAX) {
+ CHECK(snprintf(buffer, sizeof(buffer), "Real-time signal %d",
+ signal - SIGRTMIN) > 0);
+ return buffer;
+ }
+
+ if (signal > 0 && signal < NSIG && sys_siglist[signal] != nullptr) {
+ return sys_siglist[signal];
+ }
+
+ CHECK(snprintf(buffer, sizeof(buffer), "Unknown signal %d", signal) > 0);
+ return buffer;
+}