diff --git a/components/dfs/filesystems/lwip/dfs_lwip.h b/components/dfs/filesystems/lwip/dfs_lwip.h index c72c38a7d6..0c100f9d34 100644 --- a/components/dfs/filesystems/lwip/dfs_lwip.h +++ b/components/dfs/filesystems/lwip/dfs_lwip.h @@ -29,6 +29,8 @@ extern "C" { #endif +#include + struct dfs_filesystem* dfs_lwip_get_fs(void); int dfs_lwip_getsocket(int fd); diff --git a/components/dfs/filesystems/lwip/lwip_sockets.c b/components/dfs/filesystems/lwip/lwip_sockets.c index 399bc7ed3c..153f4444bd 100644 --- a/components/dfs/filesystems/lwip/lwip_sockets.c +++ b/components/dfs/filesystems/lwip/lwip_sockets.c @@ -24,7 +24,8 @@ #include #include -#include +#include + #include #include "dfs_lwip.h" diff --git a/components/dfs/filesystems/lwip/sys/select.h b/components/dfs/filesystems/lwip/sys/select.h new file mode 100644 index 0000000000..406913d5db --- /dev/null +++ b/components/dfs/filesystems/lwip/sys/select.h @@ -0,0 +1,46 @@ +/* + * File : select.h + * This file is part of RT-Thread RTOS + * COPYRIGHT (C) 2015, RT-Thread Development Team + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Change Logs: + * Date Author Notes + * 2015-05-02 Bernard First version + */ + +#ifndef SELECT_H__ +#define SELECT_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +/* select API */ +#ifdef RT_USING_LWIP +/* we use lwIP's structure definitions. */ +#include + +int +select(int maxfdp1, fd_set *readset, fd_set *writeset, fd_set *exceptset, + struct timeval *timeout); +#endif + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/components/dfs/filesystems/lwip/sys/socket.h b/components/dfs/filesystems/lwip/sys/socket.h index 23d4bf32c5..9a789ca094 100644 --- a/components/dfs/filesystems/lwip/sys/socket.h +++ b/components/dfs/filesystems/lwip/sys/socket.h @@ -1,5 +1,5 @@ /* - * File : netdb.h + * File : socket.h * This file is part of RT-Thread RTOS * COPYRIGHT (C) 2015, RT-Thread Development Team * @@ -29,6 +29,8 @@ extern "C" { #endif +#include + int accept(int s, struct sockaddr *addr, socklen_t *addrlen); int bind(int s, const struct sockaddr *name, socklen_t namelen); int shutdown(int s, int how); diff --git a/components/dfs/include/dfs_posix.h b/components/dfs/include/dfs_posix.h index 56a0511422..2d08ec71fa 100644 --- a/components/dfs/include/dfs_posix.h +++ b/components/dfs/include/dfs_posix.h @@ -30,6 +30,10 @@ #include #include +#ifdef __cplusplus +extern "C" { +#endif + #ifndef RT_USING_NEWLIB #define O_RDONLY DFS_O_RDONLY #define O_WRONLY DFS_O_WRONLY @@ -79,6 +83,7 @@ #if defined(__CC_ARM) #include +#include #elif defined(_MSC_VER) #include #else @@ -109,6 +114,8 @@ int closedir(DIR* d); #include #endif +struct stat; + /* file api*/ int open(const char *file, int flags, int mode); int close(int d); @@ -126,5 +133,8 @@ int rmdir(const char *path); int chdir(const char *path); char *getcwd(char *buf, size_t size); +#ifdef __cplusplus +} #endif +#endif diff --git a/components/net/lwip-1.4.1/src/lwipopts.h b/components/net/lwip-1.4.1/src/lwipopts.h index 84f068db7a..0501df6ea8 100644 --- a/components/net/lwip-1.4.1/src/lwipopts.h +++ b/components/net/lwip-1.4.1/src/lwipopts.h @@ -353,8 +353,25 @@ #define LWIP_RAND rand #endif -#ifdef RT_USING_DFS_LWIP +#if defined(RT_USING_DFS_LWIP) #define LWIP_COMPAT_SOCKETS 0 #endif +#if defined(__CC_ARM) || defined(__IAR_SYSTEMS_ICC__) + +#if defined(RT_USING_PTHREADS) +#define LWIP_TIMEVAL_PRIVATE 0 +#include +#else +/* there is no timeval in CC_ARM and IAR */ +#define LWIP_TIMEVAL_PRIVATE 1 +#endif /* RT_USING_PTHREADS */ + +#elif defined (__GNUC__) + +#define LWIP_TIMEVAL_PRIVATE 0 +#include + +#endif + #endif /* __LWIPOPTS_H__ */