diff --git a/src/api/err.c b/src/api/err.c index 30348a91..1593e70a 100644 --- a/src/api/err.c +++ b/src/api/err.c @@ -42,6 +42,7 @@ #include "lwip/errno.h" +#if !NO_SYS /** Table to quickly map an lwIP error (err_t) to a socket error * by using -err as an index */ static const int err_to_errno_table[] = { @@ -63,6 +64,7 @@ static const int err_to_errno_table[] = { ENOTCONN, /* ERR_CLSD -15 Connection closed. */ EIO /* ERR_ARG -16 Illegal argument. */ }; +#endif /* !NO_SYS */ #ifdef LWIP_DEBUG @@ -103,6 +105,7 @@ lwip_strerr(err_t err) #endif /* LWIP_DEBUG */ +#if !NO_SYS int err_to_errno(err_t err) { @@ -111,3 +114,4 @@ err_to_errno(err_t err) } return err_to_errno_table[-err]; } +#endif /* !NO_SYS */ diff --git a/src/include/lwip/err.h b/src/include/lwip/err.h index 136e6b2c..84e528d1 100644 --- a/src/include/lwip/err.h +++ b/src/include/lwip/err.h @@ -108,7 +108,9 @@ extern const char *lwip_strerr(err_t err); #define lwip_strerr(x) "" #endif /* LWIP_DEBUG */ +#if !NO_SYS int err_to_errno(err_t err); +#endif /* !NO_SYS */ #ifdef __cplusplus } diff --git a/src/include/lwip/errno.h b/src/include/lwip/errno.h index b6a897b7..e2d996c6 100644 --- a/src/include/lwip/errno.h +++ b/src/include/lwip/errno.h @@ -173,6 +173,13 @@ extern int errno; #endif +#else /* LWIP_PROVIDE_ERRNO */ + +/* Define LWIP_ERRNO_INCLUDE to to include the error defines here */ +#ifdef LWIP_ERRNO_INCLUDE +#include LWIP_ERRNO_INCLUDE +#endif /* LWIP_ERRNO_INCLUDE */ + #endif /* LWIP_PROVIDE_ERRNO */ #ifdef __cplusplus