Phobos Patch - Version (X86_64) for struct_stat64 on Linux x86_64
Iain Buclaw
ibuclaw at ubuntu.com
Thu Dec 30 05:45:46 PST 2010
== Quote from Iain Buclaw (ibuclaw at ubuntu.com)'s article
> == Quote from Chuck Blake (cb at mit.edu)'s article
> > Hi. I realize that 64-bit phobos is relatively work in progress. I thought
> > I'd contribute. struct_stat64 is broken on Linux x86_64 which further breaks
> > an awful lot of file IO.
> > I have a small patch that fixes it by just adding a version fork for X86_64
in
> > the default fallback version{} (which should perhaps be labeled Linux since
> > all this stat stuff is *awfully* specific and brittle). Anyway, I tested
this
> > with gdc 2.051 within gcc-4.5.2, with an attached stat.d program and
comparing
> > its output to the 'stat' utility. This fix is so basic and logic-free that I
> > seriously doubt environmental considerations matter, and in any event it is
an
> > unhandled version{}.
> > This doesn't completely fix file IO, but it at least gives it a running
> > chance. I can std.file.read() files under 8MB, for example. :) I posted
this
> > on Digitalmars.D.bugs which I apparently misinterpreted as the place to
report
> > bugs and fixes.
> > << stat64_x86_64.patch >>
> > << stat.d >>
> OK, I've had a proper look, is there any reason why phobos isn't using the
stat_t
> implementation in druntime?
> That would fix this...
> Regards
The lazy fix (in my tree):
diff -r 8a2198026630 d/phobos2/std/file.d
--- a/d/phobos2/std/file.d Tue Dec 28 23:11:26 2010 +0000
+++ b/d/phobos2/std/file.d Thu Dec 30 13:40:42 2010 +0000
@@ -98,6 +98,12 @@
alias core.sys.posix.sys.stat.fstat fstat64;
alias core.sys.posix.sys.stat.stat stat64;
}
+ else version (linux)
+ {
+ alias core.sys.posix.sys.stat.stat_t struct_stat64;
+ alias core.sys.posix.sys.stat.fstat fstat64;
+ alias core.sys.posix.sys.stat.stat stat64;
+ }
else
{
struct struct_stat64 // distinguish it from the stat() function
Is there a bug report open for this? I'll have a look after breakfast. :)
Regards
More information about the Digitalmars-d
mailing list