Skip to content

Commit be7725f

Browse files
committed
[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
1 parent e6ca3f0 commit be7725f

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)