engine: platform: linux: define portability macro for sigevent (oh, glibc...)

This commit is contained in:
Alibek Omarov 2024-01-23 19:21:16 +03:00
parent 296f89acf9
commit 7d464df107
1 changed files with 10 additions and 2 deletions

View File

@ -29,7 +29,8 @@ GNU General Public License for more details.
#include "platform/platform.h"
#include <sys/types.h>
#if defined(__GLIBC__) && (__GLIBC__ <= 2) && (__GLIBC_MINOR__ <= 30)
#if defined( __GLIBC__ )
#if ( __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).
@ -39,7 +40,14 @@ static pid_t gettid( void )
{
return syscall( SYS_gettid );
}
#endif
#endif // ( __GLIBC__ <= 2 ) && ( __GLIBC_MINOR__ <= 30 )
// Glibc misses this macro in POSIX headers (bits/types/sigevent_t.h)
// but it does present in Linux headers (asm-generic/siginfo.h) and musl
#if !defined( sigev_notify_thread_id )
#define sigev_notify_thread_id _sigev_un._tid
#endif // !defined( sigev_notify_thread_id )
#endif // defined(__GLIBC__)
static void *g_hsystemd;
static int (*g_pfn_sd_notify)( int unset_environment, const char *state );