From 069de57570172b01a444b0246cd4f3d530574dcc Mon Sep 17 00:00:00 2001 From: Kamil Rytarowski Date: Sun, 31 Jan 2016 10:49:09 +0100 Subject: [PATCH] NetBSD defines _lwp_self(2) in The _lwp_self(2) function prototype is missing in . It's not sufficient to include or -- as they are not including one the other. We need to check for both headers and include them both. NAME _lwp_self - get light-weight process identification LIBRARY Standard C Library (libc, -lc) SYNOPSIS #include lwpid_t _lwp_self(void); DESCRIPTION _lwp_self() returns the LWP ID of the calling LWP. --- src/pal/src/config.h.in | 1 + src/pal/src/configure.cmake | 1 + src/pal/src/thread/thread.cpp | 9 +++++++-- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/pal/src/config.h.in b/src/pal/src/config.h.in index f132b13cab..011db738f3 100644 --- a/src/pal/src/config.h.in +++ b/src/pal/src/config.h.in @@ -12,6 +12,7 @@ #cmakedefine01 HAVE_SYS_TIME_H #cmakedefine01 HAVE_PTHREAD_NP_H #cmakedefine01 HAVE_SYS_LWP_H +#cmakedefine01 HAVE_LWP_H #cmakedefine01 HAVE_LIBUNWIND_H #cmakedefine01 HAVE_LIBUUID_H #cmakedefine01 HAVE_BSD_UUID_H diff --git a/src/pal/src/configure.cmake b/src/pal/src/configure.cmake index 7817873d5f..5d153114d2 100644 --- a/src/pal/src/configure.cmake +++ b/src/pal/src/configure.cmake @@ -29,6 +29,7 @@ check_include_files(crt_externs.h HAVE_CRT_EXTERNS_H) check_include_files(sys/time.h HAVE_SYS_TIME_H) check_include_files(pthread_np.h HAVE_PTHREAD_NP_H) check_include_files(sys/lwp.h HAVE_SYS_LWP_H) +check_include_files(lwp.h HAVE_LWP_H) check_include_files(libunwind.h HAVE_LIBUNWIND_H) check_include_files(runetype.h HAVE_RUNETYPE_H) check_include_files(lttng/tracepoint.h HAVE_LTTNG_TRACEPOINT_H) diff --git a/src/pal/src/thread/thread.cpp b/src/pal/src/thread/thread.cpp index 47fba85383..02740d1dc9 100644 --- a/src/pal/src/thread/thread.cpp +++ b/src/pal/src/thread/thread.cpp @@ -51,12 +51,17 @@ Abstract: #include "pal/fakepoll.h" #endif // HAVE_POLL #include + #if HAVE_SYS_LWP_H #include +#endif +#if HAVE_LWP_H +#include +#endif // If we don't have sys/lwp.h but do expect to use _lwp_self, declare it to silence compiler warnings -#elif HAVE__LWP_SELF +#if HAVE__LWP_SELF && !HAVE_SYS_LWP_H && !HAVE_LWP_H extern "C" int _lwp_self (); -#endif // HAVE_LWP_H +#endif using namespace CorUnix; -- 2.34.1