[gdbserver] return ENOSYS if readlink not supported.
authorJoel Brobecker <brobecker@gnat.com>
Thu, 9 Feb 2012 17:29:34 +0000 (17:29 +0000)
committerJoel Brobecker <brobecker@gnat.com>
Thu, 9 Feb 2012 17:29:34 +0000 (17:29 +0000)
This reproduces on the GDBserver side what GDB does when readlink is
not supported.

gdb/gdbserver/ChangeLog:

        * configure.ac: Add readlink to AC_CHECK_FUNCS list.
        * configure, config.in: Regenerate.
        * hostio.c: Provide an alternate implementation if HAVE_READLINK
        is not defined.

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

index 690d2a68c3f710552e6553edd24aa99e6fdaacea..e0823091b50c3277587c9eb6754da229ccbb6f2f 100644 (file)
@@ -1,3 +1,10 @@
+2012-02-09  Joel Brobecker  <brobecker@adacore.com>
+
+       * configure.ac: Add readlink to AC_CHECK_FUNCS list.
+       * configure, config.in: Regenerate.
+       * hostio.c: Provide an alternate implementation if HAVE_READLINK
+       is not defined.
+
 2012-02-02  Pedro Alves  <palves@redhat.com>
 
        Try SIGKILL first, then PTRACE_KILL.
index a9472eaa4fc3c52c1c16d202924af5ff398f39ad..7fa3b5b21e3a13326f67c5f8b199a14ff2ab092b 100644 (file)
 /* Define to 1 if you have the `pwrite' function. */
 #undef HAVE_PWRITE
 
+/* Define to 1 if you have the `readlink' function. */
+#undef HAVE_READLINK
+
 /* Define to 1 if you have the <sgtty.h> header file. */
 #undef HAVE_SGTTY_H
 
index d92a00f3c0edb4cd0de678ded8d19b648fc729e2..e251844bd4cb94c207bb2e9eaed39cc4f70c5312 100755 (executable)
@@ -4163,7 +4163,7 @@ fi
 
 done
 
-for ac_func in pread pwrite pread64
+for ac_func in pread pwrite pread64 readlink
 do :
   as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
 ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
index 30666ec40651b58b291a86f6e15abcb6a5ebbb0d..7c86cd45d14b2686990e3513fc7ce7fd440c5700 100644 (file)
@@ -43,7 +43,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(pread pwrite pread64)
+AC_CHECK_FUNCS(pread pwrite pread64 readlink)
 AC_REPLACE_FUNCS(memmem vasprintf vsnprintf)
 
 # Check for UST
index 34e4fa8e09ebf4441cce45e3c66690c19ec36904..03aab587d982de967b2c9ec31391842d3bb6e5bf 100644 (file)
@@ -459,6 +459,7 @@ handle_unlink (char *own_buf)
 static void
 handle_readlink (char *own_buf, int *new_packet_len)
 {
+#if defined (HAVE_READLINK)
   char filename[PATH_MAX], linkname[PATH_MAX];
   char *p;
   int ret, bytes_sent;
@@ -485,6 +486,9 @@ handle_readlink (char *own_buf, int *new_packet_len)
      to return a partial response, but simply fail.  */
   if (bytes_sent < ret)
     sprintf (own_buf, "F-1,%x", FILEIO_ENAMETOOLONG);
+#else /* ! HAVE_READLINK */
+    sprintf (own_buf, "F-1,%x", FILEIO_ENOSYS);
+#endif
 }
 
 /* Handle all the 'F' file transfer packets.  */
This page took 0.052366 seconds and 4 git commands to generate.