lwip-users
[Top][All Lists]
Advanced

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

Re: [lwip-users] lwip_getsockopt_impl() return type


From: Joan Lledó
Subject: Re: [lwip-users] lwip_getsockopt_impl() return type
Date: Fri, 17 Feb 2017 10:53:28 +0100

Hi Simon,

I was trying to compile LwIP in the Hurd and many warnings like this
one raised when compiling sockets.c:

./api/sockets.c: In function 'lwip_getsockopt_impl':
./api/sockets.c:1892:12: warning: large integer implicitly truncated
to unsigned type [-Woverflow]
     return EBADF;
            ^~~~~

EBADF macro is defined in the Hurd's errno.h:

https://github.molgen.mpg.de/git-mirror/glibc/blob/master/sysdeps/mach/hurd/bits/errno.h

I cannot use LwIP's errno.h because I'm using sys_arch.c from your
Unix port that uses pthreads that uses the standard errno.h

I've submitted a little patch to Savannah to change the return type to
u32_t: https://savannah.nongnu.org/patch/index.php?9262

Thank you.

2017-02-16 20:51 GMT+01:00 address@hidden <address@hidden>:
> Joan,
>
> the return type is related to the type of  struct lwip_sock's 'err' member.
> reading the comment /** last error that occurred on this socket (in fact,
> all our errnos fit into an u8_t) */
> makes it clear this is just a size improvement which holds for our error
> definitions but might not hold for all errnos assigned.
>
> It should be safe to change (and I think we could do better than just using
> u8_t here, in terms of portability).
>
> However, I'd really be interested where your problem comes from. We only
> assign known error numbers to sock->err, so are you using E* defines that
> don't fit into an u8_t?
>
> Simon
>
>
> Joan Lledó wrote:
>
> Hello,
>
> lwip_getsockopt_impl() in api/sockets.c returns u8_t, which is enough for
> most errno implementations, but some implementations need all 32 bits.
> Please, take a look at this thread:
>
> https://lists.debian.org/debian-hurd/2002/01/msg00022.html
>
> I've changed return type to u32_t and have also needed to mask the value
> when converting it to u8_t in sockets.c:302. Is it safe to do this?
>
> Thank you.
>
>
> _______________________________________________
> lwip-users mailing list
> address@hidden
> https://lists.nongnu.org/mailman/listinfo/lwip-users
>
>
>
> _______________________________________________
> lwip-users mailing list
> address@hidden
> https://lists.nongnu.org/mailman/listinfo/lwip-users



reply via email to

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