Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Christopher Faylor <me@cgf.cx>
To: gdb-patches@sources.redhat.com,
	Paul Brook <paul@codesourcery.com>, Eli Zaretskii <eliz@gnu.org>
Subject: Re: [patch] Building simulators on windows hosts
Date: Sun, 01 May 2005 04:42:00 -0000	[thread overview]
Message-ID: <20050501044248.GA25397@trixie.casa.cgf.cx> (raw)
In-Reply-To: <01c54dff$Blat.v2.4$ea33f500@zahav.net.il>

On Sun, May 01, 2005 at 06:42:10AM +0300, Eli Zaretskii wrote:
>> From: Paul Brook <paul@codesourcery.com>
>> 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


      reply	other threads:[~2005-05-01  4:42 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-04-29 14:39 Paul Brook
2005-04-29 14:45 ` Daniel Jacobowitz
2005-05-01  3:46 ` Eli Zaretskii
2005-05-01  4:42   ` Christopher Faylor [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20050501044248.GA25397@trixie.casa.cgf.cx \
    --to=me@cgf.cx \
    --cc=eliz@gnu.org \
    --cc=gdb-patches@sources.redhat.com \
    --cc=paul@codesourcery.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox