* On some Linux platforms, libusbx compilation breaks with:
error: implicit declaration of function ‘pthread_mutexattr_settype’
* This regression, introduced in
463dda06db5da5de0eab32820c7af60605625afe,
is due to pthread.h needing __USE_UNIX98, which is tied to _XOPEN_SOURCE
or _GNU_SOURCE being correctly defined, and which the inclusion of
<unistd.h> before the _XOPEN_SOURCE override modified
* As _GNU_LINUX ensures the definition of __USE_UNIX98 and we require it
for syscalls, we now only define _GNU_SOURCE for Linux.
*/
#if defined(__linux__) || defined(__OpenBSD__)
+# if defined(__linux__)
+# define _GNU_SOURCE
+# else
+# define _BSD_SOURCE
+# endif
# include <unistd.h>
# include <sys/syscall.h>
#elif defined(__APPLE__)
# include <windows.h>
#endif
-#ifdef _XOPEN_SOURCE
-# if _XOPEN_SOURCE < 500
-# undef _XOPEN_SOURCE
-# define _XOPEN_SOURCE 500
-# endif
-#else
-#define _XOPEN_SOURCE 500
-#endif /* _XOPEN_SOURCE */
-
#include "threads_posix.h"
int usbi_mutex_init_recursive(pthread_mutex_t *mutex, pthread_mutexattr_t *attr)
return err;
}
+ /* mutexattr_settype requires _GNU_SOURCE or _XOPEN_SOURCE >= 500 on Linux */
err = pthread_mutexattr_settype(attr, PTHREAD_MUTEX_RECURSIVE);
if (err != 0)
goto finish;
-#define LIBUSB_NANO 10520
+#define LIBUSB_NANO 10521