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.
#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
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)
#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;