Skip to content

Commit

Permalink
fix(configure): check for SYS-gettid during configure
Browse files Browse the repository at this point in the history
Signed-off-by: Shreenidhi Shedi <[email protected]>
  • Loading branch information
sshedi authored and johannbg committed Mar 30, 2022
1 parent 7e03d81 commit 0ef40d8
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 4 deletions.
26 changes: 26 additions & 0 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -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=$?
Expand Down
4 changes: 0 additions & 4 deletions src/install/util.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 0ef40d8

Please sign in to comment.