2007-10-11 Jesper Nilsson <jesper.nilsson@axis.com>
authorDaniel Jacobowitz <drow@false.org>
Thu, 11 Oct 2007 18:40:29 +0000 (18:40 +0000)
committerDaniel Jacobowitz <drow@false.org>
Thu, 11 Oct 2007 18:40:29 +0000 (18:40 +0000)
* 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.

include/gdb/ChangeLog
include/gdb/callback.h
sim/common/ChangeLog
sim/common/callback.c
sim/common/syscall.c

index e3a3f51c7caed4a6bf53ac57a06eca42cb04a969..70266e2ccfa95d97e45382dddbc6248f9ffe890d 100644 (file)
@@ -1,3 +1,7 @@
+2007-10-11  Jesper Nilsson  <jesper.nilsson@axis.com>
+
+       * callback.h (cb_is_stdin): Add prototype.
+
 2007-08-23  Joel Brobecker  <brobecker@adacore.com>
 
        Switch the license of all .h files to GPLv3.
index f1e7d24b846c61c7889647986a5f4594b54a375e..2245c87dc430846cdc04132aa258a3ec384ba95d 100644 (file)
@@ -315,6 +315,9 @@ int cb_host_to_target_stat PARAMS ((host_callback *, const struct stat *, PTR));
 /* Translate a value to target endian.  */
 void cb_store_target_endian PARAMS ((host_callback *, char *, int, long));
 
+/* Test if the fd is stdin. */
+int cb_is_stdin PARAMS ((host_callback *, int));
+
 /* Perform a system call.  */
 CB_RC cb_syscall PARAMS ((host_callback *, CB_SYSCALL *));
 
index b31a19e9f0f72348b451cb772cf7f491814a8cbc..bd09a5c536639b691c9f206cd9080f418e33d4f1 100644 (file)
@@ -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
index fec1d148874e955845b200bc4886729b4954bd03..f83dd547c220e49d0be3c32cbfdab0b1222e0d31 100644 (file)
@@ -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;
+}
+
index 379f7e16df19728198987718edf1d49b729db92d..a3e7560bf484977a4446c8b838fa8cb5c88effb3 100644 (file)
@@ -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));
This page took 0.036846 seconds and 4 git commands to generate.