aboutsummaryrefslogtreecommitdiff
path: root/sim
diff options
context:
space:
mode:
authorDaniel Jacobowitz <drow@false.org>2007-10-11 18:40:29 +0000
committerDaniel Jacobowitz <drow@false.org>2007-10-11 18:40:29 +0000
commitb981d7096356e3e92b66f0813881754fc69bf41d (patch)
tree0edc96fe699cafa5857e63e111d743a37316394c /sim
parentf5bc1778c3150f6e9364a1af81f3ba2658f9e68c (diff)
downloadgdb-b981d7096356e3e92b66f0813881754fc69bf41d.zip
gdb-b981d7096356e3e92b66f0813881754fc69bf41d.tar.gz
gdb-b981d7096356e3e92b66f0813881754fc69bf41d.tar.bz2
2007-10-11 Jesper Nilsson <jesper.nilsson@axis.com>
* callback.c (cb_is_stdin): Add. * syscall.c (cb_syscall): Test for stdin, not just fd 0. 2007-10-11 Jesper Nilsson <jesper.nilsson@axis.com> * callback.h (cb_is_stdin): Add prototype.
Diffstat (limited to 'sim')
-rw-r--r--sim/common/ChangeLog5
-rw-r--r--sim/common/callback.c7
-rw-r--r--sim/common/syscall.c2
3 files changed, 13 insertions, 1 deletions
diff --git a/sim/common/ChangeLog b/sim/common/ChangeLog
index b31a19e..bd09a5c 100644
--- a/sim/common/ChangeLog
+++ b/sim/common/ChangeLog
@@ -1,3 +1,8 @@
+2007-10-11 Jesper Nilsson <jesper.nilsson@axis.com>
+
+ * callback.c (cb_is_stdin): Add.
+ * syscall.c (cb_syscall): Test for stdin, not just fd 0.
+
2007-08-10 Nick Clifton <nickc@redhat.com>
* sim-memopt.c (memory_options): Mention that the
diff --git a/sim/common/callback.c b/sim/common/callback.c
index fec1d14..f83dd54 100644
--- a/sim/common/callback.c
+++ b/sim/common/callback.c
@@ -1136,3 +1136,10 @@ sim_cb_eprintf (host_callback *p, const char *fmt, ...)
p->evprintf_filtered (p, fmt, ap);
va_end (ap);
}
+
+int
+cb_is_stdin (host_callback *cb, int fd)
+{
+ return fdbad (cb, fd) ? 0 : fdmap (cb, fd) == 0;
+}
+
diff --git a/sim/common/syscall.c b/sim/common/syscall.c
index 379f7e1..a3e7560 100644
--- a/sim/common/syscall.c
+++ b/sim/common/syscall.c
@@ -291,7 +291,7 @@ cb_syscall (cb, sc)
while (count > 0)
{
- if (fd == 0)
+ if (cb_is_stdin (cb, fd))
result = (int) (*cb->read_stdin) (cb, buf,
(count < FILE_XFR_SIZE
? count : FILE_XFR_SIZE));