lwip-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[lwip-devel] [bug #35928] BSD sockets functions must set errno for POSIX


From: Mason
Subject: [lwip-devel] [bug #35928] BSD sockets functions must set errno for POSIX-compliance
Date: Wed, 21 Mar 2012 14:52:44 +0000
User-agent: Mozilla/5.0 (Windows NT 5.1; rv:10.0.2) Gecko/20120216 Firefox/10.0.2 SeaMonkey/2.7.2

Follow-up Comment #4, bug #35928 (project lwip):

Simon Goldschmidt wrote:

> I can understand you're upset about wasting several hours. Still, I
> don't think defining LWIP_SOCKET is the correct guard here: we don't
> define other functions to their standard name by default (e.g.
> 'bind()', 'listen()' etc.) but prefix them with 'lwip_' and only use
> standard names when LWIP_COMPAT_SOCKETS==1.

You do have a point which I'd lost sight of.

As I've mentioned in previous messages, LWIP_COMPAT_SOCKETS
is insufficient to port libcurl, because its configure script
expects the "raw" BSD names in the binary code.

What I have at the moment:


lwipopts.h
#define LWIP_COMPAT_SOCKETS 0

cc.h
#define lwip_gethostbyname    gethostbyname
#define lwip_gethostbyname_r  gethostbyname_r
#define lwip_getaddrinfo      getaddrinfo
#define lwip_freeaddrinfo     freeaddrinfo

#define lwip_accept       accept
#define lwip_bind         bind
#define lwip_connect      connect
#define lwip_getpeername  getpeername
#define lwip_getsockname  getsockname
#define lwip_getsockopt   getsockopt
#define lwip_setsockopt   setsockopt
#define lwip_listen       listen
#define lwip_recv         recv
#define lwip_recvfrom     recvfrom
#define lwip_send         send
#define lwip_sendto       sendto
#define lwip_select       select
#define lwip_shutdown     shutdown
#define lwip_socket       socket

#include <fcntl.h> /*** F_GETFL, F_SETFL, O_NONBLOCK ***/


> Using this, we should be good and backwards compatible:
> 
> #ifndef set_errno
> #if LWIP_COMPAT_SOCKETS || defined(ERRNO)
> #define set_errno(err) errno = (err)
> #else /* LWIP_COMPAT_SOCKETS || defined(ERRNO) */
> #define set_errno(err)
> #endif /* LWIP_COMPAT_SOCKETS || defined(ERRNO) */
> #endif /* set_errno */

OK, you guys have made it clear that you don't want to kill off
the stupid ERRNO macro :-)

I propose renaming it, to make it self-explanatory, and documenting
it in opt.h (cf. attached patch)

Do you agree with the latest patch?


(file #25428)
    _______________________________________________________

Additional Item Attachment:

File name: errno_patch.txt                Size:1 KB


    _______________________________________________________

Reply to this item at:

  <http://savannah.nongnu.org/bugs/?35928>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.nongnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]