aboutsummaryrefslogtreecommitdiff
path: root/gdb/gdbserver/hostio.c
diff options
context:
space:
mode:
authorDaniel Jacobowitz <drow@false.org>2007-12-16 21:50:05 +0000
committerDaniel Jacobowitz <drow@false.org>2007-12-16 21:50:05 +0000
commit4e799345942e3d777a2639a00892b67d084204c5 (patch)
treeb6014f5c354d47a513c01b20881b92c31490e414 /gdb/gdbserver/hostio.c
parentc244f7a6ffdc6e369f271b3a2284a6e364a1cb0b (diff)
downloadgdb-4e799345942e3d777a2639a00892b67d084204c5.zip
gdb-4e799345942e3d777a2639a00892b67d084204c5.tar.gz
gdb-4e799345942e3d777a2639a00892b67d084204c5.tar.bz2
* configure.ac: Check for pread and pwrite.
* hostio.c (handle_pread): Fall back to lseek and read. (handle_pwrite): Fall back to lseek and write. * config.in, configure: Regenerated.
Diffstat (limited to 'gdb/gdbserver/hostio.c')
-rw-r--r--gdb/gdbserver/hostio.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/gdb/gdbserver/hostio.c b/gdb/gdbserver/hostio.c
index f646e85..757a229 100644
--- a/gdb/gdbserver/hostio.c
+++ b/gdb/gdbserver/hostio.c
@@ -377,7 +377,13 @@ handle_pread (char *own_buf, int *new_packet_len)
}
data = malloc (len);
+#ifdef HAVE_PREAD
ret = pread (fd, data, len, offset);
+#else
+ ret = lseek (fd, offset, SEEK_SET);
+ if (ret != -1)
+ ret = read (fd, data, len);
+#endif
if (ret == -1)
{
@@ -419,7 +425,13 @@ handle_pwrite (char *own_buf, int packet_len)
return;
}
+#ifdef HAVE_PWRITE
ret = pwrite (fd, data, len, offset);
+#else
+ ret = lseek (fd, offset, SEEK_SET);
+ if (ret != -1)
+ ret = write (fd, data, len);
+#endif
if (ret == -1)
{