]> git.ipfire.org Git - thirdparty/dracut.git/commitdiff
fix(configure): check for SYS-gettid during configure
authorShreenidhi Shedi <sshedi@vmware.com>
Tue, 15 Mar 2022 11:30:14 +0000 (17:00 +0530)
committerJóhann B. Guðmundsson <johannbg@gmail.com>
Wed, 30 Mar 2022 12:00:58 +0000 (12:00 +0000)
Signed-off-by: Shreenidhi Shedi <sshedi@vmware.com>
configure
src/install/util.c

index 3c7e6a1ff96840433319d6e19d7193f52e8cf5c9..91af417098ffc204e945274e2300f11f999fa62e 100755 (executable)
--- a/configure
+++ b/configure
@@ -104,6 +104,32 @@ if test $found = no; then
     exit 1
 fi
 
+cat << EOF > conftest.c
+#include <stdio.h>
+#include <unistd.h>
+#include <sys/syscall.h>
+
+#ifndef SYS_gettid
+#error "SYS_gettid unavailable on this system"
+#endif
+
+#define gettid()    ((pid_t) syscall(SYS_gettid))
+
+int main(void) {
+  return getpid() == gettid() ? 0 : -1;
+}
+EOF
+
+# shellcheck disable=SC2086
+${CC} $CFLAGS $LDFLAGS conftest.c > /dev/null 2>&1
+ret=$?
+rm -f conftest.c a.out
+
+if test $ret -ne 0; then
+    echo "dracut needs SYS_gettid support." >&2
+    exit 1
+fi
+
 if test "$enable_dracut_cpio" = "yes"; then
     cargo --version > /dev/null
     ret=$?
index 0af387c27707d11de454f24f364f7d4a200f3c2e..3d54f3883d82cfee80533028ef6c2e7275b4e424 100644 (file)
 
 #include "util.h"
 
-#ifndef SYS_gettid
-#error "SYS_gettid unavailable on this system"
-#endif
-
 #define gettid()    ((pid_t) syscall(SYS_gettid))
 
 size_t page_size(void)