diff options
author | Sascha Hauer <s.hauer@pengutronix.de> | 2008-03-11 00:00:37 +0100 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2008-03-11 00:00:37 +0100 |
commit | 8759e68de2e2b4ce1793d36d668359eb80278c2c (patch) | |
tree | d30cd455f52e37bea10e8ac4cc296fc8d85e7a7c /arch/sandbox/lib | |
parent | 4dba16c692bbe50ae22e3d678a01d054c4e52bb4 (diff) | |
download | barebox-8759e68de2e2b4ce1793d36d668359eb80278c2c.tar.gz barebox-8759e68de2e2b4ce1793d36d668359eb80278c2c.tar.xz |
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.
Diffstat (limited to 'arch/sandbox/lib')
-rw-r--r-- | arch/sandbox/lib/common.c | 13 |
1 files changed, 10 insertions, 3 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; |