현재 자신의 시스템이 NPTL로 작동되고 있는지를 테스트 할 수 있는 간단한 쉘스크립트

#!/bin/bash

  cat > ${T}/test-nptl.c <<-"END"

#define _XOPEN_SOURCE

#include

#include

int main() {

        char buf[255];

        char *str = buf;

        confstr(_CS_GNU_LIBPTHREAD_VERSION, str, 255);

        if (NULL != str) {

                printf("%s", str);

                if (NULL != strstr(str, "NPTL"))

                return 0;

        }

        return 1;

}

END

                                                                                

echo "Checking for _CS_GNU_LIBPTHREAD_VERSION support in glibc ... "

if gcc -o ${T}/nptl ${T}/test-nptl.c &> warning

then

        echo "yes"

        echo "Checking what PTHREADS implementation we have ... "

        if ${T}/nptl

        then

                echo "We have NPTL installed :)"

        else

                echo "NPTL is not installed :("

        fi

else

        echo "Your GLIBC does not support PTHREADS and therefore NPTL"

fi

ONIONMiXER.net
ONIONMiXER.net RSS feed 맨위로 이동