diff options
-rw-r--r-- | arch/sandbox/lib/common.c | 13 | ||||
-rw-r--r-- | common/console.c | 2 | ||||
-rw-r--r-- | include/asm-sandbox/common.h | 7 |
3 files changed, 18 insertions, 4 deletions
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; diff --git a/common/console.c b/common/console.c index 80f8cdb890..e47c46061e 100644 --- a/common/console.c +++ b/common/console.c @@ -357,6 +357,7 @@ int vprintf (const char *fmt, va_list args) } EXPORT_SYMBOL(vprintf); +#ifndef ARCH_HAS_CTRLC /* test if ctrl-c was pressed */ int ctrlc (void) { @@ -365,6 +366,7 @@ int ctrlc (void) return 0; } EXPORT_SYMBOL(ctrlc); +#endif /* ARCH_HAS_CTRC */ #ifdef CONFIG_HAS_EARLY_INIT diff --git a/include/asm-sandbox/common.h b/include/asm-sandbox/common.h index da84fa5f6b..9b8bd2d94c 100644 --- a/include/asm-sandbox/common.h +++ b/include/asm-sandbox/common.h @@ -1 +1,6 @@ -/* nothing */ +#ifndef ASM_COMMON_H +#define ASM_COMMON_H + +#define ARCH_HAS_CTRLC + +#endif /* ASM_COMMON_H */ |