summaryrefslogtreecommitdiff
path: root/components
diff options
context:
space:
mode:
authorBernard Xiong <[email protected]>2015-05-02 22:53:08 +0800
committerBernard Xiong <[email protected]>2015-05-02 22:53:08 +0800
commit854d8866d36b6911dee2fbc77e95084b44471066 (patch)
treeb8b46f5e0d2e1c929eb324ae0ce3110fe278e706 /components
parent5ca3da9e1c2f917b09ffce06bd41b29bf72600ec (diff)
[DFS] fix the compiling issue under Keil MDK.
Diffstat (limited to 'components')
-rw-r--r--components/dfs/filesystems/lwip/dfs_lwip.h2
-rw-r--r--components/dfs/filesystems/lwip/lwip_sockets.c3
-rw-r--r--components/dfs/filesystems/lwip/sys/select.h46
-rw-r--r--components/dfs/filesystems/lwip/sys/socket.h4
-rw-r--r--components/dfs/include/dfs_posix.h10
-rw-r--r--components/net/lwip-1.4.1/src/lwipopts.h19
6 files changed, 81 insertions, 3 deletions
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 <lwip/sockets.h>
+
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 <dfs.h>
#include <dfs_def.h>
-#include <lwip/sockets.h>
+#include <dfs_posix.h>
+
#include <sys/socket.h>
#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 <lwip/sockets.h>
+
+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 <lwip/sockets.h>
+
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 <dfs_file.h>
#include <dfs_def.h>
+#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 <stdio.h>
+#include <stdlib.h>
#elif defined(_MSC_VER)
#include <stdio.h>
#else
@@ -109,6 +114,8 @@ int closedir(DIR* d);
#include <sys/stat.h>
#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 <posix_types.h>
+#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 <sys/time.h>
+
+#endif
+
#endif /* __LWIPOPTS_H__ */