From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 16896 invoked by alias); 9 Feb 2012 16:32:08 -0000 Received: (qmail 16882 invoked by uid 22791); 9 Feb 2012 16:32:04 -0000 X-SWARE-Spam-Status: No, hits=-0.7 required=5.0 tests=AWL,BAYES_50,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from rock.gnat.com (HELO rock.gnat.com) (205.232.38.15) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 09 Feb 2012 16:31:49 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id C937C1C67F8; Thu, 9 Feb 2012 11:31:47 -0500 (EST) Received: from rock.gnat.com ([127.0.0.1]) by localhost (rock.gnat.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id xCi39HhK-lW6; Thu, 9 Feb 2012 11:31:47 -0500 (EST) Received: from joel.gnat.com (localhost.localdomain [127.0.0.1]) by rock.gnat.com (Postfix) with ESMTP id 3FEAA1C664C; Thu, 9 Feb 2012 11:31:47 -0500 (EST) Received: by joel.gnat.com (Postfix, from userid 1000) id 78F0B145615; Thu, 9 Feb 2012 20:31:41 +0400 (RET) From: Joel Brobecker To: gdb-patches@sourceware.org Cc: Pedro Alves , asmwarrior , Yao Qi , Joel Brobecker Subject: [RFA/commit] gdbserver: return ENOSYS if readlink not supported. Date: Thu, 09 Feb 2012 16:32:00 -0000 Message-Id: <1328805094-18863-1-git-send-email-brobecker@adacore.com> In-Reply-To: <4F22760A.2020309@redhat.com> References: <4F22760A.2020309@redhat.com> Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2012-02/txt/msg00148.txt.bz2 Hi Pedro, Given that this problem has been lingering for 3 weeks, I've decided to just KISS. This reproduces on the GDBserver side what GDB does when readlink is not supported. Does this look good to you? Thanks! gdb/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. Tested on x86_64-linux and x86-windows (by simply rebuilding and verifying that the correct section of the #if/#else is taken). I'd like to commit sometime today if possible - people keep reporting this problem. --- gdb/gdbserver/config.in | 3 +++ gdb/gdbserver/configure | 2 +- gdb/gdbserver/configure.ac | 2 +- gdb/gdbserver/hostio.c | 4 ++++ 4 files changed, 9 insertions(+), 2 deletions(-) diff --git a/gdb/gdbserver/config.in b/gdb/gdbserver/config.in index a9472ea..7fa3b5b 100644 --- a/gdb/gdbserver/config.in +++ b/gdb/gdbserver/config.in @@ -128,6 +128,9 @@ /* 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 header file. */ #undef HAVE_SGTTY_H diff --git a/gdb/gdbserver/configure b/gdb/gdbserver/configure index d92a00f..e251844 100755 --- a/gdb/gdbserver/configure +++ b/gdb/gdbserver/configure @@ -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" diff --git a/gdb/gdbserver/configure.ac b/gdb/gdbserver/configure.ac index 30666ec..7c86cd4 100644 --- a/gdb/gdbserver/configure.ac +++ b/gdb/gdbserver/configure.ac @@ -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 diff --git a/gdb/gdbserver/hostio.c b/gdb/gdbserver/hostio.c index 34e4fa8..03aab58 100644 --- a/gdb/gdbserver/hostio.c +++ b/gdb/gdbserver/hostio.c @@ -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. */ -- 1.7.1