]> xenbits.xensource.com Git - unikraft/libs/lwip.git/commitdiff
Expose socket header & disable socket polling
authorSharan Santhanam <sharan.santhanam@neclab.eu>
Fri, 15 Jun 2018 20:53:48 +0000 (22:53 +0200)
committerSimon Kuenzer <simon.kuenzer@neclab.eu>
Sat, 16 Jun 2018 11:51:17 +0000 (13:51 +0200)
In this patch, we expose the socket API through lwIP. In its current
implementation, we do disable support for select()/poll() on a file
descriptor since an implementation is missing in vfscore.
We are going to add this feature again in the near future.

Signed-off-by: Sharan Santhanam <sharan.santhanam@neclab.eu>
include/sys/socket.h
patches/0002-introduce-lwip_getsock_status.patch [deleted file]

index 05da60bab273b6eda5124c9b9b48173e1d84bccf..5f496cbbd99aee36ce580122feab78eb7be4a02d 100644 (file)
@@ -1,7 +1,6 @@
 #ifndef UK_LWIP_SOCKET_H
 #include <uk/config.h>
 
-#ifndef CONFIG_HAVE_LIBC
 
 #if CONFIG_LIBLWIP
 #include <lwip/inet.h>
@@ -11,5 +10,4 @@
 #define SOCK_CLOEXEC    0x10000000
 #define SOCK_NONBLOCK   0x20000000
 
-#endif /* CONFIG_HAVELIBC */
 #endif /* UK_LWIP_SOCKET_H */
diff --git a/patches/0002-introduce-lwip_getsock_status.patch b/patches/0002-introduce-lwip_getsock_status.patch
deleted file mode 100644 (file)
index 65447b7..0000000
+++ /dev/null
@@ -1,64 +0,0 @@
-diff -urp lwip-2.0.3-orig/src/api/sockets.c src/api/sockets.c
---- a/src/api/sockets.c        2018-03-20 13:07:37.161480805 +0100
-+++ b/src/api/sockets.c        2018-03-19 18:01:08.206420575 +0100
-@@ -1290,6 +1290,46 @@ lwip_writev(int s, const struct iovec *i
-   return lwip_sendmsg(s, &msg, 0);\r
- }\r
\r
-+int lwip_getsock_status(int fd)\r
-+{\r
-+  int flags = 0;\r
-+  struct lwip_sock *sock;\r
-+\r
-+  SYS_ARCH_DECL_PROTECT(lev);\r
-+  SYS_ARCH_PROTECT(lev);\r
-+  sock = tryget_socket(fd);\r
-+  if (sock != NULL) {\r
-+    void* lastdata = sock->lastdata;\r
-+    s16_t rcvevent = sock->rcvevent;\r
-+    u16_t sendevent = sock->sendevent;\r
-+    u16_t errevent = sock->errevent;\r
-+    SYS_ARCH_UNPROTECT(lev);\r
-+\r
-+    /* ... then examine it: */\r
-+    /* See if netconn of this socket is ready for read */\r
-+    if ((lastdata != NULL) || (rcvevent > 0)) {\r
-+      flags |= LWIP_SOC_RD_READY;\r
-+      LWIP_DEBUGF(SOCKETS_DEBUG, ("%s: lwip_fd=%d ready for reading\n",\r
-+                                  __func__, fd));\r
-+    }\r
-+    /* See if netconn of this socket is ready for write */\r
-+    if (sendevent != 0) {\r
-+      flags |= LWIP_SOC_WR_READY;\r
-+      LWIP_DEBUGF(SOCKETS_DEBUG, ("%s: lwip_fd=%d ready for writing\n",\r
-+                                  __func__, fd));\r
-+    }\r
-+    /* See if netconn of this socket had an error */\r
-+    if (errevent != 0) {\r
-+      flags |= LWIP_SOC_EXCEPTION;\r
-+      LWIP_DEBUGF(SOCKETS_DEBUG, ("%s: lwip_fd=%d ready for exception\n",\r
-+                                  __func__, fd));\r
-+    }\r
-+  } else {\r
-+    SYS_ARCH_UNPROTECT(lev);\r
-+  }\r
-+\r
-+  return flags;\r
-+}\r
- /**\r
-  * Go through the readset and writeset lists and see which socket of the sockets\r
-  * set in the sets has events. On return, readset, writeset and exceptset have\r
-diff -urp src/include/lwip/sockets.h src/include/lwip/sockets.h
---- a/src/include/lwip/sockets.h       2017-03-01 23:13:14.000000000 +0100
-+++ b/src/include/lwip/sockets.h       2018-03-19 17:34:49.143047601 +0100
-@@ -419,6 +419,10 @@ typedef struct ip_mreq {
- #define FD_ISSET(n,p) FDSETSAFEGET(n, (p)->fd_bits[((n)-LWIP_SOCKET_OFFSET)/8] &   (1 << (((n)-LWIP_SOCKET_OFFSET) & 7)))\r
- #define FD_ZERO(p)    memset((void*)(p), 0, sizeof(*(p)))\r
\r
-+#define LWIP_SOC_RD_READY  0x01\r
-+#define LWIP_SOC_WR_READY  0x02\r
-+#define LWIP_SOC_EXCEPTION 0x04\r
-+\r
- typedef struct fd_set\r
- {\r
-   unsigned char fd_bits [(FD_SETSIZE+7)/8];\r