diff options
| author | Wayne Lin <[email protected]> | 2021-11-10 16:01:38 +0800 |
|---|---|---|
| committer | Wayne Lin <[email protected]> | 2021-11-10 16:01:38 +0800 |
| commit | 9b44e57a6022b8eb46eda7037b719ec918fdcc55 (patch) | |
| tree | 26be9facf0f37d1c38b9e4b6e4abc99d6f8b5a8d /components/net/sal_socket | |
| parent | 37f5236dfa45b98d02e867536a10ac0b6622b80b (diff) | |
| parent | fdbaa2a808d12d522ad90702795c08ae8443aab9 (diff) | |
Merge branch 'master' of https://github.com/RT-Thread/rt-thread into nuvoton
Diffstat (limited to 'components/net/sal_socket')
| -rw-r--r-- | components/net/sal_socket/SConscript | 3 | ||||
| -rw-r--r-- | components/net/sal_socket/impl/af_inet_at.c | 2 | ||||
| -rw-r--r-- | components/net/sal_socket/impl/af_inet_lwip.c | 2 | ||||
| -rw-r--r-- | components/net/sal_socket/include/dfs_net/sys_select/sys/select.h | 16 | ||||
| -rw-r--r-- | components/net/sal_socket/include/sal_netdb.h | 1 | ||||
| -rw-r--r-- | components/net/sal_socket/include/sal_socket.h | 1 | ||||
| -rw-r--r-- | components/net/sal_socket/include/socket/netdb.h | 3 | ||||
| -rw-r--r-- | components/net/sal_socket/socket/net_netdb.c | 1 | ||||
| -rw-r--r-- | components/net/sal_socket/socket/net_sockets.c | 2 | ||||
| -rw-r--r-- | components/net/sal_socket/src/sal_socket.c | 14 |
10 files changed, 14 insertions, 31 deletions
diff --git a/components/net/sal_socket/SConscript b/components/net/sal_socket/SConscript index cc7634f7d9..3903dce89a 100644 --- a/components/net/sal_socket/SConscript +++ b/components/net/sal_socket/SConscript @@ -26,9 +26,6 @@ if GetDepend('SAL_USING_POSIX'): CPPPATH += [cwd + '/include/dfs_net'] src += Glob('socket/net_sockets.c') src += Glob('dfs_net/*.c') - - if not GetDepend('HAVE_SYS_SELECT_H'): - CPPPATH += [cwd + '/include/dfs_net/sys_select'] if not GetDepend('HAVE_SYS_SOCKET_H'): CPPPATH += [cwd + '/include/socket/sys_socket'] diff --git a/components/net/sal_socket/impl/af_inet_at.c b/components/net/sal_socket/impl/af_inet_at.c index c85dfe9f06..07dff0018c 100644 --- a/components/net/sal_socket/impl/af_inet_at.c +++ b/components/net/sal_socket/impl/af_inet_at.c @@ -19,7 +19,7 @@ #include <netdev.h> #ifdef SAL_USING_POSIX -#include <dfs_poll.h> +#include <poll.h> #endif #ifdef SAL_USING_AT diff --git a/components/net/sal_socket/impl/af_inet_lwip.c b/components/net/sal_socket/impl/af_inet_lwip.c index 2e19275b5d..2cf0958ee4 100644 --- a/components/net/sal_socket/impl/af_inet_lwip.c +++ b/components/net/sal_socket/impl/af_inet_lwip.c @@ -17,7 +17,7 @@ #include <lwip/netif.h> #ifdef SAL_USING_POSIX -#include <dfs_poll.h> +#include <poll.h> #endif #include <sal.h> diff --git a/components/net/sal_socket/include/dfs_net/sys_select/sys/select.h b/components/net/sal_socket/include/dfs_net/sys_select/sys/select.h deleted file mode 100644 index f174bc6504..0000000000 --- a/components/net/sal_socket/include/dfs_net/sys_select/sys/select.h +++ /dev/null @@ -1,16 +0,0 @@ -/* - * Copyright (c) 2006-2021, RT-Thread Development Team - * - * SPDX-License-Identifier: Apache-2.0 - * - * Change Logs: - * Date Author Notes - * 2015-05-02 Bernard First version - */ - -#ifndef SELECT_H__ -#define SELECT_H__ - -#include <dfs_select.h> - -#endif diff --git a/components/net/sal_socket/include/sal_netdb.h b/components/net/sal_socket/include/sal_netdb.h index 50064ce343..9b1421270f 100644 --- a/components/net/sal_socket/include/sal_netdb.h +++ b/components/net/sal_socket/include/sal_netdb.h @@ -10,6 +10,7 @@ #ifndef SAL_NETDB_H__ #define SAL_NETDB_H__ +#include <stddef.h> #include "sal_socket.h" #ifdef __cplusplus diff --git a/components/net/sal_socket/include/sal_socket.h b/components/net/sal_socket/include/sal_socket.h index 497be47e41..c479d21c62 100644 --- a/components/net/sal_socket/include/sal_socket.h +++ b/components/net/sal_socket/include/sal_socket.h @@ -11,6 +11,7 @@ #ifndef SAL_SOCKET_H__ #define SAL_SOCKET_H__ +#include <stddef.h> #include <arpa/inet.h> #ifdef __cplusplus diff --git a/components/net/sal_socket/include/socket/netdb.h b/components/net/sal_socket/include/socket/netdb.h index 4783405022..8394fddea5 100644 --- a/components/net/sal_socket/include/socket/netdb.h +++ b/components/net/sal_socket/include/socket/netdb.h @@ -6,7 +6,7 @@ * Change Logs: * Date Author Notes * 2015-02-17 Bernard First version - * 2108-05-24 ChenYong Add socket abstraction layer + * 2018-05-24 ChenYong Add socket abstraction layer */ #ifndef NETDB_H__ @@ -16,6 +16,7 @@ extern "C" { #endif +#include <stddef.h> #include <sal_netdb.h> struct hostent *gethostbyname(const char *name); diff --git a/components/net/sal_socket/socket/net_netdb.c b/components/net/sal_socket/socket/net_netdb.c index 03b995c68d..1eb84e1c32 100644 --- a/components/net/sal_socket/socket/net_netdb.c +++ b/components/net/sal_socket/socket/net_netdb.c @@ -9,6 +9,7 @@ * 2108-05-24 ChenYong Add socket abstraction layer */ +#include <stddef.h> #include <rtthread.h> #include <netdb.h> diff --git a/components/net/sal_socket/socket/net_sockets.c b/components/net/sal_socket/socket/net_sockets.c index 7d4db34327..1b6db50e6d 100644 --- a/components/net/sal_socket/socket/net_sockets.c +++ b/components/net/sal_socket/socket/net_sockets.c @@ -11,7 +11,7 @@ #include <dfs.h> #include <dfs_file.h> -#include <dfs_poll.h> +#include <poll.h> #include <dfs_net.h> #include <sys/errno.h> #include <sys/socket.h> diff --git a/components/net/sal_socket/src/sal_socket.c b/components/net/sal_socket/src/sal_socket.c index dd3c5d3dc2..7b33038d17 100644 --- a/components/net/sal_socket/src/sal_socket.c +++ b/components/net/sal_socket/src/sal_socket.c @@ -165,7 +165,6 @@ static void check_netdev_internet_up_work(struct rt_work *work, void *work_data) struct netdev *netdev = (struct netdev *)work_data; socklen_t addr_len = sizeof(struct sockaddr_in); char send_data[SAL_INTERNET_BUFF_LEN], recv_data = 0; - struct rt_delayed_work *delay_work = (struct rt_delayed_work *)work; const char month[][SAL_INTERNET_MONTH_LEN] = {"Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"}; char date[SAL_INTERNET_DATE_LEN]; @@ -176,7 +175,7 @@ static void check_netdev_internet_up_work(struct rt_work *work, void *work_data) if (work) { - rt_free(delay_work); + rt_free(work); } /* get network interface socket operations */ @@ -287,18 +286,18 @@ int sal_check_netdev_internet_up(struct netdev *netdev) #ifdef SAL_INTERNET_CHECK /* workqueue for network connect */ - struct rt_delayed_work *net_work = RT_NULL; + struct rt_work *net_work = RT_NULL; - net_work = (struct rt_delayed_work *)rt_calloc(1, sizeof(struct rt_delayed_work)); + net_work = (struct rt_work *)rt_calloc(1, sizeof(struct rt_work)); if (net_work == RT_NULL) { LOG_W("No memory for network interface device(%s) delay work.", netdev->name); return -1; } - rt_delayed_work_init(net_work, check_netdev_internet_up_work, (void *)netdev); - rt_work_submit(&(net_work->work), RT_TICK_PER_SECOND); + rt_work_init(net_work, check_netdev_internet_up_work, (void *)netdev); + rt_work_submit(net_work, RT_TICK_PER_SECOND); #endif /* SAL_INTERNET_CHECK */ return 0; } @@ -619,7 +618,7 @@ int sal_accept(int socket, struct sockaddr *addr, socklen_t *addrlen) LOG_E("New socket registered failed, return error %d.", retval); return -1; } - + /* new socket create by accept should have the same netdev with server*/ new_sock->netdev = sock->netdev; /* socket structure user_data used to store the acquired new socket */ @@ -1176,4 +1175,3 @@ void sal_freeaddrinfo(struct addrinfo *ai) pf->netdb_ops->freeaddrinfo(ai); } } - |
