diff --git a/stdlib/public/runtime/CrashHandlerLinux.cpp b/stdlib/public/runtime/CrashHandlerLinux.cpp index 42f83ca616847..2913245b97566 100644 --- a/stdlib/public/runtime/CrashHandlerLinux.cpp +++ b/stdlib/public/runtime/CrashHandlerLinux.cpp @@ -183,6 +183,18 @@ _swift_installCrashHandler() namespace { +// Older glibc and musl don't have these two syscalls +pid_t +gettid() +{ + return (pid_t)syscall(SYS_gettid); +} + +int +tgkill(int tgid, int tid, int sig) { + return syscall(SYS_tgkill, tgid, tid, sig); +} + void reset_signal(int signum) { @@ -296,12 +308,6 @@ getdents(int fd, void *buf, size_t bufsiz) return syscall(SYS_getdents64, fd, buf, bufsiz); } -pid_t -gettid() -{ - return (pid_t)syscall(SYS_gettid); -} - /* Stop all other threads in this process; we do this by establishing a signal handler for SIGPROF, then iterating through the threads sending SIGPROF.