[Sanitizer] Fix build openbsd
authorDavid Carlier <devnexen@gmail.com>
Thu, 16 Aug 2018 15:54:38 +0000 (15:54 +0000)
committerDavid Carlier <devnexen@gmail.com>
Thu, 16 Aug 2018 15:54:38 +0000 (15:54 +0000)
- The alternative syscall exists only on FreeBSD.
- Adding OpenBSD's equivalent and while at it other
remaining oses ones.

Reviewers: vitalybuka, krytarowsky, hiraditya

Reviewed By: hiraditya

Differential Revision: https://reviews.llvm.org/D50760

llvm-svn: 339886

compiler-rt/lib/sanitizer_common/sanitizer_linux.cc

index f856238..204b0d1 100644 (file)
@@ -489,8 +489,17 @@ tid_t GetTid() {
 int TgKill(pid_t pid, tid_t tid, int sig) {
 #if SANITIZER_LINUX
   return internal_syscall(SYSCALL(tgkill), pid, tid, sig);
-#else
+#elif SANITIZER_FREEBSD
   return internal_syscall(SYSCALL(thr_kill2), pid, tid, sig);
+#elif SANITIZER_OPENBSD
+  (void)pid;
+  return internal_syscall(SYSCALL(thrkill), tid, sig, nullptr);
+#elif SANITIZER_NETBSD
+  (void)pid;
+  return _lwp_kill(tid, sig);
+#elif SANITIZER_SOLARIS
+  (void)pid;
+  return thr_kill(tid, sig);
 #endif
 }