From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 521 invoked by alias); 1 May 2005 04:42:54 -0000 Mailing-List: contact gdb-patches-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sources.redhat.com Received: (qmail 493 invoked from network); 1 May 2005 04:42:49 -0000 Received: from unknown (HELO cgf.cx) (66.30.17.189) by sourceware.org with SMTP; 1 May 2005 04:42:49 -0000 Received: by cgf.cx (Postfix, from userid 201) id EC5F013C373; Sun, 1 May 2005 00:42:48 -0400 (EDT) Date: Sun, 01 May 2005 04:42:00 -0000 From: Christopher Faylor To: gdb-patches@sources.redhat.com, Paul Brook , Eli Zaretskii Subject: Re: [patch] Building simulators on windows hosts Message-ID: <20050501044248.GA25397@trixie.casa.cgf.cx> Mail-Followup-To: gdb-patches@sources.redhat.com, Paul Brook , Eli Zaretskii References: <200504291539.15275.paul@codesourcery.com> <01c54dff$Blat.v2.4$ea33f500@zahav.net.il> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <01c54dff$Blat.v2.4$ea33f500@zahav.net.il> User-Agent: Mutt/1.5.8i X-SW-Source: 2005-05/txt/msg00005.txt.bz2 On Sun, May 01, 2005 at 06:42:10AM +0300, Eli Zaretskii wrote: >> From: Paul Brook >> Date: Fri, 29 Apr 2005 15:39:15 +0100 >> >> +#ifdef HAVE_LSTAT >> return wrap (p, lstat (file, buf)); >> +#else >> + return wrap (p, stat (file, buf)); >> +#endif > >Wouldn't it be cleaner to say in some strategic place (like a header >included by many sim files) > > #ifndef HAVE_LSTAT > #define lstat stat > #endif > >and then leave the *.c files alone? I think this is a better >solution, and include/gdb/callback.h seems like a good place to do >that. > >Perhaps it's even something MinGW headers should do for you, but for >now a GDB solution will be fine. I agree with the above. Sprinkling ifdefs for things like this in the code is really not pretty. >> +#ifdef HAVE_FTRUNCATE >> result = wrap (p, ftruncate (fdmap (p, fd), len)); >> +#else >> + p->last_errno = EINVAL; >> + result = -1; >> +#endif >> return result; > >`ftruncate' is a very simple function; you could write an emulation >using `lseek' and `write'. (If you want, I can show you the >implementation from the DJGPP library.) I think it's better to add >such an emulation that to fail the calls. FWIW, the windows equivalent of 'ftruncate' is more-or-less 'SetEndOfFile'. It should be pretty easy to write an emulation of ftruncate using that. cgf