瀏覽代碼

Fix compilation of profile.c on old versions of glibc (#507)

Zeta 3 年之前
父節點
當前提交
6d87705018
共有 1 個文件被更改,包括 11 次插入1 次删除
  1. 11 1
      src/profile.c

+ 11 - 1
src/profile.c

@@ -23,11 +23,21 @@
 #include <hlmodule.h>
 #include <hlmodule.h>
 
 
 #ifdef HL_LINUX
 #ifdef HL_LINUX
-#include <signal.h>
 #include <semaphore.h>
 #include <semaphore.h>
+#include <signal.h>
+#include <sys/syscall.h>
 #include <unistd.h>
 #include <unistd.h>
 #endif
 #endif
 
 
+#if defined(__GLIBC__)
+#if __GLIBC_PREREQ(2, 30)
+// tgkill is present
+#else
+// int tgkill(pid_t tgid, pid_t tid, int sig)
+#define tgkill(tgid, tid, sig) syscall(SYS_tgkill, tgid, tid, sig)
+#endif
+#endif
+
 #define MAX_STACK_SIZE (8 << 20)
 #define MAX_STACK_SIZE (8 << 20)
 #define MAX_STACK_COUNT 2048
 #define MAX_STACK_COUNT 2048