This is the mail archive of the mailing list for the eCos project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Re: lwip socket errors

On 18/02/2011 20:41, John Dallaway wrote:
Hi Will

William Wagner wrote:

Been looking at getting lwip to set errno when errors occur and am
struggling a bit. The problem is in

To get it so that errno is set with the macro set_errno you must have
ERRNO defined. I have changed the cdl so that this is set. However you
then get a compilation error as errno is undefined. Attached is my
proposed patch to fix the issue. I realise this is a change to lwip code
which is best avoided but I can't see any other way of making it work.
According to the lwIP documentation file doc/sys_arch.txt, the file
include/arch/cc.h "must either include a system-local<errno.h>  which
defines the standard *nix error codes, or it should #define
LWIP_PROVIDE_ERRNO to make lwip/arch.h define the codes which are used

Try including errno.h from the file include/arch/cc.h and let us know if
it helps...

I have tried the below patch instead and this seems to work. I tried just making it include cyg/error/errno.h but was running into compile errors where the #define errno (*cyg_error_get_errno_p()) in errno.h was meaning that subsequent uses of #include <errno.h> lead to compiler errors saying (*cyg_error_get_errno_p()).h could not be found. I'm no expert on preprocessor rules but I wonder if that is a compiler bug. Either way changing cc.h to include errno.h rather than cyg/error/errno.h fixed the issue for me. I have then tried to make it cope when your config doesn't have isoinfra.

--- a/packages/net/lwip_tcpip/current/include/arch/cc.h +++ b/packages/net/lwip_tcpip/current/include/arch/cc.h @@ -34,7 +34,13 @@ #define __LWIP_ARCH_CC_H__

+#include<pkgconf/isoinfra.h>           /* Configuration header */

 typedef int sys_prot_t;
@@ -47,6 +53,11 @@ typedef int sys_prot_t;
 #define ETIME           62
 #define ENSRNOTFOUND    163

+// If errno support, define ERRNO used in api/sockets.c
+#define ERRNO
 // Platform byteorder

John Dallaway
eCos maintainer

-- ------------------------------------------------------------------------ Will Wagner Development Manager Office Tel: +44 (0)20 7371 2032 Carallon Ltd, Studio G20, Shepherds Building, Rockley Rd, London W14 0DA ------------------------------------------------------------------------

Before posting, please read the FAQ:
and search the list archive:

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]