Skip to content

Commit ef0f848

Browse files
sshedijohannbg
authored andcommitted
fix(install): improve gettid definition
Signed-off-by: Shreenidhi Shedi <sshedi@vmware.com>
1 parent 19537f8 commit ef0f848

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

src/install/util.c

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,17 @@
2424
#include <errno.h>
2525
#include <fcntl.h>
2626
#include <sys/types.h>
27-
#include <sys/syscall.h>
2827

2928
#include "util.h"
3029

31-
static inline pid_t gettid(void)
32-
{
33-
return (pid_t) syscall(SYS_gettid);
34-
}
30+
#if __GLIBC_PREREQ(2, 30) == 0
31+
#include <sys/syscall.h>
32+
#ifndef SYS_gettid
33+
#error "SYS_gettid unavailable on this system"
34+
#endif
35+
36+
#define gettid() ((pid_t) syscall(SYS_gettid))
37+
#endif /*__GLIBC_PREREQ */
3538

3639
size_t page_size(void)
3740
{

0 commit comments

Comments
 (0)