|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Minios-devel] [UNIKRAFT/NEWLIB PATCH v2 3/6] Add poll() and select() support via lwIP if available
Hi Florian, this looks good, thanks.
Reviewed-by: Felipe Huici <felipe.huici@xxxxxxxxx>
============================================================
Dr. Felipe Huici
Chief Researcher, Systems and Machine Learning Group
NEC Laboratories Europe GmbH
Kurfuerstenanlage 36, D-69115 Heidelberg
Tel. +49
(0)6221 4342-241
Fax: +49
(0)6221 4342-155
e-mail:
felipe.huici@xxxxxxxxx
============================================================
Registered at Amtsgericht Mannheim, Germany, HRB728558
On 28.05.19, 09:55, "Florian Schmidt" <Florian.Schmidt@xxxxxxxxx> wrote:
Otherwise, provide dummy stubs.
Signed-off-by: Florian Schmidt <florian.schmidt@xxxxxxxxx>
---
file.c | 33 +++++++++++++++++++++++++++++++++
include/sys/poll.h | 5 +++++
2 files changed, 38 insertions(+)
diff --git a/file.c b/file.c
index 02f1b6f..d9c1194 100644
--- a/file.c
+++ b/file.c
@@ -35,7 +35,15 @@
* 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>
+#else
+#include <poll.h>
+#include <sys/select.h>
+#endif
#include <sys/stat.h>
#include <errno.h>
#undef errno
@@ -66,3 +74,28 @@ int munmap(void *addr __unused, size_t len __unused)
{
return 0;
}
+
+#if !CONFIG_LWIP_SOCKET
+int poll(struct pollfd _pfd[] __unused, nfds_t _nfds __unused,
+ int _timeout __unused)
+{
+ errno = ENOTSUP;
+ return -1;
+}
+
+int select(int nfds, fd_set *readfds __unused, fd_set *writefds __unused,
+ fd_set *exceptfds __unused, 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;
+ }
+
+ errno = ENOTSUP;
+ return -1;
+}
+#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
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |