From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 28974 invoked by alias); 3 Feb 2012 13:26:07 -0000 Received: (qmail 28960 invoked by uid 22791); 3 Feb 2012 13:26:06 -0000 X-SWARE-Spam-Status: No, hits=-2.0 required=5.0 tests=AWL,BAYES_00 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; Fri, 03 Feb 2012 13:25:51 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id 1DB6F2BB1D2; Fri, 3 Feb 2012 08:25:51 -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 IjkGXgNZfGrR; Fri, 3 Feb 2012 08:25:51 -0500 (EST) Received: from joel.gnat.com (localhost.localdomain [127.0.0.1]) by rock.gnat.com (Postfix) with ESMTP id 86E5E2BB1AF; Fri, 3 Feb 2012 08:25:50 -0500 (EST) Received: by joel.gnat.com (Postfix, from userid 1000) id A684C145615; Fri, 3 Feb 2012 17:25:29 +0400 (RET) Date: Fri, 03 Feb 2012 13:26:00 -0000 From: Joel Brobecker To: Eli Zaretskii Cc: gdb-patches@sourceware.org, palves@redhat.com Subject: Re: [RFA/gdbserver] Provide dummy readlink on systems where routine is not available. Message-ID: <20120203132529.GK31383@adacore.com> References: <1328269562-19101-1-git-send-email-brobecker@adacore.com> <1328270124-27388-1-git-send-email-brobecker@adacore.com> <20120203123030.GJ31383@adacore.com> <83r4ycdptz.fsf@gnu.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <83r4ycdptz.fsf@gnu.org> User-Agent: Mutt/1.5.20 (2009-06-14) 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/msg00051.txt.bz2 > If memory serves, Pedro was against this when I suggested it. Do you mean returning EINVAL, or having a dummy readlink? > > + This function return -1 (error) and sets errno to ENOSYS to indicate > > + that this function is not implemented. The caller should be prepared > > + to recover from that. */ > > But the function in fact returns EINVAL: I'll fix that, but another day, when I seem to have a functioning brain. > I cannot resist re-iterating my original suggestion: test the file for > existence, return ENOENT if it doesn't exist, and otherwise return > EINVAL, meaning that the file is not a link. > > Or just use the readlink module from gnulib, which does exactly that. The first suggestion is too much work that has already been done by gnulib. The second is too much work for the time I have right now because gnulib hasn't been formally introduced in gdbserver. I tried doing just that many moons ago and failed miserably. I think I have better chances today, but I am still not confident at all. Part of the problem comes from the fact that gnulib more or less assumes that the project using it uses automake, which is not the case for neither GDB nor GDBserver. This patch has the advantage of being simple and fixing a build failure that has been lingering since Jan 20th. If peopler prefer, I can implement the "#if noreadlink ... #else return ENOSYS" approach, which is fewer changes, but less appealing (IMO). -- Joel