From 8759e68de2e2b4ce1793d36d668359eb80278c2c Mon Sep 17 00:00:00 2001 From: Sascha Hauer Date: Tue, 11 Mar 2008 00:00:37 +0100 Subject: Add the possibility to have an architecture specific ctrlc() function. This allows us to return immediately in ctrlc() on sandbox and thus not slow down network througput. --- arch/sandbox/lib/common.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'arch/sandbox/lib') diff --git a/arch/sandbox/lib/common.c b/arch/sandbox/lib/common.c index 0924c9bb9a..21ec720d7c 100644 --- a/arch/sandbox/lib/common.c +++ b/arch/sandbox/lib/common.c @@ -97,9 +97,7 @@ int linux_tstc(int fd) /* * 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. + * for input. */ ret = select(fd + 1, &rfds, NULL, NULL, &tv); @@ -109,6 +107,15 @@ int linux_tstc(int fd) return 0; } +int ctrlc(void) +{ + char chr; + + if (linux_read_nonblock(0, &chr, 1) == 1 && chr == 3) + return 1; + return 0; +} + int linux_getc(void) { char ret; -- cgit v1.2.3