NetBSD defines _lwp_self(2) in <lwp.h>
authorKamil Rytarowski <n54@gmx.com>
Sun, 31 Jan 2016 09:49:09 +0000 (10:49 +0100)
committerKamil Rytarowski <n54@gmx.com>
Sun, 31 Jan 2016 09:49:09 +0000 (10:49 +0100)
The _lwp_self(2) function prototype is missing in <sys/lwp.h>.

It's not sufficient to include <sys/lwp.h> or <lwp.h> -- 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 <lwp.h>

     lwpid_t
     _lwp_self(void);

DESCRIPTION
     _lwp_self() returns the LWP ID of the calling LWP.

src/pal/src/config.h.in
src/pal/src/configure.cmake
src/pal/src/thread/thread.cpp

index f132b13cab92c1b8ee6a402406b77d07c0417b41..011db738f3a918ea8781bcfe3c7f45a488d10f23 100644 (file)
@@ -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
index 7817873d5f92b6f625e7b620bb48ed34eaf48045..5d153114d2e3ef18988e05853b7adadc8a90da08 100644 (file)
@@ -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)
index 47fba8538341cee35f51095a9e9c21c0b6e54eef..02740d1dc968697bc9c139c07d20f48b0cfdc796 100644 (file)
@@ -51,12 +51,17 @@ Abstract:
 #include "pal/fakepoll.h"
 #endif  // HAVE_POLL
 #include <limits.h>
+
 #if HAVE_SYS_LWP_H
 #include <sys/lwp.h>
+#endif
+#if HAVE_LWP_H
+#include <lwp.h>
+#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;