[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Minios-devel] [UNIKRAFT/NEWLIB PATCH 3/6] Add select() support via lwIP if available





On 5/27/19 2:05 PM, Felipe Huici wrote:
Hi Florian,

Please see a single comment inline.

Thanks,

-- Felipe

On 20.05.19, 13:31, "Minios-devel on behalf of Florian Schmidt" 
<minios-devel-bounces@xxxxxxxxxxxxxxxxxxxx on behalf of florian.schmidt@xxxxxxxxx> wrote:

     Otherwise, provide a dummy stub.
Signed-off-by: Florian Schmidt <florian.schmidt@xxxxxxxxx>
     ---
      file.c             | 39 +++++++++++++++++++++++++++++++++++++++
      include/sys/poll.h |  5 +++++
      2 files changed, 44 insertions(+)
diff --git a/file.c b/file.c
     index 02f1b6f..43c1bf4 100644
     --- a/file.c
     +++ b/file.c
     @@ -35,7 +35,12 @@
       * THIS HEADER MAY NOT BE EXTRACTED OR MODIFIED IN ANY WAY.
       */
+#include <uk/config.h>
     +#include <uk/sched.h>
      #include <uk/plat/console.h>
     +#if CONFIG_LWIP_SOCKET
     +#include <lwip/sockets.h>
     +#endif
      #include <sys/stat.h>
      #include <errno.h>
      #undef errno
     @@ -66,3 +71,37 @@ int munmap(void *addr __unused, size_t len __unused)
      {
        return 0;
      }
     +
     +#if !CONFIG_LWIP_SOCKET
     +static int select_notimplemented(int nfds  __unused, fd_set *readfds 
__unused,
     +          fd_set *writefds __unused, fd_set *exceptfds __unused,
     +          struct timeval *timeout __unused)
     +{
     +  errno = EINTR;
     +  return -1;
     +}
     +#endif


This #endif should be moved to the bottom of select(), otherwise we get a clash 
with the select() definition in lwip's sockets.c

Actually, I don't know what happened there, but I must by mistake have messed up which patch I sent out. I have an updated version locally that I will send in the v2 of the patch series.





     +
     +int select(int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds,
     +          struct timeval *timeout)
     +{
     +  uint64_t nsecs;
     +
     +  if (nfds == 0) {
     +          nsecs = timeout->tv_sec * 1000000000;
     +          nsecs += timeout->tv_usec * 1000;
     +          uk_sched_thread_sleep(nsecs);
     +          return 0;
     +  }
     +  else {
     +#if CONFIG_LWIP_SOCKET
     +          return lwip_select(nfds, readfds, writefds, exceptfds,
     +                          timeout);
     +#else
     +          /* TODO: implement */
     +          return select_notimplemented(nfds, readfds, writefds,
     +                          exceptfds, timeout);
     +#endif /* CONFIG_LWIP_SOCKET */
     +  }
     +}
     +
     diff --git a/include/sys/poll.h b/include/sys/poll.h
     index 2afbbde..556e038 100644
     --- a/include/sys/poll.h
     +++ b/include/sys/poll.h
     @@ -34,6 +34,10 @@
      #ifndef _POSIX_SYS_POLL_H_
      #define _POSIX_SYS_POLL_H_
+/* LWIP's socket interface provides poll primitives */
     +#include <uk/config.h>
     +#if !CONFIG_LWIP_SOCKET
     +
      /*
       * This file is intended to be compatible with the traditional poll.h.
       */
     @@ -77,4 +81,5 @@ struct pollfd {
int poll(struct pollfd _pfd[], nfds_t _nfds, int _timeout); +#endif /* !CONFIG_LWIP_SOCKET */
      #endif /* _POSIX_SYS_POLL_H_ */
     --
     2.21.0
_______________________________________________
     Minios-devel mailing list
     Minios-devel@xxxxxxxxxxxxxxxxxxxx
     https://lists.xenproject.org/mailman/listinfo/minios-devel


--
Dr. Florian Schmidt
フローリアン・シュミット
Research Scientist,
Systems and Machine Learning Group
NEC Laboratories Europe
Kurfürsten-Anlage 36, D-69115 Heidelberg
Tel.     +49 (0)6221 4342-265
Fax:     +49 (0)6221 4342-155
e-mail:  florian.schmidt@xxxxxxxxx
============================================================
Registered at Amtsgericht Mannheim, Germany, HRB728558

_______________________________________________
Minios-devel mailing list
Minios-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/minios-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.