From dccda9879bab1faaf22816a47c0b669d47cdadb2 Mon Sep 17 00:00:00 2001 From: Sascha Hauer Date: Thu, 5 Jul 2007 18:02:18 +0200 Subject: [PATCH] svn_rev_703 --- arch/linux/lib/common.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/arch/linux/lib/common.c b/arch/linux/lib/common.c index c6aa91f38..99cbc98fc 100644 --- a/arch/linux/lib/common.c +++ b/arch/linux/lib/common.c @@ -60,6 +60,13 @@ int linux_tstc(int fd) FD_ZERO(&rfds); FD_SET(fd, &rfds); + /* + * We set the timeout here to 100us, because otherwise + * U-Boot would eat all cpu resources while waiting + * for input. On the other hand this makes some + * things like networking slow, because U-Boot will + * poll this function very often. + */ tv.tv_sec = 0; tv.tv_usec = 100; @@ -127,14 +134,8 @@ int linux_read_nonblock(int fd, void *buf, size_t count) if (fcntl(fd, F_SETFL, oldflags) == -1) goto err_out; - if (ret == -1) { -// printf("errno\n"); - usleep(1000); - } - -// if (ret == -1 && errno == EAGAIN) { -// printf("delay\n"); -// } + if (ret == -1) + usleep(100); return ret; @@ -245,7 +246,7 @@ int main(int argc, char *argv[]) { void *ram; int opt, ret, fd; - int malloc_size = 1024 * 1024; + int malloc_size = 8 * 1024 * 1024; ram = malloc(malloc_size); if (!ram) {