check for pthread_stackseg_np() during build

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
Ivailo Monev 2020-11-27 01:23:41 +00:00
parent 5b908937b5
commit b7376b2e53
3 changed files with 4 additions and 3 deletions

View file

@ -389,6 +389,7 @@ katie_check_function(fesetenv "fenv.h")
katie_check_function(feclearexcept "fenv.h")
katie_check_function(feenableexcept "fenv.h")
# none
katie_check_function(pthread_stackseg_np "pthread_np.h" "${CMAKE_THREAD_LIBS_INIT}")
katie_check_function(madvise "sys/mman.h")
katie_check_function(getifaddrs "ifaddrs.h")
katie_check_struct(sockaddr_ll sll_addr "netpacket/packet.h")

View file

@ -50,7 +50,7 @@
#include <pthread.h>
#endif
#if defined(Q_OS_OPENBSD) || defined(QT_HAVE_PTHREAD_ATTR_GET_NP)
#if defined(QT_HAVE_PTHREAD_STACKSEG_NP) || defined(QT_HAVE_PTHREAD_ATTR_GET_NP)
#include <pthread_np.h>
#endif
@ -335,7 +335,7 @@ static inline void* currentThreadStackBase()
stack_t s;
thr_stksegment(&s);
return s.ss_sp;
#elif defined(Q_OS_OPENBSD)
#elif defined(QT_HAVE_PTHREAD_STACKSEG_NP)
pthread_t thread = pthread_self();
stack_t stack;
pthread_stackseg_np(thread, &stack);

View file

@ -1525,7 +1525,7 @@ void qsrand(uint seed)
*/
int qrand()
{
#if defined(QT_HAVE_ARC4RANDOM)
#ifdef QT_HAVE_ARC4RANDOM
return ::arc4random();
#else
// Seed the PRNG once per thread with a combination of current time and its address