aboutsummaryrefslogtreecommitdiffstats
path: root/extras/mini-os
diff options
context:
space:
mode:
Diffstat (limited to 'extras/mini-os')
-rw-r--r--extras/mini-os/lib/sys.c16
-rw-r--r--extras/mini-os/main.c2
-rw-r--r--extras/mini-os/netfront.c11
3 files changed, 18 insertions, 11 deletions
diff --git a/extras/mini-os/lib/sys.c b/extras/mini-os/lib/sys.c
index 7c5f05cd41..12395bf730 100644
--- a/extras/mini-os/lib/sys.c
+++ b/extras/mini-os/lib/sys.c
@@ -677,7 +677,7 @@ static int select_poll(int nfds, fd_set *readfds, fd_set *writefds, fd_set *exce
{
int i, n = 0;
#ifdef HAVE_LWIP
- int sock_n, sock_nfds = 0;
+ int sock_n = 0, sock_nfds = 0;
fd_set sock_readfds, sock_writefds, sock_exceptfds;
struct timeval timeout = { .tv_sec = 0, .tv_usec = 0};
#endif
@@ -711,12 +711,14 @@ static int select_poll(int nfds, fd_set *readfds, fd_set *writefds, fd_set *exce
}
}
}
- DEBUG("lwip_select(");
- dump_set(nfds, &sock_readfds, &sock_writefds, &sock_exceptfds, &timeout);
- DEBUG("); -> ");
- sock_n = lwip_select(sock_nfds, &sock_readfds, &sock_writefds, &sock_exceptfds, &timeout);
- dump_set(nfds, &sock_readfds, &sock_writefds, &sock_exceptfds, &timeout);
- DEBUG("\n");
+ if (sock_nfds > 0) {
+ DEBUG("lwip_select(");
+ dump_set(nfds, &sock_readfds, &sock_writefds, &sock_exceptfds, &timeout);
+ DEBUG("); -> ");
+ sock_n = lwip_select(sock_nfds, &sock_readfds, &sock_writefds, &sock_exceptfds, &timeout);
+ dump_set(nfds, &sock_readfds, &sock_writefds, &sock_exceptfds, &timeout);
+ DEBUG("\n");
+ }
#endif
/* Then see others as well. */
diff --git a/extras/mini-os/main.c b/extras/mini-os/main.c
index 3289c638e4..204cf85f8a 100644
--- a/extras/mini-os/main.c
+++ b/extras/mini-os/main.c
@@ -62,7 +62,7 @@ static void call_main(void *p)
#ifndef CONFIG_GRUB
sparse((unsigned long) &__app_bss_start, &__app_bss_end - &__app_bss_start);
-#ifdef HAVE_LWIP
+#if defined(HAVE_LWIP) && !defined(CONFIG_QEMU)
start_networking();
#endif
init_fs_frontend();
diff --git a/extras/mini-os/netfront.c b/extras/mini-os/netfront.c
index 824c42a737..a235769377 100644
--- a/extras/mini-os/netfront.c
+++ b/extras/mini-os/netfront.c
@@ -306,11 +306,16 @@ struct netfront_dev *init_netfront(char *_nodename, void (*thenetif_rx)(unsigned
int retry=0;
int i;
char* msg;
- char* nodename = _nodename ? _nodename : "device/vif/0";
-
+ char nodename[256];
+ char path[256];
struct netfront_dev *dev;
+ static int netfrontends = 0;
- char path[strlen(nodename) + 1 + 10 + 1];
+ if (!_nodename)
+ snprintf(nodename, sizeof(nodename), "device/vif/%d", netfrontends);
+ else
+ strncpy(nodename, _nodename, strlen(nodename));
+ netfrontends++;
if (!thenetif_rx)
thenetif_rx = netif_rx;