Skip to content

Commit 008b1ca

Browse files
authored
Merge pull request #66486 from al45tair/eng/PR-110417355-take2
[Backtracing][Linux] Include declarations for gettid() and tgkill().
2 parents 7092e50 + be7725f commit 008b1ca

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

stdlib/public/runtime/CrashHandlerLinux.cpp

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,18 @@ _swift_installCrashHandler()
183183

184184
namespace {
185185

186+
// Older glibc and musl don't have these two syscalls
187+
pid_t
188+
gettid()
189+
{
190+
return (pid_t)syscall(SYS_gettid);
191+
}
192+
193+
int
194+
tgkill(int tgid, int tid, int sig) {
195+
return syscall(SYS_tgkill, tgid, tid, sig);
196+
}
197+
186198
void
187199
reset_signal(int signum)
188200
{
@@ -296,12 +308,6 @@ getdents(int fd, void *buf, size_t bufsiz)
296308
return syscall(SYS_getdents64, fd, buf, bufsiz);
297309
}
298310

299-
pid_t
300-
gettid()
301-
{
302-
return (pid_t)syscall(SYS_gettid);
303-
}
304-
305311
/* Stop all other threads in this process; we do this by establishing a
306312
signal handler for SIGPROF, then iterating through the threads sending
307313
SIGPROF.

0 commit comments

Comments
 (0)