[Backtracing][Linux] Include declarations for gettid() and tgkill().

Older glibc doesn't include these.  Nor does Musl, it seems.  The
previous fix put the gettid() declaration too far down the file.

rdar://110417355
This commit is contained in:
Alastair Houghton
2023-06-09 09:04:27 +01:00
parent e6ca3f0469
commit be7725f0fd

View File

@@ -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.