diff --git a/engine/platform/linux/sys_linux.c b/engine/platform/linux/sys_linux.c index 210a727c..908f2cca 100644 --- a/engine/platform/linux/sys_linux.c +++ b/engine/platform/linux/sys_linux.c @@ -13,7 +13,10 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. */ +#ifndef _GNU_SOURCE #define _GNU_SOURCE +#endif + #include #include #include @@ -24,6 +27,19 @@ GNU General Public License for more details. #include #include #include "platform/platform.h" +#include + +#if defined(__GLIBC__) && (__GLIBC__ <= 2) && (__GLIBC_MINOR__ <= 30) +// Library support was added in glibc 2.30. +// Earlier glibc versions did not provide a wrapper for this system call, +// necessitating the use of syscall(2). +#include + +static pid_t gettid( void ) +{ + return syscall( SYS_gettid ); +} +#endif static void *g_hsystemd; static int (*g_pfn_sd_notify)( int unset_environment, const char *state );