From a2d1f21b43c8613848f025b5a9fbe77a5031641e Mon Sep 17 00:00:00 2001 From: aozima Date: Mon, 11 Dec 2017 17:25:25 +0800 Subject: [PATCH 1/4] [LWIP] fixed closesocket issues: socket has been closed, delete it from file system fd. --- components/dfs/filesystems/net/net_sockets.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/components/dfs/filesystems/net/net_sockets.c b/components/dfs/filesystems/net/net_sockets.c index a22fbdc9ad..4f33571129 100644 --- a/components/dfs/filesystems/net/net_sockets.c +++ b/components/dfs/filesystems/net/net_sockets.c @@ -327,6 +327,13 @@ RTM_EXPORT(socket); int closesocket(int s) { int sock = dfs_net_getsocket(s); + struct dfs_fd *d; + + d = fd_get(s); + + /* socket has been closed, delete it from file system fd */ + fd_put(d); + fd_put(d); return lwip_close(sock); } From 108a1434cd7a11894aea8b563f090ca289e1b762 Mon Sep 17 00:00:00 2001 From: aozima Date: Thu, 14 Dec 2017 17:02:39 +0800 Subject: [PATCH 2/4] [LWIP] fixed select issues: pollset need clean. --- components/dfs/src/select.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/dfs/src/select.c b/components/dfs/src/select.c index 36a8942331..c727763991 100644 --- a/components/dfs/src/select.c +++ b/components/dfs/src/select.c @@ -52,7 +52,7 @@ int select(int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, struc /* Allocate the descriptor list for poll() */ if (npfds > 0) { - pollset = (struct pollfd *)rt_malloc(npfds * sizeof(struct pollfd)); + pollset = (struct pollfd *)rt_calloc(npfds, sizeof(struct pollfd)); if (!pollset) { return -1; From bc2de526db3f836e86f966fa48e21963ce717635 Mon Sep 17 00:00:00 2001 From: aozima Date: Thu, 14 Dec 2017 17:05:06 +0800 Subject: [PATCH 3/4] [LWIP] update SConscript: add /src/include/posix to include path when RT_USING_DFS_NET not enable. --- components/net/lwip-2.0.2/SConscript | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/components/net/lwip-2.0.2/SConscript b/components/net/lwip-2.0.2/SConscript index 84125a4cb2..c86f67d07f 100644 --- a/components/net/lwip-2.0.2/SConscript +++ b/components/net/lwip-2.0.2/SConscript @@ -67,6 +67,10 @@ path = [GetCurrentDir() + '/src', GetCurrentDir() + '/src/arch/include', GetCurrentDir() + '/src/include/netif'] +if not GetDepend('RT_USING_POSIX') or not GetDepend('RT_USING_DFS_NET'): + path += [GetCurrentDir() + '/src/include/posix'] + print('include /src/include/posix') + if GetDepend(['RT_LWIP_SNMP']): src += snmp_src path += [GetCurrentDir() + '/src/apps/snmp'] From 37e5985540e812d62a6a5da8fdd906c6d72336a1 Mon Sep 17 00:00:00 2001 From: aozima Date: Thu, 14 Dec 2017 21:39:32 +0800 Subject: [PATCH 4/4] [LWIP] delete errno.h, use RT-Thread implement. --- .../net/lwip-2.0.2/src/include/posix/errno.h | 33 ------------------- 1 file changed, 33 deletions(-) delete mode 100644 components/net/lwip-2.0.2/src/include/posix/errno.h diff --git a/components/net/lwip-2.0.2/src/include/posix/errno.h b/components/net/lwip-2.0.2/src/include/posix/errno.h deleted file mode 100644 index 5917c75e24..0000000000 --- a/components/net/lwip-2.0.2/src/include/posix/errno.h +++ /dev/null @@ -1,33 +0,0 @@ -/** - * @file - * This file is a posix wrapper for lwip/errno.h. - */ - -/* - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT - * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT - * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING - * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY - * OF SUCH DAMAGE. - * - * This file is part of the lwIP TCP/IP stack. - * - */ - -#include "lwip/errno.h"