Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 9, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 12 additions & 6 deletions stdlib/public/runtime/CrashHandlerLinux.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down Expand Up @@ -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.
Expand Down