]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
* configure.ac: Check for pread and pwrite.
authorDaniel Jacobowitz <drow@false.org>
Sun, 16 Dec 2007 21:50:05 +0000 (21:50 +0000)
committerDaniel Jacobowitz <drow@false.org>
Sun, 16 Dec 2007 21:50:05 +0000 (21:50 +0000)
* hostio.c (handle_pread): Fall back to lseek and read.
(handle_pwrite): Fall back to lseek and write.
* config.in, configure: Regenerated.

gdb/gdbserver/ChangeLog
gdb/gdbserver/config.in
gdb/gdbserver/configure
gdb/gdbserver/configure.ac
gdb/gdbserver/hostio.c

index 50d8f1a7ce4763a14ca750a644d6cf834447ec7d..10bf1d0d40f9fc28770dffccc024378ab542005f 100644 (file)
@@ -1,3 +1,10 @@
+2007-12-16  Daniel Jacobowitz  <dan@codesourcery.com>
+
+       * 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.
+
 2007-12-07  Daniel Jacobowitz  <dan@codesourcery.com>
 
        * server.c (myresume): Add own_buf argument.
index 017a1ed7e2431819fe2f358b7aa69a4a6fad7592..c666ab2292e69cda47cd7e596d93707f3f37f22f 100644 (file)
@@ -53,6 +53,9 @@
 /* Define to 1 if you have the <netinet/tcp.h> header file. */
 #undef HAVE_NETINET_TCP_H
 
+/* Define to 1 if you have the `pread' function. */
+#undef HAVE_PREAD
+
 /* Define to 1 if you have the `pread64' function. */
 #undef HAVE_PREAD64
 
@@ -72,6 +75,9 @@
 /* Define if the target supports PTRACE_GETREGS for register access. */
 #undef HAVE_PTRACE_GETREGS
 
+/* Define to 1 if you have the `pwrite' function. */
+#undef HAVE_PWRITE
+
 /* Define to 1 if you have the <sgtty.h> header file. */
 #undef HAVE_SGTTY_H
 
index 0b5ed9d87c6d74c3015f9507022a096114aae940..b8b28790826cc3d247659749e7e0998645d7448b 100755 (executable)
@@ -3099,7 +3099,9 @@ fi
 done
 
 
-for ac_func in pread64
+
+
+for ac_func in pread pwrite pread64
 do
 as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
 echo "$as_me:$LINENO: checking for $ac_func" >&5
index 4e94f3146b3211ecf2c516285ebb71993cb52f89..819feade83aaec51b0e58d8b6fd9693cc55986c3 100644 (file)
@@ -41,7 +41,7 @@ AC_CHECK_HEADERS(sgtty.h termio.h termios.h sys/reg.h string.h dnl
                 errno.h fcntl.h signal.h sys/file.h malloc.h dnl
                 sys/ioctl.h netinet/in.h sys/socket.h netdb.h dnl
                 netinet/tcp.h arpa/inet.h sys/wait.h)
-AC_CHECK_FUNCS(pread64)
+AC_CHECK_FUNCS(pread pwrite pread64)
 
 have_errno=no
 AC_MSG_CHECKING(for errno)
index f646e85c004aacd8092d293613ad97c9797d26fe..757a229e8469600964a7f84d18b2aa6edd8126d8 100644 (file)
@@ -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)
     {