Explorar el Código

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

Zeta hace 3 años
padre
commit
6d87705018
Se han modificado 1 ficheros con 11 adiciones y 1 borrados
  1. 11 1
      src/profile.c

+ 11 - 1
src/profile.c

@@ -23,11 +23,21 @@
 #include <hlmodule.h>
 
 #ifdef HL_LINUX
-#include <signal.h>
 #include <semaphore.h>
+#include <signal.h>
+#include <sys/syscall.h>
 #include <unistd.h>
 #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_COUNT 2048