From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 13549 invoked by alias); 6 Feb 2006 22:58:33 -0000 Received: (qmail 13541 invoked by uid 22791); 6 Feb 2006 22:58:33 -0000 X-Spam-Check-By: sourceware.org Received: from nevyn.them.org (HELO nevyn.them.org) (66.93.172.17) by sourceware.org (qpsmtpd/0.31.1) with ESMTP; Mon, 06 Feb 2006 22:58:31 +0000 Received: from drow by nevyn.them.org with local (Exim 4.54) id 1F6FJV-0008JA-S7 for gdb-patches@sourceware.org; Mon, 06 Feb 2006 17:58:29 -0500 Date: Mon, 06 Feb 2006 22:58:00 -0000 From: Daniel Jacobowitz To: gdb-patches@sourceware.org Subject: Re: RFA: Support Windows extended error numbers in safe_strerror Message-ID: <20060206225829.GA31895@nevyn.them.org> Mail-Followup-To: gdb-patches@sourceware.org References: <20060203215455.GA3501@nevyn.them.org> <20060206173550.GB22947@nevyn.them.org> <200602062254.k16MsagK009925@elgar.sibelius.xs4all.nl> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <200602062254.k16MsagK009925@elgar.sibelius.xs4all.nl> User-Agent: Mutt/1.5.8i X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2006-02/txt/msg00139.txt.bz2 On Mon, Feb 06, 2006 at 11:54:36PM +0100, Mark Kettenis wrote: > > Date: Mon, 6 Feb 2006 12:35:50 -0500 > > From: Daniel Jacobowitz > > > > On Fri, Feb 03, 2006 at 04:54:55PM -0500, Daniel Jacobowitz wrote: > > > This is an improved version of a patch Mark Mitchell submitted last > > > year. If you give strerror() anything above 42 (sys_nerr) on Windows, > > > it gives you back "Unknown error" - particularly unfortunate since > > > WSAECONNREFUSED is way above there, so connecting to a closed socket > > > will give you a generic error message. This patch lets us try an > > > OS-specific interface to fetch an error string. > > > > > > [Actually you need my next patch too to get the connection refused message; > > > right now you'll get a timeout.] > > > > > > Any comments on this patch? > > > > There were plenty :-) Is this better? > > > > We had finally eliminated the XM files in favor of autoconf checks. > > This patch re-adds an xm-*.h header file, but I think it's still > > the best of our options. We can restrict our use of these headers > > to things where autoconf is a bad fit - like right here. > > No please don't do that. There's got to be a better way. Is it > possible to write a complete replacement for strerror for MinGW and > put that one in mingw-hdep.c? Could you explain why you don't like this one a little more clearly? Of course it'd be possible to write a complete replacement; I'd just replace the call to the system strerror with a switch statement and copy the strings out of the system runtime, or out of some other standard source. But I don't see why that's any better than this, and it's gratuituous duplication of information, so I'd like to understand what you dislike about it. If it's the #define strerror that you dislike, two comments: - I could put an #ifdef around the one and only call to strerror instead, in utils.c. I'd be perfectly happy with that. - I can't override the system strerror by defining my own copy; that would be prone to breakage due to the workings of __attribute__((dllimport)). I discussed that with Chris before posting this version. -- Daniel Jacobowitz CodeSourcery