From fe1a40db63043d22e959901336d6e13c86a2b3fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joan=20Lled=C3=B3?= Date: Mon, 3 Sep 2018 10:56:43 +0200 Subject: [PATCH] Unix port: add support for the Hurd. * ports/unix/port/include/arch/cc.h: Define LWIP_ERRNO_STDINCLUDE for Linux and Hurd, as defining LWIP_ERRNO_INCLUDE doesn't work on these systems. * ports/unix/port/sys_arch.c: Rename pthread_cond_wait() and pthread_cond_timedwait() to use the Hurd's non-portable versions on GNU systems. --- ports/unix/port/include/arch/cc.h | 6 ++++++ ports/unix/port/sys_arch.c | 5 +++++ 2 files changed, 11 insertions(+) diff --git a/ports/unix/port/include/arch/cc.h b/ports/unix/port/include/arch/cc.h index 8b0df31..80b37d8 100644 --- a/ports/unix/port/include/arch/cc.h +++ b/ports/unix/port/include/arch/cc.h @@ -43,6 +43,8 @@ #define LWIP_UNIX_OPENBSD #elif defined __CYGWIN__ #define LWIP_UNIX_CYGWIN +#elif defined __GNU__ +#define LWIP_UNIX_HURD #endif #define LWIP_TIMEVAL_PRIVATE 0 @@ -50,6 +52,10 @@ #define LWIP_ERRNO_INCLUDE +#if defined(LWIP_UNIX_LINUX) || defined(LWIP_UNIX_HURD) +#define LWIP_ERRNO_STDINCLUDE 1 +#endif + #define LWIP_RAND() ((u32_t)rand()) /* different handling for unit test, normally not needed */ diff --git a/ports/unix/port/sys_arch.c b/ports/unix/port/sys_arch.c index df41daa..3336539 100644 --- a/ports/unix/port/sys_arch.c +++ b/ports/unix/port/sys_arch.c @@ -477,6 +477,11 @@ cond_wait(pthread_cond_t *cond, pthread_mutex_t *mutex, u32_t timeout) struct timespec rtime1, rtime2, ts; int ret; +#ifdef __GNU__ + #define pthread_cond_wait pthread_hurd_cond_wait_np + #define pthread_cond_timedwait pthread_hurd_cond_timedwait_np +#endif + if (timeout == 0) { pthread_cond_wait(cond, mutex); return 0;