Skip to content

Commit 0ef40d8

Browse files
sshedijohannbg
authored andcommitted
fix(configure): check for SYS-gettid during configure
Signed-off-by: Shreenidhi Shedi <[email protected]>
1 parent 7e03d81 commit 0ef40d8

File tree

2 files changed

+26
-4
lines changed

2 files changed

+26
-4
lines changed

configure

+26
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,32 @@ if test $found = no; then
104104
exit 1
105105
fi
106106

107+
cat << EOF > conftest.c
108+
#include <stdio.h>
109+
#include <unistd.h>
110+
#include <sys/syscall.h>
111+
112+
#ifndef SYS_gettid
113+
#error "SYS_gettid unavailable on this system"
114+
#endif
115+
116+
#define gettid() ((pid_t) syscall(SYS_gettid))
117+
118+
int main(void) {
119+
return getpid() == gettid() ? 0 : -1;
120+
}
121+
EOF
122+
123+
# shellcheck disable=SC2086
124+
${CC} $CFLAGS $LDFLAGS conftest.c > /dev/null 2>&1
125+
ret=$?
126+
rm -f conftest.c a.out
127+
128+
if test $ret -ne 0; then
129+
echo "dracut needs SYS_gettid support." >&2
130+
exit 1
131+
fi
132+
107133
if test "$enable_dracut_cpio" = "yes"; then
108134
cargo --version > /dev/null
109135
ret=$?

src/install/util.c

-4
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,6 @@
2828

2929
#include "util.h"
3030

31-
#ifndef SYS_gettid
32-
#error "SYS_gettid unavailable on this system"
33-
#endif
34-
3531
#define gettid() ((pid_t) syscall(SYS_gettid))
3632

3733
size_t page_size(void)

0 commit comments

Comments
 (0)