From: Shreenidhi Shedi Date: Tue, 15 Mar 2022 11:30:14 +0000 (+0530) Subject: fix(configure): check for SYS-gettid during configure X-Git-Tag: 057~65 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0ef40d88124fe67726b8b5d8321dce064c727447;p=thirdparty%2Fdracut.git fix(configure): check for SYS-gettid during configure Signed-off-by: Shreenidhi Shedi --- diff --git a/configure b/configure index 3c7e6a1ff..91af41709 100755 --- a/configure +++ b/configure @@ -104,6 +104,32 @@ if test $found = no; then exit 1 fi +cat << EOF > conftest.c +#include +#include +#include + +#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=$? diff --git a/src/install/util.c b/src/install/util.c index 0af387c27..3d54f3883 100644 --- a/src/install/util.c +++ b/src/install/util.c @@ -28,10 +28,6 @@ #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)